[clang-tidy] Ignore using-declarations defined in marcro in misc-unused-using-decls checks.
Reviewers: djasper Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D20197 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@269278 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
b799d4171a
Коммит
3bb156523a
|
@ -35,6 +35,10 @@ void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
|
|||
const auto *TargetDecl =
|
||||
Using->shadow_begin()->getTargetDecl()->getCanonicalDecl();
|
||||
|
||||
// Ignores using-declarations defined in macros.
|
||||
if (TargetDecl->getLocation().isMacroID())
|
||||
return;
|
||||
|
||||
// Ignores using-declarations defined in class definition.
|
||||
if (isa<CXXRecordDecl>(TargetDecl->getDeclContext()))
|
||||
return;
|
||||
|
|
|
@ -70,6 +70,14 @@ using n::UnusedFunc; // UnusedFunc
|
|||
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() {
|
||||
|
|
Загрузка…
Ссылка в новой задаче