Skip to content

Commit 4c52061

Browse files
committed
address comments
1 parent 74c4e2a commit 4c52061

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

clang/include/clang/Basic/FileEntry.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,9 @@ class FileEntryRef {
7171
return *getBaseMapEntry().second->V.get<FileEntry *>();
7272
}
7373

74-
// This is a non const version of getFileEntry() which is used if the buffer
75-
// size needs to be increased due to potential z/OS EBCDIC -> UTF-8 conversion
76-
FileEntry &getFileEntryToUpdate() {
77-
return *getBaseMapEntry().second->V.get<FileEntry *>();
78-
}
74+
// This function is used if the buffer size needs to be increased
75+
// due to potential z/OS EBCDIC -> UTF-8 conversion
76+
inline void updateFileEntryBufferSize(unsigned BufferSize);
7977

8078
DirectoryEntryRef getDir() const { return ME->second->Dir; }
8179

@@ -362,6 +360,10 @@ bool FileEntryRef::isNamedPipe() const { return getFileEntry().isNamedPipe(); }
362360

363361
void FileEntryRef::closeFile() const { getFileEntry().closeFile(); }
364362

363+
void FileEntryRef::updateFileEntryBufferSize(unsigned BufferSize) {
364+
getBaseMapEntry().second->V.get<FileEntry *>()->setSize(BufferSize);
365+
}
366+
365367
} // end namespace clang
366368

367369
#endif // LLVM_CLANG_BASIC_FILEENTRY_H

clang/lib/Basic/SourceManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ FileID SourceManager::createFileIDImpl(ContentCache &File, StringRef Filename,
627627
unsigned BufSize = Buffer->getBufferSize();
628628
if (BufSize > FileSize) {
629629
if (File.ContentsEntry.has_value())
630-
File.ContentsEntry->getFileEntryToUpdate().setSize(BufSize);
630+
File.ContentsEntry->updateFileEntryBufferSize(BufSize);
631631
FileSize = BufSize;
632632
}
633633
}

0 commit comments

Comments
 (0)