This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Ignore ADL-style using decls in unused-using-decls check.
Needs RevisionPublic

Authored by hokein on May 23 2016, 2:04 AM.

Details

Reviewers
alexfh

Diff Detail

Event Timeline

hokein updated this revision to Diff 58077.May 23 2016, 2:04 AM
hokein retitled this revision from to [clang-tidy] Ignore ADL-style using decls in unused-using-decls check..
hokein updated this object.
hokein added a reviewer: alexfh.
hokein added a subscriber: cfe-commits.
alexfh added inline comments.May 23 2016, 4:54 AM
clang-tidy/misc/UnusedUsingDeclsCheck.cpp
47

I don't think using declarations in functions are inherently related to ADL. This check doesn't seem like a useful heuristic.

hokein added inline comments.May 23 2016, 6:39 AM
clang-tidy/misc/UnusedUsingDeclsCheck.cpp
47

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.

alexfh requested changes to this revision.May 24 2016, 4:47 PM
alexfh edited edge metadata.
alexfh added inline comments.
clang-tidy/misc/UnusedUsingDeclsCheck.cpp
47

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?

This revision now requires changes to proceed.May 24 2016, 4:47 PM
hokein added inline comments.May 26 2016, 12:45 AM
clang-tidy/misc/UnusedUsingDeclsCheck.cpp
47

Great, this idea looks good to me. Will make the change.