diff options
Diffstat (limited to 'include/clang/Driver')
-rw-r--r-- | include/clang/Driver/CC1Options.td | 80 | ||||
-rw-r--r-- | include/clang/Driver/Driver.h | 7 | ||||
-rw-r--r-- | include/clang/Driver/Job.h | 11 | ||||
-rw-r--r-- | include/clang/Driver/OptParser.td | 6 | ||||
-rw-r--r-- | include/clang/Driver/OptTable.h | 37 | ||||
-rw-r--r-- | include/clang/Driver/Options.td | 58 |
6 files changed, 158 insertions, 41 deletions
diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index b34fe03..a9566f3 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -55,7 +55,7 @@ def analysis_CheckerCFRef : Flag<"-checker-cfref">, def analysis_WarnSizeofPointer : Flag<"-warn-sizeof-pointer">, HelpText<"Warn about unintended use of sizeof() on pointer expressions">; def analysis_InlineCall : Flag<"-inline-call">, - HelpText<"Experimental transfer function inling callees when its definition is available.">; + HelpText<"Experimental transfer function inlining callees when its definition is available.">; def analyzer_store : Separate<"-analyzer-store">, HelpText<"Source Code Analysis - Abstract Memory Store Models">; @@ -73,6 +73,8 @@ def analyzer_output_EQ : Joined<"-analyzer-output=">, def analyzer_opt_analyze_headers : Flag<"-analyzer-opt-analyze-headers">, HelpText<"Force the static analyzer to analyze functions defined in header files">; +def analyzer_opt_analyze_nested_blocks : Flag<"-analyzer-opt-analyze-nested-blocks">, + HelpText<"Analyze the definitions of blocks in addition to functions">; def analyzer_display_progress : Flag<"-analyzer-display-progress">, HelpText<"Emit verbose output about the analyzer's progress">; def analyzer_experimental_checks : Flag<"-analyzer-experimental-checks">, @@ -103,6 +105,8 @@ def disable_llvm_optzns : Flag<"-disable-llvm-optzns">, def disable_red_zone : Flag<"-disable-red-zone">, HelpText<"Do not emit code that uses the red zone.">; def g : Flag<"-g">, HelpText<"Generate source level debug information">; +def fcatch_undefined_behavior : Flag<"-fcatch-undefined-behavior">, + HelpText<"Generate runtime checks for undefined behavior.">; def fno_common : Flag<"-fno-common">, HelpText<"Compile common globals like normal definitions">; def no_implicit_float : Flag<"-no-implicit-float">, @@ -117,13 +121,13 @@ def mdebug_pass : Separate<"-mdebug-pass">, HelpText<"Enable additional debug output">; def mdisable_fp_elim : Flag<"-mdisable-fp-elim">, HelpText<"Disable frame pointer elimination optimization">; -def mfloat_abi : Flag<"-mfloat-abi">, +def mfloat_abi : Separate<"-mfloat-abi">, HelpText<"The float ABI to use">; def mlimit_float_precision : Separate<"-mlimit-float-precision">, HelpText<"Limit float precision to the given value">; def mno_zero_initialized_in_bss : Flag<"-mno-zero-initialized-in-bss">, HelpText<"Do not put zero initialized data in the BSS">; -def msoft_float : Separate<"-msoft-float">, +def msoft_float : Flag<"-msoft-float">, HelpText<"Use software floating point">; def mrelocation_model : Separate<"-mrelocation-model">, HelpText<"The relocation model to use">; @@ -149,7 +153,7 @@ def MP : Flag<"-MP">, //===----------------------------------------------------------------------===// def dump_build_information : Separate<"-dump-build-information">, - MetaVarName<"filename">, + MetaVarName<"<filename>">, HelpText<"output a dump of some build information to a file">; def fno_show_column : Flag<"-fno-show-column">, HelpText<"Do not include column number on diagnostics">; @@ -172,7 +176,7 @@ def fdiagnostics_print_source_range_info : Flag<"-fdiagnostics-print-source-rang HelpText<"Print source range spans in numeric form">; def fdiagnostics_show_option : Flag<"-fdiagnostics-show-option">, HelpText<"Print diagnostic name with mappable diagnostics">; -def fmessage_length : Separate<"-fmessage-length">, MetaVarName<"N">, +def fmessage_length : Separate<"-fmessage-length">, MetaVarName<"<N>">, HelpText<"Format message diagnostics so that they fit within N columns or fewer, when possible.">; def fcolor_diagnostics : Flag<"-fcolor-diagnostics">, HelpText<"Use colors in diagnostics">; @@ -185,28 +189,45 @@ def verify : Flag<"-verify">, // Frontend Options //===----------------------------------------------------------------------===// +// This isn't normally used, it is just here so we can parse a +// CompilerInvocation out of a driver-derived argument vector. +def cc1 : Flag<"-cc1">; + def code_completion_at : Separate<"-code-completion-at">, - MetaVarName<"file:line:column">, + MetaVarName<"<file>:<line>:<column>">, HelpText<"Dump code-completion information at a location">; +def remap_file : Separate<"-remap-file">, + MetaVarName<"<from>;<to>">, + HelpText<"Replace the contents of the <from> file with the contents of the <to> file">; def code_completion_at_EQ : Joined<"-code-completion-at=">, Alias<code_completion_at>; def no_code_completion_debug_printer : Flag<"-no-code-completion-debug-printer">, - HelpText<"Don't the \"debug\" code-completion print">; + HelpText<"Don't use the \"debug\" code-completion print">; def code_completion_macros : Flag<"-code-completion-macros">, HelpText<"Include macros in code-completion results">; def disable_free : Flag<"-disable-free">, HelpText<"Disable freeing of memory on exit">; def empty_input_only : Flag<"-empty-input-only">, HelpText<"Force running on an empty input file">; +def help : Flag<"-help">, + HelpText<"Print this help text">; +def _help : Flag<"--help">, Alias<help>; def x : Separate<"-x">, HelpText<"Input language type">; def cxx_inheritance_view : Separate<"-cxx-inheritance-view">, - MetaVarName<"class name">, + MetaVarName<"<class name>">, HelpText<"View C++ inheritance for a specified class">; -def fixit_at : Separate<"-fixit-at">, MetaVarName<"source-location">, +def fixit_at : Separate<"-fixit-at">, MetaVarName<"<source location>">, HelpText<"Perform Fix-It modifications at the given source location">; -def o : Separate<"-o">, MetaVarName<"path">, HelpText<"Specify output file">; +def o : Separate<"-o">, MetaVarName<"<path>">, HelpText<"Specify output file">; +def load : Separate<"-load">, MetaVarName<"<dsopath>">, + HelpText<"Load the named plugin (dynamic shared object)">; def plugin : Separate<"-plugin">, HelpText<"Use the named plugin action (use \"help\" to list available options)">; +def resource_dir : Separate<"-resource-dir">, + HelpText<"The directory which holds the compiler resource files">; +def version : Flag<"-version">, + HelpText<"Print the compiler version">; +def _version : Flag<"--version">, Alias<version>; def Action_Group : OptionGroup<"<action group>">; let Group = Action_Group in { @@ -313,7 +334,7 @@ def fno_signed_char : Flag<"-fno-signed-char">, def fno_operator_names : Flag<"-fno-operator-names">, HelpText<"Do not treat C++ operator name keywords as synonyms for operators">; def fconstant_string_class : Separate<"-fconstant-string-class">, - MetaVarName<"class name">, + MetaVarName<"<class name>">, HelpText<"Specify the class to use for constant Objective-C string objects.">; def fobjc_gc : Flag<"-fobjc-gc">, HelpText<"Enable Objective-C garbage collection">; @@ -326,7 +347,7 @@ def fobjc_nonfragile_abi : Flag<"-fobjc-nonfragile-abi">, def ftrapv : Flag<"-ftrapv">, HelpText<"Trap on integer overflow">; def pic_level : Separate<"-pic-level">, - HelpText<"-Value for __PIC__">; + HelpText<"Value for __PIC__">; def pthread : Flag<"-pthread">, HelpText<"Support POSIX threads in generated code">; def fpascal_strings : Flag<"-fpascal-strings">, @@ -356,23 +377,24 @@ def nostdinc : Flag<"-nostdinc">, HelpText<"Disable standard #include directories">; def nobuiltininc : Flag<"-nobuiltininc">, HelpText<"Disable builtin #include directories">; -def F : JoinedOrSeparate<"-F">, MetaVarName<"directory">, +def F : JoinedOrSeparate<"-F">, MetaVarName<"<directory>">, HelpText<"Add directory to framework include search path">; -def I : JoinedOrSeparate<"-I">, MetaVarName<"directory">, +def I : JoinedOrSeparate<"-I">, MetaVarName<"<directory>">, HelpText<"Add directory to include search path">; -def idirafter : Separate<"-idirafter">, MetaVarName<"directory">, +def idirafter : JoinedOrSeparate<"-idirafter">, MetaVarName<"<directory>">, HelpText<"Add directory to AFTER include search path">; -def iquote : Separate<"-iquote">, MetaVarName<"directory">, +def iquote : JoinedOrSeparate<"-iquote">, MetaVarName<"<directory>">, HelpText<"Add directory to QUOTE include search path">; -def isystem : Separate<"-isystem">, MetaVarName<"directory">, +def isystem : JoinedOrSeparate<"-isystem">, MetaVarName<"<directory>">, HelpText<"Add directory to SYSTEM include search path">; -def iprefix : Separate<"-iprefix">, MetaVarName<"prefix">, +def iprefix : JoinedOrSeparate<"-iprefix">, MetaVarName<"<prefix>">, HelpText<"Set the -iwithprefix/-iwithprefixbefore prefix">; -def iwithprefix : Separate<"-iwithprefix">, MetaVarName<"dir">, +def iwithprefix : JoinedOrSeparate<"-iwithprefix">, MetaVarName<"<dir>">, HelpText<"Set directory to SYSTEM include search path with prefix">; -def iwithprefixbefore : Separate<"-iwithprefixbefore">, MetaVarName<"dir">, +def iwithprefixbefore : JoinedOrSeparate<"-iwithprefixbefore">, + MetaVarName<"<dir>">, HelpText<"Set directory to include search path with prefix">; -def isysroot : Separate<"-isysroot">, MetaVarName<"dir">, +def isysroot : JoinedOrSeparate<"-isysroot">, MetaVarName<"<dir>">, HelpText<"Set the system root directory (usually /)">; def v : Flag<"-v">, HelpText<"Enable verbose output">; @@ -380,21 +402,21 @@ def v : Flag<"-v">, HelpText<"Enable verbose output">; // Preprocessor Options //===----------------------------------------------------------------------===// -def D : JoinedOrSeparate<"-D">, MetaVarName<"macro">, +def D : JoinedOrSeparate<"-D">, MetaVarName<"<macro>">, HelpText<"Predefine the specified macro">; -def include_ : Separate<"-include">, MetaVarName<"file">, EnumName<"include">, +def include_ : JoinedOrSeparate<"-include">, MetaVarName<"<file>">, EnumName<"include">, HelpText<"Include file before parsing">; -def imacros : Separate<"-imacros">, MetaVarName<"file">, +def imacros : JoinedOrSeparate<"-imacros">, MetaVarName<"<file>">, HelpText<"Include macros from file before parsing">; -def include_pch : Separate<"-include-pch">, MetaVarName<"file">, +def include_pch : Separate<"-include-pch">, MetaVarName<"<file>">, HelpText<"Include precompiled header file">; -def include_pth : Separate<"-include-pth">, MetaVarName<"file">, +def include_pth : Separate<"-include-pth">, MetaVarName<"<file>">, HelpText<"Include file before parsing">; -def token_cache : Separate<"-token-cache">, MetaVarName<"path">, +def token_cache : Separate<"-token-cache">, MetaVarName<"<path>">, HelpText<"Use specified token cache file">; -def U : JoinedOrSeparate<"-U">, MetaVarName<"macro">, +def U : JoinedOrSeparate<"-U">, MetaVarName<"<macro>">, HelpText<"Undefine the specified macro">; -def undef : Flag<"-undef">, MetaVarName<"macro">, +def undef : Flag<"-undef">, MetaVarName<"<macro>">, HelpText<"undef all system defines">; //===----------------------------------------------------------------------===// diff --git a/include/clang/Driver/Driver.h b/include/clang/Driver/Driver.h index d3ab115..8933619 100644 --- a/include/clang/Driver/Driver.h +++ b/include/clang/Driver/Driver.h @@ -15,6 +15,7 @@ #include "clang/Driver/Phases.h" #include "clang/Driver/Util.h" +#include "llvm/ADT/StringRef.h" #include "llvm/ADT/Triple.h" #include "llvm/System/Path.h" // FIXME: Kill when CompilationInfo // lands. @@ -112,9 +113,9 @@ private: std::list<std::string> ResultFiles; public: - Driver(const char *_Name, const char *_Dir, - const char *_DefaultHostTriple, - const char *_DefaultImageName, + Driver(llvm::StringRef _Name, llvm::StringRef _Dir, + llvm::StringRef _DefaultHostTriple, + llvm::StringRef _DefaultImageName, bool IsProduction, Diagnostic &_Diags); ~Driver(); diff --git a/include/clang/Driver/Job.h b/include/clang/Driver/Job.h index 906d731..74ca083 100644 --- a/include/clang/Driver/Job.h +++ b/include/clang/Driver/Job.h @@ -22,7 +22,8 @@ using llvm::dyn_cast_or_null; namespace clang { namespace driver { - class Command; +class Command; +class Tool; class Job { public: @@ -55,6 +56,9 @@ class Command : public Job { /// Source - The action which caused the creation of this job. const Action &Source; + /// Tool - The tool which caused the creation of this job. + const Tool &Creator; + /// The executable to run. const char *Executable; @@ -63,12 +67,15 @@ class Command : public Job { ArgStringList Arguments; public: - Command(const Action &_Source, const char *_Executable, + Command(const Action &_Source, const Tool &_Creator, const char *_Executable, const ArgStringList &_Arguments); /// getSource - Return the Action which caused the creation of this job. const Action &getSource() const { return Source; } + /// getCreator - Return the Tool which caused the creation of this job. + const Tool &getCreator() const { return Creator; } + const char *getExecutable() const { return Executable; } const ArgStringList &getArguments() const { return Arguments; } diff --git a/include/clang/Driver/OptParser.td b/include/clang/Driver/OptParser.td index f5b6980..a9f4289 100644 --- a/include/clang/Driver/OptParser.td +++ b/include/clang/Driver/OptParser.td @@ -77,11 +77,17 @@ def RenderSeparate : OptionFlag; // lines that use it. def Unsupported : OptionFlag; +// HelpHidden - The option should not be displayed in --help, even if it has +// help text. Clients *can* use this in conjuction with the OptTable::PrintHelp +// arguments to implement hidden help groups. +def HelpHidden : OptionFlag; + // Define the option group class. class OptionGroup<string name> { string EnumName = ?; // Uses the def name if undefined. string Name = name; + string HelpText = ?; OptionGroup Group = ?; } diff --git a/include/clang/Driver/OptTable.h b/include/clang/Driver/OptTable.h index faaeba6..edae75c 100644 --- a/include/clang/Driver/OptTable.h +++ b/include/clang/Driver/OptTable.h @@ -13,17 +13,22 @@ #include "clang/Driver/OptSpecifier.h" #include <cassert> +namespace llvm { + class raw_ostream; +} + namespace clang { namespace driver { namespace options { enum DriverFlag { DriverOption = (1 << 0), - LinkerInput = (1 << 1), - NoArgumentUnused = (1 << 2), - RenderAsInput = (1 << 3), - RenderJoined = (1 << 4), - RenderSeparate = (1 << 5), - Unsupported = (1 << 6) + HelpHidden = (1 << 1), + LinkerInput = (1 << 2), + NoArgumentUnused = (1 << 3), + RenderAsInput = (1 << 4), + RenderJoined = (1 << 5), + RenderSeparate = (1 << 6), + Unsupported = (1 << 7) }; } @@ -113,6 +118,17 @@ namespace options { return getInfo(id).Kind; } + /// getOptionGroupID - Get the group id for the given option. + unsigned getOptionGroupID(OptSpecifier id) const { + return getInfo(id).GroupID; + } + + /// isOptionHelpHidden - Should the help for the given option be hidden by + /// default. + bool isOptionHelpHidden(OptSpecifier id) const { + return getInfo(id).Flags & options::HelpHidden; + } + /// getOptionHelpText - Get the help text to use to describe this option. const char *getOptionHelpText(OptSpecifier id) const { return getInfo(id).HelpText; @@ -156,6 +172,15 @@ namespace options { const char **ArgEnd, unsigned &MissingArgIndex, unsigned &MissingArgCount) const; + + /// PrintHelp - Render the help text for an option table. + /// + /// \param OS - The stream to write the help text to. + /// \param Name - The name to use in the usage line. + /// \param Title - The title to use in the usage line. + /// \param ShowHidden - Whether help-hidden arguments should be shown. + void PrintHelp(llvm::raw_ostream &OS, const char *Name, + const char *Title, bool ShowHidden = false) const; }; } } diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index ace1a3c..3592fc9 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -61,6 +61,55 @@ def clang_ignored_m_Group : OptionGroup<"<clang ignored m group>">, // = => _EQ // C++ => CXX +// Developer Driver Options + +def ccc_Group : OptionGroup<"<clang internal options>">; +def ccc_driver_Group : OptionGroup<"<clang driver internal options>">, + Group<ccc_Group>, HelpText<"DRIVER OPTIONS">; +def ccc_debug_Group : OptionGroup<"<clang debug/development internal options>">, + Group<ccc_Group>, HelpText<"DEBUG/DEVELOPMENT OPTIONS">; + +class CCCDriverOpt : Group<ccc_driver_Group>, Flags<[DriverOption, HelpHidden]>; +def ccc_cxx : Flag<"-ccc-cxx">, CCCDriverOpt, + HelpText<"Act as a C++ driver">; +def ccc_echo : Flag<"-ccc-echo">, CCCDriverOpt, + HelpText<"Echo commands before running them">; +def ccc_gcc_name : Separate<"-ccc-gcc-name">, CCCDriverOpt, + HelpText<"Name for native GCC compiler">, + MetaVarName<"<gcc-path>">; +def ccc_clang_cxx : Flag<"-ccc-clang-cxx">, CCCDriverOpt, + HelpText<"Enable the clang compiler for C++">; +def ccc_no_clang_cxx : Flag<"-ccc-no-clang-cxx">, CCCDriverOpt, + HelpText<"Disable the clang compiler for C++">; +def ccc_no_clang : Flag<"-ccc-no-clang">, CCCDriverOpt, + HelpText<"Disable the clang compiler">; +def ccc_no_clang_cpp : Flag<"-ccc-no-clang-cpp">, CCCDriverOpt, + HelpText<"Disable the clang preprocessor">; +def ccc_clang_archs : Separate<"-ccc-clang-archs">, CCCDriverOpt, + HelpText<"Comma separate list of architectures to use the clang compiler for">, + MetaVarName<"<arch-list>">; +def ccc_pch_is_pch : Flag<"-ccc-pch-is-pch">, CCCDriverOpt, + HelpText<"Use lazy PCH for precompiled headers">; +def ccc_pch_is_pth : Flag<"-ccc-pch-is-pth">, CCCDriverOpt, + HelpText<"Use pretokenized headers for precompiled headers">; + +class CCCDebugOpt : Group<ccc_debug_Group>, Flags<[DriverOption, HelpHidden]>; +def ccc_host_triple : Separate<"-ccc-host-triple">, CCCDebugOpt, + HelpText<"Simulate running on the given target">; +def ccc_install_dir : Separate<"-ccc-install-dir">, CCCDebugOpt, + HelpText<"Simulate installation in the given directory">; +def ccc_print_options : Flag<"-ccc-print-options">, CCCDebugOpt, + HelpText<"Dump parsed command line arguments">; +def ccc_print_phases : Flag<"-ccc-print-phases">, CCCDebugOpt, + HelpText<"Dump list of actions to perform">; +def ccc_print_bindings : Flag<"-ccc-print-bindings">, CCCDebugOpt, + HelpText<"Show bindings of tools to actions">; + +// Make sure all other -ccc- options are rejected. +def ccc_ : Joined<"-ccc-">, Group<ccc_Group>, Flags<[Unsupported]>; + +// Standard Options + def _HASH_HASH_HASH : Flag<"-###">, Flags<[DriverOption]>, HelpText<"Print the commands to run for this compilation">; def A : JoinedOrSeparate<"-A">; @@ -187,6 +236,8 @@ def fbootclasspath_EQ : Joined<"-fbootclasspath=">, Group<f_Group>; def fbuiltin_strcat : Flag<"-fbuiltin-strcat">, Group<f_Group>; def fbuiltin_strcpy : Flag<"-fbuiltin-strcpy">, Group<f_Group>; def fbuiltin : Flag<"-fbuiltin">, Group<f_Group>; +def fcatch_undefined_behavior : Flag<"-fcatch-undefined-behavior">, + Group<f_Group>, HelpText<"Generate runtime checks for undefined behavior.">; def fclasspath_EQ : Joined<"-fclasspath=">, Group<f_Group>; def fcolor_diagnostics : Flag<"-fcolor-diagnostics">, Group<f_Group>; def fcommon : Flag<"-fcommon">, Group<f_Group>; @@ -277,6 +328,9 @@ def fprofile_arcs : Flag<"-fprofile-arcs">, Group<f_Group>; def fprofile_generate : Flag<"-fprofile-generate">, Group<f_Group>; def framework : Separate<"-framework">, Flags<[LinkerInput]>; def frtti : Flag<"-frtti">, Group<f_Group>; +def fsched_interblock : Flag<"-fsched-interblock">, Group<clang_ignored_f_Group>; +def fshort_enums : Flag<"-fshort-enums">, Group<clang_ignored_f_Group>; +def freorder_blocks : Flag<"-freorder-blocks">, Group<clang_ignored_f_Group>; def fshort_wchar : Flag<"-fshort-wchar">, Group<f_Group>; def fshow_source_location : Flag<"-fshow-source-location">, Group<f_Group>; def fsigned_bitfields : Flag<"-fsigned-bitfields">, Group<f_Group>; @@ -315,7 +369,7 @@ def init : Separate<"-init">; def install__name : Separate<"-install_name">; def iprefix : JoinedOrSeparate<"-iprefix">, Group<clang_i_Group>; def iquote : JoinedOrSeparate<"-iquote">, Group<clang_i_Group>; -def isysroot : JoinedOrSeparate<"-isysroot">, Group<i_Group>; +def isysroot : JoinedOrSeparate<"-isysroot">, Group<clang_i_Group>; def isystem : JoinedOrSeparate<"-isystem">, Group<clang_i_Group>; def iwithprefixbefore : JoinedOrSeparate<"-iwithprefixbefore">, Group<clang_i_Group>; def iwithprefix : JoinedOrSeparate<"-iwithprefix">, Group<clang_i_Group>; @@ -373,6 +427,8 @@ def multiply__defined : Separate<"-multiply_defined">; def mwarn_nonportable_cfstrings : Flag<"-mwarn-nonportable-cfstrings">, Group<m_Group>; def m_Separate : Separate<"-m">, Group<m_Group>; def m_Joined : Joined<"-m">, Group<m_Group>; +def no_canonical_prefixes : Flag<"-no-canonical-prefixes">, Flags<[DriverOption, HelpHidden]>, + HelpText<"Use relative instead of canonical paths">; def no_cpp_precomp : Flag<"-no-cpp-precomp">; def no_integrated_cpp : Flag<"-no-integrated-cpp">, Flags<[DriverOption]>; def no__dead__strip__inits__and__terms : Flag<"-no_dead_strip_inits_and_terms">; |