Fix tests failure on 75993812d5

It follows the rules:
1. Use native path if it's already absolute
2. Use Windows back-slash if it's windows formatting.
3. Use Posix style otherwise.
This commit is contained in:
Zequan Wu
2023-05-19 13:34:29 -04:00
parent 338fc76200
commit fe69bb6441

View File

@@ -1392,9 +1392,11 @@ void TypePrinter::printTag(TagDecl *D, raw_ostream &OS) {
// clang::DirectoryLookup::LookupFile when the file path is relative
// path.
llvm::sys::path::Style Style =
!llvm::sys::path::is_absolute(WrittenFile) && Policy.MSVCFormatting
? llvm::sys::path::Style::windows_backslash
: llvm::sys::path::Style::native;
llvm::sys::path::is_absolute(WrittenFile)
? llvm::sys::path::Style::native
: (Policy.MSVCFormatting
? llvm::sys::path::Style::windows_backslash
: llvm::sys::path::Style::posix);
llvm::sys::path::native(WrittenFile, Style);
OS << WrittenFile << ':' << PLoc.getLine() << ':' << PLoc.getColumn();
}