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);
   }
 }


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);
   }
 }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to