From ad981bfbccedd4e8c139f27db4bbc49ef3e783b9 Mon Sep 17 00:00:00 2001 From: Mikhail Glushenkov Date: Mon, 28 Sep 2009 01:16:42 +0000 Subject: Add a way to query the number of input files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82957 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvmc/doc/LLVMC-Reference.rst | 7 +++++++ tools/llvmc/plugins/Base/Base.td.in | 2 ++ 2 files changed, 9 insertions(+) (limited to 'tools') diff --git a/tools/llvmc/doc/LLVMC-Reference.rst b/tools/llvmc/doc/LLVMC-Reference.rst index 7e609a7bc3..5d3b02a169 100644 --- a/tools/llvmc/doc/LLVMC-Reference.rst +++ b/tools/llvmc/doc/LLVMC-Reference.rst @@ -458,6 +458,13 @@ use TableGen inheritance instead. - ``empty`` - The opposite of ``not_empty``. Equivalent to ``(not (not_empty X))``. Provided for convenience. + - ``single_input_file`` - Returns true if there was only one input file + provided on the command-line. Used without arguments: + ``(single_input_file)``. + + - ``multiple_input_files`` - Equivalent to ``(not (single_input_file))`` (the + case of zero input files is considered an error). + - ``default`` - Always evaluates to true. Should always be the last test in the ``case`` expression. diff --git a/tools/llvmc/plugins/Base/Base.td.in b/tools/llvmc/plugins/Base/Base.td.in index d4bff17a31..4b964e3dea 100644 --- a/tools/llvmc/plugins/Base/Base.td.in +++ b/tools/llvmc/plugins/Base/Base.td.in @@ -70,6 +70,8 @@ class llvm_gcc_based : Tool< !strconcat(cmd_prefix, " -c $INFILE -o $OUTFILE -emit-llvm"))), (actions (case + (and (multiple_input_files), (or (switch_on "S"), (switch_on "c"))), + (error "cannot specify -o with -c or -S with multiple files"), (switch_on "E"), [(stop_compilation), (output_suffix E_ext)], (and (switch_on "emit-llvm"), (switch_on "S")), [(output_suffix "ll"), (stop_compilation)], -- cgit v1.2.3