[llvm-commits] [llvm] r45884 - in /llvm/trunk: lib/AsmParser/llvmAsmParser.y test/Assembler/2008-01-11-VarargAttrs.ll
Duncan Sands
baldrick at free.fr
Fri Jan 11 13:23:39 PST 2008
Author: baldrick
Date: Fri Jan 11 15:23:39 2008
New Revision: 45884
URL: http://llvm.org/viewvc/llvm-project?rev=45884&view=rev
Log:
If there are attributes on the varargs part of a
call, don't discard them.
Added:
llvm/trunk/test/Assembler/2008-01-11-VarargAttrs.ll
Modified:
llvm/trunk/lib/AsmParser/llvmAsmParser.y
Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=45884&r1=45883&r2=45884&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original)
+++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Fri Jan 11 15:23:39 2008
@@ -2675,8 +2675,15 @@
if (Ty->isVarArg()) {
if (I == E)
- for (; ArgI != ArgE; ++ArgI)
+ for (; ArgI != ArgE; ++ArgI, ++index) {
Args.push_back(ArgI->Val); // push the remaining varargs
+ if (ArgI->Attrs != ParamAttr::None) {
+ ParamAttrsWithIndex PAWI;
+ PAWI.index = index;
+ PAWI.attrs = ArgI->Attrs;
+ Attrs.push_back(PAWI);
+ }
+ }
} else if (I != E || ArgI != ArgE)
GEN_ERROR("Invalid number of parameters detected");
}
@@ -3006,8 +3013,15 @@
}
if (Ty->isVarArg()) {
if (I == E)
- for (; ArgI != ArgE; ++ArgI)
+ for (; ArgI != ArgE; ++ArgI, ++index) {
Args.push_back(ArgI->Val); // push the remaining varargs
+ if (ArgI->Attrs != ParamAttr::None) {
+ ParamAttrsWithIndex PAWI;
+ PAWI.index = index;
+ PAWI.attrs = ArgI->Attrs;
+ Attrs.push_back(PAWI);
+ }
+ }
} else if (I != E || ArgI != ArgE)
GEN_ERROR("Invalid number of parameters detected");
}
Added: llvm/trunk/test/Assembler/2008-01-11-VarargAttrs.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2008-01-11-VarargAttrs.ll?rev=45884&view=auto
==============================================================================
--- llvm/trunk/test/Assembler/2008-01-11-VarargAttrs.ll (added)
+++ llvm/trunk/test/Assembler/2008-01-11-VarargAttrs.ll Fri Jan 11 15:23:39 2008
@@ -0,0 +1,10 @@
+; RUN: llvm-as < %s | llvm-dis | grep byval | count 2
+
+ %struct = type { }
+
+declare void @foo(...)
+
+define void @bar() {
+ call void (...)* @foo(%struct* byval null, %struct* byval null )
+ ret void
+}
More information about the llvm-commits
mailing list