[clang] [flang] [clang][driver] Special care for -l flags in config files (PR #117573)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 30 10:35:41 PST 2024


================
@@ -1062,6 +1062,19 @@ bool Driver::readConfigFile(StringRef FileName,
   for (Arg *A : *NewOptions)
     A->claim();
 
+  // Filter out all -l and -Wl, options, put them into a separate list and erase
+  // from the original list of configuration file options. These will be used
+  // only when linking and appended after all of the command line options.
+  auto NewLinkerIns = std::make_unique<InputArgList>();
+  for (Arg *A : NewOptions->filtered(options::OPT_Wl_COMMA, options::OPT_l)) {
+    const Arg *BaseArg = &A->getBaseArg();
+    if (BaseArg == A)
+      BaseArg = nullptr;
----------------
MaskRay wrote:

`getBaseArg()` is always nullptr. I've cleaned up the existing code using it. Please rebase

https://github.com/llvm/llvm-project/pull/117573


More information about the cfe-commits mailing list