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
+7 -7
View File
@@ -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.