[llvm-commits] [llvm] r61722 - /llvm/trunk/lib/AsmParser/LLParser.cpp
Chris Lattner
sabre at nondot.org
Mon Jan 5 10:27:50 PST 2009
Author: lattner
Date: Mon Jan 5 12:27:50 2009
New Revision: 61722
URL: http://llvm.org/viewvc/llvm-project?rev=61722&view=rev
Log:
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)
^
Modified:
llvm/trunk/lib/AsmParser/LLParser.cpp
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=61722&r1=61721&r2=61722&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Mon Jan 5 12:27:50 2009
@@ -602,11 +602,17 @@
// 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;
More information about the llvm-commits
mailing list