Home | History | Annotate | Download | only in Tooling

Lines Matching full:context

38     return Replacement(Context.Sources, Start, Length, ReplacementText);
41 RewriterTestContext Context;
45 FileID ID = Context.createInMemoryFile("input.cpp", "text");
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", "line1\nline2\nline3");
54 SourceLocation Location = Context.getLocation(ID, 1, 1);
56 EXPECT_TRUE(Replace.apply(Context.Rewrite));
57 EXPECT_EQ("", Context.getRewrittenText(ID));
61 FileID ID = Context.createInMemoryFile("input.cpp", "");
62 SourceLocation Location = Context.getLocation(ID, 1, 1);
64 EXPECT_TRUE(Replace.apply(Context.Rewrite));
65 EXPECT_EQ("result", Context.getRewrittenText(ID));
69 FileID ID = Context.createInMemoryFile("input.cpp",
71 SourceLocation Location = Context.getLocation(ID, 2, 3);
73 EXPECT_TRUE(Replace.apply(Context.Rewrite));
74 EXPECT_EQ("line1\nlixne4", Context.getRewrittenText(ID));
78 FileID ID = Context.createInMemoryFile("input.cpp",
80 SourceLocation Location1 = Context.getLocation(ID, 2, 3);
82 EXPECT_TRUE(Replace1.apply(Context.Rewrite));
83 EXPECT_EQ("line1\nlix\ny\nne4", Context.getRewrittenText(ID));
87 SourceLocation Location2 = Context.getLocation(ID, 4, 4);
89 EXPECT_TRUE(Replace2.apply(Context.Rewrite));
90 EXPECT_EQ("line1\nlix\ny\nnf4", Context.getRewrittenText(ID));
95 EXPECT_FALSE(Replace.apply(Context.Rewrite));
104 Replacement Replace1(Context.Sources, SourceLocation(), 0, "");
112 FileID ID = Context.createInMemoryFile("input.cpp",
115 Replaces.insert(Replacement(Context.Sources, Context.getLocation(ID, 2, 1),
117 Replaces.insert(Replacement(Context.Sources, Context.getLocation(ID, 3, 1),
119 EXPECT_TRUE(applyAllReplacements(Replaces, Context.Rewrite));
120 EXPECT_EQ("line1\nreplaced\nother\nline4", Context.getRewrittenText(ID));
124 FileID ID = Context.createInMemoryFile("input.cpp",
127 Replaces.insert(Replacement(Context.Sources, Context.getLocation(ID, 2, 1),
129 Replaces.insert(Replacement(Context.Sources, Context.getLocation(ID, 2, 1),
131 Replaces.insert(Replacement(Context.Sources, Context.getLocation(ID, 2, 1),
133 EXPECT_TRUE(applyAllReplacements(Replaces, Context.Rewrite));
134 EXPECT_EQ("line1\nreplaced\nline3\nline4", Context.getRewrittenText(ID));
140 FileID IDa = Context.createInMemoryFile("a.cpp", "text");
141 FileID IDz = Context.createInMemoryFile("z.cpp", "text");
143 Replaces.insert(Replacement(Context.Sources, Context.getLocation(IDa, 1, 1),
145 Replaces.insert(Replacement(Context.Sources, SourceLocation(),
147 Replaces.insert(Replacement(Context.Sources, Context.getLocation(IDz, 1, 1),
149 EXPECT_FALSE(applyAllReplacements(Replaces, Context.Rewrite));
150 EXPECT_EQ("a", Context.getRewrittenText(IDa));
151 EXPECT_EQ("z", Context.getRewrittenText(IDz));
177 const FileEntry *File = Context.Files.getFile(Path);
179 return Context.Sources.createFileID(File, SourceLocation(), SrcMgr::C_User);
190 return Context.Files.getBufferForFile(Path, NULL)->getBuffer();
194 RewriterTestContext Context;
200 Replaces.insert(Replacement(Context.Sources, Context.getLocation(ID, 2, 1),
202 EXPECT_TRUE(applyAllReplacements(Replaces, Context.Rewrite));
203 EXPECT_FALSE(Context.Rewrite.overwriteChangedFiles());
224 virtual void HandleTranslationUnit(clang::ASTContext &Context) {
225 Visitor->TraverseDecl(Context.getTranslationUnitDecl());