@@ -104,6 +104,7 @@ void anchorForGetMainExecutable() {}
104
104
105
105
int getSyntaxTree (const char *MainExecutablePath,
106
106
const StringRef InputFilename,
107
+ CompilerInstance &Instance,
107
108
llvm::SmallVectorImpl<syntax::Syntax> &TopLevelDecls,
108
109
std::vector<std::pair<RC<syntax::TokenSyntax>,
109
110
syntax::AbsolutePosition>> &Tokens) {
@@ -115,7 +116,6 @@ int getSyntaxTree(const char *MainExecutablePath,
115
116
reinterpret_cast <void *>(&anchorForGetMainExecutable)));
116
117
117
118
Invocation.setModuleName (" Test" );
118
- CompilerInstance Instance;
119
119
120
120
auto &SourceMgr = Instance.getSourceMgr ();
121
121
@@ -219,8 +219,10 @@ int doFullParseRoundTrip(const char *MainExecutablePath,
219
219
llvm::SmallVector<syntax::Syntax, 10 > TopLevelDecls;
220
220
std::vector<std::pair<RC<syntax::TokenSyntax>,
221
221
syntax::AbsolutePosition>> Tokens;
222
+ CompilerInstance Instance;
222
223
223
- getSyntaxTree (MainExecutablePath, InputFilename, TopLevelDecls, Tokens);
224
+ getSyntaxTree (MainExecutablePath, InputFilename, Instance,
225
+ TopLevelDecls, Tokens);
224
226
225
227
for (auto &Node : TopLevelDecls) {
226
228
Node.print (llvm::outs ());
@@ -239,8 +241,10 @@ int doSerializeRawTree(const char *MainExecutablePath,
239
241
llvm::SmallVector<syntax::Syntax, 10 > TopLevelDecls;
240
242
std::vector<std::pair<RC<syntax::TokenSyntax>,
241
243
syntax::AbsolutePosition>> Tokens;
244
+ CompilerInstance Instance;
242
245
243
- getSyntaxTree (MainExecutablePath, InputFilename, TopLevelDecls, Tokens);
246
+ getSyntaxTree (MainExecutablePath, InputFilename, Instance,
247
+ TopLevelDecls, Tokens);
244
248
245
249
for (auto &Node : TopLevelDecls) {
246
250
swift::json::Output out (llvm::outs ());
0 commit comments