[llvm] [llvm-config] Add new flag `--quote-paths` to optionally quote and escape paths (PR #103397)

Saleem Abdulrasool via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 13:18:44 PDT 2024


================
@@ -504,6 +507,36 @@ int main(int argc, char **argv) {
   };
 
   raw_ostream &OS = outs();
+
+  // Check if we want quoting and escaping.
+  bool QuotePaths = false;
+  for (int i = 1; i != argc; ++i) {
+    if (StringRef(argv[i]) == "--quote-paths") {
+      QuotePaths = true;
+      break;
+    }
+  }
----------------
compnerd wrote:

Could we do something like:

```suggestion
  bool QuotePaths = std::any_of(&argv[0], &argv[argc], [](const char *arg) {
    return StringRef(arg) == "--quote-paths";
  });
```

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


More information about the llvm-commits mailing list