-
Notifications
You must be signed in to change notification settings - Fork 15k
[Driver] Move CommonArgs to a location visible by the Frontend Drivers #142800
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
Changes from 6 commits
918b853
28c4762
aef6882
db4482d
a6535b1
ef34cdf
121c41a
8b69907
2691029
d33a5f9
ca89f42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include "CommonArgs.h" | ||
| #include "clang/Driver/CommonArgs.h" | ||
| #include "Arch/AArch64.h" | ||
| #include "Arch/ARM.h" | ||
| #include "Arch/CSKY.h" | ||
|
|
@@ -3167,3 +3167,29 @@ void tools::handleInterchangeLoopsArgs(const ArgList &Args, | |
| options::OPT_fno_loop_interchange, EnableInterchange)) | ||
| CmdArgs.push_back("-floop-interchange"); | ||
| } | ||
|
|
||
| std::optional<StringRef> tools::ParseMPreferVectorWidthOption( | ||
| clang::DiagnosticsEngine &Diags, const llvm::opt::ArgList &Args, | ||
| ArgStringList &CmdArgs, bool isCompilerDriver) { | ||
| // If this was invoked by the Compiler Driver, we pass through the option | ||
| // as-is. Otherwise, if this is the Frontend Driver, we want just the value. | ||
| StringRef Out = isCompilerDriver ? "-mprefer-vector-width=" : ""; | ||
|
|
||
| Arg *A = Args.getLastArg(clang::driver::options::OPT_mprefer_vector_width_EQ); | ||
| if (!A) | ||
| return std::nullopt; | ||
|
|
||
| StringRef Value = A->getValue(); | ||
| unsigned Width __attribute((uninitialized)); | ||
|
|
||
| // Only "none" and Integer values are accepted by | ||
| // -mprefer-vector-width=<value>. | ||
| if (Value != "none" && Value.getAsInteger(10, Width)) { | ||
| Diags.Report(clang::diag::err_drv_invalid_value) | ||
| << A->getOption().getName() << Value; | ||
| return std::nullopt; | ||
| } | ||
|
|
||
| CmdArgs.push_back(Args.MakeArgString(Out + Value)); | ||
|
||
| return Value; | ||
| } | ||
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.
Could we add a docstring for this function