aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/HeaderMap.cpp
diff options
context:
space:
mode:
authorAbhina Sree <Abhina.Sreeskantharajan@ibm.com>2024-10-21 08:20:22 -0400
committerGitHub <noreply@github.com>2024-10-21 08:20:22 -0400
commit46dc91e7d9a1b6dd0144e628519d06954b7b4e53 (patch)
tree09268f150d0a775e4bd7466176a2db515a94db3b /clang/lib/Lex/HeaderMap.cpp
parentc47df3e8c8f47bab8a8302757c50710e0e1c43fb (diff)
downloadllvm-46dc91e7d9a1b6dd0144e628519d06954b7b4e53.zip
llvm-46dc91e7d9a1b6dd0144e628519d06954b7b4e53.tar.gz
llvm-46dc91e7d9a1b6dd0144e628519d06954b7b4e53.tar.bz2
[SystemZ][z/OS] Add new openFileForReadBinary function, and pass IsText parameter to getBufferForFile (#111723)
This patch adds an IsText parameter to the following getBufferForFile, getBufferForFileImpl. We introduce a new virtual function openFileForReadBinary which defaults to openFileForRead except in RealFileSystem which uses the OF_None flag instead of OF_Text. The default is set to OF_Text instead of OF_None, this change in value does not affect any other platforms other than z/OS. Setting this parameter correctly is required to open files on z/OS in the correct encoding. The IsText parameter is based on the context of where we open files, for example, in the ASTReader, HeaderMap requires that files always be opened in binary even though they might be tagged as text.
Diffstat (limited to 'clang/lib/Lex/HeaderMap.cpp')
-rw-r--r--clang/lib/Lex/HeaderMap.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Lex/HeaderMap.cpp b/clang/lib/Lex/HeaderMap.cpp
index 00bf880..b04f67a 100644
--- a/clang/lib/Lex/HeaderMap.cpp
+++ b/clang/lib/Lex/HeaderMap.cpp
@@ -54,7 +54,10 @@ std::unique_ptr<HeaderMap> HeaderMap::Create(FileEntryRef FE, FileManager &FM) {
unsigned FileSize = FE.getSize();
if (FileSize <= sizeof(HMapHeader)) return nullptr;
- auto FileBuffer = FM.getBufferForFile(FE);
+ auto FileBuffer =
+ FM.getBufferForFile(FE, /*IsVolatile=*/false,
+ /*RequiresNullTerminator=*/true,
+ /*MaybeList=*/std::nullopt, /*IsText=*/false);
if (!FileBuffer || !*FileBuffer)
return nullptr;
bool NeedsByteSwap;