[clang-tools-extra] f71404c - [clangd] Replace usages of dummy with more descriptive words

Kadir Cetinkaya via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 22 04:50:35 PDT 2021


Author: Kadir Cetinkaya
Date: 2021-03-22T12:49:24+01:00
New Revision: f71404c37c32902b66cf802bc18984be184d583e

URL: https://github.com/llvm/llvm-project/commit/f71404c37c32902b66cf802bc18984be184d583e
DIFF: https://github.com/llvm/llvm-project/commit/f71404c37c32902b66cf802bc18984be184d583e.diff

LOG: [clangd] Replace usages of dummy with more descriptive words

Dummy is a word with inappropriate associations. This patch updates the
references to it in clangd code base with more precise ones.

The only user-visible change is the default variable name used when extracting a
variable. It will be named as `placeholder` from now on.

Differential Revision: https://reviews.llvm.org/D99065

Added: 
    clang-tools-extra/clangd/fuzzer/FuzzerClangdMain.cpp

Modified: 
    clang-tools-extra/clangd/ClangdServer.cpp
    clang-tools-extra/clangd/CompileCommands.cpp
    clang-tools-extra/clangd/FindSymbols.cpp
    clang-tools-extra/clangd/Format.cpp
    clang-tools-extra/clangd/SemanticHighlighting.cpp
    clang-tools-extra/clangd/SourceCode.cpp
    clang-tools-extra/clangd/XRefs.cpp
    clang-tools-extra/clangd/fuzzer/CMakeLists.txt
    clang-tools-extra/clangd/index/remote/CMakeLists.txt
    clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
    clang-tools-extra/clangd/support/Trace.cpp
    clang-tools-extra/clangd/unittests/ClangdTests.cpp
    clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
    clang-tools-extra/clangd/unittests/RenameTests.cpp
    clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
    clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp

Removed: 
    clang-tools-extra/clangd/fuzzer/DummyClangdMain.cpp


################################################################################
diff  --git a/clang-tools-extra/clangd/ClangdServer.cpp b/clang-tools-extra/clangd/ClangdServer.cpp
index f9516a1537a0..557689774b14 100644
--- a/clang-tools-extra/clangd/ClangdServer.cpp
+++ b/clang-tools-extra/clangd/ClangdServer.cpp
@@ -497,7 +497,7 @@ void ClangdServer::prepareRename(PathRef File, Position Pos,
     // prepareRename is latency-sensitive: we don't query the index, as we
     // only need main-file references
     auto Results =
-        clangd::rename({Pos, NewName.getValueOr("__clangd_rename_dummy"),
+        clangd::rename({Pos, NewName.getValueOr("__clangd_rename_placeholder"),
                         InpAST->AST, File, /*FS=*/nullptr,
                         /*Index=*/nullptr, RenameOpts});
     if (!Results) {

diff  --git a/clang-tools-extra/clangd/CompileCommands.cpp b/clang-tools-extra/clangd/CompileCommands.cpp
index b55d1b03dee6..7966b7dfa8a3 100644
--- a/clang-tools-extra/clangd/CompileCommands.cpp
+++ b/clang-tools-extra/clangd/CompileCommands.cpp
@@ -96,9 +96,9 @@ std::string detectClangPath() {
     if (auto PathCC = llvm::sys::findProgramByName(Name))
       return resolve(std::move(*PathCC));
   // Fallback: a nonexistent 'clang' binary next to clangd.
-  static int Dummy;
+  static int StaticForMainAddr;
   std::string ClangdExecutable =
-      llvm::sys::fs::getMainExecutable("clangd", (void *)&Dummy);
+      llvm::sys::fs::getMainExecutable("clangd", (void *)&StaticForMainAddr);
   SmallString<128> ClangPath;
   ClangPath = llvm::sys::path::parent_path(ClangdExecutable);
   llvm::sys::path::append(ClangPath, "clang");
@@ -120,8 +120,9 @@ const llvm::Optional<std::string> detectSysroot() {
 }
 
 std::string detectStandardResourceDir() {
-  static int Dummy; // Just an address in this process.
-  return CompilerInvocation::GetResourcesPath("clangd", (void *)&Dummy);
+  static int StaticForMainAddr; // Just an address in this process.
+  return CompilerInvocation::GetResourcesPath("clangd",
+                                              (void *)&StaticForMainAddr);
 }
 
 // The path passed to argv[0] is important:

diff  --git a/clang-tools-extra/clangd/FindSymbols.cpp b/clang-tools-extra/clangd/FindSymbols.cpp
index bda5dcadf12e..e4846ac7a59d 100644
--- a/clang-tools-extra/clangd/FindSymbols.cpp
+++ b/clang-tools-extra/clangd/FindSymbols.cpp
@@ -376,10 +376,10 @@ class DocumentOutline {
 
   /// Builds the document outline for the generated AST.
   std::vector<DocumentSymbol> build() {
-    SymBuilder DummyRoot;
+    SymBuilder Root;
     for (auto &TopLevel : AST.getLocalTopLevelDecls())
-      traverseDecl(TopLevel, DummyRoot);
-    return std::move(std::move(DummyRoot).build().children);
+      traverseDecl(TopLevel, Root);
+    return std::move(std::move(Root).build().children);
   }
 
 private:

diff  --git a/clang-tools-extra/clangd/Format.cpp b/clang-tools-extra/clangd/Format.cpp
index d68a5bc672d0..3963bc21d403 100644
--- a/clang-tools-extra/clangd/Format.cpp
+++ b/clang-tools-extra/clangd/Format.cpp
@@ -23,7 +23,7 @@ namespace {
 /// as it isn't sure where the errors are and so can't correct.
 /// When editing, it's reasonable to assume code before the cursor is complete.
 void closeBrackets(std::string &Code, const format::FormatStyle &Style) {
-  SourceManagerForFile FileSM("dummy.cpp", Code);
+  SourceManagerForFile FileSM("mock_file.cpp", Code);
   auto &SM = FileSM.get();
   FileID FID = SM.getMainFileID();
   Lexer Lex(FID, SM.getBufferOrFake(FID), SM,

diff  --git a/clang-tools-extra/clangd/SemanticHighlighting.cpp b/clang-tools-extra/clangd/SemanticHighlighting.cpp
index 0b4965c42715..cf06eac01a34 100644
--- a/clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ b/clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -294,7 +294,7 @@ class HighlightingsBuilder {
   HighlightingToken &addToken(SourceLocation Loc, HighlightingKind Kind) {
     Loc = getHighlightableSpellingToken(Loc, SourceMgr);
     if (Loc.isInvalid())
-      return Dummy;
+      return InvalidHighlightingToken;
     const auto *Tok = TB.spelledTokenAt(Loc);
     assert(Tok);
     return addToken(
@@ -395,7 +395,8 @@ class HighlightingsBuilder {
   const SourceManager &SourceMgr;
   const LangOptions &LangOpts;
   std::vector<HighlightingToken> Tokens;
-  HighlightingToken Dummy; // returned from addToken(InvalidLoc)
+  // returned from addToken(InvalidLoc)
+  HighlightingToken InvalidHighlightingToken;
 };
 
 llvm::Optional<HighlightingModifier> scopeModifier(const NamedDecl *D) {

diff  --git a/clang-tools-extra/clangd/SourceCode.cpp b/clang-tools-extra/clangd/SourceCode.cpp
index 8faed3e046aa..5a9cf05ea818 100644
--- a/clang-tools-extra/clangd/SourceCode.cpp
+++ b/clang-tools-extra/clangd/SourceCode.cpp
@@ -599,7 +599,7 @@ lex(llvm::StringRef Code, const LangOptions &LangOpts,
         Action) {
   // FIXME: InMemoryFileAdapter crashes unless the buffer is null terminated!
   std::string NullTerminatedCode = Code.str();
-  SourceManagerForFile FileSM("dummy.cpp", NullTerminatedCode);
+  SourceManagerForFile FileSM("mock_file_name.cpp", NullTerminatedCode);
   auto &SM = FileSM.get();
   for (const auto &Tok : syntax::tokenize(SM.getMainFileID(), SM, LangOpts))
     Action(Tok, SM);

diff  --git a/clang-tools-extra/clangd/XRefs.cpp b/clang-tools-extra/clangd/XRefs.cpp
index 1f821f8edd1e..65bbbcd28b40 100644
--- a/clang-tools-extra/clangd/XRefs.cpp
+++ b/clang-tools-extra/clangd/XRefs.cpp
@@ -162,10 +162,10 @@ SymbolLocation toIndexLocation(const Location &Loc, std::string &URIStorage) {
 SymbolLocation getPreferredLocation(const Location &ASTLoc,
                                     const SymbolLocation &IdxLoc,
                                     std::string &Scratch) {
-  // Also use a dummy symbol for the index location so that other fields (e.g.
+  // Also use a mock symbol for the index location so that other fields (e.g.
   // definition) are not factored into the preference.
   Symbol ASTSym, IdxSym;
-  ASTSym.ID = IdxSym.ID = SymbolID("dummy_id");
+  ASTSym.ID = IdxSym.ID = SymbolID("mock_symbol_id");
   ASTSym.CanonicalDeclaration = toIndexLocation(ASTLoc, Scratch);
   IdxSym.CanonicalDeclaration = IdxLoc;
   auto Merged = mergeSymbol(ASTSym, IdxSym);

diff  --git a/clang-tools-extra/clangd/fuzzer/CMakeLists.txt b/clang-tools-extra/clangd/fuzzer/CMakeLists.txt
index 778b61158304..18cab4b41e1a 100644
--- a/clang-tools-extra/clangd/fuzzer/CMakeLists.txt
+++ b/clang-tools-extra/clangd/fuzzer/CMakeLists.txt
@@ -9,7 +9,7 @@ set(LLVM_LINK_COMPONENTS
 # This fuzzer runs on oss-fuzz, so keep it around even if it looks unreferenced.
 add_llvm_fuzzer(clangd-fuzzer
   clangd-fuzzer.cpp
-  DUMMY_MAIN DummyClangdMain.cpp
+  DUMMY_MAIN FuzzerClangdMain.cpp
   )
 
 clang_target_link_libraries(clangd-fuzzer

diff  --git a/clang-tools-extra/clangd/fuzzer/DummyClangdMain.cpp b/clang-tools-extra/clangd/fuzzer/FuzzerClangdMain.cpp
similarity index 91%
rename from clang-tools-extra/clangd/fuzzer/DummyClangdMain.cpp
rename to clang-tools-extra/clangd/fuzzer/FuzzerClangdMain.cpp
index cd5a61217511..7b10dbb78201 100644
--- a/clang-tools-extra/clangd/fuzzer/DummyClangdMain.cpp
+++ b/clang-tools-extra/clangd/fuzzer/FuzzerClangdMain.cpp
@@ -1,4 +1,4 @@
-//===---- DummyClangdMain.cpp - Entry point to sanity check the fuzzer ----===//
+//===--- FuzzerClangdMain.cpp - Entry point to sanity check the fuzzer ----===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.

diff  --git a/clang-tools-extra/clangd/index/remote/CMakeLists.txt b/clang-tools-extra/clangd/index/remote/CMakeLists.txt
index ded3f9274f86..2aa6e9b6cfa9 100644
--- a/clang-tools-extra/clangd/index/remote/CMakeLists.txt
+++ b/clang-tools-extra/clangd/index/remote/CMakeLists.txt
@@ -39,6 +39,6 @@ if (CLANGD_ENABLE_REMOTE)
   add_subdirectory(marshalling)
   add_subdirectory(server)
 else()
-  # Provides a dummy implementation of clangdRemoteIndex.
+  # Provides a no-op implementation of clangdRemoteIndex.
   add_subdirectory(unimplemented)
 endif()

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp b/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
index c603861c3d69..a4db11f1a364 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/ExtractVariable.cpp
@@ -376,7 +376,7 @@ bool eligibleForExtraction(const SelectionTree::Node *N) {
   if (llvm::isa<DeclRefExpr>(E) || llvm::isa<MemberExpr>(E))
     return false;
 
-  // Extracting Exprs like a = 1 gives dummy = a = 1 which isn't useful.
+  // Extracting Exprs like a = 1 gives placeholder = a = 1 which isn't useful.
   // FIXME: we could still hoist the assignment, and leave the variable there?
   ParsedBinaryOperator BinOp;
   if (BinOp.parse(*N) && BinaryOperator::isAssignmentOp(BinOp.Kind))
@@ -387,7 +387,7 @@ bool eligibleForExtraction(const SelectionTree::Node *N) {
   if (!Parent)
     return false;
   // We don't want to extract expressions used as statements, that would leave
-  // a `dummy;` around that has no effect.
+  // a `placeholder;` around that has no effect.
   // Unfortunately because the AST doesn't have ExprStmt, we have to check in
   // this roundabout way.
   if (childExprIsStmt(Parent->ASTNode.get<Stmt>(),
@@ -422,7 +422,7 @@ const SelectionTree::Node *computeExtractedExpr(const SelectionTree::Node *N) {
       llvm::isa<MemberExpr>(SelectedExpr))
     if (const SelectionTree::Node *Call = getCallExpr(N))
       TargetNode = Call;
-  // Extracting Exprs like a = 1 gives dummy = a = 1 which isn't useful.
+  // Extracting Exprs like a = 1 gives placeholder = a = 1 which isn't useful.
   if (const BinaryOperator *BinOpExpr =
           dyn_cast_or_null<BinaryOperator>(SelectedExpr)) {
     if (BinOpExpr->getOpcode() == BinaryOperatorKind::BO_Assign)
@@ -433,13 +433,13 @@ const SelectionTree::Node *computeExtractedExpr(const SelectionTree::Node *N) {
   return TargetNode;
 }
 
-/// Extracts an expression to the variable dummy
+/// Extracts an expression to the variable placeholder
 /// Before:
 /// int x = 5 + 4 * 3;
 ///         ^^^^^
 /// After:
-/// auto dummy = 5 + 4;
-/// int x = dummy * 3;
+/// auto placeholder = 5 + 4;
+/// int x = placeholder * 3;
 class ExtractVariable : public Tweak {
 public:
   const char *id() const override final;
@@ -476,7 +476,7 @@ bool ExtractVariable::prepare(const Selection &Inputs) {
 Expected<Tweak::Effect> ExtractVariable::apply(const Selection &Inputs) {
   tooling::Replacements Result;
   // FIXME: get variable name from user or suggest based on type
-  std::string VarName = "dummy";
+  std::string VarName = "placeholder";
   SourceRange Range = Target->getExtractionChars();
   // insert new variable declaration
   if (auto Err = Result.add(Target->insertDeclaration(VarName, Range)))

diff  --git a/clang-tools-extra/clangd/support/Trace.cpp b/clang-tools-extra/clangd/support/Trace.cpp
index d69b1c2bbde5..9cfc58c37733 100644
--- a/clang-tools-extra/clangd/support/Trace.cpp
+++ b/clang-tools-extra/clangd/support/Trace.cpp
@@ -112,14 +112,14 @@ class JSONTracer : public EventTracer {
             "s",
             llvm::json::Object{{"id", FlowID},
                                {"name", "Context crosses threads"},
-                               {"cat", "dummy"}},
+                               {"cat", "mock_cat"}},
             (*Parent)->TID, (*Parent)->StartTime);
         Tracer->jsonEvent(
             "f",
             llvm::json::Object{{"id", FlowID},
                                {"bp", "e"},
                                {"name", "Context crosses threads"},
-                               {"cat", "dummy"}},
+                               {"cat", "mock_cat"}},
             TID);
       }
     }

diff  --git a/clang-tools-extra/clangd/unittests/ClangdTests.cpp b/clang-tools-extra/clangd/unittests/ClangdTests.cpp
index 15320e8bd8e8..49e1f7aa93b6 100644
--- a/clang-tools-extra/clangd/unittests/ClangdTests.cpp
+++ b/clang-tools-extra/clangd/unittests/ClangdTests.cpp
@@ -407,9 +407,9 @@ TEST(ClangdServerTest, SearchLibDir) {
 
   // Put crtbegin.o into LibDir/64 to trick clang into thinking there's a gcc
   // installation there.
-  SmallString<64> DummyLibFile;
-  llvm::sys::path::append(DummyLibFile, LibDir, "64", "crtbegin.o");
-  FS.Files[DummyLibFile] = "";
+  SmallString<64> MockLibFile;
+  llvm::sys::path::append(MockLibFile, LibDir, "64", "crtbegin.o");
+  FS.Files[MockLibFile] = "";
 
   SmallString<64> IncludeDir("/randomusr/include/c++");
   llvm::sys::path::append(IncludeDir, Version);

diff  --git a/clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp b/clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
index 2ec64128485b..9c02f697d46c 100644
--- a/clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
+++ b/clang-tools-extra/clangd/unittests/GlobalCompilationDatabaseTests.cpp
@@ -463,7 +463,9 @@ MATCHER_P2(hasFlag, Flag, Path, "") {
   return true;
 }
 
-auto hasFlag(llvm::StringRef Flag) { return hasFlag(Flag, "dummy.cc"); }
+auto hasFlag(llvm::StringRef Flag) {
+  return hasFlag(Flag, "mock_file_name.cc");
+}
 
 TEST_F(DirectoryBasedGlobalCompilationDatabaseCacheTest, Cacheable) {
   MockFS FS;
@@ -507,15 +509,15 @@ TEST_F(DirectoryBasedGlobalCompilationDatabaseCacheTest, Cacheable) {
   // compile_commands.json takes precedence over compile_flags.txt.
   FS.Files["foo/compile_commands.json"] =
       llvm::formatv(R"json([{
-    "file": "{0}/foo/dummy.cc",
-    "command": "clang -DBAZ dummy.cc",
+    "file": "{0}/foo/mock_file.cc",
+    "command": "clang -DBAZ mock_file.cc",
     "directory": "{0}/foo",
   }])json",
                     llvm::sys::path::convert_to_slash(testRoot()));
   EXPECT_EQ(FooBar, lookupCDB(GDB, testPath("foo/test.cc"), Stale))
       << "cache still valid";
   auto Baz = lookupCDB(GDB, testPath("foo/test.cc"), Fresh);
-  EXPECT_THAT(Baz, hasFlag("-DBAZ", testPath("foo/dummy.cc")))
+  EXPECT_THAT(Baz, hasFlag("-DBAZ", testPath("foo/mock_file.cc")))
       << "compile_commands overrides compile_flags";
 
   // Removing compile_commands.json reveals compile_flags.txt again.

diff  --git a/clang-tools-extra/clangd/unittests/RenameTests.cpp b/clang-tools-extra/clangd/unittests/RenameTests.cpp
index 5b35ac00d888..f917e30cd7fe 100644
--- a/clang-tools-extra/clangd/unittests/RenameTests.cpp
+++ b/clang-tools-extra/clangd/unittests/RenameTests.cpp
@@ -844,7 +844,7 @@ TEST(RenameTest, Renameable) {
     const char *Code;
     const char* ErrorMessage; // null if no error
     bool IsHeaderFile;
-    llvm::StringRef NewName = "DummyName";
+    llvm::StringRef NewName = "MockName";
   };
   const bool HeaderFile = true;
   Case Cases[] = {

diff  --git a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
index 5f8faf78df3c..d68cb3efa3d6 100644
--- a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
+++ b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
@@ -71,7 +71,7 @@ MATCHER_P2(TUState, PreambleActivity, ASTActivity, "") {
   return true;
 }
 
-// Dummy ContextProvider to verify the provider is invoked & contexts are used.
+// Simple ContextProvider to verify the provider is invoked & contexts are used.
 static Key<std::string> BoundPath;
 Context bindPath(PathRef F) {
   return Context::current().derive(BoundPath, F.str());

diff  --git a/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp b/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp
index 4e9223cfe553..5862d4938d4a 100644
--- a/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp
+++ b/clang-tools-extra/clangd/unittests/tweaks/ExtractVariableTests.cpp
@@ -131,7 +131,7 @@ TEST_F(ExtractVariableTest, Test) {
                    int a = 5 * (4 + (3 [[- 1)]]);
                  })cpp",
        R"cpp(void varDecl() {
-                   auto dummy = (3 - 1); int a = 5 * (4 + dummy);
+                   auto placeholder = (3 - 1); int a = 5 * (4 + placeholder);
                  })cpp"},
       // FIXME: extraction from switch case
       /*{R"cpp(void f(int a) {
@@ -146,11 +146,11 @@ TEST_F(ExtractVariableTest, Test) {
                    }
              })cpp",
        R"cpp(void f(int a) {
-               auto dummy = 1 + 2; if(1)
+               auto placeholder = 1 + 2; if(1)
                  while(a < 1)
                    switch (1) {
                        case 1:
-                         a = dummy;
+                         a = placeholder;
                          break;
                        default:
                          break;
@@ -164,11 +164,11 @@ TEST_F(ExtractVariableTest, Test) {
        /*FIXME: It should be extracted like this.
         R"cpp(#define PLUS(x) x++
               void f(int a) {
-                auto dummy = 1+a; int y = PLUS(dummy);
+                auto placeholder = 1+a; int y = PLUS(placeholder);
               })cpp"},*/
        R"cpp(#define PLUS(x) x++
                  void f(int a) {
-                   auto dummy = PLUS(1+a); int y = dummy;
+                   auto placeholder = PLUS(1+a); int y = placeholder;
                  })cpp"},
       // ensure InsertionPoint isn't inside a macro
       {R"cpp(#define LOOP(x) while (1) {a = x;}
@@ -178,8 +178,8 @@ TEST_F(ExtractVariableTest, Test) {
                  })cpp",
        R"cpp(#define LOOP(x) while (1) {a = x;}
                  void f(int a) {
-                   auto dummy = 3; if(1)
-                    LOOP(5 + dummy)
+                   auto placeholder = 3; if(1)
+                    LOOP(5 + placeholder)
                  })cpp"},
       {R"cpp(#define LOOP(x) do {x;} while(1);
                  void f(int a) {
@@ -188,15 +188,15 @@ TEST_F(ExtractVariableTest, Test) {
                  })cpp",
        R"cpp(#define LOOP(x) do {x;} while(1);
                  void f(int a) {
-                   auto dummy = 3; if(1)
-                    LOOP(5 + dummy)
+                   auto placeholder = 3; if(1)
+                    LOOP(5 + placeholder)
                  })cpp"},
       // attribute testing
       {R"cpp(void f(int a) {
                     [ [gsl::suppress("type")] ] for (;;) a = [[1]] + 1;
                  })cpp",
        R"cpp(void f(int a) {
-                    auto dummy = 1; [ [gsl::suppress("type")] ] for (;;) a = dummy + 1;
+                    auto placeholder = 1; [ [gsl::suppress("type")] ] for (;;) a = placeholder + 1;
                  })cpp"},
       // MemberExpr
       {R"cpp(class T {
@@ -206,7 +206,7 @@ TEST_F(ExtractVariableTest, Test) {
                  };)cpp",
        R"cpp(class T {
                    T f() {
-                     auto dummy = T().f(); return dummy.f();
+                     auto placeholder = T().f(); return placeholder.f();
                    }
                  };)cpp"},
       // Function DeclRefExpr
@@ -214,7 +214,7 @@ TEST_F(ExtractVariableTest, Test) {
                    return [[f]]();
                  })cpp",
        R"cpp(int f() {
-                   auto dummy = f(); return dummy;
+                   auto placeholder = f(); return placeholder;
                  })cpp"},
       // FIXME: Wrong result for \[\[clang::uninitialized\]\] int b = [[1]];
       // since the attr is inside the DeclStmt and the bounds of
@@ -225,33 +225,33 @@ TEST_F(ExtractVariableTest, Test) {
                    int x = 1 + [[2 + 3 + 4]] + 5;
                  })cpp",
        R"cpp(void f() {
-                   auto dummy = 2 + 3 + 4; int x = 1 + dummy + 5;
+                   auto placeholder = 2 + 3 + 4; int x = 1 + placeholder + 5;
                  })cpp"},
       {R"cpp(void f() {
                    int x = [[1 + 2 + 3]] + 4 + 5;
                  })cpp",
        R"cpp(void f() {
-                   auto dummy = 1 + 2 + 3; int x = dummy + 4 + 5;
+                   auto placeholder = 1 + 2 + 3; int x = placeholder + 4 + 5;
                  })cpp"},
       {R"cpp(void f() {
                    int x = 1 + 2 + [[3 + 4 + 5]];
                  })cpp",
        R"cpp(void f() {
-                   auto dummy = 3 + 4 + 5; int x = 1 + 2 + dummy;
+                   auto placeholder = 3 + 4 + 5; int x = 1 + 2 + placeholder;
                  })cpp"},
       // Non-associative operations have no special support
       {R"cpp(void f() {
                    int x = 1 - [[2 - 3 - 4]] - 5;
                  })cpp",
        R"cpp(void f() {
-                   auto dummy = 1 - 2 - 3 - 4; int x = dummy - 5;
+                   auto placeholder = 1 - 2 - 3 - 4; int x = placeholder - 5;
                  })cpp"},
       // A mix of associative operators isn't associative.
       {R"cpp(void f() {
                    int x = 0 + 1 * [[2 + 3]] * 4 + 5;
                  })cpp",
        R"cpp(void f() {
-                   auto dummy = 1 * 2 + 3 * 4; int x = 0 + dummy + 5;
+                   auto placeholder = 1 * 2 + 3 * 4; int x = 0 + placeholder + 5;
                  })cpp"},
       // Overloaded operators are supported, we assume associativity
       // as if they were built-in.
@@ -269,7 +269,7 @@ TEST_F(ExtractVariableTest, Test) {
                  S operator+(S, S);
 
                  void f() {
-                   auto dummy = S(2) + S(3) + S(4); S x = S(1) + dummy + S(5);
+                   auto placeholder = S(2) + S(3) + S(4); S x = S(1) + placeholder + S(5);
                  })cpp"},
       // Don't try to analyze across macro boundaries
       // FIXME: it'd be nice to do this someday (in a safe way)
@@ -279,7 +279,7 @@ TEST_F(ExtractVariableTest, Test) {
                  })cpp",
        R"cpp(#define ECHO(X) X
                  void f() {
-                   auto dummy = 1 + ECHO(2 + 3) + 4; int x = dummy + 5;
+                   auto placeholder = 1 + ECHO(2 + 3) + 4; int x = placeholder + 5;
                  })cpp"},
       {R"cpp(#define ECHO(X) X
                  void f() {
@@ -287,7 +287,7 @@ TEST_F(ExtractVariableTest, Test) {
                  })cpp",
        R"cpp(#define ECHO(X) X
                  void f() {
-                   auto dummy = 1 + ECHO(2) + ECHO(3) + 4; int x = dummy + 5;
+                   auto placeholder = 1 + ECHO(2) + ECHO(3) + 4; int x = placeholder + 5;
                  })cpp"},
   };
   for (const auto &IO : InputOutputs) {


        


More information about the cfe-commits mailing list