diff options
author | John McCall <rjmccall@apple.com> | 2010-02-04 22:26:26 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-02-04 22:26:26 +0000 |
commit | 67da35c832e66d3310ed67486cb46306f20cc642 (patch) | |
tree | fb9a44adb34cad6cc2686e6cca6427c8c0c489ed /clang/lib/Sema/SemaLookup.cpp | |
parent | 1de1707bfc789e9cf9467c2d37af2a584db6520b (diff) | |
download | bcm5719-llvm-67da35c832e66d3310ed67486cb46306f20cc642.tar.gz bcm5719-llvm-67da35c832e66d3310ed67486cb46306f20cc642.zip |
Extract a common structure for holding information about the definition
of a C++ record. Exposed a lot of problems where various routines were
silently doing The Wrong Thing (or The Acceptable Thing in The Wrong Order)
when presented with a non-definition. Also cuts down on memory usage.
llvm-svn: 95330
Diffstat (limited to 'clang/lib/Sema/SemaLookup.cpp')
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index d1a379435ef..c4b261fad44 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -1406,6 +1406,12 @@ addAssociatedClassesAndNamespaces(CXXRecordDecl *Class, AssociatedClasses); } + // Only recurse into base classes for complete types. + if (!Class->hasDefinition()) { + // FIXME: we might need to instantiate templates here + return; + } + // Add direct and indirect base classes along with their associated // namespaces. llvm::SmallVector<CXXRecordDecl *, 32> Bases; @@ -2058,6 +2064,9 @@ static void LookupVisibleDecls(DeclContext *Ctx, LookupResult &Result, // Traverse the contexts of inherited C++ classes. if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(Ctx)) { + if (!Record->hasDefinition()) + return; + for (CXXRecordDecl::base_class_iterator B = Record->bases_begin(), BEnd = Record->bases_end(); B != BEnd; ++B) { |