[PATCH] D138677: [Lex] Fix suggested spelling of /usr/bin/../include/foo

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 24 09:51:42 PST 2022


kadircet added inline comments.


================
Comment at: clang/lib/Lex/HeaderSearch.cpp:1932
+  
+  llvm::SmallString<32> FilePath(File.begin(), File.end());
+  path::remove_dots(FilePath, /*remove_dot_dot=*/true);
----------------
nit: you can change the method signature to take in a SmallString directly. there's an implicit constructor and any caller that already has a copy that they're throwing away can pass it here instead.


================
Comment at: clang/lib/Lex/HeaderSearch.cpp:1932
+  
+  llvm::SmallString<32> FilePath(File.begin(), File.end());
+  path::remove_dots(FilePath, /*remove_dot_dot=*/true);
----------------
kadircet wrote:
> nit: you can change the method signature to take in a SmallString directly. there's an implicit constructor and any caller that already has a copy that they're throwing away can pass it here instead.
this is same as `llvm::SmallString<32> FilePath(File);`


================
Comment at: clang/lib/Lex/HeaderSearch.cpp:1950
       if (DI == DE) {
-        // Dir is a prefix of File, up to '.' components and choice of path
-        // separators.
+        // Dir is a prefix of File, up to choice of path // separators.
         unsigned PrefixLength = NI - path::begin(File);
----------------
looks like reflow went wrong here, drop `//`?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138677



More information about the cfe-commits mailing list