summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-05-04 00:25:33 +0000
committerDouglas Gregor <dgregor@apple.com>2011-05-04 00:25:33 +0000
commited8a29b855467f44db51a194bf06a709dcfbe861 (patch)
tree6dcb05eb923eef6c30e0734151826ca0671d8b6d /clang/lib
parentae700c971c2aa37e1e0ee6cf3d079c0dd03610e5 (diff)
downloadbcm5719-llvm-ed8a29b855467f44db51a194bf06a709dcfbe861.tar.gz
bcm5719-llvm-ed8a29b855467f44db51a194bf06a709dcfbe861.zip
When tag lookup finds something ambiguous, and we're defining a new
tag, filter out those ambiguous names that we found if they aren't within the declaration context where this newly-defined tag will be visible. This is basically a hack, because we really need to fix the lookup of tag declarations in this case to not find things it shouldn't. However, it's better than what we had before, and it fixes <rdar://problem/9168556>. llvm-svn: 130810
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 975a9635748..d5112a2f0cc 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -6715,6 +6715,19 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
// shouldn't be diagnosing.
LookupName(Previous, S);
+ if (Previous.isAmbiguous() && TUK == TUK_Definition) {
+ LookupResult::Filter F = Previous.makeFilter();
+ while (F.hasNext()) {
+ NamedDecl *ND = F.next();
+ if (ND->getDeclContext()->getRedeclContext() != SearchDC)
+ F.erase();
+ }
+ F.done();
+
+ if (Previous.isAmbiguous())
+ return 0;
+ }
+
// Note: there used to be some attempt at recovery here.
if (Previous.isAmbiguous())
return 0;
OpenPOWER on IntegriCloud