[all-commits] [llvm/llvm-project] 822210: [AST] Preserve the type in RecoveryExprs for broke...

Haojian Wu via All-commits all-commits at lists.llvm.org
Mon May 11 00:10:00 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 8222107aa9249aada81334c922a2d284042242ed
      https://github.com/llvm/llvm-project/commit/8222107aa9249aada81334c922a2d284042242ed
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2020-05-11 (Mon, 11 May 2020)

  Changed paths:
    M clang/include/clang/AST/Expr.h
    M clang/include/clang/Basic/LangOptions.def
    M clang/include/clang/Driver/CC1Options.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/AST/ComputeDependence.cpp
    M clang/lib/AST/Expr.cpp
    M clang/lib/Frontend/CompilerInvocation.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/lib/Sema/SemaOverload.cpp
    M clang/test/AST/ast-dump-recovery.cpp
    M clang/test/CodeCompletion/member-access.cpp
    M clang/test/Index/getcursor-recovery.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list