diff options
author | Chris Lattner <sabre@nondot.org> | 2009-01-08 19:05:36 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-01-08 19:05:36 +0000 |
commit | 8c1cc34d6a2bbf68a2e507c31207dd957b91f43f (patch) | |
tree | 25f83bfcee4e7d8015295f0fdf64a6305b049a5d /llvm/lib/AsmParser | |
parent | 4f6a38e68c10e59e173046c29f6fbeb223d01410 (diff) | |
download | bcm5719-llvm-8c1cc34d6a2bbf68a2e507c31207dd957b91f43f.tar.gz bcm5719-llvm-8c1cc34d6a2bbf68a2e507c31207dd957b91f43f.zip |
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()
^
llvm-svn: 61933
Diffstat (limited to 'llvm/lib/AsmParser')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 80a4fca769b..edfdf154380 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -564,11 +564,18 @@ GlobalValue *LLParser::GetGlobalVal(const std::string &Name, const Type *Ty, // 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; |