[PATCH] D69330: [AST] Add RecoveryExpr to retain expressions on semantic errors

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 23 09:15:02 PDT 2020


sammccall accepted this revision.
sammccall added inline comments.


================
Comment at: clang/include/clang/Basic/LangOptions.def:151
 
+LANGOPT(RecoveryAST, 1, 0, "Preserve expressions in AST when encountering errors")
+
----------------
this should be COMPATIBLE_LANGOPT I believe - it affects semantics but not in a breaking way.


================
Comment at: clang/include/clang/Driver/CC1Options.td:569
 
+def frecovery_ast : Flag<["-"], "frecovery-ast">,
+  HelpText<"Preserve expressions in AST rather than dropping them when "
----------------
We'll want the positive and negative version of this flag because the default will be "sometimes". See fpadding_on_unsigned_fixed_point for such a pair.

This could be deferred to the next patch (as the default is false for now) but seems cleaner to introduce them together.


================
Comment at: clang/test/AST/ast-dump-recovery.cpp:1
+// RUN: not %clang_cc1 -triple x86_64-unknown-unknown -Wno-unused-value -fcxx-exceptions -std=gnu++17 -frecovery-ast -ast-dump %s | FileCheck -strict-whitespace %s
+
----------------
This is probably a good test to add a second run line with `-fno-recovery-ast` and `FileCheck -check-prefix=DISABLED` to test that the flag controls the behaviour.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69330/new/

https://reviews.llvm.org/D69330





More information about the cfe-commits mailing list