diff options
author | Chris Lattner <sabre@nondot.org> | 2011-07-10 05:39:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-07-10 05:39:13 +0000 |
commit | 117b724b594b60b052e43ee1c5adc6f0841f27fc (patch) | |
tree | f0a3ec87bf19415643af87062c45faf7afd3f577 /clang/lib | |
parent | 13ee4f48341b9f7f7fb3b18126744b2358f7b263 (diff) | |
download | bcm5719-llvm-117b724b594b60b052e43ee1c5adc6f0841f27fc.tar.gz bcm5719-llvm-117b724b594b60b052e43ee1c5adc6f0841f27fc.zip |
keep track of whether being in a RS_StructPointer state
caused us to skip layout out a function accurately. If
so, flush the type cache for both the function and struct
case to ensure that any pointers to the functions get
recomputed. This is overconservative, but with this patch
clang can build itself again.
llvm-svn: 134863
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CodeGenTypes.cpp | 9 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenTypes.h | 6 |
2 files changed, 13 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp index 59c632f0d7d..16946b64b3d 100644 --- a/clang/lib/CodeGen/CodeGenTypes.cpp +++ b/clang/lib/CodeGen/CodeGenTypes.cpp @@ -32,6 +32,7 @@ CodeGenTypes::CodeGenTypes(ASTContext &Ctx, llvm::Module& M, : Context(Ctx), Target(Ctx.Target), TheModule(M), TheTargetData(TD), TheABIInfo(Info), TheCXXABI(CXXABI), CodeGenOpts(CGO) { RecursionState = RS_Normal; + SkippedLayout = false; } CodeGenTypes::~CodeGenTypes() { @@ -345,6 +346,8 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) { // This function's type depends on an incomplete tag type. // Return a placeholder type. ResultType = llvm::StructType::get(getLLVMContext()); + + SkippedLayout |= RecursionState == RS_StructPointer; break; } @@ -373,6 +376,9 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) { // Restore our recursion state. RecursionState = SavedRecursionState; + + if (SkippedLayout) + TypeCache.clear(); if (RecursionState == RS_Normal) while (!DeferredRecords.empty()) @@ -487,7 +493,8 @@ llvm::StructType *CodeGenTypes::ConvertRecordDeclType(const RecordDecl *RD) { // If this struct blocked a FunctionType conversion, then recompute whatever // was derived from that. // FIXME: This is hugely overconservative. - TypeCache.clear(); + if (SkippedLayout) + TypeCache.clear(); // Restore our recursion state. If we're done converting the outer-most diff --git a/clang/lib/CodeGen/CodeGenTypes.h b/clang/lib/CodeGen/CodeGenTypes.h index 98786007d79..4229c59b835 100644 --- a/clang/lib/CodeGen/CodeGenTypes.h +++ b/clang/lib/CodeGen/CodeGenTypes.h @@ -86,7 +86,11 @@ class CodeGenTypes { RS_Struct, // Recursively inside a struct conversion. RS_StructPointer // Recursively inside a pointer in a struct. } RecursionState; - + + /// SkippedLayout - True if we didn't layout a function bit due to a + /// RS_StructPointer RecursionState. + bool SkippedLayout; + llvm::SmallVector<const RecordDecl *, 8> DeferredRecords; struct RecursionStatePointerRAII { |