diff options
author | Abid Qadeer <haqadeer@amd.com> | 2025-06-02 11:37:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-02 11:37:26 +0100 |
commit | de38c4eaf52717f152b41f285403e6006783f39c (patch) | |
tree | 38c195e6c3ecbdb0f07ca5c3611ef8ca4fe3d74e /clang/lib/Driver/Driver.cpp | |
parent | 1984c7539ebeb2697233f8163a051a2ce0d4fa50 (diff) | |
download | llvm-de38c4eaf52717f152b41f285403e6006783f39c.zip llvm-de38c4eaf52717f152b41f285403e6006783f39c.tar.gz llvm-de38c4eaf52717f152b41f285403e6006783f39c.tar.bz2 |
[flang][driver] Introduce FCC_OVERRIDE_OPTIONS. (#140556)
This PR add functionality to change `flang` command line using
environment variable `FCC_OVERRIDE_OPTIONS`. It is quite similar to what
`CCC_OVERRIDE_OPTIONS` does for clang.
The `FCC_OVERRIDE_OPTIONS` seemed like the most obvious name to me but I
am open to other ideas. The `applyOverrideOptions` now takes an extra
argument that is the name of the environment variable. Previously
`CCC_OVERRIDE_OPTIONS` was hardcoded.
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r-- | clang/lib/Driver/Driver.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 6aa0f4c..87c827d 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -7204,9 +7204,10 @@ static const char *GetStableCStr(llvm::StringSet<> &SavedStrings, StringRef S) { /// /// '#': Silence information about the changes to the command line arguments. /// -/// '^': Add FOO as a new argument at the beginning of the command line. +/// '^FOO': Add FOO as a new argument at the beginning of the command line +/// right after the name of the compiler executable. /// -/// '+': Add FOO as a new argument at the end of the command line. +/// '+FOO': Add FOO as a new argument at the end of the command line. /// /// 's/XXX/YYY/': Substitute the regular expression XXX with YYY in the command /// line. @@ -7294,7 +7295,7 @@ static void applyOneOverrideOption(raw_ostream &OS, void driver::applyOverrideOptions(SmallVectorImpl<const char *> &Args, const char *OverrideStr, llvm::StringSet<> &SavedStrings, - raw_ostream *OS) { + StringRef EnvVar, raw_ostream *OS) { if (!OS) OS = &llvm::nulls(); @@ -7303,7 +7304,7 @@ void driver::applyOverrideOptions(SmallVectorImpl<const char *> &Args, OS = &llvm::nulls(); } - *OS << "### CCC_OVERRIDE_OPTIONS: " << OverrideStr << "\n"; + *OS << "### " << EnvVar << ": " << OverrideStr << "\n"; // This does not need to be efficient. |