From 8222107aa9249aada81334c922a2d284042242ed Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Fri, 8 May 2020 16:13:17 +0200 Subject: [AST] Preserve the type in RecoveryExprs for broken function calls. RecoveryExprs are modeled as dependent type to prevent bogus diagnostics and crashes in clang. This patch allows to preseve the type for broken calls when the RecoveryEprs have a known type, e.g. a broken non-overloaded call, a overloaded call when the all candidates have the same return type, so that more features (code completion still work on "take2args(x).^") still work. However, adding the type is risky, which may result in more clang code being affected leading to new crashes and hurt diagnostic, and it requires large effort to minimize the affect (update all sites in clang to handle errorDepend case), so we add a new flag (off by default) to allow us to develop/test them incrementally. This patch also has some trivial fixes to suppress diagnostics (to prevent regressions). Tested: all existing tests are passed (when both "-frecovery-ast", "-frecovery-ast-type" flags are flipped on); Reviewed By: sammccall Subscribers: rsmith, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D79160 --- clang/lib/Frontend/CompilerInvocation.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'clang/lib/Frontend/CompilerInvocation.cpp') diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index e3a57d6..c5166ad 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -2890,6 +2890,8 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, Diags.Report(diag::warn_fe_concepts_ts_flag); Opts.RecoveryAST = Args.hasFlag(OPT_frecovery_ast, OPT_fno_recovery_ast, false); + Opts.RecoveryASTType = ++ Args.hasFlag(OPT_frecovery_ast_type, OPT_fno_recovery_ast_type, false); Opts.HeinousExtensions = Args.hasArg(OPT_fheinous_gnu_extensions); Opts.AccessControl = !Args.hasArg(OPT_fno_access_control); Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors); -- cgit v1.1