[llvm-commits] [dragonegg] r102901 - in /dragonegg/trunk: llvm-backend.cpp llvm-convert.cpp llvm-internal.h
Duncan Sands
baldrick at free.fr
Mon May 3 05:44:40 PDT 2010
Author: baldrick
Date: Mon May 3 07:44:40 2010
New Revision: 102901
URL: http://llvm.org/viewvc/llvm-project?rev=102901&view=rev
Log:
Move the language test for turning "T foo() {}" into "T foo(void) {}"
into the common language specific configuration routine.
Modified:
dragonegg/trunk/llvm-backend.cpp
dragonegg/trunk/llvm-convert.cpp
dragonegg/trunk/llvm-internal.h
Modified: dragonegg/trunk/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-backend.cpp?rev=102901&r1=102900&r2=102901&view=diff
==============================================================================
--- dragonegg/trunk/llvm-backend.cpp (original)
+++ dragonegg/trunk/llvm-backend.cpp Mon May 3 07:44:40 2010
@@ -518,6 +518,11 @@
/// definitions are equivalent).
bool flag_odr;
+/// flag_vararg_requires_arguments - Do not consider functions with no arguments
+/// to take a variable number of arguments (...). If set then a function like
+/// "T foo() {}" will be treated like "T foo(void) {}" and not "T foo(...) {}".
+bool flag_vararg_requires_arguments;
+
/// InstallLanguageSettings - Do any language-specific back-end configuration.
static void InstallLanguageSettings() {
// The principal here is that not doing any language-specific configuration
@@ -528,12 +533,14 @@
if (LanguageName == "GNU Ada") {
flag_odr = true; // Ada obeys the one-definition-rule.
} else if (LanguageName == "GNU C") {
+ flag_vararg_requires_arguments = true; // "T foo() {}" -> "T foo(void) {}"
} else if (LanguageName == "GNU C++") {
flag_odr = true; // C++ obeys the one-definition-rule.
} else if (LanguageName == "GNU Fortran") {
} else if (LanguageName == "GNU GIMPLE") { // LTO gold plugin.
} else if (LanguageName == "GNU Java") {
} else if (LanguageName == "GNU Objective-C") {
+ flag_vararg_requires_arguments = true; // "T foo() {}" -> "T foo(void) {}"
} else if (LanguageName == "GNU Objective-C++") {
flag_odr = true; // Objective C++ obeys the one-definition-rule.
}
Modified: dragonegg/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-convert.cpp?rev=102901&r1=102900&r2=102901&view=diff
==============================================================================
--- dragonegg/trunk/llvm-convert.cpp (original)
+++ dragonegg/trunk/llvm-convert.cpp Mon May 3 07:44:40 2010
@@ -525,19 +525,6 @@
return false;
}
-/// 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);
- return (Val = false);
-}
-
void TreeToLLVM::StartFunctionBody() {
std::string Name = getLLVMAssemblerName(FnDecl).str();
// TODO: Add support for dropping the leading '\1' in order to support
@@ -558,7 +545,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 && LanguageIsC()) {
+ if (TYPE_ARG_TYPES(TREE_TYPE(FnDecl)) == 0 && flag_vararg_requires_arguments){
FTy = TheTypeConverter->ConvertArgListToFnType(TREE_TYPE(FnDecl),
DECL_ARGUMENTS(FnDecl),
static_chain,
Modified: dragonegg/trunk/llvm-internal.h
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-internal.h?rev=102901&r1=102900&r2=102901&view=diff
==============================================================================
--- dragonegg/trunk/llvm-internal.h (original)
+++ dragonegg/trunk/llvm-internal.h Mon May 3 07:44:40 2010
@@ -92,6 +92,11 @@
/// definitions are equivalent).
extern bool flag_odr;
+/// flag_vararg_requires_arguments - Do not consider functions with no arguments
+/// to take a variable number of arguments (...). If set then a function like
+/// "T foo() {}" will be treated like "T foo(void) {}" and not "T foo(...) {}".
+extern bool flag_vararg_requires_arguments;
+
/// AttributeUsedGlobals - The list of globals that are marked attribute(used).
extern SmallSetVector<Constant *,32> AttributeUsedGlobals;
More information about the llvm-commits
mailing list