diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-03-14 22:07:27 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-03-14 22:07:27 +0000 |
commit | 594461f02c6a4bc19ae00d614c6dfaf000700944 (patch) | |
tree | f9e99d6b9f3c3bc9782927d54a93c18d7df8eb09 /clang/lib/Sema/SemaLookup.cpp | |
parent | 709590838ff772a315012a9270604406dcd26d63 (diff) | |
download | bcm5719-llvm-594461f02c6a4bc19ae00d614c6dfaf000700944.tar.gz bcm5719-llvm-594461f02c6a4bc19ae00d614c6dfaf000700944.zip |
Call RequireCompleteType when performing ADL even if the type is already
complete. We hook into this check from a couple of other places (modules,
debug info) so it's not OK to elide the check if the type was already
complete.
llvm-svn: 203978
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index b3766a8c119..7ac10d38eb7 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -2027,6 +2027,10 @@ addAssociatedClassesAndNamespaces(AssociatedLookup &Result, // Add the class itself. If we've already seen this class, we don't // need to visit base classes. + // + // FIXME: That's not correct, we may have added this class only because it + // was the enclosing class of another class, and in that case we won't have + // added its base classes yet. if (!Result.Classes.insert(Class)) return; @@ -2053,12 +2057,8 @@ addAssociatedClassesAndNamespaces(AssociatedLookup &Result, } // Only recurse into base classes for complete types. - if (!Class->hasDefinition()) { - QualType type = Result.S.Context.getTypeDeclType(Class); - if (Result.S.RequireCompleteType(Result.InstantiationLoc, type, - /*no diagnostic*/ 0)) - return; - } + if (!Class->hasDefinition()) + return; // Add direct and indirect base classes along with their associated // namespaces. @@ -2150,6 +2150,8 @@ addAssociatedClassesAndNamespaces(AssociatedLookup &Result, QualType Ty) { // classes. Its associated namespaces are the namespaces in // which its associated classes are defined. case Type::Record: { + Result.S.RequireCompleteType(Result.InstantiationLoc, QualType(T, 0), + /*no diagnostic*/ 0); CXXRecordDecl *Class = cast<CXXRecordDecl>(cast<RecordType>(T)->getDecl()); addAssociatedClassesAndNamespaces(Result, Class); |