Skip to content

Commit 0d3e248

Browse files
committed
Use a better trick to cheat clang-tidy
1 parent debd3cc commit 0d3e248

File tree

1 file changed

+23
-27
lines changed

1 file changed

+23
-27
lines changed

src/LoadStoreChunk.cpp

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -303,18 +303,19 @@ namespace compose
303303

304304
template class compose::ConfigureLoadStore<ConfigureLoadStore>;
305305

306-
/* clang-format would destroy the NOLINT comments */
307-
// clang-format off
306+
// need this for clang-tidy
307+
#define OPENPMD_ARRAY(type) type[]
308+
#define OPENPMD_APPLY_TEMPLATE(template_, type) template_<type>
309+
308310
#define INSTANTIATE_METHOD_TEMPLATES(dtype) \
309311
template auto core::ConfigureLoadStore::enqueueLoad() \
310-
/* NOLINTNEXTLINE(bugprone-macro-parentheses) */ \
311-
-> auxiliary::DeferredComputation<std::shared_ptr<dtype>>; \
312+
-> auxiliary::DeferredComputation<OPENPMD_APPLY_TEMPLATE( \
313+
std::shared_ptr, dtype)>; \
312314
template auto core::ConfigureLoadStore::load(EnqueuePolicy) \
313315
->std::shared_ptr<dtype>;
314-
// clang-format on
315316
#define INSTANTIATE_METHOD_TEMPLATES_WITH_AND_WITHOUT_EXTENT(type) \
316317
INSTANTIATE_METHOD_TEMPLATES(type) \
317-
INSTANTIATE_METHOD_TEMPLATES(type[]) \
318+
INSTANTIATE_METHOD_TEMPLATES(OPENPMD_ARRAY(type)) \
318319
template auto core::ConfigureLoadStore::enqueueStore() \
319320
-> DynamicMemoryView<type>;
320321

@@ -324,46 +325,41 @@ OPENPMD_FOREACH_NONVECTOR_DATATYPE(
324325
#undef INSTANTIATE_METHOD_TEMPLATES
325326
#undef INSTANTIATE_METHOD_TEMPLATES_WITH_AND_WITHOUT_EXTENT
326327

327-
/* clang-format would destroy the NOLINT comments */
328-
// clang-format off
329328
#define INSTANTIATE_HALF(pointer_type) \
330-
template class ConfigureStoreChunkFromBuffer<pointer_type>; \
331-
template class core::ConfigureStoreChunkFromBuffer<pointer_type>; \
332-
template class compose::ConfigureLoadStore< \
333-
/* NOLINTNEXTLINE(bugprone-macro-parentheses) */ \
334-
ConfigureStoreChunkFromBuffer<pointer_type>>; \
329+
template class OPENPMD_APPLY_TEMPLATE( \
330+
ConfigureStoreChunkFromBuffer, pointer_type); \
331+
template class core::OPENPMD_APPLY_TEMPLATE( \
332+
ConfigureStoreChunkFromBuffer, pointer_type); \
333+
template class compose::ConfigureLoadStore<OPENPMD_APPLY_TEMPLATE( \
334+
ConfigureStoreChunkFromBuffer, pointer_type)>; \
335335
template class compose::ConfigureStoreChunkFromBuffer< \
336-
/* NOLINTNEXTLINE(bugprone-macro-parentheses) */ \
337-
ConfigureStoreChunkFromBuffer<pointer_type>>;
338-
// clang-format on
336+
OPENPMD_APPLY_TEMPLATE(ConfigureStoreChunkFromBuffer, pointer_type)>;
339337

340-
/* clang-format would destroy the NOLINT comments */
341-
// clang-format off
342338
#define INSTANTIATE_FULL(pointer_type) \
343339
INSTANTIATE_HALF(pointer_type) \
344-
template class ConfigureLoadStoreFromBuffer<pointer_type>; \
345-
template class core::ConfigureLoadStoreFromBuffer<pointer_type>; \
346-
template class compose::ConfigureLoadStore< \
347-
/* NOLINTNEXTLINE(bugprone-macro-parentheses) */ \
348-
ConfigureLoadStoreFromBuffer<pointer_type>>; \
340+
template class OPENPMD_APPLY_TEMPLATE( \
341+
ConfigureLoadStoreFromBuffer, pointer_type); \
342+
template class core::OPENPMD_APPLY_TEMPLATE( \
343+
ConfigureLoadStoreFromBuffer, pointer_type); \
344+
template class compose::ConfigureLoadStore<OPENPMD_APPLY_TEMPLATE( \
345+
ConfigureLoadStoreFromBuffer, pointer_type)>; \
349346
template class compose::ConfigureStoreChunkFromBuffer< \
350-
/* NOLINTNEXTLINE(bugprone-macro-parentheses) */ \
351-
ConfigureLoadStoreFromBuffer<pointer_type>>;
352-
// clang-format on
347+
OPENPMD_APPLY_TEMPLATE(ConfigureLoadStoreFromBuffer, pointer_type)>;
353348

354349
#define INSTANTIATE_STORE_CHUNK_FROM_BUFFER(dtype) \
355350
INSTANTIATE_FULL(std::shared_ptr<dtype>) \
356351
INSTANTIATE_HALF(std::shared_ptr<dtype const>) \
357352
INSTANTIATE_HALF(UniquePtrWithLambda<dtype>) \
358353
INSTANTIATE_HALF(UniquePtrWithLambda<dtype const>)
359-
// /* NOLINTNEXTLINE(bugprone-macro-parentheses) */
360354

361355
OPENPMD_FOREACH_NONVECTOR_DATATYPE(INSTANTIATE_STORE_CHUNK_FROM_BUFFER)
362356

363357
#undef INSTANTIATE_STORE_CHUNK_FROM_BUFFER
364358
#undef INSTANTIATE_METHOD_TEMPLATES
365359
#undef INSTANTIATE_FULL
366360
#undef INSTANTIATE_HALF
361+
#undef OPENPMD_ARRAY
362+
#undef OPENPMD_APPLY_TEMPLATE
367363

368364
ConfigureLoadStore::ConfigureLoadStore(RecordComponent &rc)
369365
: core::ConfigureLoadStore{rc}

0 commit comments

Comments
 (0)