diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-02-16 08:38:03 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-02-16 08:38:03 +0000 |
commit | a3b0eb2f7fecd0fe15566b01215602a9784003ed (patch) | |
tree | 833d36d57fb6fd0b80140181b22411401f00b9d4 /llvm/lib/AsmParser/LLParser.cpp | |
parent | 8510f737407242f38426b5066c174259b12bacc4 (diff) | |
download | bcm5719-llvm-a3b0eb2f7fecd0fe15566b01215602a9784003ed.tar.gz bcm5719-llvm-a3b0eb2f7fecd0fe15566b01215602a9784003ed.zip |
AsmParser: Reject alloca with function type
llvm-svn: 229363
Diffstat (limited to 'llvm/lib/AsmParser/LLParser.cpp')
-rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index fc829166abf..159bbccc87d 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -5109,16 +5109,16 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS, /// ::= 'alloca' 'inalloca'? Type (',' TypeAndValue)? (',' 'align' i32)? int LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS) { Value *Size = nullptr; - LocTy SizeLoc; + LocTy SizeLoc, TyLoc; unsigned Alignment = 0; Type *Ty = nullptr; bool IsInAlloca = EatIfPresent(lltok::kw_inalloca); - if (ParseType(Ty)) return true; + if (ParseType(Ty, TyLoc)) return true; - if (!PointerType::isValidElementType(Ty)) - return TokError("pointer to this type is invalid"); + if (Ty->isFunctionTy() || !PointerType::isValidElementType(Ty)) + return Error(TyLoc, "invalid type for alloca"); bool AteExtraComma = false; if (EatIfPresent(lltok::comma)) { |