[llvm-commits] [llvm-gcc-4.2] r78039 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Rafael Espindola
rafael.espindola at gmail.com
Mon Aug 3 20:43:46 PDT 2009
Author: rafael
Date: Mon Aug 3 22:43:38 2009
New Revision: 78039
URL: http://llvm.org/viewvc/llvm-project?rev=78039&view=rev
Log:
In C++, produce a varargs function for "T foo(...)".
Fixes PR 4678
Modified:
llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=78039&r1=78038&r2=78039&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Mon Aug 3 22:43:38 2009
@@ -415,7 +415,11 @@
// allows C functions declared as "T foo() {}" to be treated like
// "T foo(void) {}" and allows us to handle functions with K&R-style
// definitions correctly.
- if (TYPE_ARG_TYPES(TREE_TYPE(FnDecl)) == 0) {
+ // Don't do this for c++. In c++ "T foo() {}" is not varargs and
+ // if the user typed "T foo(...)", he probably wants a varargs
+ // function. This also avoids a warning in instcombine. See
+ // llvm.org/PR4678
+ if (TYPE_ARG_TYPES(TREE_TYPE(FnDecl)) == 0 && !c_dialect_cxx()) {
FTy = TheTypeConverter->ConvertArgListToFnType(TREE_TYPE(FnDecl),
DECL_ARGUMENTS(FnDecl),
static_chain,
More information about the llvm-commits
mailing list