def MT : Separate<"-MT">, HelpText<"Specify target for dependency">;
def MP : Flag<"-MP">,
HelpText<"Create phony target for each dependency (other than main file)">;
+
+// Diagnostic Options
+
+def dump_build_information : Separate<"-dump-build-information">,
+ 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">;
+
+def fno_show_source_location : Flag<"-fno-show-source-location">,
+ HelpText<"Do not include source location information with diagnostics">;
+
+def fno_caret_diagnostics : Flag<"-fno-caret-diagnostics">,
+ HelpText<"Do not include source line and caret with diagnostics">;
+
+def fno_diagnostics_fixit_info : Flag<"-fno-diagnostics-fixit-info">,
+ HelpText<"Do not include fixit information in diagnostics">;
+
+def w : Flag<"w">, HelpText<"Suppress all warnings">;
+
+def pedantic : Flag<"-pedantic">;
+
+def pedantic_errors : Flag<"-pedantic-errors">;
+
+// This gets all -W options, including -Werror, -W[no-]system-headers, etc. The
+// driver has stripped off -Wa,foo etc. The driver has also translated -W to
+// -Wextra, so we don't need to worry about it.
+def W : Joined<"-W">;
+
+def fdiagnostics_print_source_range_info : Flag<"-fdiagnostics-print-source-range-info">,
+ 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">,
+ 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">;
+
+def Wno_rewrite_macros : Flag<"-Wno-rewrite-macros">,
+ HelpText<"Silence ObjC rewriting warnings">;
+
+def verify : Flag<"-verify">,
+ HelpText<"Verify emitted diagnostics and warnings">;
//
static void ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args) {
+ using namespace cc1options;
+
Opts.AnalysisList.clear();
#define ANALYSIS(NAME, CMDFLAG, DESC, SCOPE) \
- if (Args.hasArg(cc1options::OPT_analysis_##NAME)) \
- Opts.AnalysisList.push_back(NAME);
+ if (Args.hasArg(OPT_analysis_##NAME)) Opts.AnalysisList.push_back(NAME);
#include "clang/Frontend/Analyses.def"
- if (Arg *A = Args.getLastArg(cc1options::OPT_analyzer_store)) {
+ if (Arg *A = Args.getLastArg(OPT_analyzer_store)) {
llvm::StringRef Name = A->getValue(Args);
AnalysisStores Value = llvm::StringSwitch<AnalysisStores>(Name)
#define ANALYSIS_STORE(NAME, CMDFLAG, DESC, CREATFN) \
Opts.AnalysisStoreOpt = Value;
}
- if (Arg *A = Args.getLastArg(cc1options::OPT_analyzer_constraints)) {
+ if (Arg *A = Args.getLastArg(OPT_analyzer_constraints)) {
llvm::StringRef Name = A->getValue(Args);
AnalysisConstraints Value = llvm::StringSwitch<AnalysisConstraints>(Name)
#define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATFN) \
Opts.AnalysisConstraintsOpt = Value;
}
- if (Arg *A = Args.getLastArg(cc1options::OPT_analyzer_output)) {
+ if (Arg *A = Args.getLastArg(OPT_analyzer_output)) {
llvm::StringRef Name = A->getValue(Args);
AnalysisDiagClients Value = llvm::StringSwitch<AnalysisDiagClients>(Name)
#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN, AUTOCREAT) \
Opts.AnalysisDiagOpt = Value;
}
- Opts.VisualizeEGDot =
- Args.hasArg(cc1options::OPT_analyzer_viz_egraph_graphviz);
- Opts.VisualizeEGUbi =
- Args.hasArg(cc1options::OPT_analyzer_viz_egraph_ubigraph);
- Opts.AnalyzeAll = Args.hasArg(cc1options::OPT_analyzer_opt_analyze_headers);
- Opts.AnalyzerDisplayProgress =
- Args.hasArg(cc1options::OPT_analyzer_display_progress);
- Opts.PurgeDead = !Args.hasArg(cc1options::OPT_analyzer_no_purge_dead);
- Opts.EagerlyAssume = Args.hasArg(cc1options::OPT_analyzer_eagerly_assume);
- Opts.AnalyzeSpecificFunction =
- getLastArgValue(Args, cc1options::OPT_analyze_function);
- Opts.EnableExperimentalChecks =
- Args.hasArg(cc1options::OPT_analyzer_experimental_checks);
+ Opts.VisualizeEGDot = Args.hasArg(OPT_analyzer_viz_egraph_graphviz);
+ Opts.VisualizeEGUbi = Args.hasArg(OPT_analyzer_viz_egraph_ubigraph);
+ Opts.AnalyzeAll = Args.hasArg(OPT_analyzer_opt_analyze_headers);
+ Opts.AnalyzerDisplayProgress = Args.hasArg(OPT_analyzer_display_progress);
+ Opts.PurgeDead = !Args.hasArg(OPT_analyzer_no_purge_dead);
+ Opts.EagerlyAssume = Args.hasArg(OPT_analyzer_eagerly_assume);
+ Opts.AnalyzeSpecificFunction = getLastArgValue(Args, OPT_analyze_function);
+ Opts.EnableExperimentalChecks = Args.hasArg(OPT_analyzer_experimental_checks);
Opts.EnableExperimentalInternalChecks =
- Args.hasArg(cc1options::OPT_analyzer_experimental_internal_checks);
- Opts.TrimGraph = Args.hasArg(cc1options::OPT_trim_egraph);
+ Args.hasArg(OPT_analyzer_experimental_internal_checks);
+ Opts.TrimGraph = Args.hasArg(OPT_trim_egraph);
}
static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args) {
+ using namespace cc1options;
// -Os implies -O2
- if (Args.hasArg(cc1options::OPT_Os))
+ if (Args.hasArg(OPT_Os))
Opts.OptimizationLevel = 2;
else
- Opts.OptimizationLevel = getLastArgIntValue(Args, cc1options::OPT_O);
+ Opts.OptimizationLevel = getLastArgIntValue(Args, OPT_O);
// FIXME: What to do about argument parsing errors?
if (Opts.OptimizationLevel > 3) {
Opts.Inlining = (Opts.OptimizationLevel > 1) ? CodeGenOptions::NormalInlining
: CodeGenOptions::OnlyAlwaysInlining;
- Opts.DebugInfo = Args.hasArg(cc1options::OPT_g);
- Opts.DisableLLVMOpts = Args.hasArg(cc1options::OPT_disable_llvm_optzns);
- Opts.DisableRedZone = Args.hasArg(cc1options::OPT_disable_red_zone);
- Opts.MergeAllConstants = !Args.hasArg(cc1options::OPT_fno_merge_all_constants);
- Opts.NoCommon = Args.hasArg(cc1options::OPT_fno_common);
- Opts.NoImplicitFloat = Args.hasArg(cc1options::OPT_no_implicit_float);
- Opts.OptimizeSize = Args.hasArg(cc1options::OPT_Os);
+ Opts.DebugInfo = Args.hasArg(OPT_g);
+ Opts.DisableLLVMOpts = Args.hasArg(OPT_disable_llvm_optzns);
+ Opts.DisableRedZone = Args.hasArg(OPT_disable_red_zone);
+ Opts.MergeAllConstants = !Args.hasArg(OPT_fno_merge_all_constants);
+ Opts.NoCommon = Args.hasArg(OPT_fno_common);
+ Opts.NoImplicitFloat = Args.hasArg(OPT_no_implicit_float);
+ Opts.OptimizeSize = Args.hasArg(OPT_Os);
Opts.SimplifyLibCalls = 1;
Opts.UnrollLoops = (Opts.OptimizationLevel > 1 && !Opts.OptimizeSize);
// FIXME: Put elsewhere?
#ifdef NDEBUG
Opts.VerifyModule = 0;
+#else
+ Opts.VerifyModule = 1;
#endif
}
static void ParseDependencyOutputArgs(DependencyOutputOptions &Opts,
- ArgList &Args) {
- Opts.OutputFile = getLastArgValue(Args, cc1options::OPT_dependency_file);
- Opts.Targets = getAllArgValues(Args, cc1options::OPT_MT);
- Opts.IncludeSystemHeaders = Args.hasArg(cc1options::OPT_sys_header_deps);
- Opts.UsePhonyTargets = Args.hasArg(cc1options::OPT_MP);
+ ArgList &Args) {
+ using namespace cc1options;
+ Opts.OutputFile = getLastArgValue(Args, OPT_dependency_file);
+ Opts.Targets = getAllArgValues(Args, OPT_MT);
+ Opts.IncludeSystemHeaders = Args.hasArg(OPT_sys_header_deps);
+ Opts.UsePhonyTargets = Args.hasArg(OPT_MP);
+}
+
+static void ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args) {
+ using namespace cc1options;
+ Opts.IgnoreWarnings = Args.hasArg(OPT_w);
+ Opts.NoRewriteMacros = Args.hasArg(OPT_Wno_rewrite_macros);
+ Opts.Pedantic = Args.hasArg(OPT_pedantic);
+ Opts.PedanticErrors = Args.hasArg(OPT_pedantic_errors);
+ Opts.ShowCarets = !Args.hasArg(OPT_fno_caret_diagnostics);
+ Opts.ShowColors = Args.hasArg(OPT_fcolor_diagnostics);
+ Opts.ShowColumn = !Args.hasArg(OPT_fno_show_column);
+ Opts.ShowFixits = !Args.hasArg(OPT_fno_diagnostics_fixit_info);
+ Opts.ShowLocation = !Args.hasArg(OPT_fno_show_source_location);
+ Opts.ShowOptionNames = Args.hasArg(OPT_fdiagnostics_show_option);
+ Opts.ShowSourceRanges = Args.hasArg(OPT_fdiagnostics_print_source_range_info);
+ Opts.VerifyDiagnostics = Args.hasArg(OPT_verify);
+ Opts.MessageLength = getLastArgIntValue(Args, OPT_fmessage_length);
+ Opts.DumpBuildInformation = getLastArgValue(Args, OPT_dump_build_information);
+ Opts.Warnings = getAllArgValues(Args, OPT_W);
}
static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args) {
- Opts.ABI = getLastArgValue(Args, cc1options::OPT_target_abi);
- Opts.CPU = getLastArgValue(Args, cc1options::OPT_mcpu);
- Opts.Triple = getLastArgValue(Args, cc1options::OPT_triple);
- Opts.Features = getAllArgValues(Args, cc1options::OPT_target_feature);
+ using namespace cc1options;
+ Opts.ABI = getLastArgValue(Args, OPT_target_abi);
+ Opts.CPU = getLastArgValue(Args, OPT_mcpu);
+ Opts.Triple = getLastArgValue(Args, OPT_triple);
+ Opts.Features = getAllArgValues(Args, OPT_target_feature);
// Use the host triple if unspecified.
if (Opts.Triple.empty())
ParseAnalyzerArgs(Res.getAnalyzerOpts(), *InputArgs);
ParseCodeGenArgs(Res.getCodeGenOpts(), *InputArgs);
ParseDependencyOutputArgs(Res.getDependencyOutputOpts(), *InputArgs);
+ ParseDiagnosticArgs(Res.getDiagnosticOpts(), *InputArgs);
ParseTargetArgs(Res.getTargetOpts(), *InputArgs);
}