diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-05 18:27:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-05 18:27:50 +0000 |
commit | dc83a54567bef6da3b188fb4a3b72de3c4b99d00 (patch) | |
tree | d942d727f4f474e0bd08ce35a3b879d01349de52 /llvm/lib/AsmParser | |
parent | 8f57d29e0ca766199c5b9e3b1fb9c8f4d2d8be56 (diff) | |
download | bcm5719-llvm-dc83a54567bef6da3b188fb4a3b72de3c4b99d00.tar.gz bcm5719-llvm-dc83a54567bef6da3b188fb4a3b72de3c4b99d00.zip |
reject PR3281:crash11.ll with:
llvm-as: crash11.ll:2:27: function may not return return opaque type
"xw" = tail call opaque @608(label %31)
^
llvm-svn: 61722
Diffstat (limited to 'llvm/lib/AsmParser')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index c13737aae52..a9f8e192d38 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -602,11 +602,17 @@ GlobalValue *LLParser::GetGlobalVal(unsigned ID, const Type *Ty, LocTy Loc) { // Otherwise, create a new forward reference for this value and remember it. GlobalValue *FwdVal; - if (const FunctionType *FT = dyn_cast<FunctionType>(PTy->getElementType())) + if (const FunctionType *FT = dyn_cast<FunctionType>(PTy->getElementType())) { + // Function types can return opaque but functions can't. + if (isa<OpaqueType>(FT->getReturnType())) { + Error(Loc, "function may not return return opaque type"); + return 0; + } FwdVal = Function::Create(FT, GlobalValue::ExternalWeakLinkage, "", M); - else + } else { FwdVal = new GlobalVariable(PTy->getElementType(), false, GlobalValue::ExternalWeakLinkage, 0, "", M); + } ForwardRefValIDs[ID] = std::make_pair(FwdVal, Loc); return FwdVal; |