[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 01:10:52 PST 2020
kadircet added a comment.
tests look good, but please upload the logs to the bug report for investigation.
================
Comment at: clang-tools-extra/clangd/QueryDriverDatabase.cpp:137
+ llvm::StringRef Arg = CommandLine[I];
+ if (llvm::any_of(FlagsToPreserve, [&Arg](auto &&S) { return S == Arg; })) {
+ Args.push_back(Arg);
----------------
s/auto/llvm::StringRef
same for the other two lambdas below
================
Comment at: clang-tools-extra/clangd/QueryDriverDatabase.cpp:139
+ Args.push_back(Arg);
+ } else if (llvm::any_of(ArgsToPreserve,
+ [&Arg](auto &&S) { return S == Arg; }) &&
----------------
instead of having the third case, you can check whether the `Arg.startswith(S)`, then call `Arg.consume_front(S)` to drop the prefix and check for emptiness or starting with equals.
================
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 '[[ " $* " =~ " -nostdinc " ]] || exit' >> %t.dir/my_driver.sh
+# RUN: echo '[[ " $* " =~ " --sysroot /my/sysroot/path " ]] || exit' >> %t.dir/my_driver.sh
----------------
could you rather make use of `[ -z "${args##"-nostdinc"}" ]` to be compatible with non-bash shells ?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D73453/new/
https://reviews.llvm.org/D73453
More information about the cfe-commits
mailing list