[PATCH] D79223: Fix pr31836 on Windows too, and correctly handle repeated separators.

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 30 18:07:38 PDT 2020


thakis created this revision.
thakis added a reviewer: hans.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The approach in D30000 <https://reviews.llvm.org/D30000> assumes that the '/' returned by path::begin()
is the first element for absolute paths, but that's not true on
Windows.

Also, on Windows backslashes in include lines often end up escaped
so that there are two of them. Having backslashes in include lines
is undefined behavior in most cases and implementation-defined
behavior in C++20, but since clang treats it as normal repeated
path separators, the diagnostic should too.

Unbreaks -Wnonportable-include-path for absolute paths on Windows,
and unbreaks it on non-Windows in the case of absolute paths with
repeated directory separators.


https://reviews.llvm.org/D79223

Files:
  clang/lib/Lex/PPDirectives.cpp
  clang/test/Lexer/case-insensitive-include-ms.c
  clang/test/Lexer/case-insensitive-include-pr31836.sh
  clang/test/Lexer/case-insensitive-include.c
  llvm/include/llvm/Support/Path.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79223.261408.patch
Type: text/x-patch
Size: 7384 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200501/8474e59f/attachment.bin>


More information about the llvm-commits mailing list