[PATCH] D20519: [clang-tidy] Ignore ADL-style using decls in unused-using-decls check.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Thu May 26 00:45:30 PDT 2016


hokein added inline comments.

================
Comment at: clang-tidy/misc/UnusedUsingDeclsCheck.cpp:47
@@ +46,3 @@
+      return;
+    // Ignores using-declarations defined in function definitions to avoid
+    // arguement-dependent lookup.
----------------
alexfh wrote:
> hokein wrote:
> > alexfh wrote:
> > > I don't think using declarations in functions are inherently related to ADL. This check doesn't seem like a useful heuristic.
> > Yeah, the current work around is only to ignore all using-decls in function context which is not perfect. I didn't find out a better way.
> If we're talking about this pattern:
> 
>   using std::swap;
>   ...
>   ::ns::T x, y;
>   swap(x, y); // ::ns::swap() is used
> 
> then for each function name resolved using ADL, we can find all using declarations for the same name in different namespaces and mark them used. WDYT?
Great, this idea looks good to me. Will make the change.


http://reviews.llvm.org/D20519





More information about the cfe-commits mailing list