================
Comment at: lib/Sema/Sema.cpp:755-756
@@ -755,1 +754,4 @@
+ } else if (getSourceManager().isFromMainFile(DiagD->getLocation())) {
+ // If the decl is in a header, it may be used in some other TU, so
+ // only warn if it's in the main file.
Diag(DiagD->getLocation(), diag::warn_unused_variable)
----------------
This comment is not quite right; maybe...
If the declaration is in a header which is included into multiple TUs, it will
declare one variable per TU, and one of the other variables may be used.
================
Comment at: test/SemaCXX/Inputs/warn-unused-variables.h:8-10
@@ +7,5 @@
+
+class B {
+ static A a;
+};
+}
----------------
This doesn't seem like a good testcase, since the variable is both unused here
and cannot declare another variable which is usable from another TU without an
ODR violation (ideally, we should still warn in this case).
Maybe move 'class B' into the anonymous namespace too?
http://llvm-reviews.chandlerc.com/D597
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits