[clang] 4b76a80 - [Clang] Fix use of `hasArg` when `hasFlag` should be used instead
Joseph Huber via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 11 11:41:03 PDT 2022
Author: Joseph Huber
Date: 2022-10-11T13:40:41-05:00
New Revision: 4b76a80459e69daca2f62f522a6117a9350613dc
URL: https://github.com/llvm/llvm-project/commit/4b76a80459e69daca2f62f522a6117a9350613dc
DIFF: https://github.com/llvm/llvm-project/commit/4b76a80459e69daca2f62f522a6117a9350613dc.diff
LOG: [Clang] Fix use of `hasArg` when `hasFlag` should be used instead
Summary:
This option forwards a clang flag with a `-no` variant to the Clang
compiler. It should use the `hasFlag` so it works properly when the
option is overridden.
Added:
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 1a3ee09648359..93e0a18e7da94 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6233,7 +6233,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
}
// Forward the new driver to change offloading code generation.
- if (Args.hasArg(options::OPT_offload_new_driver))
+ if (Args.hasFlag(options::OPT_offload_new_driver,
+ options::OPT_no_offload_new_driver, false))
CmdArgs.push_back("--offload-new-driver");
SanitizeArgs.addArgs(TC, Args, CmdArgs, InputType);
More information about the cfe-commits
mailing list