reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced

References

tools/clang/unittests/Format/FormatTest.cpp
14368   FileID ID = Context.createInMemoryFile("format.cpp", Code);
14370       {tooling::Replacement(Context.Sources, Context.getLocation(ID, 1, 1), 6,
14370       {tooling::Replacement(Context.Sources, Context.getLocation(ID, 1, 1), 6,
14372        tooling::Replacement(Context.Sources, Context.getLocation(ID, 3, 10), 1,
14372        tooling::Replacement(Context.Sources, Context.getLocation(ID, 3, 10), 1,
14374        tooling::Replacement(Context.Sources, Context.getLocation(ID, 4, 3), 1,
14374        tooling::Replacement(Context.Sources, Context.getLocation(ID, 4, 3), 1,
14376        tooling::Replacement(Context.Sources, Context.getLocation(ID, 4, 13), 1,
14376        tooling::Replacement(Context.Sources, Context.getLocation(ID, 4, 13), 1,
14403   FileID ID = Context.createInMemoryFile("fix.cpp", Code);
14405       {tooling::Replacement(Context.Sources, Context.getLocation(ID, 1, 1), 0,
14405       {tooling::Replacement(Context.Sources, Context.getLocation(ID, 1, 1), 0,
tools/clang/unittests/Tooling/RefactoringTest.cpp
   37   FileID ID = Context.createInMemoryFile("input.cpp", "text");
   38   SourceLocation Location = Context.getLocation(ID, 1, 1);
   40   EXPECT_TRUE(Replace.apply(Context.Rewrite));
   41   EXPECT_EQ("", Context.getRewrittenText(ID));
   45   FileID ID = Context.createInMemoryFile("input.cpp", "line1\nline2\nline3");
   46   SourceLocation Location = Context.getLocation(ID, 1, 1);
   48   EXPECT_TRUE(Replace.apply(Context.Rewrite));
   49   EXPECT_EQ("", Context.getRewrittenText(ID));
   53   FileID ID = Context.createInMemoryFile("input.cpp", "");
   54   SourceLocation Location = Context.getLocation(ID, 1, 1);
   56   EXPECT_TRUE(Replace.apply(Context.Rewrite));
   57   EXPECT_EQ("result", Context.getRewrittenText(ID));
   61   FileID ID = Context.createInMemoryFile("input.cpp",
   63   SourceLocation Location = Context.getLocation(ID, 2, 3);
   65   EXPECT_TRUE(Replace.apply(Context.Rewrite));
   66   EXPECT_EQ("line1\nlixne4", Context.getRewrittenText(ID));
   70   FileID ID = Context.createInMemoryFile("input.cpp",
   72   SourceLocation Location1 = Context.getLocation(ID, 2, 3);
   74   EXPECT_TRUE(Replace1.apply(Context.Rewrite));
   75   EXPECT_EQ("line1\nlix\ny\nne4", Context.getRewrittenText(ID));
   79   SourceLocation Location2 = Context.getLocation(ID, 4, 4);
   81   EXPECT_TRUE(Replace2.apply(Context.Rewrite));
   82   EXPECT_EQ("line1\nlix\ny\nnf4", Context.getRewrittenText(ID));
   87   EXPECT_FALSE(Replace.apply(Context.Rewrite));
   96   Replacement Replace1(Context.Sources, SourceLocation(), 0, "");
  433   FileID ID = Context.createInMemoryFile("input.cpp",
  436       toReplacements({Replacement(Context.Sources,
  437                                   Context.getLocation(ID, 2, 1), 5, "replaced"),
  438                       Replacement(Context.Sources,
  439                                   Context.getLocation(ID, 3, 1), 5, "other")});
  440   EXPECT_TRUE(applyAllReplacements(Replaces, Context.Rewrite));
  441   EXPECT_EQ("line1\nreplaced\nother\nline4", Context.getRewrittenText(ID));
  447   FileID ID = Context.createInMemoryFile("input.cpp",
  450       {Replacement(Context.Sources, Context.getLocation(ID, 2, 1), 6, ""),
  450       {Replacement(Context.Sources, Context.getLocation(ID, 2, 1), 6, ""),
  451        Replacement(Context.Sources, Context.getLocation(ID, 2, 1), 0,
  451        Replacement(Context.Sources, Context.getLocation(ID, 2, 1), 0,
  453   EXPECT_TRUE(applyAllReplacements(Replaces, Context.Rewrite));
  454   EXPECT_EQ("line1\nother\nline3\nline4", Context.getRewrittenText(ID));
  458   FileID ID = Context.createInMemoryFile("input.cpp",
  461       {Replacement(Context.Sources, Context.getLocation(ID, 1, 1), 1, "x"),
  461       {Replacement(Context.Sources, Context.getLocation(ID, 1, 1), 1, "x"),
  462        Replacement(Context.Sources, Context.getLocation(ID, 1, 2), 1, "y")});
  462        Replacement(Context.Sources, Context.getLocation(ID, 1, 2), 1, "y")});
  463   EXPECT_TRUE(applyAllReplacements(Replaces, Context.Rewrite));
  464   EXPECT_EQ("xy", Context.getRewrittenText(ID));
  468   FileID ID = Context.createInMemoryFile("input.cpp",
  471       Context.Sources, Context.getLocation(ID, 2, 1), 5, "replaced")});
  471       Context.Sources, Context.getLocation(ID, 2, 1), 5, "replaced")});
  474       Context.Sources, Context.getLocation(ID, 2, 1), 5, "replaced"));
  474       Context.Sources, Context.getLocation(ID, 2, 1), 5, "replaced"));
  478   Err = Replaces.add(Replacement(Context.Sources, Context.getLocation(ID, 2, 1),
  478   Err = Replaces.add(Replacement(Context.Sources, Context.getLocation(ID, 2, 1),
  483   EXPECT_TRUE(applyAllReplacements(Replaces, Context.Rewrite));
  484   EXPECT_EQ("line1\nreplaced\nline3\nline4", Context.getRewrittenText(ID));
  488   FileID ID = Context.createInMemoryFile("input.cpp",
  491       Context.Sources, Context.getLocation(ID, 2, 1), 5, "other")});
  491       Context.Sources, Context.getLocation(ID, 2, 1), 5, "other")});
  493   Replacement ConflictReplacement(Context.Sources,
  494                                   Context.getLocation(ID, 2, 1), 5, "rehto");
  500   EXPECT_TRUE(applyAllReplacements(Replaces, Context.Rewrite));
  501   EXPECT_EQ("line1\nother\nline3\nline4", Context.getRewrittenText(ID));
  506       toReplacements({Replacement(Context.Sources, SourceLocation(), 5, "2")});
  508   EXPECT_FALSE(applyAllReplacements(Replaces, Context.Rewrite));
  526   FileID ID1 = Context.createInMemoryFile(File1, Code1);
  527   FileID ID2 = Context.createInMemoryFile(File2, Code2);
  532       {tooling::Replacement(Context.Sources, Context.getLocation(ID1, 1, 1), 6,
  532       {tooling::Replacement(Context.Sources, Context.getLocation(ID1, 1, 1), 6,
  534        tooling::Replacement(Context.Sources, Context.getLocation(ID1, 3, 10), 1,
  534        tooling::Replacement(Context.Sources, Context.getLocation(ID1, 3, 10), 1,
  537       {tooling::Replacement(Context.Sources, Context.getLocation(ID2, 1, 12), 0,
  537       {tooling::Replacement(Context.Sources, Context.getLocation(ID2, 1, 12), 0,
  539        tooling::Replacement(Context.Sources, Context.getLocation(ID2, 2, 9), 1,
  539        tooling::Replacement(Context.Sources, Context.getLocation(ID2, 2, 9), 1,
  542       formatAndApplyAllReplacements(FileToReplaces, Context.Rewrite,
  544   EXPECT_EQ(Expected1, Context.getRewrittenText(ID1));
  545   EXPECT_EQ(Expected2, Context.getRewrittenText(ID2));
tools/clang/unittests/Tooling/ReplacementTest.h
   45     return tooling::Replacement(Context.Sources, Start, Length,