clang/Basic: Replace ContentCache::getBuffer with Optional semantics
Remove `ContentCache::getBuffer`, which always returned a dereferenceable `MemoryBuffer*` and had a `bool*Invalid` out parameter, and replace it with: - `ContentCache::getBufferOrNone`, which returns `Optional<MemoryBufferRef>`. This is the new API that consumers should use. Later it could be renamed to `getBuffer`, but intentionally using a different name to root out any unexpected callers. - `ContentCache::getBufferPointer`, which returns `MemoryBuffer*` with "optional" semantics. This is `private` to avoid growing callers and `SourceManager` has temporarily been made a `friend` to access it. Later paches will update the transitive callers to not need a raw pointer, and eventually this will be deleted. No functionality change intended here. Differential Revision: https://reviews.llvm.org/D89348
Loading
Please sign in to comment