diff --git a/common/enum_base.h b/common/enum_base.h index e4686c0d50c9..a642166776b2 100644 --- a/common/enum_base.h +++ b/common/enum_base.h @@ -42,7 +42,7 @@ namespace Carbon::Internal { // // // OPTIONAL: To expose the ability to create an instance from the raw // // enumerator (for unusual use cases), add this: -// using EnumBase::Create; +// using EnumBase::Make; // // // Plus, anything else you wish to include. // }; @@ -141,12 +141,12 @@ class EnumBase : public Printable { protected: // The default constructor is explicitly defaulted (and constexpr) as a // protected constructor to allow derived classes to be constructed but not - // the base itself. This should only be used in the `Create` function below. + // the base itself. This should only be used in the `Make` function below. constexpr EnumBase() = default; // Create an instance from the raw enumerator. Mainly used internally, but may // be exposed for unusual use cases. - static constexpr auto Create(RawEnumType value) -> EnumType { + static constexpr auto Make(RawEnumType value) -> EnumType { EnumType result; result.value_ = value; return result; @@ -161,7 +161,7 @@ class EnumBase : public Printable { // Convert from the underlying integer type. Derived types can choose to // expose this as part of their API. static constexpr auto FromInt(UnderlyingType value) -> EnumType { - return Create(static_cast(value)); + return Make(static_cast(value)); } private: @@ -211,7 +211,7 @@ class EnumBase : public Printable { // constant. #define CARBON_ENUM_CONSTANT_DEFINITION(EnumClassName, Name) \ constexpr EnumClassName EnumClassName::Name = \ - EnumClassName::Create(RawEnumType::Name); + EnumClassName::Make(RawEnumType::Name); // Alternatively, use this within the Carbon enum class body to declare and // define each named constant. Due to type completeness constraints, this will @@ -221,7 +221,7 @@ class EnumBase : public Printable { // `EnumBase` base class. #define CARBON_INLINE_ENUM_CONSTANT_DEFINITION(Name) \ static constexpr const typename Base::EnumType& Name = \ - Base::Create(Base::RawEnumType::Name); + Base::Make(Base::RawEnumType::Name); // Use this in the `.cpp` file for an enum class to start the definition of the // constant names array for each enumerator. It is followed by the desired diff --git a/common/indirect_value.h b/common/indirect_value.h index 9849975df173..4b7bc9293cff 100644 --- a/common/indirect_value.h +++ b/common/indirect_value.h @@ -17,7 +17,7 @@ class IndirectValue; // Creates and returns an IndirectValue that holds the value returned by // `callable()`. template -auto CreateIndirectValue(Callable callable) +auto MakeIndirectValue(Callable callable) -> IndirectValue>; // An IndirectValue object stores a T value, using a layer of indirection @@ -88,7 +88,7 @@ class IndirectValue { static_assert(std::is_object_v, "T must be an object type"); template - friend auto CreateIndirectValue(Callable callable) + friend auto MakeIndirectValue(Callable callable) -> IndirectValue>; template @@ -98,7 +98,7 @@ class IndirectValue { }; template -auto CreateIndirectValue(Callable callable) +auto MakeIndirectValue(Callable callable) -> IndirectValue> { using T = std::decay_t; return IndirectValue(std::unique_ptr(new T(callable()))); diff --git a/common/indirect_value_test.cpp b/common/indirect_value_test.cpp index c546f56bbe0c..d9a538b8d4d4 100644 --- a/common/indirect_value_test.cpp +++ b/common/indirect_value_test.cpp @@ -35,7 +35,7 @@ struct NonMovable { TEST(IndirectValueTest, Create) { IndirectValue v = - CreateIndirectValue([] { return NonMovable(42); }); + MakeIndirectValue([] { return NonMovable(42); }); EXPECT_EQ(v->i, 42); } @@ -45,7 +45,7 @@ auto GetIntReference() -> const int& { } TEST(IndirectValueTest, CreateWithDecay) { - auto v = CreateIndirectValue(GetIntReference); + auto v = MakeIndirectValue(GetIntReference); EXPECT_TRUE((std::is_same_v>)); EXPECT_EQ(*v, 42); } diff --git a/language_server/language_server.cpp b/language_server/language_server.cpp index a025f59c6a2a..fb35ef5dc332 100644 --- a/language_server/language_server.cpp +++ b/language_server/language_server.cpp @@ -99,7 +99,7 @@ void LanguageServer::OnDocumentSymbol( vfs.addFile(file, /*mtime=*/0, llvm::MemoryBuffer::getMemBufferCopy(files_.at(file))); - auto buf = SourceBuffer::CreateFromFile(vfs, file, NullDiagnosticConsumer()); + auto buf = SourceBuffer::MakeFromFile(vfs, file, NullDiagnosticConsumer()); auto lexed = Lex::Lex(value_stores, *buf, NullDiagnosticConsumer()); auto parsed = Parse::Parse(lexed, NullDiagnosticConsumer(), nullptr); std::vector result; diff --git a/toolchain/codegen/codegen.cpp b/toolchain/codegen/codegen.cpp index c244d0943a37..5bfd8e01e3f4 100644 --- a/toolchain/codegen/codegen.cpp +++ b/toolchain/codegen/codegen.cpp @@ -13,9 +13,8 @@ namespace Carbon { -auto CodeGen::Create(llvm::Module& module, llvm::StringRef target_triple, - llvm::raw_pwrite_stream& errors) - -> std::optional { +auto CodeGen::Make(llvm::Module& module, llvm::StringRef target_triple, + llvm::raw_pwrite_stream& errors) -> std::optional { std::string error; const llvm::Target* target = llvm::TargetRegistry::lookupTarget(target_triple, error); diff --git a/toolchain/codegen/codegen.h b/toolchain/codegen/codegen.h index 8ed9f9930873..17259d8c2557 100644 --- a/toolchain/codegen/codegen.h +++ b/toolchain/codegen/codegen.h @@ -12,8 +12,8 @@ namespace Carbon { class CodeGen { public: - static auto Create(llvm::Module& module, llvm::StringRef target_triple, - llvm::raw_pwrite_stream& errors) -> std::optional; + static auto Make(llvm::Module& module, llvm::StringRef target_triple, + llvm::raw_pwrite_stream& errors) -> std::optional; // Generates the object code file. // Returns false in case of failure, and any information about the failure is diff --git a/toolchain/driver/driver.cpp b/toolchain/driver/driver.cpp index cb66f88d8677..a27785a4f916 100644 --- a/toolchain/driver/driver.cpp +++ b/toolchain/driver/driver.cpp @@ -410,12 +410,12 @@ class Driver::CompilationUnit { // Loads source and lexes it. Returns true on success. auto RunLex() -> bool { - LogCall("SourceBuffer::CreateFromFile", [&] { + LogCall("SourceBuffer::MakeFromFile", [&] { if (input_file_name_ == "-") { - source_ = SourceBuffer::CreateFromStdin(*consumer_); + source_ = SourceBuffer::MakeFromStdin(*consumer_); } else { - source_ = SourceBuffer::CreateFromFile(driver_->fs_, input_file_name_, - *consumer_); + source_ = SourceBuffer::MakeFromFile(driver_->fs_, input_file_name_, + *consumer_); } }); if (!source_) { @@ -514,7 +514,7 @@ class Driver::CompilationUnit { CARBON_VLOG() << "*** CodeGen ***\n"; std::optional codegen = - CodeGen::Create(*module_, options_.target, driver_->error_stream_); + CodeGen::Make(*module_, options_.target, driver_->error_stream_); if (!codegen) { return false; } diff --git a/toolchain/driver/driver_test.cpp b/toolchain/driver/driver_test.cpp index 315d7d20e8df..984dc057e11b 100644 --- a/toolchain/driver/driver_test.cpp +++ b/toolchain/driver/driver_test.cpp @@ -46,8 +46,8 @@ class DriverTest : public testing::Test { test_tmpdir_ = tmpdir_env; } - auto CreateTestFile(llvm::StringRef text, - llvm::StringRef file_name = "test_file.carbon") + auto MakeTestFile(llvm::StringRef text, + llvm::StringRef file_name = "test_file.carbon") -> llvm::StringRef { fs_.addFile(file_name, /*ModificationTime=*/0, llvm::MemoryBuffer::getMemBuffer(text)); @@ -117,7 +117,7 @@ TEST_F(DriverTest, CompileCommandErrors) { // Invalid output filename. No reliably error message here. // TODO: Likely want a different filename on Windows. - auto empty_file = CreateTestFile(""); + auto empty_file = MakeTestFile(""); EXPECT_FALSE( driver_.RunCommand({"compile", "--output=/dev/empty", empty_file})); EXPECT_THAT(test_error_stream_.TakeStr(), @@ -125,7 +125,7 @@ TEST_F(DriverTest, CompileCommandErrors) { } TEST_F(DriverTest, DumpTokens) { - auto file = CreateTestFile("Hello World"); + auto file = MakeTestFile("Hello World"); EXPECT_TRUE( driver_.RunCommand({"compile", "--phase=lex", "--dump-tokens", file})); EXPECT_THAT(test_error_stream_.TakeStr(), StrEq("")); @@ -135,7 +135,7 @@ TEST_F(DriverTest, DumpTokens) { } TEST_F(DriverTest, DumpParseTree) { - auto file = CreateTestFile("var v: i32 = 42;"); + auto file = MakeTestFile("var v: i32 = 42;"); EXPECT_TRUE(driver_.RunCommand( {"compile", "--phase=parse", "--dump-parse-tree", file})); EXPECT_THAT(test_error_stream_.TakeStr(), StrEq("")); @@ -146,7 +146,7 @@ TEST_F(DriverTest, DumpParseTree) { TEST_F(DriverTest, StdoutOutput) { // Use explicit filenames so we can look for those to validate output. - CreateTestFile("fn Main() -> i32 { return 0; }", "test.carbon"); + MakeTestFile("fn Main() -> i32 { return 0; }", "test.carbon"); EXPECT_TRUE(driver_.RunCommand({"compile", "--output=-", "test.carbon"})); EXPECT_THAT(test_error_stream_.TakeStr(), StrEq("")); @@ -170,7 +170,7 @@ TEST_F(DriverTest, FileOutput) { // Use explicit filenames as the default output filename is computed from // this, and we can use this to validate output. - CreateTestFile("fn Main() -> i32 { return 0; }", "test.carbon"); + MakeTestFile("fn Main() -> i32 { return 0; }", "test.carbon"); // Object output (the default) uses `.o`. // TODO: This should actually reflect the platform defaults. diff --git a/toolchain/lex/lex.cpp b/toolchain/lex/lex.cpp index 533ba0ff0e66..3ea6352df0e5 100644 --- a/toolchain/lex/lex.cpp +++ b/toolchain/lex/lex.cpp @@ -87,7 +87,7 @@ class [[clang::internal_linkage]] Lexer { // Explicitly kept out-of-line because this is a significant loop that is // useful to have in the profile and it doesn't simplify by inlining at all. // But because it can, the compiler will flatten this otherwise. - [[gnu::noinline]] auto CreateLines(llvm::StringRef source_text) -> void; + [[gnu::noinline]] auto MakeLines(llvm::StringRef source_text) -> void; auto current_line() -> LineIndex { return LineIndex(line_index_); } @@ -647,7 +647,7 @@ auto Lexer::Lex() && -> TokenizedBuffer { llvm::StringRef source_text = buffer_.source_->text(); // First build up our line data structures. - CreateLines(source_text); + MakeLines(source_text); ssize_t position = 0; LexFileStart(source_text, position); @@ -663,7 +663,7 @@ auto Lexer::Lex() && -> TokenizedBuffer { return std::move(buffer_); } -auto Lexer::CreateLines(llvm::StringRef source_text) -> void { +auto Lexer::MakeLines(llvm::StringRef source_text) -> void { // We currently use `memchr` here which typically is well optimized to use // SIMD or other significantly faster than byte-wise scanning. We also use // carefully selected variables and the `ssize_t` type for performance and diff --git a/toolchain/lex/tokenized_buffer_benchmark.cpp b/toolchain/lex/tokenized_buffer_benchmark.cpp index 383c73875715..ace6d4cc6982 100644 --- a/toolchain/lex/tokenized_buffer_benchmark.cpp +++ b/toolchain/lex/tokenized_buffer_benchmark.cpp @@ -396,8 +396,8 @@ class LexerBenchHelper { auto MakeSourceBuffer(llvm::StringRef text) -> SourceBuffer { CARBON_CHECK(fs_.addFile(filename_, /*ModificationTime=*/0, llvm::MemoryBuffer::getMemBuffer(text))); - return std::move(*SourceBuffer::CreateFromFile( - fs_, filename_, ConsoleDiagnosticConsumer())); + return std::move(*SourceBuffer::MakeFromFile(fs_, filename_, + ConsoleDiagnosticConsumer())); } SharedValueStores value_stores_; diff --git a/toolchain/lex/tokenized_buffer_fuzzer.cpp b/toolchain/lex/tokenized_buffer_fuzzer.cpp index 07d7e3984f1e..99cbf8659e39 100644 --- a/toolchain/lex/tokenized_buffer_fuzzer.cpp +++ b/toolchain/lex/tokenized_buffer_fuzzer.cpp @@ -32,7 +32,7 @@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, llvm::MemoryBuffer::getMemBuffer(data_ref, /*BufferName=*/TestFileName, /*RequiresNullTerminator=*/false))); auto source = - SourceBuffer::CreateFromFile(fs, TestFileName, NullDiagnosticConsumer()); + SourceBuffer::MakeFromFile(fs, TestFileName, NullDiagnosticConsumer()); SharedValueStores value_stores; auto buffer = Lex::Lex(value_stores, *source, NullDiagnosticConsumer()); diff --git a/toolchain/lex/tokenized_buffer_test.cpp b/toolchain/lex/tokenized_buffer_test.cpp index b6d8e0fbb966..777574742143 100644 --- a/toolchain/lex/tokenized_buffer_test.cpp +++ b/toolchain/lex/tokenized_buffer_test.cpp @@ -39,7 +39,7 @@ class LexerTest : public ::testing::Test { std::string filename = llvm::formatv("test{0}.carbon", ++file_index_); CARBON_CHECK(fs_.addFile(filename, /*ModificationTime=*/0, llvm::MemoryBuffer::getMemBuffer(text))); - source_storage_.push_front(std::move(*SourceBuffer::CreateFromFile( + source_storage_.push_front(std::move(*SourceBuffer::MakeFromFile( fs_, filename, ConsoleDiagnosticConsumer()))); return source_storage_.front(); } diff --git a/toolchain/lower/function_context.cpp b/toolchain/lower/function_context.cpp index 32e2d89f682f..f1ac4f66bfab 100644 --- a/toolchain/lower/function_context.cpp +++ b/toolchain/lower/function_context.cpp @@ -71,7 +71,7 @@ auto FunctionContext::GetBlockArg(SemIR::InstBlockId block_id, return phi; } -auto FunctionContext::CreateSyntheticBlock() -> llvm::BasicBlock* { +auto FunctionContext::MakeSyntheticBlock() -> llvm::BasicBlock* { synthetic_block_ = llvm::BasicBlock::Create(llvm_context(), "", function_); return synthetic_block_; } diff --git a/toolchain/lower/function_context.h b/toolchain/lower/function_context.h index 3e61090c1fa3..4f9a2839a518 100644 --- a/toolchain/lower/function_context.h +++ b/toolchain/lower/function_context.h @@ -78,7 +78,7 @@ class FunctionContext { // a block should only ever have a single predecessor, and is used when we // need multiple `llvm::BasicBlock`s to model the linear control flow in a // single SemIR::File block. - auto CreateSyntheticBlock() -> llvm::BasicBlock*; + auto MakeSyntheticBlock() -> llvm::BasicBlock*; // Determine whether block is the most recently created synthetic block. auto IsCurrentSyntheticBlock(llvm::BasicBlock* block) -> bool { diff --git a/toolchain/lower/handle.cpp b/toolchain/lower/handle.cpp index b4cbe06c9175..e37d357391c3 100644 --- a/toolchain/lower/handle.cpp +++ b/toolchain/lower/handle.cpp @@ -107,7 +107,7 @@ auto HandleBranchIf(FunctionContext& context, SemIR::InstId /*inst_id*/, SemIR::BranchIf inst) -> void { llvm::Value* cond = context.GetValue(inst.cond_id); llvm::BasicBlock* then_block = context.GetBlock(inst.target_id); - llvm::BasicBlock* else_block = context.CreateSyntheticBlock(); + llvm::BasicBlock* else_block = context.MakeSyntheticBlock(); context.builder().CreateCondBr(cond, then_block, else_block); context.builder().SetInsertPoint(else_block); } diff --git a/toolchain/parse/node_kind.h b/toolchain/parse/node_kind.h index ba3610b54983..657341afe184 100644 --- a/toolchain/parse/node_kind.h +++ b/toolchain/parse/node_kind.h @@ -75,7 +75,7 @@ class NodeKind : public CARBON_ENUM_BASE(NodeKind) { static const int ValidCount; using EnumBase::AsInt; - using EnumBase::Create; + using EnumBase::Make; class Definition; diff --git a/toolchain/parse/parse_fuzzer.cpp b/toolchain/parse/parse_fuzzer.cpp index 7c36ab5deba7..9b473a7fcc58 100644 --- a/toolchain/parse/parse_fuzzer.cpp +++ b/toolchain/parse/parse_fuzzer.cpp @@ -29,7 +29,7 @@ extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, llvm::MemoryBuffer::getMemBuffer(data_ref, /*BufferName=*/TestFileName, /*RequiresNullTerminator=*/false))); auto source = - SourceBuffer::CreateFromFile(fs, TestFileName, NullDiagnosticConsumer()); + SourceBuffer::MakeFromFile(fs, TestFileName, NullDiagnosticConsumer()); // Lex the input. SharedValueStores value_stores; diff --git a/toolchain/parse/tree_test.cpp b/toolchain/parse/tree_test.cpp index ca4c07bc13f4..cf2c8955e54d 100644 --- a/toolchain/parse/tree_test.cpp +++ b/toolchain/parse/tree_test.cpp @@ -32,8 +32,8 @@ class TreeTest : public ::testing::Test { auto GetSourceBuffer(llvm::StringRef t) -> SourceBuffer& { CARBON_CHECK(fs_.addFile("test.carbon", /*ModificationTime=*/0, llvm::MemoryBuffer::getMemBuffer(t))); - source_storage_.push_front(std::move( - *SourceBuffer::CreateFromFile(fs_, "test.carbon", consumer_))); + source_storage_.push_front( + std::move(*SourceBuffer::MakeFromFile(fs_, "test.carbon", consumer_))); return source_storage_.front(); } diff --git a/toolchain/parse/typed_nodes_test.cpp b/toolchain/parse/typed_nodes_test.cpp index d1e4bc095521..eff1fcdec44e 100644 --- a/toolchain/parse/typed_nodes_test.cpp +++ b/toolchain/parse/typed_nodes_test.cpp @@ -27,8 +27,8 @@ class TypedNodeTest : public ::testing::Test { auto GetSourceBuffer(llvm::StringRef t) -> SourceBuffer& { CARBON_CHECK(fs_.addFile("test.carbon", /*ModificationTime=*/0, llvm::MemoryBuffer::getMemBuffer(t))); - source_storage_.push_front(std::move( - *SourceBuffer::CreateFromFile(fs_, "test.carbon", consumer_))); + source_storage_.push_front( + std::move(*SourceBuffer::MakeFromFile(fs_, "test.carbon", consumer_))); return source_storage_.front(); } diff --git a/toolchain/sem_ir/inst.h b/toolchain/sem_ir/inst.h index 60f32d9091ce..d152241beaa0 100644 --- a/toolchain/sem_ir/inst.h +++ b/toolchain/sem_ir/inst.h @@ -127,7 +127,7 @@ class Inst : public Printable { // NOLINTNEXTLINE(google-explicit-constructor) Inst(TypedInst typed_inst) // kind_ is always overwritten below. - : kind_(InstKind::Create({})), + : kind_(InstKind::Make({})), type_id_(TypeId::Invalid), arg0_(InstId::InvalidIndex), arg1_(InstId::InvalidIndex) { diff --git a/toolchain/sem_ir/inst_kind.h b/toolchain/sem_ir/inst_kind.h index 56a17695e846..b07032729ca3 100644 --- a/toolchain/sem_ir/inst_kind.h +++ b/toolchain/sem_ir/inst_kind.h @@ -60,7 +60,7 @@ class InstKind : public CARBON_ENUM_BASE(InstKind) { -> Definition; using EnumBase::AsInt; - using EnumBase::Create; + using EnumBase::Make; // Returns the name to use for this instruction kind in Semantics IR. auto ir_name() const -> llvm::StringLiteral; diff --git a/toolchain/source/source_buffer.cpp b/toolchain/source/source_buffer.cpp index a4637eded23d..dff4e308667b 100644 --- a/toolchain/source/source_buffer.cpp +++ b/toolchain/source/source_buffer.cpp @@ -18,15 +18,15 @@ struct FilenameTranslator : DiagnosticLocationTranslator { }; } // namespace -auto SourceBuffer::CreateFromStdin(DiagnosticConsumer& consumer) +auto SourceBuffer::MakeFromStdin(DiagnosticConsumer& consumer) -> std::optional { - return CreateFromMemoryBuffer(llvm::MemoryBuffer::getSTDIN(), "", - /*is_regular_file=*/false, consumer); + return MakeFromMemoryBuffer(llvm::MemoryBuffer::getSTDIN(), "", + /*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 { FilenameTranslator translator; DiagnosticEmitter 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> buffer, llvm::StringRef filename, bool is_regular_file, DiagnosticConsumer& consumer) -> std::optional { diff --git a/toolchain/source/source_buffer.h b/toolchain/source/source_buffer.h index 9f7c6f645c86..feaee5397384 100644 --- a/toolchain/source/source_buffer.h +++ b/toolchain/source/source_buffer.h @@ -36,14 +36,13 @@ class SourceBuffer { public: // Opens and reads the contents of stdin. Returns a SourceBuffer on success. // Prints an error and returns nullopt on failure. - static auto CreateFromStdin(DiagnosticConsumer& consumer) + static auto MakeFromStdin(DiagnosticConsumer& consumer) -> std::optional; // Opens the requested file. Returns a SourceBuffer on success. Prints an // error and returns nullopt on failure. - static auto CreateFromFile(llvm::vfs::FileSystem& fs, - llvm::StringRef filename, - DiagnosticConsumer& consumer) + static auto MakeFromFile(llvm::vfs::FileSystem& fs, llvm::StringRef filename, + DiagnosticConsumer& consumer) -> std::optional; // Use one of the factory functions above to create a source buffer. @@ -60,7 +59,7 @@ class SourceBuffer { private: // Creates a `SourceBuffer` from the given `llvm::MemoryBuffer`. Prints an // error and returns nullopt on failure. - static auto CreateFromMemoryBuffer( + static auto MakeFromMemoryBuffer( llvm::ErrorOr> buffer, llvm::StringRef filename, bool is_regular_file, DiagnosticConsumer& consumer) -> std::optional; diff --git a/toolchain/source/source_buffer_test.cpp b/toolchain/source/source_buffer_test.cpp index 7a62c4d2a93c..9feab961ed0f 100644 --- a/toolchain/source/source_buffer_test.cpp +++ b/toolchain/source/source_buffer_test.cpp @@ -17,8 +17,8 @@ static constexpr llvm::StringLiteral TestFileName = "test.carbon"; TEST(SourceBufferTest, MissingFile) { llvm::vfs::InMemoryFileSystem fs; - auto buffer = SourceBuffer::CreateFromFile(fs, TestFileName, - ConsoleDiagnosticConsumer()); + auto buffer = + SourceBuffer::MakeFromFile(fs, TestFileName, ConsoleDiagnosticConsumer()); EXPECT_FALSE(buffer); } @@ -27,8 +27,8 @@ TEST(SourceBufferTest, SimpleFile) { CARBON_CHECK(fs.addFile(TestFileName, /*ModificationTime=*/0, llvm::MemoryBuffer::getMemBuffer("Hello World"))); - auto buffer = SourceBuffer::CreateFromFile(fs, TestFileName, - ConsoleDiagnosticConsumer()); + auto buffer = + SourceBuffer::MakeFromFile(fs, TestFileName, ConsoleDiagnosticConsumer()); ASSERT_TRUE(buffer); EXPECT_EQ(TestFileName, buffer->filename()); @@ -44,8 +44,8 @@ TEST(SourceBufferTest, NoNull) { /*BufferName=*/"", /*RequiresNullTerminator=*/false))); - auto buffer = SourceBuffer::CreateFromFile(fs, TestFileName, - ConsoleDiagnosticConsumer()); + auto buffer = + SourceBuffer::MakeFromFile(fs, TestFileName, ConsoleDiagnosticConsumer()); ASSERT_TRUE(buffer); EXPECT_EQ(TestFileName, buffer->filename()); @@ -57,8 +57,8 @@ TEST(SourceBufferTest, EmptyFile) { CARBON_CHECK(fs.addFile(TestFileName, /*ModificationTime=*/0, llvm::MemoryBuffer::getMemBuffer(""))); - auto buffer = SourceBuffer::CreateFromFile(fs, TestFileName, - ConsoleDiagnosticConsumer()); + auto buffer = + SourceBuffer::MakeFromFile(fs, TestFileName, ConsoleDiagnosticConsumer()); ASSERT_TRUE(buffer); EXPECT_EQ(TestFileName, buffer->filename());