Skip to content

Conversation

@benlangmuir
Copy link
Collaborator

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

Update TextDiagnostic and SARIFDiagnostic emitFilename to use the FileManager's
makeAbsolutePath instead of directly calling make_absolute. This fixes IO
sandbox violation errors.
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Dec 19, 2025
@llvmbot
Copy link
Member

llvmbot commented Dec 19, 2025

@llvm/pr-subscribers-clang

Author: Ben Langmuir (benlangmuir)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/173107.diff

2 Files Affected:

  • (modified) clang/lib/Frontend/SARIFDiagnostic.cpp (+1-1)
  • (modified) clang/lib/Frontend/TextDiagnostic.cpp (+1-1)
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());

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants