[PATCH] D79531: Make -Wnonportable-include-path ignore drive case on Windows.

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 6 19:20:15 PDT 2020


thakis marked an inline comment as done.
thakis added inline comments.


================
Comment at: clang/lib/Lex/PPDirectives.cpp:2118
+    // given drive letter case as correct for the purpose of this warning.
+    SmallString<128> FixedDriveRealPath;
+    if (llvm::sys::path::is_absolute(Name) &&
----------------
rnk wrote:
> It seems like trySimplifyPath could check if it is checking the case of the first component on Windows, and that would hide the complexity from the main Preprocessor::HandleHeaderIncludeOrImport implementation. It also saves a string copy for every include.
Not easily, since that walks the path backwards. Includes are almost never absolute, so this also almost never does a string copy and it's imho a bit simpler this way.

I agree pulling out the code for this warning into its own function is a good idea though.


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

https://reviews.llvm.org/D79531





More information about the llvm-commits mailing list