Index: clang-tidy/misc/UnusedUsingDeclsCheck.cpp =================================================================== --- clang-tidy/misc/UnusedUsingDeclsCheck.cpp +++ clang-tidy/misc/UnusedUsingDeclsCheck.cpp @@ -35,6 +35,12 @@ const auto *TargetDecl = Using->shadow_begin()->getTargetDecl()->getCanonicalDecl(); + // Ignores using-declarations defined in macro. + if (Result.SourceManager->isMacroBodyExpansion(TargetDecl->getLocStart()), + Result.SourceManager->isMacroBodyExpansion(TargetDecl->getLocEnd())) { + return; + } + // Ignores using-declarations defined in class definition. if (isa(TargetDecl->getDeclContext())) return; Index: test/clang-tidy/misc-unused-using-decls.cpp =================================================================== --- test/clang-tidy/misc-unused-using-decls.cpp +++ test/clang-tidy/misc-unused-using-decls.cpp @@ -70,6 +70,14 @@ using n::cout; using n::endl; +#define DEFINE_INT(name) \ + namespace INT { \ + static const int _##name = 1; \ + } \ + using INT::_##name +DEFINE_INT(test); +#undef DEFIND_INT + // ----- Usages ----- void f(B b); void g() { @@ -83,4 +91,3 @@ UsedTemplateFunc(); cout << endl; } -