summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
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/AST/Decl.cpp
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/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 31a9b3b2929..479f80f1dd4 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -938,6 +938,12 @@ bool NamedDecl::declarationReplaces(NamedDecl *OldD) const {
cast<UsingDecl>(OldD)->getQualifier());
}
+ // A typedef of an Objective-C class type can replace an Objective-C class
+ // declaration or definition, and vice versa.
+ if ((isa<TypedefNameDecl>(this) && isa<ObjCInterfaceDecl>(OldD)) ||
+ (isa<ObjCInterfaceDecl>(this) && isa<TypedefNameDecl>(OldD)))
+ return true;
+
// For non-function declarations, if the declarations are of the
// same kind then this must be a redeclaration, or semantic analysis
// would not have given us the new declaration.
OpenPOWER on IntegriCloud