[cfe-commits] r152739 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaCXX/warn-unused-value.cpp
Nick Lewycky
nicholas at mxc.ca
Wed Mar 14 13:41:01 PDT 2012
Author: nicholas
Date: Wed Mar 14 15:41:00 2012
New Revision: 152739
URL: http://llvm.org/viewvc/llvm-project?rev=152739&view=rev
Log:
When emitting a diagnostic about two-phase name lookup, don't do useless
qualified name lookups into transparent contexts.
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/SemaCXX/warn-unused-value.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=152739&r1=152738&r2=152739&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Wed Mar 14 15:41:00 2012
@@ -9244,6 +9244,9 @@
return false;
for (DeclContext *DC = SemaRef.CurContext; DC; DC = DC->getParent()) {
+ if (DC->isTransparentContext())
+ continue;
+
SemaRef.LookupQualifiedName(R, DC);
if (!R.empty()) {
Modified: cfe/trunk/test/SemaCXX/warn-unused-value.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-unused-value.cpp?rev=152739&r1=152738&r2=152739&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-unused-value.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-unused-value.cpp Wed Mar 14 15:41:00 2012
@@ -30,3 +30,22 @@
}
#undef NOP
}
+
+namespace test2 {
+ extern "C" {
+ namespace std {
+ template<typename T> struct basic_string {
+ struct X {};
+ void method() const {
+ X* x;
+ &x[0]; // expected-warning {{expression result unused}}
+ }
+ };
+ typedef basic_string<char> string;
+ void func(const std::string& str) {
+ str.method(); // expected-note {{in instantiation of member function}}
+ }
+ }
+ }
+}
+
More information about the cfe-commits
mailing list