[llvm-commits] [llvm] r50755 - in /llvm/trunk: test/LLVMC/false.c test/LLVMC/hello.cpp tools/llvmc2/Example.td tools/llvmc2/Tools.td utils/TableGen/LLVMCConfigurationEmitter.cpp
Mikhail Glushenkov
foldr at codedgers.com
Tue May 6 11:13:00 PDT 2008
Author: foldr
Date: Tue May 6 13:13:00 2008
New Revision: 50755
URL: http://llvm.org/viewvc/llvm-project?rev=50755&view=rev
Log:
Add a --linker command-line option, make all tests pass.
Modified:
llvm/trunk/test/LLVMC/false.c
llvm/trunk/test/LLVMC/hello.cpp
llvm/trunk/tools/llvmc2/Example.td
llvm/trunk/tools/llvmc2/Tools.td
llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp
Modified: llvm/trunk/test/LLVMC/false.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LLVMC/false.c?rev=50755&r1=50754&r2=50755&view=diff
==============================================================================
--- llvm/trunk/test/LLVMC/false.c (original)
+++ llvm/trunk/test/LLVMC/false.c Tue May 6 13:13:00 2008
@@ -1,5 +1,5 @@
// Test that we can compile .c files as C++ and vice versa
-// RUN: llvmc2 -x c++ %s -x c %p/false.cpp -x lisp -x whatnot -x none %p/false2.cpp -o %t
+// RUN: llvmc2 --linker=c++ -x c++ %s -x c %p/false.cpp -x lisp -x whatnot -x none %p/false2.cpp -o %t
// RUN: ./%t | grep hello
#include <iostream>
@@ -10,5 +10,5 @@
int main() {
std::cout << "h";
test();
- std::cout << test2() << '\n';
+ std::cout << test2() << '\n';
}
Modified: llvm/trunk/test/LLVMC/hello.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LLVMC/hello.cpp?rev=50755&r1=50754&r2=50755&view=diff
==============================================================================
--- llvm/trunk/test/LLVMC/hello.cpp (original)
+++ llvm/trunk/test/LLVMC/hello.cpp Tue May 6 13:13:00 2008
@@ -1,5 +1,5 @@
// Test that we can compile C++ code.
-// RUN: llvmc2 %s -o %t
+// RUN: llvmc2 --linker=c++ %s -o %t
// RUN: ./%t | grep hello
#include <iostream>
Modified: llvm/trunk/tools/llvmc2/Example.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/Example.td?rev=50755&r1=50754&r2=50755&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc2/Example.td (original)
+++ llvm/trunk/tools/llvmc2/Example.td Tue May 6 13:13:00 2008
@@ -33,6 +33,13 @@
Edge<llc, llvm_gcc_assembler>,
Edge<llvm_gcc_assembler, llvm_gcc_linker>,
+ OptionalEdge<llvm_gcc_assembler, llvm_gcc_cpp_linker,
+ [(parameter_equals "linker", "g++"),
+ (parameter_equals "linker", "c++")]>,
- Edge<root, llvm_gcc_linker>
+
+ Edge<root, llvm_gcc_linker>,
+ OptionalEdge<root, llvm_gcc_cpp_linker,
+ [(parameter_equals "linker", "g++"),
+ (parameter_equals "linker", "c++")]>
]>;
Modified: llvm/trunk/tools/llvmc2/Tools.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc2/Tools.td?rev=50755&r1=50754&r2=50755&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc2/Tools.td (original)
+++ llvm/trunk/tools/llvmc2/Tools.td Tue May 6 13:13:00 2008
@@ -81,19 +81,18 @@
]>;
// Alternative linker for C++
-// TOTHINK: how to implement this best?
-// Something like input_file_language can only choose between two languages.
-// def llvm_gcc_cpp_linker : Tool<
-// [(in_language "object-code"),
-// (out_language "executable"),
-// (output_suffix "out"),
-// (cmd_line "llvm-g++ $INFILE -o $OUTFILE"),
-// (join),
-// //(input_file_language "c++"),
-// (prefix_list_option "L", (forward)),
-// (prefix_list_option "l", (forward)),
-// (prefix_list_option "Wl", (unpack_values))
-// ]>;
+def llvm_gcc_cpp_linker : Tool<
+[(in_language "object-code"),
+ (out_language "executable"),
+ (output_suffix "out"),
+ (cmd_line "llvm-g++ $INFILE -o $OUTFILE"),
+ (join),
+ (parameter_option "linker",
+ (help "Choose linker (possible values: gcc, g++)")),
+ (prefix_list_option "L", (forward)),
+ (prefix_list_option "l", (forward)),
+ (prefix_list_option "Wl", (unpack_values))
+]>;
// Language map
Modified: llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp?rev=50755&r1=50754&r2=50755&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/LLVMCConfigurationEmitter.cpp Tue May 6 13:13:00 2008
@@ -175,11 +175,12 @@
if (other.Type != Type)
throw "Conflicting definitions for the option " + Name + "!";
- if (Help.empty() && !other.Help.empty())
+ if (Help == DefaultHelpString)
Help = other.Help;
- else if (!Help.empty() && !other.Help.empty())
- cerr << "Warning: more than one help string defined for option "
+ else if (other.Help != DefaultHelpString) {
+ llvm::cerr << "Warning: more than one help string defined for option "
+ Name + "\n";
+ }
Flags |= other.Flags;
}
@@ -290,8 +291,8 @@
// Default ctor here is needed because StringMap can only store
// DefaultConstructible objects
- ToolProperties() {}
- ToolProperties (const std::string& n) : Name(n) {}
+ ToolProperties() : Flags(0) {}
+ ToolProperties (const std::string& n) : Name(n), Flags(0) {}
};
More information about the llvm-commits
mailing list