summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaAccess.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-12-11 03:35:27 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-12-11 03:35:27 +0000
commit608da01ccac64936067698f494a4912f7894dbe6 (patch)
treeeea9b8f2703468b6ce74cf8d5aa6f101fb3f1c35 /clang/lib/Sema/SemaAccess.cpp
parent5bde5c35f44beb94c8a9253cedc954d055f3b091 (diff)
downloadbcm5719-llvm-608da01ccac64936067698f494a4912f7894dbe6.tar.gz
bcm5719-llvm-608da01ccac64936067698f494a4912f7894dbe6.zip
When performing a delayed access check, use the surrounding lexical context for
any local extern declaration, not just a local extern function. llvm-svn: 197000
Diffstat (limited to 'clang/lib/Sema/SemaAccess.cpp')
-rw-r--r--clang/lib/Sema/SemaAccess.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp
index 61dc157f858..b7df3244caa 100644
--- a/clang/lib/Sema/SemaAccess.cpp
+++ b/clang/lib/Sema/SemaAccess.cpp
@@ -1482,11 +1482,10 @@ void Sema::HandleDelayedAccessCheck(DelayedDiagnostic &DD, Decl *D) {
// However, this does not apply to local extern declarations.
DeclContext *DC = D->getDeclContext();
- if (FunctionDecl *FN = dyn_cast<FunctionDecl>(D)) {
- if (D->getLexicalDeclContext()->isFunctionOrMethod())
- DC = D->getLexicalDeclContext();
- else
- DC = FN;
+ if (D->isLocalExternDecl()) {
+ DC = D->getLexicalDeclContext();
+ } else if (FunctionDecl *FN = dyn_cast<FunctionDecl>(D)) {
+ DC = FN;
} else if (TemplateDecl *TD = dyn_cast<TemplateDecl>(D)) {
DC = cast<DeclContext>(TD->getTemplatedDecl());
}
OpenPOWER on IntegriCloud