summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaLookup.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-02-22 06:58:37 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-02-22 06:58:37 +0000
commit1fcd7fd633a44ab3ec944a5102afea74fcc8a23e (patch)
tree8e1241701e8fcf2e566cf19321a269333239656c /clang/lib/Sema/SemaLookup.cpp
parent425daaa5d258d927a5f608fc92f7685dbc36db66 (diff)
downloadbcm5719-llvm-1fcd7fd633a44ab3ec944a5102afea74fcc8a23e.tar.gz
bcm5719-llvm-1fcd7fd633a44ab3ec944a5102afea74fcc8a23e.zip
In LookupResult::resolveKind(), when handling multiple found declarations, ignore invalid declarations.
This reduces the "ambiguous reference" errors (which are rather strange in C/ObjC) and fixes an assertion hit with an invalid code test case. llvm-svn: 175869
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r--clang/lib/Sema/SemaLookup.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index a4228a50581..d931bc7dd9f 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -371,6 +371,12 @@ void LookupResult::resolveKind() {
NamedDecl *D = Decls[I]->getUnderlyingDecl();
D = cast<NamedDecl>(D->getCanonicalDecl());
+ // Ignore an invalid declaration unless it's the only one left.
+ if (D->isInvalidDecl() && I < N-1) {
+ Decls[I] = Decls[--N];
+ continue;
+ }
+
// Redeclarations of types via typedef can occur both within a scope
// and, through using declarations and directives, across scopes. There is
// no ambiguity if they all refer to the same type, so unique based on the
OpenPOWER on IntegriCloud