[PATCH] D126289: [Clang][Driver] Fix include paths for `--sysroot /` on Linux

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 26 13:51:06 PDT 2022


MaskRay accepted this revision.
MaskRay added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/lib/Driver/ToolChain.cpp:917
 
+/*static*/ std::string ToolChain::concat(const std::string &Path,
+                                         const Twine &A, const Twine &B,
----------------
I think the first argument of `concat` should be `StringRef`, then we can avoid changing the signature of `getMultiarchTriple`


================
Comment at: clang/test/Driver/linux-header-search.cpp:76
+
+// Test Linux with libstdc++.
+// RUN: %clang -### %s -fsyntax-only 2>&1 \
----------------
I suspect this test does not add more coverage than linux-cross.cpp.

To test --sysroot with a trailing `/`, just modify the previous `CHECK-BASIC-LIBCXXV2` by appending a `/`


================
Comment at: clang/test/Driver/linux-header-search.cpp:88
+// CHECK-BASIC-LIBSTDCXX-SYSROOT-SAME: "-internal-isystem" "[[SYSROOT]]/usr/lib/gcc/x86_64-unknown-linux-gnu/4.8/../../../../x86_64-unknown-linux-gnu/include"
+//
+// Test Linux with libstdc++ when the sysroot path ends with `/`.
----------------
Remove the otherwise empty `//`

It adds no value but makes `{` `}` in vim-style editors inconvenient.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126289



More information about the cfe-commits mailing list