[PATCH] D126396: Clean "./" from __FILE__ expansion.
Paul Pluzhnikov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 2 14:09:30 PDT 2022
ppluzhnikov created this revision.
Herald added a project: All.
ppluzhnikov updated this revision to Diff 432064.
ppluzhnikov added a comment.
Herald added a subscriber: hiraditya.
ppluzhnikov updated this revision to Diff 433837.
ppluzhnikov published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Also fix a buglet in remove_dots().
ppluzhnikov added a comment.
Rebase to ToT.
This is alternative to https://reviews.llvm.org/D121733
and helps with Clang header modules in which FILE
may expand to "./foo.h" or "foo.h" depending on whether the file was
included directly or not.
Only do this when UseTargetPathSeparator is true, as we are already
changing the path in that case.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D126396
Files:
clang/lib/Lex/PPMacroExpansion.cpp
Index: clang/lib/Lex/PPMacroExpansion.cpp
===================================================================
--- clang/lib/Lex/PPMacroExpansion.cpp
+++ clang/lib/Lex/PPMacroExpansion.cpp
@@ -1895,9 +1895,9 @@
LangOpts.remapPathPrefix(Path);
if (LangOpts.UseTargetPathSeparator) {
if (TI.getTriple().isOSWindows())
- llvm::sys::path::make_preferred(
- Path, llvm::sys::path::Style::windows_backslash);
+ llvm::sys::path::remove_dots(Path, false,
+ llvm::sys::path::Style::windows_backslash);
else
- llvm::sys::path::make_preferred(Path, llvm::sys::path::Style::posix);
+ llvm::sys::path::remove_dots(Path, false, llvm::sys::path::Style::posix);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126396.433837.patch
Type: text/x-patch
Size: 732 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220602/15fb35be/attachment.bin>
More information about the cfe-commits
mailing list