[PATCH] D81452: [AST] RecoveryAST options should only be enabled for C++ only.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 9 02:42:54 PDT 2020


hokein created this revision.
hokein added a reviewer: sammccall.
Herald added a project: clang.

The flag should be off for non-c++ files even there is a "-frecovery-ast" in
the commandline.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81452

Files:
  clang/lib/Frontend/CompilerInvocation.cpp


Index: clang/lib/Frontend/CompilerInvocation.cpp
===================================================================
--- clang/lib/Frontend/CompilerInvocation.cpp
+++ clang/lib/Frontend/CompilerInvocation.cpp
@@ -2885,10 +2885,16 @@
       !Args.hasArg(OPT_fno_concept_satisfaction_caching);
   if (Args.hasArg(OPT_fconcepts_ts))
     Diags.Report(diag::warn_fe_concepts_ts_flag);
+
+  // Recovery AST still heavily relies on dependent-type machinery, so C++ only
+  // for now.
   Opts.RecoveryAST =
-      Args.hasFlag(OPT_frecovery_ast, OPT_fno_recovery_ast, false);
+      Args.hasFlag(OPT_frecovery_ast, OPT_fno_recovery_ast, false) &&
+      Opts.CPlusPlus;
   Opts.RecoveryASTType =
-+      Args.hasFlag(OPT_frecovery_ast_type, OPT_fno_recovery_ast_type, false);
+      Args.hasFlag(OPT_frecovery_ast_type, OPT_fno_recovery_ast_type, false) &&
+      Opts.CPlusPlus;
+
   Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions);
   Opts.AccessControl = !Args.hasArg(OPT_fno_access_control);
   Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81452.269455.patch
Type: text/x-patch
Size: 1078 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200609/bcd43c28/attachment-0001.bin>


More information about the cfe-commits mailing list