diff --git a/include/swift/AST/DiagnosticsParse.def b/include/swift/AST/DiagnosticsParse.def index 3e6a8d8f99e..b420d438b4d 100644 --- a/include/swift/AST/DiagnosticsParse.def +++ b/include/swift/AST/DiagnosticsParse.def @@ -1585,8 +1585,8 @@ ERROR(availability_query_repeated_platform, none, //------------------------------------------------------------------------------ // syntax parsing diagnostics //------------------------------------------------------------------------------ -WARNING(unknown_syntax_entity, PointsToFirstBadToken, - "unknown %0 syntax exists in the source", (StringRef)) +ERROR(unknown_syntax_entity, PointsToFirstBadToken, + "unknown %0 syntax exists in the source", (StringRef)) #ifndef DIAG_NO_UNDEF # if defined(DIAG) diff --git a/include/swift/Option/FrontendOptions.td b/include/swift/Option/FrontendOptions.td index 7308af13e61..c09c6a3b7e1 100644 --- a/include/swift/Option/FrontendOptions.td +++ b/include/swift/Option/FrontendOptions.td @@ -81,6 +81,9 @@ def verify_generic_signatures : Separate<["-"], "verify-generic-signatures">, MetaVarName<"">, HelpText<"Verify the generic signatures in the given module">; +def verify_syntax_tree : Flag<["-"], "verify-syntax-tree">, + HelpText<"Verify that no unknown nodes exist in the libSyntax tree">; + def show_diagnostics_after_fatal : Flag<["-"], "show-diagnostics-after-fatal">, HelpText<"Keep emitting subsequent diagnostics after a fatal error">; diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 8af50c86407..21ef308c12d 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -214,6 +214,11 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args, Opts.NamedLazyMemberLoading &= !Args.hasArg(OPT_disable_named_lazy_member_loading); Opts.DebugGenericSignatures |= Args.hasArg(OPT_debug_generic_signatures); + if (Args.hasArg(OPT_verify_syntax_tree)) { + Opts.BuildSyntaxTree = true; + Opts.VerifySyntaxTree = true; + } + Opts.DebuggerSupport |= Args.hasArg(OPT_debugger_support); if (Opts.DebuggerSupport) Opts.EnableDollarIdentifiers = true; diff --git a/test/Syntax/syntax_diagnostics.swift b/test/Syntax/syntax_diagnostics.swift index d17ab38b363..e97652902e6 100644 --- a/test/Syntax/syntax_diagnostics.swift +++ b/test/Syntax/syntax_diagnostics.swift @@ -1,3 +1,3 @@ // RUN: %target-swift-frontend -emit-syntax -primary-file %s -verify -typealias Inner: Foo // expected-warning{{unknown declaration syntax exists in the source}} expected-error{{expected '=' in type alias declaration}} +typealias Inner: Foo // expected-error{{unknown declaration syntax exists in the source}} expected-error{{expected '=' in type alias declaration}}