[all-commits] [llvm/llvm-project] e0cdaf: [AST] Better recovery on an expression refers to a...

Haojian Wu via All-commits all-commits at lists.llvm.org
Thu Sep 22 05:31:57 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e0cdafe8d4b2f1585f4756447b677fec37954ec4
      https://github.com/llvm/llvm-project/commit/e0cdafe8d4b2f1585f4756447b677fec37954ec4
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2022-09-22 (Thu, 22 Sep 2022)

  Changed paths:
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaExpr.cpp
    M clang/test/AST/ast-dump-recovery.cpp
    M clang/test/SemaTemplate/constraints.cpp
    M clang/test/SemaTemplate/cxx2a-constraint-exprs.cpp
    M clang/test/SemaTemplate/instantiate-var-template.cpp

  Log Message:
  -----------
  [AST] Better recovery on an expression refers to an invalid decl.

Prior to the patch, we didn't build a DeclRefExpr if the Decl being
referred to is invalid, because many clang downstream AST consumers
assume it, violating it will cause many diagnostic regressions.

With this patch, we build a DeclRefExpr enven for an invalid decl (when the
AcceptInvalidDecl is true), and wrap it with a dependent-type
RecoveryExpr (to prevent follow-up semantic analysis, and diagnostic
regressions).

This is a revised version of https://reviews.llvm.org/D76831

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D121599




More information about the All-commits mailing list