[cfe-commits] r78480 - in /cfe/trunk: lib/Sema/Sema.cpp test/SemaCXX/attr-deprecated.cpp
Anders Carlsson
andersca at mac.com
Sat Aug 8 10:48:50 PDT 2009
Author: andersca
Date: Sat Aug 8 12:48:49 2009
New Revision: 78480
URL: http://llvm.org/viewvc/llvm-project?rev=78480&view=rev
Log:
getFunctionLevelDeclContext needs to get the previous DeclContext if EnterDeclaratorContext has been called. Fixes PR4694. (Doug, please review)
Modified:
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/test/SemaCXX/attr-deprecated.cpp
Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=78480&r1=78479&r2=78480&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Sat Aug 8 12:48:49 2009
@@ -310,7 +310,8 @@
//===----------------------------------------------------------------------===//
DeclContext *Sema::getFunctionLevelDeclContext() {
- DeclContext *DC = CurContext;
+ DeclContext *DC = PreDeclaratorDC ? PreDeclaratorDC : CurContext;
+
while (isa<BlockDecl>(DC))
DC = DC->getParent();
Modified: cfe/trunk/test/SemaCXX/attr-deprecated.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-deprecated.cpp?rev=78480&r1=78479&r2=78480&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/attr-deprecated.cpp (original)
+++ cfe/trunk/test/SemaCXX/attr-deprecated.cpp Sat Aug 8 12:48:49 2009
@@ -2,6 +2,7 @@
class A {
void f() __attribute__((deprecated));
void g(A* a);
+ void h(A* a) __attribute__((deprecated));
int b __attribute__((deprecated));
};
@@ -14,3 +15,12 @@
(void)b; // expected-warning{{'b' is deprecated}}
(void)a->b; // expected-warning{{'b' is deprecated}}
}
+
+void A::h(A* a)
+{
+ f();
+ a->f();
+
+ (void)b;
+ (void)a->b;
+}
More information about the cfe-commits
mailing list