aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llvmc
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvmc')
-rw-r--r--tools/llvmc/src/Base.td.in46
1 files changed, 26 insertions, 20 deletions
diff --git a/tools/llvmc/src/Base.td.in b/tools/llvmc/src/Base.td.in
index f82276c..12c283a 100644
--- a/tools/llvmc/src/Base.td.in
+++ b/tools/llvmc/src/Base.td.in
@@ -165,10 +165,10 @@ def Preprocess : OptionPreprocessor<
// Tools
class llvm_gcc_based <string cmd, string in_lang,
- string E_ext, string out_lang> : Tool<
+ string E_ext, string out_lang, string out_ext> : Tool<
[(in_language in_lang),
- (out_language "llvm-bitcode"),
- (output_suffix out_lang),
+ (out_language out_lang),
+ (output_suffix out_ext),
(command cmd),
(actions
(case
@@ -214,24 +214,29 @@ class llvm_gcc_based <string cmd, string in_lang,
(sink)
]>;
-def llvm_gcc_c : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x c", "c", "i", "bc">;
-def llvm_gcc_cpp : llvm_gcc_based<"@LLVMGXXCOMMAND@ -x c++", "c++", "i", "bc">;
-def llvm_gcc_m : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c",
- "objective-c", "mi", "bc">;
-def llvm_gcc_mxx : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c++",
- "objective-c++", "mi", "bc">;
+class llvm_gcc_comp_based <string cmd, string in_lang, string E_ext>
+: llvm_gcc_based<cmd, in_lang, E_ext, "llvm-bitcode", "bc">;
+
+class llvm_gcc_pch_based <string cmd, string in_lang, string E_ext>
+: llvm_gcc_based<cmd, in_lang, E_ext, "precompiled-header", "gch">;
+
+def llvm_gcc_c : llvm_gcc_comp_based
+ <"@LLVMGCCCOMMAND@ -x c", "c", "i">;
+def llvm_gcc_cpp : llvm_gcc_comp_based
+ <"@LLVMGXXCOMMAND@ -x c++", "c++", "i">;
+def llvm_gcc_m : llvm_gcc_comp_based
+ <"@LLVMGCCCOMMAND@ -x objective-c", "objective-c", "mi">;
+def llvm_gcc_mxx : llvm_gcc_comp_based
+ <"@LLVMGCCCOMMAND@ -x objective-c++", "objective-c++", "mi">;
-def llvm_gcc_c_pch : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x c-header",
- "c-header", "i", "gch">;
-def llvm_gcc_cpp_pch : llvm_gcc_based<"@LLVMGXXCOMMAND@ -x c++-header",
- "c++-header",
- "i", "gch">;
-def llvm_gcc_m_pch : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c-header",
- "objective-c-header",
- "mi", "gch">;
-def llvm_gcc_mxx_pch
- : llvm_gcc_based<"@LLVMGCCCOMMAND@ -x objective-c++-header",
- "objective-c++-header", "mi", "gch">;
+def llvm_gcc_c_pch : llvm_gcc_pch_based
+ <"@LLVMGCCCOMMAND@ -x c-header", "c-header", "i">;
+def llvm_gcc_cpp_pch : llvm_gcc_pch_based
+ <"@LLVMGXXCOMMAND@ -x c++-header", "c++-header", "i">;
+def llvm_gcc_m_pch : llvm_gcc_pch_based
+ <"@LLVMGCCCOMMAND@ -x objective-c-header", "objective-c-header", "mi">;
+def llvm_gcc_mxx_pch : llvm_gcc_pch_based
+ <"@LLVMGCCCOMMAND@ -x objective-c++-header", "objective-c++-header", "mi">;
def opt : Tool<
[(in_language "llvm-bitcode"),
@@ -343,6 +348,7 @@ def llvm_gcc_cpp_linker : llvm_gcc_based_linker<"@LLVMGXXCOMMAND@",
// Language map
def LanguageMap : LanguageMap<[
+ (lang_to_suffixes "precompiled-header", ["gch", "pch"]),
(lang_to_suffixes "c++", ["cc", "cp", "cxx", "cpp", "CPP", "c++", "C"]),
(lang_to_suffixes "c++-header", "hpp"),
(lang_to_suffixes "c", "c"),