diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2010-05-30 06:03:20 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2010-05-30 06:03:20 +0000 |
commit | c8731be34d18955bec1b71e172c978197c8f4ad7 (patch) | |
tree | a206a768dff7cfbbacfb8b5ca8fc80fda294671c /clang/lib/CodeGen/CGCall.cpp | |
parent | ad98fc9733cc4b89599f13727e7f4da9465933b2 (diff) | |
download | bcm5719-llvm-c8731be34d18955bec1b71e172c978197c8f4ad7.tar.gz bcm5719-llvm-c8731be34d18955bec1b71e172c978197c8f4ad7.zip |
Fix for PR7040: Don't try to compute the LLVM type for a function where it
isn't possible to compute.
This patch is mostly refactoring; the key change is the addition of the code
starting with the comment, "Check whether the function has a computable LLVM
signature." The solution here is essentially the same as the way the
vtable code handles such functions.
llvm-svn: 105151
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 73cee3c10d2..f8fa620c4ba 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -515,27 +515,11 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI, bool IsVariadic) { return llvm::FunctionType::get(ResultType, ArgTys, IsVariadic); } -static bool HasIncompleteReturnTypeOrArgumentTypes(const FunctionProtoType *T) { - if (const TagType *TT = T->getResultType()->getAs<TagType>()) { - if (!TT->getDecl()->isDefinition()) - return true; - } - - for (unsigned i = 0, e = T->getNumArgs(); i != e; ++i) { - if (const TagType *TT = T->getArgType(i)->getAs<TagType>()) { - if (!TT->getDecl()->isDefinition()) - return true; - } - } - - return false; -} - const llvm::Type * CodeGenTypes::GetFunctionTypeForVTable(const CXXMethodDecl *MD) { const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>(); - if (!HasIncompleteReturnTypeOrArgumentTypes(FPT)) + if (!VerifyFuncTypeComplete(FPT)) return GetFunctionType(getFunctionInfo(MD), FPT->isVariadic()); return llvm::OpaqueType::get(getLLVMContext()); |