Clean "./" from __FILE__ expansion.

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.

Reviewed By: ayzhao

Differential Revision: https://reviews.llvm.org/D126396
This commit is contained in:
Paul Pluzhnikov 2022-06-02 17:58:56 -04:00 committed by Alan Zhao
parent 3a96256b7e
commit 4ad17d2e96
1 changed files with 3 additions and 3 deletions

View File

@ -1895,9 +1895,9 @@ void Preprocessor::processPathForFileMacro(SmallVectorImpl<char> &Path,
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);
}
}