[PATCH] D79160: [AST] Preserve the type in RecoveryExprs for broken function calls.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 30 02:25:35 PDT 2020


hokein created this revision.
Herald added subscribers: cfe-commits, arphaman.
Herald added a project: clang.

RecoveryExprs was 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).^") will still
work.

However, adding the type is ricky, 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.

Tested:

- all existing tests are passed (when both "-frecovery-ast", "-frecovery-ast-type" flags are flipped on);


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79160

Files:
  clang/include/clang/AST/Expr.h
  clang/include/clang/Basic/LangOptions.def
  clang/include/clang/Driver/CC1Options.td
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/ComputeDependence.cpp
  clang/lib/AST/Expr.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaDeclCXX.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaOverload.cpp
  clang/test/AST/ast-dump-recovery.cpp
  clang/test/CodeCompletion/member-access.cpp
  clang/test/Index/getcursor-recovery.cpp
  clang/test/SemaCXX/enable_if.cpp
  clang/test/SemaCXX/recovery-expr-type.cpp
  clang/test/SemaTemplate/instantiate-function-params.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79160.261157.patch
Type: text/x-patch
Size: 23004 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200430/21560014/attachment-0001.bin>


More information about the cfe-commits mailing list