-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[NFC][clang] Move argument handling: Driver::BuildActions -> handleArguments #142455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…guments This commit simply moves code for diagnosing misuse of arguments `/Fo`, `/Fa`, and `/o` from `Driver::BuildActions` into `Driver::handleArguments`, following the intention of 740f69b. This change better aligns with the roles of `BuildActions` and `handleArguments`.
@llvm/pr-subscribers-clang @llvm/pr-subscribers-clang-driver Author: Naveen Seth Hanig (naveen-seth) ChangesThis simply moves code for diagnosing misuse of arguments Full diff: https://github.com/llvm/llvm-project/pull/142455.diff 1 Files Affected:
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 87c827de17d9e..282f69a071e45 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -4226,6 +4226,39 @@ void Driver::handleArguments(Compilation &C, DerivedArgList &Args,
const InputList &Inputs,
ActionList &Actions) const {
+ // Diagnose misuse of /Fo.
+ if (Arg *A = Args.getLastArg(options::OPT__SLASH_Fo)) {
+ StringRef V = A->getValue();
+ if (Inputs.size() > 1 && !V.empty() &&
+ !llvm::sys::path::is_separator(V.back())) {
+ // Check whether /Fo tries to name an output file for multiple inputs.
+ Diag(clang::diag::err_drv_out_file_argument_with_multiple_sources)
+ << A->getSpelling() << V;
+ Args.eraseArg(options::OPT__SLASH_Fo);
+ }
+ }
+
+ // Diagnose misuse of /Fa.
+ if (Arg *A = Args.getLastArg(options::OPT__SLASH_Fa)) {
+ StringRef V = A->getValue();
+ if (Inputs.size() > 1 && !V.empty() &&
+ !llvm::sys::path::is_separator(V.back())) {
+ // Check whether /Fa tries to name an asm file for multiple inputs.
+ Diag(clang::diag::err_drv_out_file_argument_with_multiple_sources)
+ << A->getSpelling() << V;
+ Args.eraseArg(options::OPT__SLASH_Fa);
+ }
+ }
+
+ // Diagnose misuse of /o.
+ if (Arg *A = Args.getLastArg(options::OPT__SLASH_o)) {
+ if (A->getValue()[0] == '\0') {
+ // It has to have a value.
+ Diag(clang::diag::err_drv_missing_argument) << A->getSpelling() << 1;
+ Args.eraseArg(options::OPT__SLASH_o);
+ }
+ }
+
// Ignore /Yc/Yu if both /Yc and /Yu passed but with different filenames.
Arg *YcArg = Args.getLastArg(options::OPT__SLASH_Yc);
Arg *YuArg = Args.getLastArg(options::OPT__SLASH_Yu);
@@ -4368,39 +4401,6 @@ void Driver::BuildActions(Compilation &C, DerivedArgList &Args,
return;
}
- // Diagnose misuse of /Fo.
- if (Arg *A = Args.getLastArg(options::OPT__SLASH_Fo)) {
- StringRef V = A->getValue();
- if (Inputs.size() > 1 && !V.empty() &&
- !llvm::sys::path::is_separator(V.back())) {
- // Check whether /Fo tries to name an output file for multiple inputs.
- Diag(clang::diag::err_drv_out_file_argument_with_multiple_sources)
- << A->getSpelling() << V;
- Args.eraseArg(options::OPT__SLASH_Fo);
- }
- }
-
- // Diagnose misuse of /Fa.
- if (Arg *A = Args.getLastArg(options::OPT__SLASH_Fa)) {
- StringRef V = A->getValue();
- if (Inputs.size() > 1 && !V.empty() &&
- !llvm::sys::path::is_separator(V.back())) {
- // Check whether /Fa tries to name an asm file for multiple inputs.
- Diag(clang::diag::err_drv_out_file_argument_with_multiple_sources)
- << A->getSpelling() << V;
- Args.eraseArg(options::OPT__SLASH_Fa);
- }
- }
-
- // Diagnose misuse of /o.
- if (Arg *A = Args.getLastArg(options::OPT__SLASH_o)) {
- if (A->getValue()[0] == '\0') {
- // It has to have a value.
- Diag(clang::diag::err_drv_missing_argument) << A->getSpelling() << 1;
- Args.eraseArg(options::OPT__SLASH_o);
- }
- }
-
handleArguments(C, Args, Inputs, Actions);
bool UseNewOffloadingDriver =
|
Hi @Bigcheese, can I tag you for review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm.
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/51/builds/17258 Here is the relevant piece of the build log for the reference
|
…guments (llvm#142455) This simply moves code for diagnosing misuse of arguments `/Fo`, `/Fa`, and `/o` from `Driver::BuildActions` into `Driver::handleArguments`, following the intention of 740f69b. This change better aligns with the roles of `BuildActions` and `handleArguments`.
This simply moves code for diagnosing misuse of arguments
/Fo
,/Fa
, and/o
fromDriver::BuildActions
intoDriver::handleArguments
, following the intention of 740f69b.This change better aligns with the roles of
BuildActions
andhandleArguments
.