Skip to content

Commit

Permalink
[AutoBump] Merge with be6aed9 (Sep 26)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgehre-amd committed Jan 9, 2025
2 parents c6d34c5 + be6aed9 commit f78fcd7
Show file tree
Hide file tree
Showing 50 changed files with 2,233 additions and 1,631 deletions.
11 changes: 8 additions & 3 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1975,10 +1975,15 @@ def fno_color_diagnostics : Flag<["-"], "fno-color-diagnostics">, Group<f_Group>
Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>,
HelpText<"Disable colors in diagnostics">;
def : Flag<["-"], "fdiagnostics-color">, Group<f_Group>,
Visibility<[ClangOption, CLOption, DXCOption]>, Alias<fcolor_diagnostics>;
Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>,
Alias<fcolor_diagnostics>;
def : Flag<["-"], "fno-diagnostics-color">, Group<f_Group>,
Visibility<[ClangOption, CLOption, DXCOption]>, Alias<fno_color_diagnostics>;
def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">, Group<f_Group>;
Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>,
Alias<fno_color_diagnostics>;
def fdiagnostics_color_EQ : Joined<["-"], "fdiagnostics-color=">, Group<f_Group>,
Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>,
Values<"auto,always,never">,
HelpText<"When to use colors in diagnostics">;
def fansi_escape_codes : Flag<["-"], "fansi-escape-codes">, Group<f_Group>,
Visibility<[ClangOption, CLOption, DXCOption, CC1Option]>,
HelpText<"Use ANSI escape codes for diagnostics">,
Expand Down
16 changes: 1 addition & 15 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4424,21 +4424,7 @@ static void RenderDiagnosticsOptions(const Driver &D, const ArgList &Args,
CmdArgs.push_back("-fno-diagnostics-show-note-include-stack");
}

// Color diagnostics are parsed by the driver directly from argv and later
// re-parsed to construct this job; claim any possible color diagnostic here
// to avoid warn_drv_unused_argument and diagnose bad
// OPT_fdiagnostics_color_EQ values.
Args.getLastArg(options::OPT_fcolor_diagnostics,
options::OPT_fno_color_diagnostics);
if (const Arg *A = Args.getLastArg(options::OPT_fdiagnostics_color_EQ)) {
StringRef Value(A->getValue());
if (Value != "always" && Value != "never" && Value != "auto")
D.Diag(diag::err_drv_invalid_argument_to_option)
<< Value << A->getOption().getName();
}

if (D.getDiags().getDiagnosticOptions().ShowColors)
CmdArgs.push_back("-fcolor-diagnostics");
handleColorDiagnosticsArgs(D, Args, CmdArgs);

if (Args.hasArg(options::OPT_fansi_escape_codes))
CmdArgs.push_back("-fansi-escape-codes");
Expand Down
19 changes: 19 additions & 0 deletions clang/lib/Driver/ToolChains/CommonArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2960,3 +2960,22 @@ void tools::addMCModel(const Driver &D, const llvm::opt::ArgList &Args,
}
}
}

void tools::handleColorDiagnosticsArgs(const Driver &D, const ArgList &Args,
ArgStringList &CmdArgs) {
// Color diagnostics are parsed by the driver directly from argv and later
// re-parsed to construct this job; claim any possible color diagnostic here
// to avoid warn_drv_unused_argument and diagnose bad
// OPT_fdiagnostics_color_EQ values.
Args.getLastArg(options::OPT_fcolor_diagnostics,
options::OPT_fno_color_diagnostics);
if (const Arg *A = Args.getLastArg(options::OPT_fdiagnostics_color_EQ)) {
StringRef Value(A->getValue());
if (Value != "always" && Value != "never" && Value != "auto")
D.Diag(diag::err_drv_invalid_argument_to_option)
<< Value << A->getOption().getName();
}

if (D.getDiags().getDiagnosticOptions().ShowColors)
CmdArgs.push_back("-fcolor-diagnostics");
}
4 changes: 4 additions & 0 deletions clang/lib/Driver/ToolChains/CommonArgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ void addMCModel(const Driver &D, const llvm::opt::ArgList &Args,
const llvm::Reloc::Model &RelocationModel,
llvm::opt::ArgStringList &CmdArgs);

/// Handle the -f{no}-color-diagnostics and -f{no}-diagnostics-colors options.
void handleColorDiagnosticsArgs(const Driver &D, const llvm::opt::ArgList &Args,
llvm::opt::ArgStringList &CmdArgs);

} // end namespace tools
} // end namespace driver
} // end namespace clang
Expand Down
8 changes: 1 addition & 7 deletions clang/lib/Driver/ToolChains/Flang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,13 +727,7 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,

addFortranDialectOptions(Args, CmdArgs);

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

// LTO mode is parsed by the Clang driver library.
LTOKind LTOMode = D.getLTOMode();
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Driver/cl-options.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,9 @@
// RUN: /Zm \
// RUN: /Zo \
// RUN: /Zo- \
// RUN: -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s
// RUN: -### -- %s 2>&1 | FileCheck -DMSG=%errc_ENOENT -check-prefix=IGNORED %s
// IGNORED-NOT: argument unused during compilation
// IGNORED-NOT: no such file or directory
// IGNORED-NOT: [[MSG]]
// Don't confuse /openmp- with the /o flag:
// IGNORED-NOT: "-o" "penmp-.obj"

Expand Down
4 changes: 2 additions & 2 deletions clang/test/Driver/cl-zc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@
// RUN: /Zc:inline \
// RUN: /Zc:rvalueCast \
// RUN: /Zc:ternary \
// RUN: -### -- %s 2>&1 | FileCheck -check-prefix=IGNORED %s
// RUN: -### -- %s 2>&1 | FileCheck -DMSG=%errc_ENOENT -check-prefix=IGNORED %s
// IGNORED-NOT: argument unused during compilation
// IGNORED-NOT: no such file or directory
// IGNORED-NOT: [[MSG]]

// Negated form warns:
// RUN: %clang_cl /c \
Expand Down
6 changes: 3 additions & 3 deletions clang/test/Driver/config-file-errs.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

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


//--- All '--config' arguments must be existing files.
//
// RUN: not %clang --config %S/Inputs/config-4.cfg --config somewhere/nonexistent-config-file 2>&1 | FileCheck %s -check-prefix CHECK-NONEXISTENT
// 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


//--- Argument of '--config' must exist somewhere in well-known directories, if it is specified by bare name.
Expand Down
4 changes: 2 additions & 2 deletions clang/test/Driver/response-file-errs.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@

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

! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 -fcolor-diagnostics \
! RUN: | FileCheck %s --check-prefix=CHECK-CD
! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 -fdiagnostics-color \
! RUN: | FileCheck %s --check-prefix=CHECK-CD
! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 -fdiagnostics-color=always \
! RUN: | FileCheck %s --check-prefix=CHECK-CD
! CHECK-CD: "-fc1"{{.*}} "-fcolor-diagnostics"

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

! Check that the last flag wins.
! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 \
! RUN: -fno-color-diagnostics -fcolor-diagnostics \
! RUN: | FileCheck %s --check-prefix=CHECK-NCD_CD_S
! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 \
! RUN: -fno-diagnostics-color -fdiagnostics-color \
! RUN: | FileCheck %s --check-prefix=CHECK-NCD_CD_S
! RUN: %flang -fsyntax-only -### %s -o %t \
! RUN: -fno-color-diagnostics -fdiagnostics-color=always 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK-NCD_CD_S
! RUN: %flang -fsyntax-only -### %s -o %t \
! RUN: -fdiagnostics-color=never -fdiagnostics-color=always 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK-NCD_CD_S
! RUN: %flang -fsyntax-only -### %s -o %t \
! RUN: -fdiagnostics-color=never -fcolor-diagnostics 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK-NCD_CD_S
! CHECK-NCD_CD_S: "-fc1"{{.*}} "-fcolor-diagnostics"

! RUN: %flang -fsyntax-only -### %s -o %t 2>&1 \
! RUN: -fcolor-diagnostics -fno-color-diagnostics \
! RUN: | FileCheck %s --check-prefix=CHECK-CD_NCD_S
! RUN: %flang -fsyntax-only -### %s -o %t \
! RUN: -fdiagnostics-color -fno-diagnostics-color 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK-CD_NCD_S
! RUN: %flang -fsyntax-only -### %s -o %t \
! RUN: -fdiagnostics-color=always -fno-color-diagnostics 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK-CD_NCD_S
! RUN: %flang -fsyntax-only -### %s -o %t \
! RUN: -fdiagnostics-color=always -fdiagnostics-color=never 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK-CD_NCD_S
! RUN: %flang -fsyntax-only -### %s -o %t \
! RUN: -fcolor-diagnostics -fdiagnostics-color=never 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK-CD_NCD_S
! CHECK-CD_NCD_S-NOT: "-fc1"{{.*}} "-fcolor-diagnostics"
14 changes: 12 additions & 2 deletions flang/test/Driver/color-diagnostics-parse.f90
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
! Test the behaviors of -f{no-}color-diagnostics when emitting parsing
! diagnostics.
! Test the behaviors of -f{no-}color-diagnostics and -f{no-}diagnostics-color
! when emitting parsing diagnostics.
! Windows command prompt doesn't support ANSI escape sequences.
! REQUIRES: shell

! RUN: not %flang %s -fcolor-diagnostics 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_CD
! RUN: not %flang %s -fdiagnostics-color 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_CD
! RUN: not %flang %s -fdiagnostics-color=always 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_CD

! RUN: not %flang %s -fno-color-diagnostics 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_NCD
! RUN: not %flang %s -fno-diagnostics-color 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_NCD
! RUN: not %flang %s -fdiagnostics-color=never 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_NCD

! RUN: not %flang_fc1 %s -fcolor-diagnostics 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_CD
! RUN: not %flang_fc1 %s 2>&1 | FileCheck %s --check-prefix=CHECK_NCD
Expand Down
15 changes: 13 additions & 2 deletions flang/test/Driver/color-diagnostics-scan.f
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test the behaviors of -f{no-}color-diagnostics when emitting scanning
! diagnostics.
! Test the behaviors of -f{no-}color-diagnostics and -f{no}-diagnostic-colors
! when emitting scanning diagnostics.
! Windows command prompt doesn't support ANSI escape sequences.
! REQUIRES: shell

Expand All @@ -9,6 +9,17 @@
! RUN: | FileCheck %s --check-prefix=CHECK_NCD
! RUN: not %flang_fc1 -E -Werror %s -fcolor-diagnostics 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_CD

! RUN: not %flang %s -E -Werror -fdiagnostics-color 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_CD
! RUN: not %flang %s -E -Werror -fno-diagnostics-color 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_NCD

! RUN: not %flang %s -E -Werror -fdiagnostics-color=always 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_CD
! RUN: not %flang %s -E -Werror -fdiagnostics-color=never 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_NCD

! RUN: not %flang_fc1 -E -Werror %s 2>&1 | FileCheck %s --check-prefix=CHECK_NCD

! CHECK_CD: {{.*}}[0;1;35mwarning: {{.*}}[0mCharacter in fixed-form label field must be a digit
Expand Down
15 changes: 13 additions & 2 deletions flang/test/Driver/color-diagnostics-sema.f90
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
! Test the behaviors of -f{no-}color-diagnostics when emitting semantic
! diagnostics.
! Test the behaviors of -f{no-}color-diagnostics and -f{no}diagnostics-color
! when emitting semantic diagnostics.
! Windows command prompt doesn't support ANSI escape sequences.
! REQUIRES: shell

Expand All @@ -9,6 +9,17 @@
! RUN: | FileCheck %s --check-prefix=CHECK_NCD
! RUN: not %flang_fc1 %s -fcolor-diagnostics 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_CD

! RUN: not %flang %s -fdiagnostics-color 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_CD
! RUN: not %flang %s -fno-diagnostics-color 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_NCD

! RUN: not %flang %s -fdiagnostics-color=always 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_CD
! RUN: not %flang %s -fdiagnostics-color=never 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_NCD

! RUN: not %flang_fc1 %s 2>&1 | FileCheck %s --check-prefix=CHECK_NCD

! CHECK_CD: {{.*}}[0;1;31merror: {{.*}}[0mMust be a constant value
Expand Down
28 changes: 25 additions & 3 deletions flang/test/Driver/color-diagnostics.f90
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! Test the behaviors of -f{no-}color-diagnostics.
! Test the behaviors of -f{no-}color-diagnostics and -f{no}-diagnostics-color.
! Windows command prompt doesn't support ANSI escape sequences.
! REQUIRES: shell

Expand All @@ -9,14 +9,36 @@
! RUN: not %flang_fc1 %s -fcolor-diagnostics 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_CD
! RUN: not %flang_fc1 %s -fno-color-diagnostics 2>&1 \
! RUN: | FileCheck %s --check-prefix=UNSUPPORTED_OPTION
! RUN: | FileCheck %s --check-prefix=UNSUPPORTED_COLOR_DIAGS

! RUN: not %flang %s -fdiagnostics-color 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_CD
! RUN: not %flang %s -fno-diagnostics-color 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_NCD
! RUN: not %flang_fc1 %s -fdiagnostics-color 2>&1 \
! RUN: | FileCheck %s --check-prefix=UNSUPPORTED_DIAGS_COLOR
! RUN: not %flang_fc1 %s -fno-diagnostics-color 2>&1 \
! RUN: | FileCheck %s --check-prefix=UNSUPPORTED_NO_DIAGS_COLOR

! RUN: not %flang %s -fdiagnostics-color=always 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_CD
! RUN: not %flang %s -fdiagnostics-color=never 2>&1 \
! RUN: | FileCheck %s --check-prefix=CHECK_NCD

! RUN: not %flang_fc1 %s 2>&1 | FileCheck %s --check-prefix=CHECK_NCD

! CHECK_CD: {{.*}}[0;1;31merror: {{.*}}[0m{{.*}}[1mSemantic errors in {{.*}}color-diagnostics.f90{{.*}}[0m

! CHECK_NCD: Semantic errors in {{.*}}color-diagnostics.f90

! UNSUPPORTED_OPTION: error: unknown argument: '-fno-color-diagnostics'
! UNSUPPORTED_COLOR_DIAGS: error: unknown argument: '-fno-color-diagnostics'
! UNSUPPORTED_DIAGS_COLOR: error: unknown argument: '-fdiagnostics-color'
! UNSUPPORTED_NO_DIAGS_COLOR: error: unknown argument: '-fno-diagnostics-color'

! Check that invalid values of -fdiagnostics-color= are disallowed.
! RUN: not %flang %s -fdiagnostics-color=sometimes 2>&1 \
! RUN: | FileCheck %s --check-prefix=DCEQ_BAD
! DCEQ_BAD: error: invalid argument 'sometimes' to -fdiagnostics-color=

program m
integer :: i = k
Expand Down
8 changes: 5 additions & 3 deletions llvm/include/llvm/MC/MCRegisterInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ class MCRegisterInfo {
friend class MCRegUnitRootIterator;
friend class MCRegAliasIterator;

virtual ~MCRegisterInfo() {}

/// Initialize MCRegisterInfo, called by TableGen
/// auto-generated routines. *DO NOT USE*.
void InitMCRegisterInfo(const MCRegisterDesc *D, unsigned NR, unsigned RA,
Expand Down Expand Up @@ -418,15 +420,15 @@ class MCRegisterInfo {
/// number. Returns -1 if there is no equivalent value. The second
/// parameter allows targets to use different numberings for EH info and
/// debugging info.
int getDwarfRegNum(MCRegister RegNum, bool isEH) const;
virtual int64_t getDwarfRegNum(MCRegister RegNum, bool isEH) const;

/// Map a dwarf register back to a target register. Returns std::nullopt if
/// there is no mapping.
std::optional<MCRegister> getLLVMRegNum(unsigned RegNum, bool isEH) const;
std::optional<MCRegister> getLLVMRegNum(uint64_t RegNum, bool isEH) const;

/// Map a target EH register number to an equivalent DWARF register
/// number.
int getDwarfRegNumFromDwarfEHRegNum(unsigned RegNum) const;
int64_t getDwarfRegNumFromDwarfEHRegNum(uint64_t RegNum) const;

/// Map a target register to an equivalent SEH register
/// number. Returns LLVM register number if there is no equivalent value.
Expand Down
Loading

0 comments on commit f78fcd7

Please sign in to comment.