[clang] fe69bb6 - Fix tests failure on 75993812d5c1f269b781c34987748f2a792a579d

Zequan Wu via cfe-commits cfe-commits at lists.llvm.org
Fri May 19 10:34:52 PDT 2023


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


        


More information about the cfe-commits mailing list