diff options
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
-rw-r--r-- | clang/lib/Basic/SourceManager.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/clang/lib/Basic/SourceManager.cpp b/clang/lib/Basic/SourceManager.cpp index 65a8a72..fe3aff7 100644 --- a/clang/lib/Basic/SourceManager.cpp +++ b/clang/lib/Basic/SourceManager.cpp @@ -121,8 +121,18 @@ ContentCache::getBufferOrNone(DiagnosticsEngine &Diag, FileManager &FM, // Start with the assumption that the buffer is invalid to simplify early // return paths. IsBufferInvalid = true; - - auto BufferOrError = FM.getBufferForFile(*ContentsEntry, IsFileVolatile); + bool IsText = false; + +#ifdef __MVS__ + // If the file is tagged with a text ccsid, it may require autoconversion. + llvm::ErrorOr<bool> IsFileText = + llvm::iszOSTextFile(ContentsEntry->getName().data()); + if (IsFileText) + IsText = *IsFileText; +#endif + + auto BufferOrError = FM.getBufferForFile( + *ContentsEntry, IsFileVolatile, /*RequiresNullTerminator=*/true, IsText); // If we were unable to open the file, then we are in an inconsistent // situation where the content cache referenced a file which no longer |