diff options
author | Haojian Wu <hokein.wu@gmail.com> | 2020-05-08 16:13:17 +0200 |
---|---|---|
committer | Haojian Wu <hokein.wu@gmail.com> | 2020-05-11 08:46:18 +0200 |
commit | 8222107aa9249aada81334c922a2d284042242ed (patch) | |
tree | ed5af4f55b5a4d93024aa66b1a3915f4eb7a0d89 /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 20629ca949cddde9f7e41a4b9e8539a970615feb (diff) | |
download | llvm-8222107aa9249aada81334c922a2d284042242ed.zip llvm-8222107aa9249aada81334c922a2d284042242ed.tar.gz llvm-8222107aa9249aada81334c922a2d284042242ed.tar.bz2 |
[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
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
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); |