[llvm-commits] [llvm] r61933 - /llvm/trunk/lib/AsmParser/LLParser.cpp
Chris Lattner
sabre at nondot.org
Thu Jan 8 11:05:36 PST 2009
Author: lattner
Date: Thu Jan 8 13:05:36 2009
New Revision: 61933
URL: http://llvm.org/viewvc/llvm-project?rev=61933&view=rev
Log:
one more crash from PR3281, we now diagnose:
llvm-as: t.ll:2:39: function may not return opaque type
%"bwmoyl" = tail call coldcc opaque @g()
^
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=61933&r1=61932&r2=61933&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Thu Jan 8 13:05:36 2009
@@ -564,11 +564,18 @@
// 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 opaque type");
+ return 0;
+ }
+
FwdVal = Function::Create(FT, GlobalValue::ExternalWeakLinkage, Name, M);
- else
+ } else {
FwdVal = new GlobalVariable(PTy->getElementType(), false,
GlobalValue::ExternalWeakLinkage, 0, Name, M);
+ }
ForwardRefVals[Name] = std::make_pair(FwdVal, Loc);
return FwdVal;
More information about the llvm-commits
mailing list