mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
AsmParser: Reject alloca with function type
llvm-svn: 229363
This commit is contained in:
parent
160432e384
commit
b5464fbff9
@ -5109,16 +5109,16 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
|
|||||||
/// ::= 'alloca' 'inalloca'? Type (',' TypeAndValue)? (',' 'align' i32)?
|
/// ::= 'alloca' 'inalloca'? Type (',' TypeAndValue)? (',' 'align' i32)?
|
||||||
int LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS) {
|
int LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS) {
|
||||||
Value *Size = nullptr;
|
Value *Size = nullptr;
|
||||||
LocTy SizeLoc;
|
LocTy SizeLoc, TyLoc;
|
||||||
unsigned Alignment = 0;
|
unsigned Alignment = 0;
|
||||||
Type *Ty = nullptr;
|
Type *Ty = nullptr;
|
||||||
|
|
||||||
bool IsInAlloca = EatIfPresent(lltok::kw_inalloca);
|
bool IsInAlloca = EatIfPresent(lltok::kw_inalloca);
|
||||||
|
|
||||||
if (ParseType(Ty)) return true;
|
if (ParseType(Ty, TyLoc)) return true;
|
||||||
|
|
||||||
if (!PointerType::isValidElementType(Ty))
|
if (Ty->isFunctionTy() || !PointerType::isValidElementType(Ty))
|
||||||
return TokError("pointer to this type is invalid");
|
return Error(TyLoc, "invalid type for alloca");
|
||||||
|
|
||||||
bool AteExtraComma = false;
|
bool AteExtraComma = false;
|
||||||
if (EatIfPresent(lltok::comma)) {
|
if (EatIfPresent(lltok::comma)) {
|
||||||
|
9
test/Assembler/alloca-invalid-type-2.ll
Normal file
9
test/Assembler/alloca-invalid-type-2.ll
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
; RUN: not llvm-as < %s 2>&1 | FileCheck %s
|
||||||
|
|
||||||
|
; CHECK: invalid type for alloca
|
||||||
|
|
||||||
|
define void @test() {
|
||||||
|
entry:
|
||||||
|
alloca i32 (i32)
|
||||||
|
ret void
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
; RUN: not llvm-as < %s 2>&1 | FileCheck %s
|
; RUN: not llvm-as < %s 2>&1 | FileCheck %s
|
||||||
|
|
||||||
; CHECK: pointer to this type is invalid
|
; CHECK: invalid type for alloca
|
||||||
|
|
||||||
define void @test() {
|
define void @test() {
|
||||||
entry:
|
entry:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
|
; RUN: not llvm-as %s -o /dev/null 2>&1 | FileCheck %s
|
||||||
; CHECK: Cannot allocate unsized type
|
; CHECK: invalid type for alloca
|
||||||
; PR2113
|
; PR2113
|
||||||
|
|
||||||
define void @test() {
|
define void @test() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user