From b59643baf6f5b2edcf56ca430894af44d9d15faa Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 3 Jan 2012 23:26:26 +0000 Subject: 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 --- clang/lib/AST/Decl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/lib/AST/Decl.cpp') 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(OldD)->getQualifier()); } + // A typedef of an Objective-C class type can replace an Objective-C class + // declaration or definition, and vice versa. + if ((isa(this) && isa(OldD)) || + (isa(this) && isa(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. -- cgit v1.2.3