mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
OpaquePtr: Make byval/sret types mandatory
This commit is contained in:
parent
c390d54618
commit
12c5d5881d
@ -472,14 +472,12 @@ public:
|
||||
|
||||
/// Extract the byval type for a parameter.
|
||||
Type *getParamByValType(unsigned ArgNo) const {
|
||||
Type *Ty = AttributeSets.getParamByValType(ArgNo);
|
||||
return Ty ? Ty : (arg_begin() + ArgNo)->getType()->getPointerElementType();
|
||||
return AttributeSets.getParamByValType(ArgNo);
|
||||
}
|
||||
|
||||
/// Extract the sret type for a parameter.
|
||||
Type *getParamStructRetType(unsigned ArgNo) const {
|
||||
Type *Ty = AttributeSets.getParamStructRetType(ArgNo);
|
||||
return Ty ? Ty : (arg_begin() + ArgNo)->getType()->getPointerElementType();
|
||||
return AttributeSets.getParamStructRetType(ArgNo);
|
||||
}
|
||||
|
||||
/// Extract the byref type for a parameter.
|
||||
|
@ -1699,14 +1699,14 @@ bool LLParser::parseOptionalParamAttrs(AttrBuilder &B) {
|
||||
}
|
||||
case lltok::kw_byval: {
|
||||
Type *Ty;
|
||||
if (parseOptionalTypeAttr(Ty, lltok::kw_byval))
|
||||
if (parseRequiredTypeAttr(Ty, lltok::kw_byval))
|
||||
return true;
|
||||
B.addByValAttr(Ty);
|
||||
continue;
|
||||
}
|
||||
case lltok::kw_sret: {
|
||||
Type *Ty;
|
||||
if (parseOptionalTypeAttr(Ty, lltok::kw_sret))
|
||||
if (parseRequiredTypeAttr(Ty, lltok::kw_sret))
|
||||
return true;
|
||||
B.addStructRetAttr(Ty);
|
||||
continue;
|
||||
@ -2628,22 +2628,6 @@ bool LLParser::parseParameterList(SmallVectorImpl<ParamInfo> &ArgList,
|
||||
return false;
|
||||
}
|
||||
|
||||
/// parseByValWithOptionalType
|
||||
/// ::= byval
|
||||
/// ::= byval(<ty>)
|
||||
bool LLParser::parseOptionalTypeAttr(Type *&Result, lltok::Kind AttrName) {
|
||||
Result = nullptr;
|
||||
if (!EatIfPresent(AttrName))
|
||||
return true;
|
||||
if (!EatIfPresent(lltok::lparen))
|
||||
return false;
|
||||
if (parseType(Result))
|
||||
return true;
|
||||
if (!EatIfPresent(lltok::rparen))
|
||||
return error(Lex.getLoc(), "expected ')'");
|
||||
return false;
|
||||
}
|
||||
|
||||
/// parseRequiredTypeAttr
|
||||
/// ::= attrname(<ty>)
|
||||
bool LLParser::parseRequiredTypeAttr(Type *&Result, lltok::Kind AttrName) {
|
||||
|
@ -328,7 +328,6 @@ namespace llvm {
|
||||
bool parseFnAttributeValuePairs(AttrBuilder &B,
|
||||
std::vector<unsigned> &FwdRefAttrGrps,
|
||||
bool inAttrGrp, LocTy &BuiltinLoc);
|
||||
bool parseOptionalTypeAttr(Type *&Result, lltok::Kind AttrName);
|
||||
bool parseRequiredTypeAttr(Type *&Result, lltok::Kind AttrName);
|
||||
bool parsePreallocated(Type *&Result);
|
||||
bool parseByRef(Type *&Result);
|
||||
|
6
test/Assembler/byval-parse-error0.ll
Normal file
6
test/Assembler/byval-parse-error0.ll
Normal file
@ -0,0 +1,6 @@
|
||||
; RUN: not llvm-as < %s 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: <stdin>:[[@LINE+1]]:34: error: expected '('{{$}}
|
||||
define void @test_byval(i8* byval) {
|
||||
ret void
|
||||
}
|
6
test/Assembler/sret-parse-error0.ll
Normal file
6
test/Assembler/sret-parse-error0.ll
Normal file
@ -0,0 +1,6 @@
|
||||
; RUN: not llvm-as < %s 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: <stdin>:[[@LINE+1]]:32: error: expected '('{{$}}
|
||||
define void @test_sret(i8* sret) {
|
||||
ret void
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user