[PATCH] D20197: [clang-tidy] Ignore using-declarations defined in marcro in misc-unused-using-decls checks.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Thu May 12 03:06:59 PDT 2016
This revision was automatically updated to reflect the committed changes.
hokein marked an inline comment as done.
Closed by commit rL269278: [clang-tidy] Ignore using-declarations defined in marcro in misc-unused-using… (authored by hokein).
Changed prior to commit:
http://reviews.llvm.org/D20197?vs=57008&id=57012#toc
Repository:
rL LLVM
http://reviews.llvm.org/D20197
Files:
clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/misc-unused-using-decls.cpp
Index: clang-tools-extra/trunk/test/clang-tidy/misc-unused-using-decls.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/misc-unused-using-decls.cpp
+++ clang-tools-extra/trunk/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() {
Index: clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
@@ -35,6 +35,10 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20197.57012.patch
Type: text/x-patch
Size: 1249 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160512/68d62169/attachment.bin>
More information about the cfe-commits
mailing list