summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-02-08 18:21:25 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-02-08 18:21:25 +0000
commit898fdbf82d622b01365d8724908fe512cd805cf7 (patch)
tree1ccb0f527db7958333cc51c7ac3fa00152ef96e4 /clang/lib/Sema
parent8665d59f4621ebc2a37da729c2618b163fb96192 (diff)
downloadbcm5719-llvm-898fdbf82d622b01365d8724908fe512cd805cf7.tar.gz
bcm5719-llvm-898fdbf82d622b01365d8724908fe512cd805cf7.zip
In Sema::CheckShadow, get the DeclContext from the variable that we are checking
instead from the Scope; Inner scopes in bodies don't have DeclContexts associated with them. Fixes http://llvm.org/PR9160 & rdar://problem/8966163. llvm-svn: 125097
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index a5190961b53..ac8e0425458 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -3121,10 +3121,9 @@ void Sema::CheckShadow(Scope *S, VarDecl *D, const LookupResult& R) {
Diagnostic::Ignored)
return;
- // Don't diagnose declarations at file scope. The scope might not
- // have a DeclContext if (e.g.) we're parsing a function prototype.
- DeclContext *NewDC = static_cast<DeclContext*>(S->getEntity());
- if (NewDC && NewDC->isFileContext())
+ // Don't diagnose declarations at file scope.
+ DeclContext *NewDC = D->getDeclContext();
+ if (NewDC->isFileContext())
return;
// Only diagnose if we're shadowing an unambiguous field or variable.
OpenPOWER on IntegriCloud