[llvm-commits] [llvm] r60660 - in /llvm/trunk/tools/llvmc/plugins: Clang/Clang.td Hello/Hello.cpp
Mikhail Glushenkov
foldr at codedgers.com
Sun Dec 7 08:43:17 PST 2008
Author: foldr
Date: Sun Dec 7 10:43:17 2008
New Revision: 60660
URL: http://llvm.org/viewvc/llvm-project?rev=60660&view=rev
Log:
Update plugins to use (actions).
Modified:
llvm/trunk/tools/llvmc/plugins/Clang/Clang.td
llvm/trunk/tools/llvmc/plugins/Hello/Hello.cpp
Modified: llvm/trunk/tools/llvmc/plugins/Clang/Clang.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/plugins/Clang/Clang.td?rev=60660&r1=60659&r2=60660&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/plugins/Clang/Clang.td (original)
+++ llvm/trunk/tools/llvmc/plugins/Clang/Clang.td Sun Dec 7 10:43:17 2008
@@ -1,4 +1,5 @@
-// A (first stab at a) replacement for the Clang's ccc script.
+// A replacement for the Clang's ccc script.
+// Depends on the Base plugin.
// To compile, use this command:
// cd $LLVMC2_DIR
// make DRIVER_NAME=ccc2 BUILTIN_PLUGINS=Clang
@@ -6,8 +7,10 @@
include "llvm/CompilerDriver/Common.td"
def Options : OptionList<[
-(switch_option "E",
- (help "Stop after the preprocessing stage, do not run the compiler"))
+(extern_switch "E",
+ (help "Stop after the preprocessing stage, do not run the compiler")),
+(extern_list "L", (help "Specify a library search path")),
+(switch_option "clang", (help "Use Clang instead of llvm-gcc"))
]>;
class clang_based<string language, string cmd> : Tool<
@@ -23,7 +26,8 @@
!strconcat(cmd, " -E $INFILE")),
(default),
!strconcat(cmd, " -emit-llvm-bc $INFILE -o $OUTFILE"))),
- (switch_option "E", (stop_compilation), (output_suffix "i")),
+ (actions (case (switch_on "E"),
+ [(stop_compilation), (output_suffix "i")])),
(sink)
]>;
@@ -39,7 +43,7 @@
(out_language "executable"),
(output_suffix "out"),
(cmd_line "llvm-ld -native -disable-internalize $INFILE -o $OUTFILE"),
- (prefix_list_option "L", (forward), (help "Specify a library search path")),
+ (actions (case (not_empty "L"), (forward "L"))),
(join)
]>;
@@ -56,9 +60,12 @@
// Compilation graph
def CompilationGraph : CompilationGraph<[
- Edge<"root", "clang_c">,
- Edge<"root", "clang_cpp">,
- Edge<"root", "clang_objective_c">,
+ OptionalEdge<"root", "clang_c",
+ (case (switch_on "clang"), (inc_weight))>,
+ OptionalEdge<"root", "clang_cpp",
+ (case (switch_on "clang"), (inc_weight))>,
+ OptionalEdge<"root", "clang_objective_c",
+ (case (switch_on "clang"), (inc_weight))>,
Edge<"clang_c", "llvm_ld">,
Edge<"clang_cpp", "llvm_ld">,
Edge<"clang_objective_c", "llvm_ld">
Modified: llvm/trunk/tools/llvmc/plugins/Hello/Hello.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvmc/plugins/Hello/Hello.cpp?rev=60660&r1=60659&r2=60660&view=diff
==============================================================================
--- llvm/trunk/tools/llvmc/plugins/Hello/Hello.cpp (original)
+++ llvm/trunk/tools/llvmc/plugins/Hello/Hello.cpp Sun Dec 7 10:43:17 2008
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
//
-// Test plugin for LLVMC.
+// Test plugin for LLVMC. Shows how to write plugins without using TableGen.
//
//===----------------------------------------------------------------------===//
More information about the llvm-commits
mailing list