[llvm-branch-commits] [llvm-gcc-branch] r84845 - /llvm-gcc-4.2/branches/Apple/Leela/gcc/llvm-convert.cpp
Bill Wendling
isanbard at gmail.com
Thu Oct 22 00:05:07 PDT 2009
Author: void
Date: Thu Oct 22 02:05:07 2009
New Revision: 84845
URL: http://llvm.org/viewvc/llvm-project?rev=84845&view=rev
Log:
$ svn merge -c 84829 https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk
--- Merging r84829 into '.':
U gcc/llvm-convert.cpp
Modified:
llvm-gcc-4.2/branches/Apple/Leela/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/branches/Apple/Leela/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Leela/gcc/llvm-convert.cpp?rev=84845&r1=84844&r2=84845&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Leela/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Leela/gcc/llvm-convert.cpp Thu Oct 22 02:05:07 2009
@@ -404,6 +404,29 @@
return false;
}
+
+/// isCompilingCCode - Return true if we are compiling C or Objective-C code.
+static bool isCompilingCCode() {
+ // If we've already determined this, return it.
+ static unsigned Val = 2;
+ if (Val != 2) return (bool)Val;
+
+ StringRef LanguageName = lang_hooks.name;
+
+ if (LanguageName == "GNU C" || LanguageName == "GNU Objective-C")
+ return (Val = true);
+
+ if (LanguageName == "GNU C++" ||
+ LanguageName == "GNU Ada" ||
+ LanguageName == "GNU F77" ||
+ LanguageName == "GNU Pascal" ||
+ LanguageName == "GNU Java" ||
+ LanguageName == "GNU Objective-C++")
+ return (Val = false);
+
+ return (Val = true);
+}
+
void TreeToLLVM::StartFunctionBody() {
const char *Name = "";
// Get the name of the function.
@@ -421,7 +444,10 @@
// 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) {
+ //
+ // Note that we only do this in C/Objective-C. Doing this in C++ for
+ // functions explicitly declared as taking (...) is bad.
+ if (TYPE_ARG_TYPES(TREE_TYPE(FnDecl)) == 0 && isCompilingCCode()) {
FTy = TheTypeConverter->ConvertArgListToFnType(TREE_TYPE(FnDecl),
DECL_ARGUMENTS(FnDecl),
static_chain,
More information about the llvm-branch-commits
mailing list