[llvm-commits] [llvm-gcc-4.2] r85224 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
Duncan Sands
baldrick at free.fr
Tue Oct 27 03:12:37 PDT 2009
Author: baldrick
Date: Tue Oct 27 05:12:37 2009
New Revision: 85224
URL: http://llvm.org/viewvc/llvm-project?rev=85224&view=rev
Log:
Port r85218 (baldrick) from dragonegg:
Only perform this somewhat dubious transform if it is known with
certainty to be correct for the language.
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=85224&r1=85223&r2=85224&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Oct 27 05:12:37 2009
@@ -404,27 +404,17 @@
return false;
}
-
-/// isCompilingCCode - Return true if we are compiling C or Objective-C code.
-static bool isCompilingCCode() {
+/// LanguageIsC - Return true if we are compiling C or Objective-C.
+static bool LanguageIsC() {
// 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);
+ return (Val = false);
}
void TreeToLLVM::StartFunctionBody() {
@@ -447,7 +437,7 @@
//
// 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()) {
+ if (TYPE_ARG_TYPES(TREE_TYPE(FnDecl)) == 0 && LanguageIsC()) {
FTy = TheTypeConverter->ConvertArgListToFnType(TREE_TYPE(FnDecl),
DECL_ARGUMENTS(FnDecl),
static_chain,
More information about the llvm-commits
mailing list