diff options
| author | Duncan Sands <baldrick@free.fr> | 2008-01-11 21:23:39 +0000 | 
|---|---|---|
| committer | Duncan Sands <baldrick@free.fr> | 2008-01-11 21:23:39 +0000 | 
| commit | 7e46c50c6a10c181a3da479fa2ffbf7e4e37b6bf (patch) | |
| tree | 8fe6f7c6d6ecc22ba9b40575db1505fca7f7d089 | |
| parent | a8f67e04bdb2c7b38fa0939a625049f049b914bc (diff) | |
| download | bcm5719-llvm-7e46c50c6a10c181a3da479fa2ffbf7e4e37b6bf.tar.gz bcm5719-llvm-7e46c50c6a10c181a3da479fa2ffbf7e4e37b6bf.zip | |
If there are attributes on the varargs part of a
call, don't discard them.
llvm-svn: 45884
| -rw-r--r-- | llvm/lib/AsmParser/llvmAsmParser.y | 18 | ||||
| -rw-r--r-- | llvm/test/Assembler/2008-01-11-VarargAttrs.ll | 10 | 
2 files changed, 26 insertions, 2 deletions
| diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y index 9f12b3eaa39..9674bba4d53 100644 --- a/llvm/lib/AsmParser/llvmAsmParser.y +++ b/llvm/lib/AsmParser/llvmAsmParser.y @@ -2675,8 +2675,15 @@ BBTerminatorInst : RET ResolvedVal {              // Return with a result...        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 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {        }        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");      } diff --git a/llvm/test/Assembler/2008-01-11-VarargAttrs.ll b/llvm/test/Assembler/2008-01-11-VarargAttrs.ll new file mode 100644 index 00000000000..c46b2a563e7 --- /dev/null +++ b/llvm/test/Assembler/2008-01-11-VarargAttrs.ll @@ -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 +} | 

