-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[flang][driver] Introduce FCC_OVERRIDE_OPTIONS. #140556
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 2 commits
5d20af4
d1f2c9b
d093a6a
9faf4d3
db45474
2efd653
f41f8ff
de566e3
3345334
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 | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -614,3 +614,28 @@ nvfortran defines `-fast` as | |||||||||||||||
| - `-Mcache_align`: there is no equivalent flag in Flang or Clang. | ||||||||||||||||
| - `-Mflushz`: flush-to-zero mode - when `-ffast-math` is specified, Flang will | ||||||||||||||||
| link to `crtfastmath.o` to ensure denormal numbers are flushed to zero. | ||||||||||||||||
|
|
||||||||||||||||
|
|
||||||||||||||||
| ## FCC_OVERRIDE_OPTIONS | ||||||||||||||||
|
|
||||||||||||||||
| The environment variable `FCC_OVERRIDE_OPTIONS` can be used to apply a list of | ||||||||||||||||
| edits to the input argument lists. The value of this environment variable is | ||||||||||||||||
tarunprabhu marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||||||||||||
| a space separated list of edits to perform. These edits are applied in order to | ||||||||||||||||
| the input argument lists. Edits should be one of the following forms: | ||||||||||||||||
|
||||||||||||||||
| The environment variable `FCC_OVERRIDE_OPTIONS` can be used to apply a list of | |
| edits to the input argument lists. The value of this environment variable is | |
| a space separated list of edits to perform. These edits are applied in order to | |
| the input argument lists. Edits should be one of the following forms: | |
| The environment variable `FCC_OVERRIDE_OPTIONS` can be used to edit flang's | |
| command line arguments. The value of this variable is a space-separated list of | |
| edits to perform. The edits are applied in the order in which they appear in `FCC_OVERRIDE_OPTIONS`. Each edit should be one of the following forms: |
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.
Thanks. This looks better than what I had originally. I have updated the docs.
Outdated
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.
For clang a.cc, this actually adds FOO after clang. The comment in clang/lib/Driver/Driver.cpp and this description probably should be made more accurate.
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.
I have added "right after the name of the compiler executable" in both places. Hopefully that is enough to make it clear.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| ! RUN: env FCC_OVERRIDE_OPTIONS="#+-Os +-Oz +-O +-O3 +-Oignore +a +b +c xb Xa Omagic ^-### " %flang -target x86_64-unknown-linux-gnu %s -O2 b -O3 2>&1 | FileCheck %s | ||
|
||
| ! RUN: env FCC_OVERRIDE_OPTIONS="x-Werror +-g" %flang -target x86_64-unknown-linux-gnu -Werror %s -c -### 2>&1 | FileCheck %s -check-prefix=RM-WERROR | ||
|
|
||
| ! CHECK: "-fc1" | ||
| ! CHECK-NOT: "-Oignore" | ||
| ! CHECK: "-Omagic" | ||
| ! CHECK-NOT: "-Oignore" | ||
|
|
||
| ! RM-WERROR: ### FCC_OVERRIDE_OPTIONS: x-Werror +-g | ||
| ! RM-WERROR-NEXT: ### Deleting argument -Werror | ||
| ! RM-WERROR-NEXT: ### Adding argument -g at end | ||
| ! RM-WERROR-NOT: "-Werror" | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -111,6 +111,13 @@ int main(int argc, const char **argv) { | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| llvm::StringSet<> SavedStrings; | ||||||
|
||||||
| llvm::StringSet<> SavedStrings; | |
| llvm::StringSet<> savedStrings; |
Outdated
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.
| if (const char *OverrideStr = ::getenv("FCC_OVERRIDE_OPTIONS")) | |
| if (const char *overrideStr = ::getenv("FCC_OVERRIDE_OPTIONS")) |
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.
I noticed that clang/docs doesn't have the documentation. Perhaps we should document
clang/docs/UsersManual.rstas well and reference it from FlangDriver.md?(
"Each edit should be one of the following forms:" listshould probably reference the clang doc)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.
I will add clang documentation in a separate PR. The
FCC_OVERRIDE_OPTIONSone can then probably just refer to it.