Rename factory functions from 'Create' to 'Make' (#3706)

Similar to #3705, we actually have a mix of `Make` and `Create` in
factory functions too, so this PR is normalizing on `Make`. It's
intended to be consistent with the naming choice for Carbon factory
functions.

Note, MakeSyntheticBlock is the only one I feel a little weird about
because llvm's own APIs use Create, and this is essentially wrapping
LLVM calls. But the flipside is it also feels like a vague line to draw,
when we also differ from LLVM coding style in other ways.
This commit is contained in:
Jon Ross-Perkins
2024-02-14 18:26:56 +00:00
committed by GitHub
parent 4873160acc
commit 1974e44fd9
24 changed files with 66 additions and 68 deletions
+8 -8
View File
@@ -18,15 +18,15 @@ struct FilenameTranslator : DiagnosticLocationTranslator<llvm::StringRef> {
};
} // namespace
auto SourceBuffer::CreateFromStdin(DiagnosticConsumer& consumer)
auto SourceBuffer::MakeFromStdin(DiagnosticConsumer& consumer)
-> std::optional<SourceBuffer> {
return CreateFromMemoryBuffer(llvm::MemoryBuffer::getSTDIN(), "<stdin>",
/*is_regular_file=*/false, consumer);
return MakeFromMemoryBuffer(llvm::MemoryBuffer::getSTDIN(), "<stdin>",
/*is_regular_file=*/false, consumer);
}
auto SourceBuffer::CreateFromFile(llvm::vfs::FileSystem& fs,
llvm::StringRef filename,
DiagnosticConsumer& consumer)
auto SourceBuffer::MakeFromFile(llvm::vfs::FileSystem& fs,
llvm::StringRef filename,
DiagnosticConsumer& consumer)
-> std::optional<SourceBuffer> {
FilenameTranslator translator;
DiagnosticEmitter<llvm::StringRef> emitter(translator, consumer);
@@ -54,12 +54,12 @@ auto SourceBuffer::CreateFromFile(llvm::vfs::FileSystem& fs,
bool is_regular_file = status->isRegularFile();
int64_t size = is_regular_file ? status->getSize() : -1;
return CreateFromMemoryBuffer(
return MakeFromMemoryBuffer(
(*file)->getBuffer(filename, size, /*RequiresNullTerminator=*/false),
filename, is_regular_file, consumer);
}
auto SourceBuffer::CreateFromMemoryBuffer(
auto SourceBuffer::MakeFromMemoryBuffer(
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> buffer,
llvm::StringRef filename, bool is_regular_file,
DiagnosticConsumer& consumer) -> std::optional<SourceBuffer> {