diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1429,6 +1429,57 @@ } // Flags = [CC1Option, NoDriverOption] +// Preprocessor Options + +def undef : Flag<["-"], "undef">, Group, Flags<[CC1Option]>, + HelpText<"undef all system defines">, + MarshallingInfoFlag<"PreprocessorOpts->UsePredefines", "true">, IsNegative; + +let Flags = [CC1Option, NoDriverOption] in { + +def pch_through_hdrstop_create : Flag<["-"], "pch-through-hdrstop-create">, + HelpText<"When creating a PCH, stop PCH generation after #pragma hdrstop.">, + MarshallingInfoFlag<"PreprocessorOpts->PCHWithHdrStopCreate", "false">; +def fno_validate_pch : Flag<["-"], "fno-validate-pch">, + HelpText<"Disable validation of precompiled headers">, + MarshallingInfoFlag<"PreprocessorOpts->DisablePCHValidation", "false">; +def fallow_pch_with_errors : Flag<["-"], "fallow-pch-with-compiler-errors">, + HelpText<"Accept a PCH file that was created with compiler errors">, + MarshallingInfoFlag<"PreprocessorOpts->AllowPCHWithCompilerErrors", "false">; +def dump_deserialized_pch_decls : Flag<["-"], "dump-deserialized-decls">, + HelpText<"Dump declarations that are deserialized from PCH, for testing">, + MarshallingInfoFlag<"PreprocessorOpts->DumpDeserializedPCHDecls", "false">; +def detailed_preprocessing_record : Flag<["-"], "detailed-preprocessing-record">, + HelpText<"include a detailed record of preprocessing actions">, + MarshallingInfoFlag<"PreprocessorOpts->DetailedRecord", "false">; +def setup_static_analyzer : Flag<["-"], "setup-static-analyzer">, + HelpText<"Set up preprocessor for static analyzer (done automatically when static analyzer is run).">, + MarshallingInfoFlag<"PreprocessorOpts->SetUpStaticAnalyzer", "false">; +def disable_pragma_debug_crash : Flag<["-"], "disable-pragma-debug-crash">, + HelpText<"Disable any #pragma clang __debug that can lead to crashing behavior. This is meant for testing.">, + MarshallingInfoFlag<"PreprocessorOpts->DisablePragmaDebugCrash", "false">; + +} // Flags = [CC1Option, NoDriverOption] + +// Preprocessor Output Options + +def CC : Flag<["-"], "CC">, Flags<[CC1Option]>, Group, + HelpText<"Include comments from within macros in preprocessed output">, + MarshallingInfoFlag<"PreprocessorOutputOpts.ShowMacroComments", "false">; +def C : Flag<["-"], "C">, Flags<[CC1Option]>, Group, + HelpText<"Include comments in preprocessed output">, + MarshallingInfoFlag<"PreprocessorOutputOpts.ShowComments", "false">; +def P : Flag<["-"], "P">, Flags<[CC1Option]>, Group, + HelpText<"Disable linemarker output in -E mode">, + MarshallingInfoFlag<"PreprocessorOutputOpts.ShowLineMarkers", "true">, IsNegative; +def dI : Flag<["-"], "dI">, Group, Flags<[CC1Option]>, + HelpText<"Print include directives in -E mode in addition to normal output">, + MarshallingInfoFlag<"PreprocessorOutputOpts.ShowIncludeDirectives", "false">; +defm rewrite_imports : OptInFFlag<"rewrite-imports", "", "", "", [], "PreprocessorOutputOpts.RewriteImports">; +defm rewrite_includes : OptInFFlag<"rewrite-includes", "", "", "", [], "PreprocessorOutputOpts.RewriteIncludes">; +defm use_line_directives : OptInFFlag<"use-line-directives", "Use #line in preprocessed output", + "", "", [], "PreprocessorOutputOpts.UseLineDirectives">; + // Standard Options def _HASH_HASH_HASH : Flag<["-"], "###">, Flags<[DriverOption, CoreOption]>, @@ -1438,10 +1489,6 @@ def A : JoinedOrSeparate<["-"], "A">, Flags<[RenderJoined]>, Group; def B : JoinedOrSeparate<["-"], "B">, MetaVarName<"">, HelpText<"Add to search path for binaries and object files used implicitly">; -def CC : Flag<["-"], "CC">, Flags<[CC1Option]>, Group, - HelpText<"Include comments from within macros in preprocessed output">; -def C : Flag<["-"], "C">, Flags<[CC1Option]>, Group, - HelpText<"Include comments in preprocessed output">; def D : JoinedOrSeparate<["-"], "D">, Group, Flags<[CC1Option]>, MetaVarName<"=">, HelpText<"Define to (or 1 if omitted)">; @@ -1487,8 +1534,6 @@ HelpText<"Treat source input files as Objective-C inputs">; def O_flag : Flag<["-"], "O">, Flags<[CC1Option]>, Alias, AliasArgs<["1"]>; def Ofast : Joined<["-"], "Ofast">, Group, Flags<[CC1Option]>; -def P : Flag<["-"], "P">, Flags<[CC1Option]>, Group, - HelpText<"Disable linemarker output in -E mode">; def : Flag<["-"], "fident">, Group, Alias, Flags<[CC1Option]>; def : Flag<["-"], "fno-ident">, Group, Alias, Flags<[CC1Option]>; def Qunused_arguments : Flag<["-"], "Qunused-arguments">, Flags<[DriverOption, CoreOption]>, @@ -1695,8 +1740,6 @@ HelpText<"Path to libomptarget-nvptx libraries">; def dD : Flag<["-"], "dD">, Group, Flags<[CC1Option]>, HelpText<"Print macro definitions in -E mode in addition to normal output">; -def dI : Flag<["-"], "dI">, Group, Flags<[CC1Option]>, - HelpText<"Print include directives in -E mode in addition to normal output">; def dM : Flag<["-"], "dM">, Group, Flags<[CC1Option]>, HelpText<"Print macro definitions in -E mode instead of normal output">; def dead__strip : Flag<["-"], "dead_strip">; @@ -2108,9 +2151,6 @@ def ffor_scope : Flag<["-"], "ffor-scope">, Group; def fno_for_scope : Flag<["-"], "fno-for-scope">, Group; -defm rewrite_imports : OptInFFlag<"rewrite-imports", "">; -defm rewrite_includes : OptInFFlag<"rewrite-includes", "">; - def frewrite_map_file : Separate<["-"], "frewrite-map-file">, Group, Flags<[ DriverOption, CC1Option ]>; @@ -2118,8 +2158,6 @@ Group, Flags<[DriverOption]>; -defm use_line_directives : OptInFFlag<"use-line-directives", "Use #line in preprocessed output">; - def fgnuc_version_EQ : Joined<["-"], "fgnuc-version=">, Group, HelpText<"Sets various macros to claim compatibility with the given GCC version (default is 4.2.1)">, Flags<[CC1Option, CoreOption]>; @@ -3446,8 +3484,6 @@ def t : Flag<["-"], "t">, Group; def umbrella : Separate<["-"], "umbrella">; def undefined : JoinedOrSeparate<["-"], "undefined">, Group; -def undef : Flag<["-"], "undef">, Group, Flags<[CC1Option]>, - HelpText<"undef all system defines">; def unexported__symbols__list : Separate<["-"], "unexported_symbols_list">; def u : JoinedOrSeparate<["-"], "u">, Group; def verify_debug_info : Flag<["--"], "verify-debug-info">, Flags<[DriverOption]>, @@ -4484,8 +4520,6 @@ def pch_through_header_EQ : Joined<["-"], "pch-through-header=">, HelpText<"Stop PCH generation after including this file. When using a PCH, " "skip tokens until after this file is included.">; -def pch_through_hdrstop_create : Flag<["-"], "pch-through-hdrstop-create">, - HelpText<"When creating a PCH, stop PCH generation after #pragma hdrstop.">; def pch_through_hdrstop_use : Flag<["-"], "pch-through-hdrstop-use">, HelpText<"When using a PCH, skip tokens until after a #pragma hdrstop.">; @@ -4522,12 +4556,6 @@ HelpText<"default alignment for functions">; def pic_level : Separate<["-"], "pic-level">, HelpText<"Value for __PIC__">; -def fno_validate_pch : Flag<["-"], "fno-validate-pch">, - HelpText<"Disable validation of precompiled headers">; -def fallow_pch_with_errors : Flag<["-"], "fallow-pch-with-compiler-errors">, - HelpText<"Accept a PCH file that was created with compiler errors">; -def dump_deserialized_pch_decls : Flag<["-"], "dump-deserialized-decls">, - HelpText<"Dump declarations that are deserialized from PCH, for testing">; def error_on_deserialized_pch_decl : Separate<["-"], "error-on-deserialized-decl">, HelpText<"Emit error if a specific declaration is deserialized from PCH, for testing">; def error_on_deserialized_pch_decl_EQ : Joined<["-"], "error-on-deserialized-decl=">, @@ -4605,12 +4633,6 @@ def preamble_bytes_EQ : Joined<["-"], "preamble-bytes=">, HelpText<"Assume that the precompiled header is a precompiled preamble " "covering the first N bytes of the main file">; -def detailed_preprocessing_record : Flag<["-"], "detailed-preprocessing-record">, - HelpText<"include a detailed record of preprocessing actions">; -def setup_static_analyzer : Flag<["-"], "setup-static-analyzer">, - HelpText<"Set up preprocessor for static analyzer (done automatically when static analyzer is run).">; -def disable_pragma_debug_crash : Flag<["-"], "disable-pragma-debug-crash">, - HelpText<"Disable any #pragma clang __debug that can lead to crashing behavior. This is meant for testing.">; //===----------------------------------------------------------------------===// // OpenCL Options diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -3054,15 +3054,9 @@ Opts.ImplicitPCHInclude = std::string(Args.getLastArgValue(OPT_include_pch)); Opts.PCHWithHdrStop = Args.hasArg(OPT_pch_through_hdrstop_create) || Args.hasArg(OPT_pch_through_hdrstop_use); - Opts.PCHWithHdrStopCreate = Args.hasArg(OPT_pch_through_hdrstop_create); Opts.PCHThroughHeader = std::string(Args.getLastArgValue(OPT_pch_through_header_EQ)); - Opts.UsePredefines = !Args.hasArg(OPT_undef); - Opts.DetailedRecord = Args.hasArg(OPT_detailed_preprocessing_record); - Opts.DisablePCHValidation = Args.hasArg(OPT_fno_validate_pch); - Opts.AllowPCHWithCompilerErrors = Args.hasArg(OPT_fallow_pch_with_errors); - Opts.DumpDeserializedPCHDecls = Args.hasArg(OPT_dump_deserialized_pch_decls); for (const auto *A : Args.filtered(OPT_error_on_deserialized_pch_decl)) Opts.DeserializedPCHDeclsToErrorOn.insert(A->getValue()); @@ -3145,9 +3139,6 @@ // "editor placeholder in source file" error in PP only mode. if (isStrictlyPreprocessorAction(Action)) Opts.LexEditorPlaceholders = false; - - Opts.SetUpStaticAnalyzer = Args.hasArg(OPT_setup_static_analyzer); - Opts.DisablePragmaDebugCrash = Args.hasArg(OPT_disable_pragma_debug_crash); } static void ParsePreprocessorOutputArgs(PreprocessorOutputOptions &Opts, @@ -3158,14 +3149,7 @@ else Opts.ShowCPP = 0; - Opts.ShowComments = Args.hasArg(OPT_C); - Opts.ShowLineMarkers = !Args.hasArg(OPT_P); - Opts.ShowMacroComments = Args.hasArg(OPT_CC); Opts.ShowMacros = Args.hasArg(OPT_dM) || Args.hasArg(OPT_dD); - Opts.ShowIncludeDirectives = Args.hasArg(OPT_dI); - Opts.RewriteIncludes = Args.hasArg(OPT_frewrite_includes); - Opts.RewriteImports = Args.hasArg(OPT_frewrite_imports); - Opts.UseLineDirectives = Args.hasArg(OPT_fuse_line_directives); } static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args,