r203978 - Call RequireCompleteType when performing ADL even if the type is already
Richard Smith
richard-llvm at metafoo.co.uk
Fri Mar 14 15:07:27 PDT 2014
Author: rsmith
Date: Fri Mar 14 17:07:27 2014
New Revision: 203978
URL: http://llvm.org/viewvc/llvm-project?rev=203978&view=rev
Log:
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.
Modified:
cfe/trunk/lib/Sema/SemaLookup.cpp
cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp
cfe/trunk/test/CodeGenCXX/debug-info-limited.cpp
Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=203978&r1=203977&r2=203978&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Fri Mar 14 17:07:27 2014
@@ -2027,6 +2027,10 @@ addAssociatedClassesAndNamespaces(Associ
// 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(Associ
}
// 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(Associ
// 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);
Modified: cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp?rev=203978&r1=203977&r2=203978&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-class-limited.cpp Fri Mar 14 17:07:27 2014
@@ -24,7 +24,7 @@ foo *bar(foo *a) {
}
namespace test1 {
-// CHECK-DAG: [ DW_TAG_structure_type ] [foo] [line [[@LINE+1]], {{.*}} [decl]
+// CHECK-DAG: [ DW_TAG_structure_type ] [foo] [line [[@LINE+1]], {{.*}} [def]
struct foo {
};
Modified: cfe/trunk/test/CodeGenCXX/debug-info-limited.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-limited.cpp?rev=203978&r1=203977&r2=203978&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-info-limited.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/debug-info-limited.cpp Fri Mar 14 17:07:27 2014
@@ -11,8 +11,7 @@ A *foo (A* x) {
return a;
}
-// Verify that we're not emitting a full definition of B in limit debug mode.
-// CHECK: ; [ DW_TAG_class_type ] [B] {{.*}} [decl]
+// CHECK: ; [ DW_TAG_class_type ] [B] {{.*}} [def]
class B {
public:
More information about the cfe-commits
mailing list