Replace SourceManager::getMemoryBufferForFile, which returned a
dereferenceable MemoryBuffer* and had a bool*Invalid out parameter,
with getMemoryBufferForFileOrNone (returning
Optional<MemoryBufferRef>) and getMemoryBufferForFileOrFake
(returning MemoryBufferRef).
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Basic/SourceManager.cpp | ||
---|---|---|
705 | Would it make sense to rename this to the slightly less verbose getMemoryBufferOrNone now that it takes just the File as an argument? Or maybe even getBufferOrNone like the method in ContentCache. |
clang/lib/Basic/SourceManager.cpp | ||
---|---|---|
121–127 | [Highlighting this for the other comment.] | |
705 | There's already a SourceManager::getBufferOrNone (see line 121 of this file, which I am highlighting). I'd rather keep the current weird naming to make it easy to grep for and eventually delete. This function shouldn't really exist since it's at the wrong layer (FileEntry* -> MemoryBuffer is a FileManager concept). The problem is that the SourceManager owns the memory buffer so this is the only way to get access to it. Once I sink the content cache / MemoryBuffer ownership into the FileManager, we can delete this entirely. |
[Highlighting this for the other comment.]