summaryrefslogtreecommitdiff
path: root/include/clang
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2013-07-27 00:23:45 +0000
committerHans Wennborg <hans@hanshq.net>2013-07-27 00:23:45 +0000
commit6981330cc231e4e2ccbd38679209e04b776483eb (patch)
treefcf65a915b83e8af6e4b48425fa607fb5074f1cb /include/clang
parent2437c8642da2728aab47262ffb74dfa796a1cf35 (diff)
downloadclang-6981330cc231e4e2ccbd38679209e04b776483eb.tar.gz
clang-cl: add support for the /? and /help options
This establishes a new Flag in Options.td, which can be assigned to options that should be made available in clang's cl.exe compatible mode, and updates the Driver to make use of the flag. (The whitespace change to CMakeLists forces the build to re-run CMake and pick up the include dependency on the new .td file. This makes the build work if someone moves backwards in commit history after this change.) Differential Revision: http://llvm-reviews.chandlerc.com/D1215 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187280 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r--include/clang/Driver/CLCompatOptions.td21
-rw-r--r--include/clang/Driver/Driver.h4
-rw-r--r--include/clang/Driver/Makefile2
-rw-r--r--include/clang/Driver/Options.h5
-rw-r--r--include/clang/Driver/Options.td7
5 files changed, 36 insertions, 3 deletions
diff --git a/include/clang/Driver/CLCompatOptions.td b/include/clang/Driver/CLCompatOptions.td
new file mode 100644
index 0000000000..2c1554f685
--- /dev/null
+++ b/include/clang/Driver/CLCompatOptions.td
@@ -0,0 +1,21 @@
+//===--- CLCompatOptions.td - Options for clang-cl ------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the options accepted by clang-cl.
+//
+//===----------------------------------------------------------------------===//
+
+def cl_Group : OptionGroup<"<clang-cl options>">,
+ HelpText<"CL.EXE COMPATIBILITY OPTIONS">;
+
+class CLFlag<string name> : Option<["/", "-"], name, KIND_FLAG>,
+ Group<cl_Group>, Flags<[CLOption]>;
+
+def _QUESTION : CLFlag<"?">, Alias<help>, HelpText<"Display available options">;
+def cl_help : CLFlag<"help">, Alias<help>, HelpText<"Display available options">;
diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h
index eac7968e77..b2db31845f 100644
--- a/include/clang/Driver/Driver.h
+++ b/include/clang/Driver/Driver.h
@@ -396,6 +396,10 @@ private:
/// @}
+ /// \brief Get bitmasks for which option flags to include and exclude based on
+ /// the driver mode.
+ std::pair<unsigned, unsigned> getIncludeExcludeOptionFlagMasks() const;
+
public:
/// GetReleaseVersion - Parse (([0-9]+)(.([0-9]+)(.([0-9]+)?))?)? and
/// return the grouped values as integers. Numbers which are not
diff --git a/include/clang/Driver/Makefile b/include/clang/Driver/Makefile
index 375f6747c9..77cf6ff8d9 100644
--- a/include/clang/Driver/Makefile
+++ b/include/clang/Driver/Makefile
@@ -5,7 +5,7 @@ TABLEGEN_INC_FILES_COMMON = 1
include $(CLANG_LEVEL)/Makefile
-$(ObjDir)/Options.inc.tmp : Options.td CC1Options.td $(LLVM_TBLGEN) $(ObjDir)/.dir
+$(ObjDir)/Options.inc.tmp : Options.td CC1Options.td CLCompatOptions.td $(LLVM_TBLGEN) $(ObjDir)/.dir
$(Echo) "Building Clang Driver Option tables with tblgen"
$(Verb) $(LLVMTableGen) -gen-opt-parser-defs -o $(call SYSPATH, $@) $<
diff --git a/include/clang/Driver/Options.h b/include/clang/Driver/Options.h
index 559d7693bb..99ec12579f 100644
--- a/include/clang/Driver/Options.h
+++ b/include/clang/Driver/Options.h
@@ -27,8 +27,9 @@ enum ClangFlags {
LinkerInput = (1 << 5),
NoArgumentUnused = (1 << 6),
Unsupported = (1 << 7),
- CC1Option = (1 << 8),
- NoDriverOption = (1 << 9)
+ CLOption = (1 << 8),
+ CC1Option = (1 << 9),
+ NoDriverOption = (1 << 10)
};
enum ID {
diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td
index 7f36d64f3a..38ed61708c 100644
--- a/include/clang/Driver/Options.td
+++ b/include/clang/Driver/Options.td
@@ -33,6 +33,10 @@ def NoArgumentUnused : OptionFlag;
// lines that use it.
def Unsupported : OptionFlag;
+// CLOption - This is a cl.exe compatibility option. Options with this flag
+// are made available when the driver is running in CL compatibility mode.
+def CLOption : OptionFlag;
+
// CC1Option - This option should be accepted by clang -cc1.
def CC1Option : OptionFlag;
@@ -95,6 +99,7 @@ def clang_ignored_m_Group : OptionGroup<"<clang ignored m group>">,
// _ => __
// - => _
// # => _HASH
+// ? => _QUESTION
// , => _COMMA
// = => _EQ
// C++ => CXX
@@ -1316,4 +1321,6 @@ def Z_reserved_lib_stdcxx : Flag<["-"], "Z-reserved-lib-stdc++">,
def Z_reserved_lib_cckext : Flag<["-"], "Z-reserved-lib-cckext">,
Flags<[LinkerInput, NoArgumentUnused, Unsupported]>, Group<reserved_lib_Group>;
+include "CLCompatOptions.td"
+
include "CC1Options.td"