[swift-syntax-test] Make VerifySyntaxTree a command line option (#15227)

Add `-verify-syntax-tree` option to `swift-syntax-test`.
Defaulted to `true`, can be disabled with `-verify-syntax-tree=false`
This commit is contained in:
Rintaro Ishizaki
2018-03-14 14:05:25 +09:00
committed by GitHub
parent c3335e53e9
commit 194a14346d

View File

@@ -101,6 +101,12 @@ PrintTrivialNodeKind("print-trivial-node-kind",
llvm::cl::cat(Category),
llvm::cl::init(false));
static llvm::cl::opt<bool>
VerifySyntaxTree("verify-syntax-tree",
llvm::cl::desc("Emit warnings for unknown nodes"),
llvm::cl::cat(Category),
llvm::cl::init(true));
static llvm::cl::opt<bool>
Visual("v",
llvm::cl::desc("Print visually"),
@@ -148,7 +154,7 @@ SourceFile *getSourceFile(CompilerInstance &Instance,
const char *MainExecutablePath) {
CompilerInvocation Invocation;
Invocation.getLangOptions().BuildSyntaxTree = true;
Invocation.getLangOptions().VerifySyntaxTree = true;
Invocation.getLangOptions().VerifySyntaxTree = options::VerifySyntaxTree;
Invocation.getFrontendOptions().InputsAndOutputs.addInputFile(InputFileName);
Invocation.setMainExecutablePath(
llvm::sys::fs::getMainExecutable(MainExecutablePath,