[all-commits] [llvm/llvm-project] d758f7: clang/Basic: Replace ContentCache::getBuffer with ...
Duncan P. N. Exon Smith via All-commits
all-commits at lists.llvm.org
Wed Oct 14 12:56:51 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: d758f79e5d381bd4f5122193a9538d89c907c812
https://github.com/llvm/llvm-project/commit/d758f79e5d381bd4f5122193a9538d89c907c812
Author: Duncan P. N. Exon Smith <dexonsmith at apple.com>
Date: 2020-10-14 (Wed, 14 Oct 2020)
Changed paths:
M clang-tools-extra/clang-tidy/ClangTidyDiagnosticConsumer.cpp
M clang/include/clang/Basic/SourceManager.h
M clang/lib/AST/ASTImporter.cpp
M clang/lib/Basic/SourceManager.cpp
M clang/lib/Serialization/ASTWriter.cpp
Log Message:
-----------
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
More information about the All-commits
mailing list