Mercurial > hg > CbC > CbC_llvm
changeset 23:7694d90773c7
if a code segment is a variadic function , llvm/clang doesn't do TCE. ( avoid a error )
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 04 Nov 2013 23:30:18 +0900 |
parents | d0228214ed38 |
children | 9b9640b7b299 |
files | tools/clang/lib/CodeGen/CGCall.cpp |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/clang/lib/CodeGen/CGCall.cpp Wed Oct 23 10:38:31 2013 +0900 +++ b/tools/clang/lib/CodeGen/CGCall.cpp Mon Nov 04 23:30:18 2013 +0900 @@ -447,8 +447,12 @@ #ifndef noCbC // if the function is a code segment , set fastcall calling convention. - if(resultType.getTypePtr()->is__CodeType()) - CC = llvm::CallingConv::Fast; + if(resultType.getTypePtr()->is__CodeType()){ + if(!required.allowsOptionalArgs()) // If the code segment is a variadic function , LLVM can't do TCE. + CC = llvm::CallingConv::Fast; + else + resultType = Context.VoidTy; + } #endif // Construct the function info. We co-allocate the ArgInfos.