[llvm-commits] [llvm] r59582 - in /llvm/trunk: include/llvm/CompilerDriver/Tools.td test/LLVMC/include.c

Daniel Dunbar daniel at zuster.org
Tue Nov 18 18:59:02 PST 2008


Author: ddunbar
Date: Tue Nov 18 20:59:00 2008
New Revision: 59582

URL: http://llvm.org/viewvc/llvm-project?rev=59582&view=rev
Log:
LLVMC2: Teach llvm_gcc_c tool about -include and -fsyntax-only.
 - Only focusing on llvm_gcc_c for now, eventually this needs to be
   refactored so it can be shared via all the gcc-like tools.

Added:
    llvm/trunk/test/LLVMC/include.c
Modified:
    llvm/trunk/include/llvm/CompilerDriver/Tools.td

Modified: llvm/trunk/include/llvm/CompilerDriver/Tools.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CompilerDriver/Tools.td?rev=59582&r1=59581&r2=59582&view=diff

==============================================================================
--- llvm/trunk/include/llvm/CompilerDriver/Tools.td (original)
+++ llvm/trunk/include/llvm/CompilerDriver/Tools.td Tue Nov 18 20:59:00 2008
@@ -21,10 +21,16 @@
                     "llvm-gcc -E -x c++ $INFILE -o $OUTFILE",
                     (default),
                     "llvm-gcc -E -x c++ $INFILE"),
+            (switch_on "fsyntax-only"),
+              "llvm-gcc -c -x c $INFILE",
             (default),
               "llvm-gcc -c -x c $INFILE -o $OUTFILE -emit-llvm")),
  (switch_option "E", (stop_compilation),
    (help "Stop after the preprocessing stage, do not run the compiler")),
+ (switch_option "fsyntax-only", (stop_compilation),
+   (help "Stop after checking the input for syntax errors")),
+ (parameter_list_option "include", (forward),
+   (help "Include the named file prior to preprocessing")),
  (sink)
 ]>;
 

Added: llvm/trunk/test/LLVMC/include.c
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/LLVMC/include.c?rev=59582&view=auto

==============================================================================
--- llvm/trunk/test/LLVMC/include.c (added)
+++ llvm/trunk/test/LLVMC/include.c Tue Nov 18 20:59:00 2008
@@ -0,0 +1,9 @@
+/*
+ * Check that the 'include' options work.
+ * RUN: echo "int x;\n" > %t1.inc
+ * RUN: llvmc2 -include %t1.inc -fsyntax-only %s
+ */
+
+int f0(void) {
+  return x;
+}





More information about the llvm-commits mailing list