[PATCH] D44826: Add -Wunused-using, a warning that finds unused using declarations.

Carlos Alberto Enciso via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 25 04:02:12 PDT 2018

CarlosAlbertoEnciso marked 2 inline comments as done.
CarlosAlbertoEnciso added inline comments.

Comment at: lib/Serialization/ASTReader.cpp:8101-8103
+    UsingDecl *D = dyn_cast_or_null<UsingDecl>(
+        GetDecl(UnusedUsingCandidates[I]));
+    if (D)
dblaikie wrote:
> roll the declaration into the condition, perhaps:
>   if (auto *D = dyn_cast_or_null...)
>     Decls.insert(D);

Comment at: test/Modules/warn-unused-using.cpp:5
+// For modules, the warning should only fire the first time, when the module is
+// built.
dblaikie wrote:
> This would only warn for the unused local using, but wouldn't fire for an namespace-scoped unused using? Perhaps there should be a test for that?
I have added a namespace-scoped unused using.


More information about the cfe-commits mailing list