forked from OSchip/llvm-project
[Driver] Flip the CC1 default of -fdiagnostics-show-option
The driver enables -fdiagnostics-show-option by default, so flip the CC1 default to reduce the lengths of common CC1 command lines. This change also makes ParseDiagnosticArgs() consistently enable -fdiagnostics-show-option by default.
This commit is contained in:
parent
b5767010a8
commit
d0d076fed9
|
@ -899,7 +899,7 @@ def fdiagnostics_hotness_threshold_EQ : Joined<["-"], "fdiagnostics-hotness-thre
|
|||
Group<f_Group>, Flags<[CC1Option]>, MetaVarName<"<number>">,
|
||||
HelpText<"Prevent optimization remarks from being output if they do not have at least this profile count">;
|
||||
def fdiagnostics_show_option : Flag<["-"], "fdiagnostics-show-option">, Group<f_Group>,
|
||||
Flags<[CC1Option]>, HelpText<"Print option name with mappable diagnostics">;
|
||||
HelpText<"Print option name with mappable diagnostics">;
|
||||
def fdiagnostics_show_note_include_stack : Flag<["-"], "fdiagnostics-show-note-include-stack">,
|
||||
Group<f_Group>, Flags<[CC1Option]>, HelpText<"Display include stacks for diagnostic notes">;
|
||||
def fdiagnostics_format_EQ : Joined<["-"], "fdiagnostics-format=">, Group<f_clang_Group>;
|
||||
|
@ -1515,7 +1515,7 @@ def fno_cxx_modules : Flag <["-"], "fno-cxx-modules">, Group<f_Group>,
|
|||
def fno_diagnostics_fixit_info : Flag<["-"], "fno-diagnostics-fixit-info">, Group<f_Group>,
|
||||
Flags<[CC1Option]>, HelpText<"Do not include fixit information in diagnostics">;
|
||||
def fno_diagnostics_show_hotness : Flag<["-"], "fno-diagnostics-show-hotness">, Group<f_Group>;
|
||||
def fno_diagnostics_show_option : Flag<["-"], "fno-diagnostics-show-option">, Group<f_Group>;
|
||||
def fno_diagnostics_show_option : Flag<["-"], "fno-diagnostics-show-option">, Group<f_Group>, Flags<[CC1Option]>;
|
||||
def fno_diagnostics_show_note_include_stack : Flag<["-"], "fno-diagnostics-show-note-include-stack">,
|
||||
Flags<[CC1Option]>, Group<f_Group>;
|
||||
def fdigraphs : Flag<["-"], "fdigraphs">, Group<f_Group>, Flags<[CC1Option]>,
|
||||
|
|
|
@ -59,8 +59,7 @@ class TargetOptions;
|
|||
/// report the error(s).
|
||||
bool ParseDiagnosticArgs(DiagnosticOptions &Opts, llvm::opt::ArgList &Args,
|
||||
DiagnosticsEngine *Diags = nullptr,
|
||||
bool DefaultDiagColor = true,
|
||||
bool DefaultShowOpt = true);
|
||||
bool DefaultDiagColor = true);
|
||||
|
||||
class CompilerInvocationBase {
|
||||
public:
|
||||
|
|
|
@ -3559,9 +3559,9 @@ static void RenderDiagnosticsOptions(const Driver &D, const ArgList &Args,
|
|||
CmdArgs.push_back("-fno-diagnostics-fixit-info");
|
||||
|
||||
// Enable -fdiagnostics-show-option by default.
|
||||
if (Args.hasFlag(options::OPT_fdiagnostics_show_option,
|
||||
options::OPT_fno_diagnostics_show_option))
|
||||
CmdArgs.push_back("-fdiagnostics-show-option");
|
||||
if (!Args.hasFlag(options::OPT_fdiagnostics_show_option,
|
||||
options::OPT_fno_diagnostics_show_option, true))
|
||||
CmdArgs.push_back("-fno-diagnostics-show-option");
|
||||
|
||||
if (const Arg *A =
|
||||
Args.getLastArg(options::OPT_fdiagnostics_show_category_EQ)) {
|
||||
|
|
|
@ -1547,7 +1547,7 @@ static bool checkVerifyPrefixes(const std::vector<std::string> &VerifyPrefixes,
|
|||
|
||||
bool clang::ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
|
||||
DiagnosticsEngine *Diags,
|
||||
bool DefaultDiagColor, bool DefaultShowOpt) {
|
||||
bool DefaultDiagColor) {
|
||||
bool Success = true;
|
||||
|
||||
Opts.DiagnosticLogFile =
|
||||
|
@ -1565,9 +1565,7 @@ bool clang::ParseDiagnosticArgs(DiagnosticOptions &Opts, ArgList &Args,
|
|||
Opts.ShowFixits = !Args.hasArg(OPT_fno_diagnostics_fixit_info);
|
||||
Opts.ShowLocation = !Args.hasArg(OPT_fno_show_source_location);
|
||||
Opts.AbsolutePath = Args.hasArg(OPT_fdiagnostics_absolute_paths);
|
||||
Opts.ShowOptionNames =
|
||||
Args.hasFlag(OPT_fdiagnostics_show_option,
|
||||
OPT_fno_diagnostics_show_option, DefaultShowOpt);
|
||||
Opts.ShowOptionNames = !Args.hasArg(OPT_fno_diagnostics_show_option);
|
||||
|
||||
llvm::sys::Process::UseANSIEscapeCodes(Args.hasArg(OPT_fansi_escape_codes));
|
||||
|
||||
|
@ -3597,9 +3595,8 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
|
|||
Diags.Report(diag::err_fe_dependency_file_requires_MT);
|
||||
Success = false;
|
||||
}
|
||||
Success &=
|
||||
ParseDiagnosticArgs(Res.getDiagnosticOpts(), Args, &Diags,
|
||||
false /*DefaultDiagColor*/, false /*DefaultShowOpt*/);
|
||||
Success &= ParseDiagnosticArgs(Res.getDiagnosticOpts(), Args, &Diags,
|
||||
/*DefaultDiagColor=*/false);
|
||||
ParseCommentArgs(LangOpts.CommentOpts, Args);
|
||||
ParseFileSystemArgs(Res.getFileSystemOpts(), Args);
|
||||
// FIXME: We shouldn't have to pass the DashX option around here
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fdiagnostics-show-option -verify %s
|
||||
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
|
||||
|
||||
template<typename T>
|
||||
struct set{};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option -verify %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option -verify -std=c++98 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option -verify -std=c++11 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
|
||||
|
||||
// C++98 [basic.lookup.classref]p1:
|
||||
// In a class member access expression (5.2.5), if the . or -> token is
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -std=c++03 -fdiagnostics-show-option -Wbind-to-temporary-copy -verify %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c++03 -Wbind-to-temporary-copy -verify %s
|
||||
|
||||
// C++03 requires that we check for a copy constructor when binding a
|
||||
// reference to a temporary, since we are allowed to make a copy, Even
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
/// -fdiagnostics-show-option is the default
|
||||
// RUN: %clang -### -c %s 2>&1 | FileCheck --check-prefix=ENABLED %s
|
||||
// ENABLED-NOT: "-fno-diagnostics-show-option"
|
||||
|
||||
// RUN: %clang -### -c %s -fdiagnostics-show-option -fno-diagnostics-show-option 2>&1 | \
|
||||
// RUN: FileCheck --check-prefix=DISABLED %s
|
||||
// DISABLED: "-fno-diagnostics-show-option"
|
|
@ -3,11 +3,11 @@
|
|||
// TEST0: clang{{.*}}" "-cc1"
|
||||
// TEST0: "-rewrite-objc"
|
||||
// FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check adjacency instead.
|
||||
// TEST0: "-stack-protector" "1" "-fblocks" "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" "-fgnuc-version=4.2.1" "-fobjc-runtime=macosx-fragile" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fmax-type-align=16" "-fdiagnostics-show-option"
|
||||
// TEST0: "-stack-protector" "1" "-fblocks" "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" "-fgnuc-version=4.2.1" "-fobjc-runtime=macosx-fragile" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fmax-type-align=16"
|
||||
// TEST0: rewrite-legacy-objc.m"
|
||||
// RUN: %clang -no-canonical-prefixes -target i386-apple-macosx10.9.0 -rewrite-legacy-objc %s -o - -### 2>&1 | \
|
||||
// RUN: FileCheck -check-prefix=TEST1 %s
|
||||
// RUN: %clang -no-canonical-prefixes -target i386-apple-macosx10.6.0 -rewrite-legacy-objc %s -o - -### 2>&1 | \
|
||||
// RUN: FileCheck -check-prefix=TEST2 %s
|
||||
// TEST1: "-stack-protector" "1" "-fblocks" "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" "-fgnuc-version=4.2.1" "-fobjc-runtime=macosx-fragile" "-fobjc-subscripting-legacy-runtime" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fmax-type-align=16" "-fdiagnostics-show-option"
|
||||
// TEST2: "-stack-protector" "1" "-fblocks" "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" "-fgnuc-version=4.2.1" "-fobjc-runtime=macosx-fragile" "-fobjc-subscripting-legacy-runtime" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fmax-type-align=16" "-fdiagnostics-show-option"
|
||||
// TEST1: "-stack-protector" "1" "-fblocks" "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" "-fgnuc-version=4.2.1" "-fobjc-runtime=macosx-fragile" "-fobjc-subscripting-legacy-runtime" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fmax-type-align=16"
|
||||
// TEST2: "-stack-protector" "1" "-fblocks" "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" "-fgnuc-version=4.2.1" "-fobjc-runtime=macosx-fragile" "-fobjc-subscripting-legacy-runtime" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fmax-type-align=16"
|
||||
|
|
|
@ -3,4 +3,4 @@
|
|||
// TEST0: clang{{.*}}" "-cc1"
|
||||
// TEST0: "-rewrite-objc"
|
||||
// FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check adjacency instead.
|
||||
// TEST0: "-stack-protector" "1" "-fblocks" "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" "-fgnuc-version=4.2.1" "-fobjc-runtime=macosx" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fmax-type-align=16" "-fdiagnostics-show-option"
|
||||
// TEST0: "-stack-protector" "1" "-fblocks" "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" "-fgnuc-version=4.2.1" "-fobjc-runtime=macosx" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fmax-type-align=16"
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
// REQUIRES: x86-registered-target
|
||||
|
||||
// RUN: %clang -target x86_64-apple-darwin -fsyntax-only -isysroot /FOO %s 2>&1 | FileCheck --check-prefix=CHECK-SHOW-OPTION-NAMES %s
|
||||
// CHECK-SHOW-OPTION-NAMES: warning: no such sysroot directory: '{{([A-Za-z]:.*)?}}/FOO' [-Wmissing-sysroot]
|
||||
|
||||
// RUN: %clang -target x86_64-apple-darwin -fsyntax-only -fno-diagnostics-show-option -isysroot /FOO %s 2>&1 | FileCheck --check-prefix=CHECK-NO-SHOW-OPTION-NAMES %s
|
||||
// CHECK-NO-SHOW-OPTION-NAMES: warning: no such sysroot directory: '{{([A-Za-z]:.*)?}}/FOO'{{$}}
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: not %clang_cc1 -fdiagnostics-show-option -Werror -Weverything %s 2> %t
|
||||
// RUN: not %clang_cc1 -Werror -Weverything %s 2> %t
|
||||
// RUN: FileCheck < %t %s
|
||||
|
||||
int f0(int, unsigned);
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only %s 2>&1 \
|
||||
// RUN: %clang_cc1 -fsyntax-only -fno-diagnostics-show-option %s 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=BASE
|
||||
// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option %s 2>&1 \
|
||||
// RUN: %clang_cc1 -fsyntax-only %s 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=OPTION
|
||||
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-show-option -Werror %s 2>&1 \
|
||||
// RUN: not %clang_cc1 -fsyntax-only -Werror %s 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=OPTION_ERROR
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c89 -pedantic -fdiagnostics-show-option %s 2>&1 \
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c89 -pedantic %s 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=OPTION_PEDANTIC
|
||||
// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-category id %s 2>&1 \
|
||||
// RUN: %clang_cc1 -fsyntax-only -fno-diagnostics-show-option -fdiagnostics-show-category id %s 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=CATEGORY_ID
|
||||
// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-category name %s 2>&1 \
|
||||
// RUN: %clang_cc1 -fsyntax-only -fno-diagnostics-show-option -fdiagnostics-show-category name %s 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=CATEGORY_NAME
|
||||
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-show-option -fdiagnostics-show-category name -Werror %s 2>&1 \
|
||||
// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-show-category name -Werror %s 2>&1 \
|
||||
// RUN: | FileCheck %s -check-prefix=OPTION_ERROR_CATEGORY
|
||||
|
||||
void test(int x, int y) {
|
||||
|
|
|
@ -117,5 +117,5 @@ void conditional_op(int x, int y, _Bool b, void* p) {
|
|||
(void)(x && b ? 1 : 2); // no warning, logical operator
|
||||
}
|
||||
|
||||
// RUN: not %clang_cc1 -fsyntax-only -Wparentheses -Werror -fdiagnostics-show-option %s 2>&1 | FileCheck %s -check-prefix=CHECK-FLAG
|
||||
// RUN: not %clang_cc1 -fsyntax-only -Wparentheses -Werror %s 2>&1 | FileCheck %s -check-prefix=CHECK-FLAG
|
||||
// CHECK-FLAG: error: using the result of an assignment as a condition without parentheses [-Werror,-Wparentheses]
|
||||
|
|
Loading…
Reference in New Issue