summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaLookup.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2015-02-10 03:28:10 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2015-02-10 03:28:10 +0000
commite8292b10a61adc03a8c0a3be47d3e39e0aa29b64 (patch)
tree223e8c3ae1aaa04b6f8c33b8d3940a1406a5533a /clang/lib/Sema/SemaLookup.cpp
parentc11b101fb64c621e6bc1a36904bc775ce6202beb (diff)
downloadbcm5719-llvm-e8292b10a61adc03a8c0a3be47d3e39e0aa29b64.tar.gz
bcm5719-llvm-e8292b10a61adc03a8c0a3be47d3e39e0aa29b64.zip
[modules] When determining whether a name from a module replaces a name we
already have, check whether the name from the module is actually newer than the existing declaration. If it isn't, we might (say) replace a visible declaration with an injected friend, and thus make it invisible (or lose a default argument or an array bound). llvm-svn: 228661
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r--clang/lib/Sema/SemaLookup.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp
index 8edbc1871b4..9184a9fd828 100644
--- a/clang/lib/Sema/SemaLookup.cpp
+++ b/clang/lib/Sema/SemaLookup.cpp
@@ -414,6 +414,8 @@ void LookupResult::resolveKind() {
if (!Unique.insert(D).second) {
// If it's not unique, pull something off the back (and
// continue at this index).
+ // FIXME: This is wrong. We need to take the more recent declaration in
+ // order to get the right type, default arguments, etc.
Decls[I] = Decls[--N];
continue;
}
@@ -1254,6 +1256,9 @@ static NamedDecl *findAcceptableDecl(Sema &SemaRef, NamedDecl *D) {
for (auto RD : D->redecls()) {
if (auto ND = dyn_cast<NamedDecl>(RD)) {
+ // FIXME: This is wrong in the case where the previous declaration is not
+ // visible in the same scope as D. This needs to be done much more
+ // carefully.
if (LookupResult::isVisible(SemaRef, ND))
return ND;
}
OpenPOWER on IntegriCloud