Make it possible to use the generalised 'case' construct in the cmd_line property.
[oota-llvm.git] / tools / llvmc2 / Tools.td
index 5a614cf4ac0bc61fc5f18137af8752d724d542af..63b713fb0a2e3aaccdf29829d5b597ebe31f4cf6 100644 (file)
@@ -25,8 +25,15 @@ def llvm_gcc_c : Tool<
 [(in_language "c"),
  (out_language "llvm-bitcode"),
  (output_suffix "bc"),
- (cmd_line "llvm-gcc -c -x c $INFILE -o $OUTFILE -emit-llvm"),
+ (cmd_line (case
+            (switch_on "E"),
+              "llvm-g++ -E -x c $INFILE -o $OUTFILE -emit-llvm",
+            (default),
+              "llvm-g++ -c -x c $INFILE -o $OUTFILE -emit-llvm")),
+ // TOFIX: Preprocessed files currently have suffix ".bc".
  (switch_option "E", (stop_compilation),
+    // Make this possible:
+    // (output_suffix "i"),
    (help "Stop after the preprocessing stage, do not run the compiler")),
  (sink)
 ]>;
@@ -35,7 +42,11 @@ def llvm_gcc_cpp : Tool<
 [(in_language "c++"),
  (out_language "llvm-bitcode"),
  (output_suffix "bc"),
- (cmd_line "llvm-g++ -c -x c++ $INFILE -o $OUTFILE -emit-llvm"),
+ (cmd_line (case
+            (switch_on "E"),
+              "llvm-g++ -E -x c++ $INFILE -o $OUTFILE -emit-llvm",
+            (default),
+              "llvm-g++ -c -x c++ $INFILE -o $OUTFILE -emit-llvm")),
  (switch_option "E", (stop_compilation)),
  (sink)
 ]>;