For PR1553:
Make the AsmParser auto-upgrade the old zext and sext
keywords for parameter attributes and handle the
end-of-line ambiguity.
llvm-svn: 40610
diff --git a/llvm/lib/AsmParser/Lexer.l b/llvm/lib/AsmParser/Lexer.l
index 6b8bba5..19be3dc 100644
--- a/llvm/lib/AsmParser/Lexer.l
+++ b/llvm/lib/AsmParser/Lexer.l
@@ -177,6 +177,8 @@
*/
HexIntConstant [us]0x[0-9A-Fa-f]+
+/* WSNL - shorthand for newline followed by whitespace */
+WSNL [ \r\t\n]*$
%%
{Comment} { /* Ignore comments for now */ }
@@ -234,6 +236,10 @@
noalias { return NOALIAS; }
byval { return BYVAL; }
nest { return NEST; }
+sext{WSNL} { // For auto-upgrade only, drop in LLVM 3.0
+ return SIGNEXT; }
+zext{WSNL} { // For auto-upgrade only, drop in LLVM 3.0
+ return ZEROEXT; }
void { RET_TY(Type::VoidTy, VOID); }
float { RET_TY(Type::FloatTy, FLOAT); }
diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y
index 0cc7a98..fd2713f 100644
--- a/llvm/lib/AsmParser/llvmAsmParser.y
+++ b/llvm/lib/AsmParser/llvmAsmParser.y
@@ -1225,7 +1225,9 @@
};
ParamAttr : ZEROEXT { $$ = ParamAttr::ZExt; }
+ | ZEXT { $$ = ParamAttr::ZExt; }
| SIGNEXT { $$ = ParamAttr::SExt; }
+ | SEXT { $$ = ParamAttr::SExt; }
| INREG { $$ = ParamAttr::InReg; }
| SRET { $$ = ParamAttr::StructRet; }
| NOALIAS { $$ = ParamAttr::NoAlias; }