Skip to content

Commit 9f349ee

Browse files
authored
Merge pull request #437 from Xilinx/bump_to_be6aed90
[AutoBump] Merge with be6aed9 (Sep 26) (1)
2 parents 2f5bd8b + f78fcd7 commit 9f349ee

File tree

50 files changed

+2233
-1631
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2233
-1631
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,10 +1975,15 @@ def fno_color_diagnostics : Flag<["-"], "fno-color-diagnostics">, Group<f_Group>
19751975
Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>,
19761976
HelpText<"Disable colors in diagnostics">;
19771977
def : Flag<["-"], "fdiagnostics-color">, Group<f_Group>,
1978-
Visibility<[ClangOption, CLOption, DXCOption]>, Alias<fcolor_diagnostics>;
1978+
Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>,
1979+
Alias<fcolor_diagnostics>;
19791980
def : Flag<["-"], "fno-diagnostics-color">, Group<f_Group>,
1980-
Visibility<[ClangOption, CLOption, DXCOption]>, Alias<fno_color_diagnostics>;
1981-
def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">, Group<f_Group>;
1981+
Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>,
1982+
Alias<fno_color_diagnostics>;
1983+
def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">, Group<f_Group>,
1984+
Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>,
1985+
Values<"auto,always,never">,
1986+
HelpText<"When to use colors in diagnostics">;
19821987
def fansi_escape_codes : Flag<["-"], "fansi-escape-codes">, Group<f_Group>,
19831988
Visibility<[ClangOption, CLOption, DXCOption, CC1Option]>,
19841989
HelpText<"Use ANSI escape codes for diagnostics">,

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4424,21 +4424,7 @@ static void RenderDiagnosticsOptions(const Driver &D, const ArgList &Args,
44244424
CmdArgs.push_back("-fno-diagnostics-show-note-include-stack");
44254425
}
44264426

4427-
// Color diagnostics are parsed by the driver directly from argv and later
4428-
// re-parsed to construct this job; claim any possible color diagnostic here
4429-
// to avoid warn_drv_unused_argument and diagnose bad
4430-
// OPT_fdiagnostics_color_EQ values.
4431-
Args.getLastArg(options::OPT_fcolor_diagnostics,
4432-
options::OPT_fno_color_diagnostics);
4433-
if (const Arg *A = Args.getLastArg(options::OPT_fdiagnostics_color_EQ)) {
4434-
StringRef Value(A->getValue());
4435-
if (Value != "always" && Value != "never" && Value != "auto")
4436-
D.Diag(diag::err_drv_invalid_argument_to_option)
4437-
<< Value << A->getOption().getName();
4438-
}
4439-
4440-
if (D.getDiags().getDiagnosticOptions().ShowColors)
4441-
CmdArgs.push_back("-fcolor-diagnostics");
4427+
handleColorDiagnosticsArgs(D, Args, CmdArgs);
44424428

44434429
if (Args.hasArg(options::OPT_fansi_escape_codes))
44444430
CmdArgs.push_back("-fansi-escape-codes");

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2960,3 +2960,22 @@ void tools::addMCModel(const Driver &D, const llvm::opt::ArgList &Args,
29602960
}
29612961
}
29622962
}
2963+
2964+
void tools::handleColorDiagnosticsArgs(const Driver &D, const ArgList &Args,
2965+
ArgStringList &CmdArgs) {
2966+
// Color diagnostics are parsed by the driver directly from argv and later
2967+
// re-parsed to construct this job; claim any possible color diagnostic here
2968+
// to avoid warn_drv_unused_argument and diagnose bad
2969+
// OPT_fdiagnostics_color_EQ values.
2970+
Args.getLastArg(options::OPT_fcolor_diagnostics,
2971+
options::OPT_fno_color_diagnostics);
2972+
if (const Arg *A = Args.getLastArg(options::OPT_fdiagnostics_color_EQ)) {
2973+
StringRef Value(A->getValue());
2974+
if (Value != "always" && Value != "never" && Value != "auto")
2975+
D.Diag(diag::err_drv_invalid_argument_to_option)
2976+
<< Value << A->getOption().getName();
2977+
}
2978+
2979+
if (D.getDiags().getDiagnosticOptions().ShowColors)
2980+
CmdArgs.push_back("-fcolor-diagnostics");
2981+
}

clang/lib/Driver/ToolChains/CommonArgs.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ void addMCModel(const Driver &D, const llvm::opt::ArgList &Args,
233233
const llvm::Reloc::Model &RelocationModel,
234234
llvm::opt::ArgStringList &CmdArgs);
235235

236+
/// Handle the -f{no}-color-diagnostics and -f{no}-diagnostics-colors options.
237+
void handleColorDiagnosticsArgs(const Driver &D, const llvm::opt::ArgList &Args,
238+
llvm::opt::ArgStringList &CmdArgs);
239+
236240
} // end namespace tools
237241
} // end namespace driver
238242
} // end namespace clang

clang/lib/Driver/ToolChains/Flang.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -727,13 +727,7 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,
727727

728728
addFortranDialectOptions(Args, CmdArgs);
729729

730-
// Color diagnostics are parsed by the driver directly from argv and later
731-
// re-parsed to construct this job; claim any possible color diagnostic here
732-
// to avoid warn_drv_unused_argument.
733-
Args.getLastArg(options::OPT_fcolor_diagnostics,
734-
options::OPT_fno_color_diagnostics);
735-
if (Diags.getDiagnosticOptions().ShowColors)
736-
CmdArgs.push_back("-fcolor-diagnostics");
730+
handleColorDiagnosticsArgs(D, Args, CmdArgs);
737731

738732
// LTO mode is parsed by the Clang driver library.
739733
LTOKind LTOMode = D.getLTOMode();

clang/test/Driver/cl-options.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,9 @@
406406
// RUN: /Zm \
407407
// RUN: /Zo \
408408
// RUN: /Zo- \
409-
// RUN: -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s
409+
// RUN: -### -- %s 2>&1 | FileCheck -DMSG=%errc_ENOENT -check-prefix=IGNORED %s
410410
// IGNORED-NOT: argument unused during compilation
411-
// IGNORED-NOT: no such file or directory
411+
// IGNORED-NOT: [[MSG]]
412412
// Don't confuse /openmp- with the /o flag:
413413
// IGNORED-NOT: "-o" "penmp-.obj"
414414

clang/test/Driver/cl-zc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@
133133
// RUN: /Zc:inline \
134134
// RUN: /Zc:rvalueCast \
135135
// RUN: /Zc:ternary \
136-
// RUN: -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s
136+
// RUN: -### -- %s 2>&1 | FileCheck -DMSG=%errc_ENOENT -check-prefix=IGNORED %s
137137
// IGNORED-NOT: argument unused during compilation
138-
// IGNORED-NOT: no such file or directory
138+
// IGNORED-NOT: [[MSG]]
139139

140140
// Negated form warns:
141141
// RUN: %clang_cl /c \

clang/test/Driver/config-file-errs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
//--- Argument of '--config' must be existing file, if it is specified by path.
88
//
9-
// RUN: not %clang --config somewhere/nonexistent-config-file 2>&1 | FileCheck %s -check-prefix CHECK-NONEXISTENT
10-
// CHECK-NONEXISTENT: configuration file '{{.*}}somewhere{{.}}nonexistent-config-file' cannot be opened: {{[Nn]}}o such file or directory
9+
// RUN: not %clang --config somewhere/nonexistent-config-file 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix CHECK-NONEXISTENT
10+
// CHECK-NONEXISTENT: configuration file '{{.*}}somewhere{{.}}nonexistent-config-file' cannot be opened: [[MSG]]
1111

1212

1313
//--- All '--config' arguments must be existing files.
1414
//
15-
// RUN: not %clang --config %S/Inputs/config-4.cfg --config somewhere/nonexistent-config-file 2>&1 | FileCheck %s -check-prefix CHECK-NONEXISTENT
15+
// RUN: not %clang --config %S/Inputs/config-4.cfg --config somewhere/nonexistent-config-file 2>&1 | FileCheck -DMSG=%errc_ENOENT %s -check-prefix CHECK-NONEXISTENT
1616

1717

1818
//--- Argument of '--config' must exist somewhere in well-known directories, if it is specified by bare name.

clang/test/Driver/response-file-errs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111

1212
// If file in `@file` is a directory, it is an error.
1313
//
14-
// RUN: not %clang @%S/Inputs -### 2>&1 | FileCheck --check-prefix=DIRECTORY %s
15-
// DIRECTORY: cannot not open file '{{.*}}Inputs': {{[Ii]}}s a directory
14+
// RUN: not %clang @%S/Inputs -### 2>&1 | FileCheck -DMSG=%errc_EISDIR --check-prefix=DIRECTORY %s
15+
// DIRECTORY: cannot not open file '{{.*}}Inputs': [[MSG]]
Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,53 @@
1-
! Test that flang-new forwards -f{no-}color-diagnostics options to
2-
! flang-new -fc1 as expected.
1+
! Test that flang-new forwards -f{no-}color-diagnostics and
2+
! -f{no-}diagnostics-color options to flang-new -fc1 as expected.
33

44
! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 -fcolor-diagnostics \
55
! RUN: | FileCheck %s --check-prefix=CHECK-CD
6+
! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 -fdiagnostics-color \
7+
! RUN: | FileCheck %s --check-prefix=CHECK-CD
8+
! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 -fdiagnostics-color=always \
9+
! RUN: | FileCheck %s --check-prefix=CHECK-CD
610
! CHECK-CD: "-fc1"{{.*}} "-fcolor-diagnostics"
711

812
! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 -fno-color-diagnostics \
913
! RUN: | FileCheck %s --check-prefix=CHECK-NCD
14+
! RUN: %flang -fsyntax-only -### %s -o %t -fno-diagnostics-color 2>&1 \
15+
! RUN: | FileCheck %s --check-prefix=CHECK-NCD
16+
! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 -fdiagnostics-color=never \
17+
! RUN: | FileCheck %s --check-prefix=CHECK-NCD
1018
! CHECK-NCD-NOT: "-fc1"{{.*}} "-fcolor-diagnostics"
1119

1220
! Check that the last flag wins.
1321
! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 \
1422
! RUN: -fno-color-diagnostics -fcolor-diagnostics \
1523
! RUN: | FileCheck %s --check-prefix=CHECK-NCD_CD_S
24+
! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 \
25+
! RUN: -fno-diagnostics-color -fdiagnostics-color \
26+
! RUN: | FileCheck %s --check-prefix=CHECK-NCD_CD_S
27+
! RUN: %flang -fsyntax-only -### %s -o %t \
28+
! RUN: -fno-color-diagnostics -fdiagnostics-color=always 2>&1 \
29+
! RUN: | FileCheck %s --check-prefix=CHECK-NCD_CD_S
30+
! RUN: %flang -fsyntax-only -### %s -o %t \
31+
! RUN: -fdiagnostics-color=never -fdiagnostics-color=always 2>&1 \
32+
! RUN: | FileCheck %s --check-prefix=CHECK-NCD_CD_S
33+
! RUN: %flang -fsyntax-only -### %s -o %t \
34+
! RUN: -fdiagnostics-color=never -fcolor-diagnostics 2>&1 \
35+
! RUN: | FileCheck %s --check-prefix=CHECK-NCD_CD_S
1636
! CHECK-NCD_CD_S: "-fc1"{{.*}} "-fcolor-diagnostics"
1737

1838
! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 \
1939
! RUN: -fcolor-diagnostics -fno-color-diagnostics \
2040
! RUN: | FileCheck %s --check-prefix=CHECK-CD_NCD_S
41+
! RUN: %flang -fsyntax-only -### %s -o %t \
42+
! RUN: -fdiagnostics-color -fno-diagnostics-color 2>&1 \
43+
! RUN: | FileCheck %s --check-prefix=CHECK-CD_NCD_S
44+
! RUN: %flang -fsyntax-only -### %s -o %t \
45+
! RUN: -fdiagnostics-color=always -fno-color-diagnostics 2>&1 \
46+
! RUN: | FileCheck %s --check-prefix=CHECK-CD_NCD_S
47+
! RUN: %flang -fsyntax-only -### %s -o %t \
48+
! RUN: -fdiagnostics-color=always -fdiagnostics-color=never 2>&1 \
49+
! RUN: | FileCheck %s --check-prefix=CHECK-CD_NCD_S
50+
! RUN: %flang -fsyntax-only -### %s -o %t \
51+
! RUN: -fcolor-diagnostics -fdiagnostics-color=never 2>&1 \
52+
! RUN: | FileCheck %s --check-prefix=CHECK-CD_NCD_S
2153
! CHECK-CD_NCD_S-NOT: "-fc1"{{.*}} "-fcolor-diagnostics"

0 commit comments

Comments
 (0)