mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user