[PATCH] D73453: Preserve -nostdinc and --sysroot when calling query driver

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 28 03:46:37 PST 2020


kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/QueryDriverDatabase.cpp:144
+          });
+      if (Found != std::end(ArgsToPreserve)) {
+        Arg.consume_front(*Found);
----------------
nit: early exit with
```
if(Found == std::end(ArgsToPreserve))
  continue;
```


================
Comment at: clang-tools-extra/clangd/QueryDriverDatabase.cpp:148
+          Args.push_back(CommandLine[I]);
+          Args.push_back(CommandLine[I + 1]);
+        } else if (Arg.startswith("=")) {
----------------
nit: also increment `I`


================
Comment at: clang-tools-extra/clangd/test/system-include-extractor.test:10
 # RUN: echo '[ "$0" = "%t.dir/my_driver.sh" ] || exit' >> %t.dir/my_driver.sh
+# RUN: echo '[ -z "${args##"-nostdinc"}" ]  || exit' >> %t.dir/my_driver.sh
+# RUN: echo '[ -z "${args##"-isysroot=/isysroot"}" ] || exit' >> %t.dir/my_driver.sh
----------------
sorry I forgot to include `*`s, it should've been `[ -z "${args##*"-nostdinc"*}" ]`.

Also you need to populate `args` with `$*` or `$@` first.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73453/new/

https://reviews.llvm.org/D73453





More information about the cfe-commits mailing list