Lines Matching refs:Context

38     return Replacement(Context.Sources, Start, Length, ReplacementText);  in createReplacement()
41 RewriterTestContext Context; member in clang::tooling::ReplacementTest
45 FileID ID = Context.createInMemoryFile("input.cpp", "text"); in TEST_F()
46 SourceLocation Location = Context.getLocation(ID, 1, 1); in TEST_F()
48 EXPECT_TRUE(Replace.apply(Context.Rewrite)); in TEST_F()
49 EXPECT_EQ("", Context.getRewrittenText(ID)); in TEST_F()
53 FileID ID = Context.createInMemoryFile("input.cpp", "line1\nline2\nline3"); in TEST_F()
54 SourceLocation Location = Context.getLocation(ID, 1, 1); in TEST_F()
56 EXPECT_TRUE(Replace.apply(Context.Rewrite)); in TEST_F()
57 EXPECT_EQ("", Context.getRewrittenText(ID)); in TEST_F()
61 FileID ID = Context.createInMemoryFile("input.cpp", ""); in TEST_F()
62 SourceLocation Location = Context.getLocation(ID, 1, 1); in TEST_F()
64 EXPECT_TRUE(Replace.apply(Context.Rewrite)); in TEST_F()
65 EXPECT_EQ("result", Context.getRewrittenText(ID)); in TEST_F()
69 FileID ID = Context.createInMemoryFile("input.cpp", in TEST_F()
71 SourceLocation Location = Context.getLocation(ID, 2, 3); in TEST_F()
73 EXPECT_TRUE(Replace.apply(Context.Rewrite)); in TEST_F()
74 EXPECT_EQ("line1\nlixne4", Context.getRewrittenText(ID)); in TEST_F()
78 FileID ID = Context.createInMemoryFile("input.cpp", in TEST_F()
80 SourceLocation Location1 = Context.getLocation(ID, 2, 3); in TEST_F()
82 EXPECT_TRUE(Replace1.apply(Context.Rewrite)); in TEST_F()
83 EXPECT_EQ("line1\nlix\ny\nne4", Context.getRewrittenText(ID)); in TEST_F()
87 SourceLocation Location2 = Context.getLocation(ID, 4, 4); in TEST_F()
89 EXPECT_TRUE(Replace2.apply(Context.Rewrite)); in TEST_F()
90 EXPECT_EQ("line1\nlix\ny\nnf4", Context.getRewrittenText(ID)); in TEST_F()
95 EXPECT_FALSE(Replace.apply(Context.Rewrite)); in TEST_F()
104 Replacement Replace1(Context.Sources, SourceLocation(), 0, ""); in TEST_F()
112 FileID ID = Context.createInMemoryFile("input.cpp", in TEST_F()
115 Replaces.insert(Replacement(Context.Sources, Context.getLocation(ID, 2, 1), in TEST_F()
117 Replaces.insert(Replacement(Context.Sources, Context.getLocation(ID, 3, 1), in TEST_F()
119 EXPECT_TRUE(applyAllReplacements(Replaces, Context.Rewrite)); in TEST_F()
120 EXPECT_EQ("line1\nreplaced\nother\nline4", Context.getRewrittenText(ID)); in TEST_F()
127 FileID ID = Context.createInMemoryFile("input.cpp", in TEST_F()
130 Replaces.push_back(Replacement(Context.Sources, Context.getLocation(ID, 2, 1), in TEST_F()
133 Replacement(Context.Sources, Context.getLocation(ID, 3, 1), 5, "other")); in TEST_F()
134 EXPECT_TRUE(applyAllReplacements(Replaces, Context.Rewrite)); in TEST_F()
135 EXPECT_EQ("line1\nreplaced\nother\nline4", Context.getRewrittenText(ID)); in TEST_F()
139 FileID ID = Context.createInMemoryFile("input.cpp", in TEST_F()
142 Replaces.insert(Replacement(Context.Sources, Context.getLocation(ID, 2, 1), in TEST_F()
144 Replaces.insert(Replacement(Context.Sources, Context.getLocation(ID, 2, 1), in TEST_F()
146 Replaces.insert(Replacement(Context.Sources, Context.getLocation(ID, 2, 1), in TEST_F()
148 EXPECT_TRUE(applyAllReplacements(Replaces, Context.Rewrite)); in TEST_F()
149 EXPECT_EQ("line1\nreplaced\nline3\nline4", Context.getRewrittenText(ID)); in TEST_F()
155 FileID IDa = Context.createInMemoryFile("a.cpp", "text"); in TEST_F()
156 FileID IDz = Context.createInMemoryFile("z.cpp", "text"); in TEST_F()
158 Replaces.insert(Replacement(Context.Sources, Context.getLocation(IDa, 1, 1), in TEST_F()
160 Replaces.insert(Replacement(Context.Sources, SourceLocation(), in TEST_F()
162 Replaces.insert(Replacement(Context.Sources, Context.getLocation(IDz, 1, 1), in TEST_F()
164 EXPECT_FALSE(applyAllReplacements(Replaces, Context.Rewrite)); in TEST_F()
165 EXPECT_EQ("a", Context.getRewrittenText(IDa)); in TEST_F()
166 EXPECT_EQ("z", Context.getRewrittenText(IDz)); in TEST_F()
246 const FileEntry *File = Context.Files.getFile(Path); in createFile()
253 return Context.Sources.createFileID(File, SourceLocation(), SrcMgr::C_User); in createFile()
264 auto FileBuffer = Context.Files.getBufferForFile(Path); in getFileContentFromDisk()
269 RewriterTestContext Context; member in clang::tooling::FlushRewrittenFilesTest
275 Replaces.insert(Replacement(Context.Sources, Context.getLocation(ID, 2, 1), in TEST_F()
277 EXPECT_TRUE(applyAllReplacements(Replaces, Context.Rewrite)); in TEST_F()
278 EXPECT_FALSE(Context.Rewrite.overwriteChangedFiles()); in TEST_F()
293 clang::ASTContext *Context; member in clang::tooling::__anon1febf4170111::TestVisitor
300 void HandleTranslationUnit(clang::ASTContext &Context) override { in HandleTranslationUnit() argument
301 Visitor->TraverseDecl(Context.getTranslationUnitDecl()); in HandleTranslationUnit()
316 Visitor->Context = &compiler.getASTContext(); in CreateASTConsumer()
389 Replace = Replacement(*SM, &NNSLoc, "", Context->getLangOpts()); in TraverseNestedNameSpecifierLoc()