summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-01-03 23:26:26 +0000
committerDouglas Gregor <dgregor@apple.com>2012-01-03 23:26:26 +0000
commitb59643baf6f5b2edcf56ca430894af44d9d15faa (patch)
tree1965be3917792d234ac7ba55733a2e9f35be2774 /clang/lib/Sema
parentf83663a9cd23ea9ef4670f89a130ed649585c34e (diff)
downloadbcm5719-llvm-b59643baf6f5b2edcf56ca430894af44d9d15faa.tar.gz
bcm5719-llvm-b59643baf6f5b2edcf56ca430894af44d9d15faa.zip
Test "merging" of typedef types across distinct modules. At present,
the AST reader doesn't actually perform a merge, because name lookup knows how to merge identical typedefs together. As part of this, teach C/Objective-C name lookup to return multiple results in all cases, rather than first digging through the attributes to see if the value is overloadable. This way, we'll catch ambiguous lookups in C/Objective-C. llvm-svn: 147498
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp2
-rw-r--r--clang/lib/Sema/SemaLookup.cpp43
2 files changed, 22 insertions, 23 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 9583ab6327f..43c9af58bc9 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -8010,8 +8010,6 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK,
// lookup. This is only actually possible in C++, where a few
// things like templates still live in the tag namespace.
} else {
- assert(getLangOptions().CPlusPlus);
-
// Use a better diagnostic if an elaborated-type-specifier
// found the wrong kind of type on the first
// (non-redeclaration) lookup.
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index 4f53487dcdb..f836a077b6b 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -1177,30 +1177,31 @@ bool Sema::LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation) {
R.addDecl(D);
- if ((*I)->getAttr<OverloadableAttr>()) {
- // If this declaration has the "overloadable" attribute, we
- // might have a set of overloaded functions.
-
- // Figure out what scope the identifier is in.
- while (!(S->getFlags() & Scope::DeclScope) ||
- !S->isDeclScope(*I))
- S = S->getParent();
-
- // Find the last declaration in this scope (with the same
- // name, naturally).
- IdentifierResolver::iterator LastI = I;
- for (++LastI; LastI != IEnd; ++LastI) {
- if (!S->isDeclScope(*LastI))
- break;
-
- D = getVisibleDecl(*LastI);
- if (D)
- R.addDecl(D);
- }
+ // Check whether there are any other declarations with the same name
+ // and in the same scope.
+
+ // Figure out what scope the identifier is in.
+ while (S->getParent() &&
+ (!(S->getFlags() & Scope::DeclScope) ||
+ !S->isDeclScope(*I)))
+ S = S->getParent();
+
+ // Find the last declaration in this scope (with the same
+ // name, naturally).
+ IdentifierResolver::iterator LastI = I;
+ for (++LastI; LastI != IEnd; ++LastI) {
+ if (!S->isDeclScope(*LastI))
+ break;
+
+ if (!(*LastI)->isInIdentifierNamespace(IDNS))
+ continue;
+
+ D = getVisibleDecl(*LastI);
+ if (D)
+ R.addDecl(D);
}
R.resolveKind();
-
return true;
}
} else {
OpenPOWER on IntegriCloud