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;


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;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to