aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Driver
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Driver')
-rw-r--r--clang/lib/Driver/Job.cpp31
-rw-r--r--clang/lib/Driver/ToolChains/Arch/Mips.cpp2
-rw-r--r--clang/lib/Driver/ToolChains/Clang.cpp5
-rw-r--r--clang/lib/Driver/XRayArgs.cpp5
4 files changed, 24 insertions, 19 deletions
diff --git a/clang/lib/Driver/Job.cpp b/clang/lib/Driver/Job.cpp
index 880e9e3..715429b 100644
--- a/clang/lib/Driver/Job.cpp
+++ b/clang/lib/Driver/Job.cpp
@@ -57,24 +57,25 @@ static bool skipArgs(const char *Flag, bool HaveCrashVFS, int &SkipNum,
SkipNum = 2;
// These flags are all of the form -Flag <Arg> and are treated as two
// arguments. Therefore, we need to skip the flag and the next argument.
- bool ShouldSkip = llvm::StringSwitch<bool>(Flag)
- .Cases("-MF", "-MT", "-MQ", "-serialize-diagnostic-file", true)
- .Cases("-o", "-dependency-file", true)
- .Cases("-fdebug-compilation-dir", "-diagnostic-log-file", true)
- .Cases("-dwarf-debug-flags", "-ivfsoverlay", true)
- .Default(false);
+ bool ShouldSkip =
+ llvm::StringSwitch<bool>(Flag)
+ .Cases({"-MF", "-MT", "-MQ", "-serialize-diagnostic-file"}, true)
+ .Cases({"-o", "-dependency-file"}, true)
+ .Cases({"-fdebug-compilation-dir", "-diagnostic-log-file"}, true)
+ .Cases({"-dwarf-debug-flags", "-ivfsoverlay"}, true)
+ .Default(false);
if (ShouldSkip)
return true;
// Some include flags shouldn't be skipped if we have a crash VFS
IsInclude =
llvm::StringSwitch<bool>(Flag)
- .Cases("-include", "-header-include-file", true)
- .Cases("-idirafter", "-internal-isystem", "-iwithprefix", true)
- .Cases("-internal-externc-isystem", "-iprefix", true)
- .Cases("-iwithprefixbefore", "-isystem", "-iquote", true)
- .Cases("-isysroot", "-I", "-F", "-resource-dir", true)
- .Cases("-internal-iframework", "-iframework", "-include-pch", true)
+ .Cases({"-include", "-header-include-file"}, true)
+ .Cases({"-idirafter", "-internal-isystem", "-iwithprefix"}, true)
+ .Cases({"-internal-externc-isystem", "-iprefix"}, true)
+ .Cases({"-iwithprefixbefore", "-isystem", "-iquote"}, true)
+ .Cases({"-isysroot", "-I", "-F", "-resource-dir"}, true)
+ .Cases({"-internal-iframework", "-iframework", "-include-pch"}, true)
.Default(false);
if (IsInclude)
return !HaveCrashVFS;
@@ -83,9 +84,9 @@ static bool skipArgs(const char *Flag, bool HaveCrashVFS, int &SkipNum,
// These flags are all of the form -Flag and have no second argument.
ShouldSkip = llvm::StringSwitch<bool>(Flag)
- .Cases("-M", "-MM", "-MG", "-MP", "-MD", true)
- .Case("-MMD", true)
- .Default(false);
+ .Cases({"-M", "-MM", "-MG", "-MP", "-MD"}, true)
+ .Case("-MMD", true)
+ .Default(false);
// Match found.
SkipNum = 1;
diff --git a/clang/lib/Driver/ToolChains/Arch/Mips.cpp b/clang/lib/Driver/ToolChains/Arch/Mips.cpp
index 8787c82..bac8681 100644
--- a/clang/lib/Driver/ToolChains/Arch/Mips.cpp
+++ b/clang/lib/Driver/ToolChains/Arch/Mips.cpp
@@ -442,6 +442,8 @@ bool mips::hasCompactBranches(StringRef &CPU) {
return llvm::StringSwitch<bool>(CPU)
.Case("mips32r6", true)
.Case("mips64r6", true)
+ .Case("i6400", true)
+ .Case("i6500", true)
.Default(false);
}
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index bf75573..f4bdfa5 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -9214,8 +9214,9 @@ void LinkerWrapper::ConstructJob(Compilation &C, const JobAction &JA,
options::OPT_nogpulibc)) {
forAllAssociatedToolChains(C, JA, getToolChain(), [&](const ToolChain &TC) {
// The device C library is only available for NVPTX and AMDGPU targets
- // currently.
- if (!TC.getTriple().isNVPTX() && !TC.getTriple().isAMDGPU())
+ // and we only link it by default for OpenMP currently.
+ if ((!TC.getTriple().isNVPTX() && !TC.getTriple().isAMDGPU()) ||
+ !JA.isHostOffloading(Action::OFK_OpenMP))
return;
bool HasLibC = TC.getStdlibIncludePath().has_value();
if (HasLibC) {
diff --git a/clang/lib/Driver/XRayArgs.cpp b/clang/lib/Driver/XRayArgs.cpp
index ceed7cb..0325296 100644
--- a/clang/lib/Driver/XRayArgs.cpp
+++ b/clang/lib/Driver/XRayArgs.cpp
@@ -105,8 +105,9 @@ XRayArgs::XRayArgs(const ToolChain &TC, const ArgList &Args) {
for (const auto &P : BundleParts) {
// TODO: Automate the generation of the string case table.
auto Valid = llvm::StringSwitch<bool>(P)
- .Cases("none", "all", "function", "function-entry",
- "function-exit", "custom", true)
+ .Cases({"none", "all", "function", "function-entry",
+ "function-exit", "custom"},
+ true)
.Default(false);
if (!Valid) {