[cfe-commits] r78474 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaCXX/attr-deprecated.cpp
Anders Carlsson
andersca at mac.com
Sat Aug 8 09:55:19 PDT 2009
Author: andersca
Date: Sat Aug 8 11:55:18 2009
New Revision: 78474
URL: http://llvm.org/viewvc/llvm-project?rev=78474&view=rev
Log:
Make sure to diagnose use of declarations in the case where we create an implicit CXXThisExpr.
Added:
cfe/trunk/test/SemaCXX/attr-deprecated.cpp
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=78474&r1=78473&r2=78474&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Sat Aug 8 11:55:18 2009
@@ -1139,6 +1139,8 @@
MarkDeclarationReferenced(Loc, D);
if (PerformObjectMemberConversion(This, D))
return ExprError();
+ if (DiagnoseUseOfDecl(D, Loc))
+ return ExprError();
return Owned(new (Context) MemberExpr(This, true, D,
Loc, MemberType));
}
Added: cfe/trunk/test/SemaCXX/attr-deprecated.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-deprecated.cpp?rev=78474&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/attr-deprecated.cpp (added)
+++ cfe/trunk/test/SemaCXX/attr-deprecated.cpp Sat Aug 8 11:55:18 2009
@@ -0,0 +1,16 @@
+// RUN: clang-cc %s -verify -fsyntax-only
+class A {
+ void f() __attribute__((deprecated));
+ void g(A* a);
+
+ int b __attribute__((deprecated));
+};
+
+void A::g(A* a)
+{
+ f(); // expected-warning{{'f' is deprecated}}
+ a->f(); // expected-warning{{'f' is deprecated}}
+
+ (void)b; // expected-warning{{'b' is deprecated}}
+ (void)a->b; // expected-warning{{'b' is deprecated}}
+}
More information about the cfe-commits
mailing list