Stop accepting and ignoring attributes in function types. Attributes are applied

to functions and call/invokes, not to types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133266 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2011-06-17 17:37:13 +00:00
parent a6591969ff
commit a16546a70b
7 changed files with 11 additions and 36 deletions

View File

@ -1559,22 +1559,16 @@ bool LLParser::ParseFunctionType(PATypeHolder &Result) {
std::vector<ArgInfo> ArgList;
bool isVarArg;
unsigned Attrs;
if (ParseArgumentList(ArgList, isVarArg, true) ||
// FIXME: Allow, but ignore attributes on function types!
// FIXME: Remove in LLVM 3.0
ParseOptionalAttrs(Attrs, 2))
if (ParseArgumentList(ArgList, isVarArg, true))
return true;
// Reject names on the arguments lists.
for (unsigned i = 0, e = ArgList.size(); i != e; ++i) {
if (!ArgList[i].Name.empty())
return Error(ArgList[i].Loc, "argument name invalid in function type");
if (!ArgList[i].Attrs != 0) {
// Allow but ignore attributes on function types; this permits
// auto-upgrade.
// FIXME: REJECT ATTRIBUTES ON FUNCTION TYPES in LLVM 3.0
}
if (ArgList[i].Attrs != 0)
return Error(ArgList[i].Loc,
"argument attributes invalid in function type");
}
std::vector<const Type*> ArgListTy;

View File

@ -362,7 +362,7 @@ bb1159: ; preds = %cond_next1150
cond_true1169: ; preds = %bb1159
%tmp11741175 = trunc i64 %lsum.11225.0 to i32 ; <i32> [#uses=1]
%tmp1178 = tail call i32 (%struct._IO_FILE* noalias , i8* noalias , ...)* @fprintf( %struct._IO_FILE* noalias %file , i8* getelementptr ([49 x i8]* @.str32, i32 0, i64 0) , i32 %tmp11741175, i32 0 ) ; <i32> [#uses=0]
%tmp1178 = tail call i32 (%struct._IO_FILE* , i8* , ...)* @fprintf( %struct._IO_FILE* noalias %file , i8* getelementptr ([49 x i8]* @.str32, i32 0, i64 0) , i32 %tmp11741175, i32 0 ) ; <i32> [#uses=0]
ret void
UnifiedReturnBlock: ; preds = %bb1159

View File

@ -2,8 +2,8 @@
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll
%ZFunTy = type i32(i8 zeroext)
%SFunTy = type i32(i8 signext)
%ZFunTy = type i32(i8)
%SFunTy = type i32(i8)
declare signext i16 @"test"(i16 signext %arg)
declare zeroext i8 @"test2" (i16 zeroext %a2)
@ -14,7 +14,7 @@ declare void @exit(i32) noreturn nounwind
define i32 @main(i32 inreg %argc, i8 ** inreg %argv) nounwind {
%val = trunc i32 %argc to i16
%res1 = call signext i16 (i16 signext) *@test(i16 signext %val)
%res1 = call signext i16 (i16 ) *@test(i16 signext %val)
%two = add i16 %res1, %res1
%res2 = call zeroext i8 @test2(i16 zeroext %two )
%retVal = sext i16 %two to i32

View File

@ -1,19 +0,0 @@
; RUN: llvm-as < %s | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll
%ZFunTy = type i33(i8 zeroext)
%SFunTy = type i33(i8 signext)
declare signext i16 @"test"(i16 signext %arg)
declare zeroext i8 @"test2" (i16 zeroext %a2)
define i33 @main(i33 %argc, i8 **%argv) {
%val = trunc i33 %argc to i16
%res = call signext i16 (i16 signext) *@test(i16 signext %val)
%two = add i16 %res, %res
%res2 = call zeroext i8 @test2(i16 zeroext %two )
%retVal = sext i16 %two to i33
ret i33 %retVal
}

View File

@ -3,7 +3,7 @@
define void @blah(i16* %tmp10) {
entry:
call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend_stret to void (i16* sret )*)( i16* sret %tmp10 )
call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend_stret to void (i16*)*)( i16* sret %tmp10 )
ret void
}

View File

@ -15,7 +15,7 @@ entry:
%tmp3 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 0 ; <i32*> [#uses=1]
store i32 %n, i32* %tmp3, align 8
%FRAME.06 = bitcast %struct.FRAME.nest* %FRAME.0 to i8* ; <i8*> [#uses=1]
%tramp = call i8* @llvm.init.trampoline( i8* %TRAMP.216.sub, i8* bitcast (i32 (%struct.FRAME.nest* nest , i32)* @f to i8*), i8* %FRAME.06 ) ; <i8*> [#uses=1]
%tramp = call i8* @llvm.init.trampoline( i8* %TRAMP.216.sub, i8* bitcast (i32 (%struct.FRAME.nest* , i32)* @f to i8*), i8* %FRAME.06 ) ; <i8*> [#uses=1]
%tmp7 = getelementptr %struct.FRAME.nest* %FRAME.0, i32 0, i32 1 ; <i32 (i32)**> [#uses=1]
%tmp89 = bitcast i8* %tramp to i32 (i32)* ; <i32 (i32)*> [#uses=2]
store i32 (i32)* %tmp89, i32 (i32)** %tmp7, align 8

View File

@ -5,7 +5,7 @@
define i32 @main(i32 %argc, i8** %argv) {
entry:
%tmp32 = tail call i32 (i8* noalias , ...) * bitcast (i32 (i8*, ...) nounwind * @printf to i32 (i8* noalias , ...) nounwind *)( i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0) , i32 0 ) nounwind ; <i32> [#uses=0]
%tmp32 = tail call i32 (i8* , ...) * bitcast (i32 (i8*, ...) * @printf to i32 (i8* , ...) *)( i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0) , i32 0 ) nounwind ; <i32> [#uses=0]
ret i32 undef
}