Author: Ben Langmuir
Date: 2026-01-05T12:36:33-08:00
New Revision: 0ff011f0a1e02577ef46e7bb4ec3ad3d86687dba

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

LOG: [clang] Fix IO sandbox violations in diagnostic filenames (#173107)

Update TextDiagnostic and SARIFDiagnostic emitFilename to use the
FileManager's makeAbsolutePath instead of directly calling
make_absolute. This fixes IO sandbox violation errors.

Added: 
    

Modified: 
    clang/lib/Frontend/SARIFDiagnostic.cpp
    clang/lib/Frontend/TextDiagnostic.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Frontend/SARIFDiagnostic.cpp 
b/clang/lib/Frontend/SARIFDiagnostic.cpp
index 2cd32ce97ea85..0179307bcbac3 100644
--- a/clang/lib/Frontend/SARIFDiagnostic.cpp
+++ b/clang/lib/Frontend/SARIFDiagnostic.cpp
@@ -219,7 +219,7 @@ llvm::StringRef SARIFDiagnostic::emitFilename(StringRef 
Filename,
       // on that system, both aforementioned paths point to the same place.
 #ifdef _WIN32
       SmallString<256> TmpFilename = File->getName();
-      llvm::sys::fs::make_absolute(TmpFilename);
+      SM.getFileManager().makeAbsolutePath(TmpFilename);
       llvm::sys::path::native(TmpFilename);
       llvm::sys::path::remove_dots(TmpFilename, /* remove_dot_dot */ true);
       Filename = StringRef(TmpFilename.data(), TmpFilename.size());

diff  --git a/clang/lib/Frontend/TextDiagnostic.cpp 
b/clang/lib/Frontend/TextDiagnostic.cpp
index 10032184b5d94..3f30709b0447e 100644
--- a/clang/lib/Frontend/TextDiagnostic.cpp
+++ b/clang/lib/Frontend/TextDiagnostic.cpp
@@ -835,7 +835,7 @@ void TextDiagnostic::emitFilename(StringRef Filename, const 
SourceManager &SM) {
       // on that system, both aforementioned paths point to the same place.
 #ifdef _WIN32
       TmpFilename = File->getName();
-      llvm::sys::fs::make_absolute(TmpFilename);
+      SM.getFileManager().makeAbsolutePath(TmpFilename);
       llvm::sys::path::native(TmpFilename);
       llvm::sys::path::remove_dots(TmpFilename, /* remove_dot_dot */ true);
       Filename = StringRef(TmpFilename.data(), TmpFilename.size());


        
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to