зеркало из https://github.com/microsoft/clang-1.git
getFunctionLevelDeclContext needs to get the previous DeclContext if EnterDeclaratorContext has been called. Fixes PR4694. (Doug, please review)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78480 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
8517d9b731
Коммит
fb7ef75a28
|
@ -310,7 +310,8 @@ void Sema::ActOnEndOfTranslationUnit() {
|
|||
//===----------------------------------------------------------------------===//
|
||||
|
||||
DeclContext *Sema::getFunctionLevelDeclContext() {
|
||||
DeclContext *DC = CurContext;
|
||||
DeclContext *DC = PreDeclaratorDC ? PreDeclaratorDC : CurContext;
|
||||
|
||||
while (isa<BlockDecl>(DC))
|
||||
DC = DC->getParent();
|
||||
|
||||
|
|
|
@ -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 A::g(A* a)
|
|||
(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;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче