Author: Zequan Wu
Date: 2023-05-19T13:34:40-04:00
New Revision: fe69bb64415ef6fe01ebbb1d1a801e85bd6bd879

URL: 
https://github.com/llvm/llvm-project/commit/fe69bb64415ef6fe01ebbb1d1a801e85bd6bd879
DIFF: 
https://github.com/llvm/llvm-project/commit/fe69bb64415ef6fe01ebbb1d1a801e85bd6bd879.diff

LOG: Fix tests failure on 75993812d5c1f269b781c34987748f2a792a579d

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.

Added: 
    

Modified: 
    clang/lib/AST/TypePrinter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp
index 42bbbde6bfb7..4444dedcfde1 100644
--- a/clang/lib/AST/TypePrinter.cpp
+++ b/clang/lib/AST/TypePrinter.cpp
@@ -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();
       }


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to