зеркало из https://github.com/microsoft/clang-1.git
Properly pop out of Objective-C method declarations when they are (ill-formedly)
found within contexts other than the translation unit. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110417 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
f65339e0f1
Коммит
9983d2d76c
|
@ -343,8 +343,10 @@ DeclContext *Sema::getContainingDC(DeclContext *DC) {
|
||||||
return DC;
|
return DC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ObjCMethodDecls are parsed (for some reason) outside the context
|
||||||
|
// of the class.
|
||||||
if (isa<ObjCMethodDecl>(DC))
|
if (isa<ObjCMethodDecl>(DC))
|
||||||
return Context.getTranslationUnitDecl();
|
return DC->getLexicalParent()->getLexicalParent();
|
||||||
|
|
||||||
return DC->getLexicalParent();
|
return DC->getLexicalParent();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,5 +23,10 @@ namespace C {
|
||||||
@implementation A(C) //expected-error{{Objective-C declarations may only appear in global scope}}
|
@implementation A(C) //expected-error{{Objective-C declarations may only appear in global scope}}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@interface B @end //expected-error{{Objective-C declarations may only appear in global scope}}
|
||||||
|
@implementation B //expected-error{{Objective-C declarations may only appear in global scope}}
|
||||||
|
+ (void) foo {}
|
||||||
|
@end
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче