diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-11-19 02:59:00 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-11-19 02:59:00 +0000 |
commit | ff6477b7203b613b6f73a884352bbb421be30f5a (patch) | |
tree | 60dfd846ebbecdae2072343314d5a4540b6eaebb | |
parent | 607d6bb819e759c65e7f4a984d095f4eeae5cb30 (diff) | |
download | external_llvm-ff6477b7203b613b6f73a884352bbb421be30f5a.zip external_llvm-ff6477b7203b613b6f73a884352bbb421be30f5a.tar.gz external_llvm-ff6477b7203b613b6f73a884352bbb421be30f5a.tar.bz2 |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59582 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/CompilerDriver/Tools.td | 6 | ||||
-rw-r--r-- | test/LLVMC/include.c | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/include/llvm/CompilerDriver/Tools.td b/include/llvm/CompilerDriver/Tools.td index 7bd6dd4..4ff1a52 100644 --- a/include/llvm/CompilerDriver/Tools.td +++ b/include/llvm/CompilerDriver/Tools.td @@ -21,10 +21,16 @@ def llvm_gcc_c : Tool< "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) ]>; diff --git a/test/LLVMC/include.c b/test/LLVMC/include.c new file mode 100644 index 0000000..eeb6ca6 --- /dev/null +++ b/test/LLVMC/include.c @@ -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; +} |