[all-commits] [llvm/llvm-project] 89d991: [AST] dont invaliate VarDecl when the initializer ...

Haojian Wu via All-commits all-commits at lists.llvm.org
Tue Apr 21 01:54:00 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 89d9912cbf45068770ac8c1e2ef97b74c3b662ab
      https://github.com/llvm/llvm-project/commit/89d9912cbf45068770ac8c1e2ef97b74c3b662ab
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2020-04-21 (Tue, 21 Apr 2020)

  Changed paths:
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaStmt.cpp
    M clang/test/AST/ast-dump-invalid-initialized.cpp
    M clang/test/AST/ast-dump-recovery.cpp
    M clang/test/CXX/special/class.copy/p11.0x.move.cpp
    M clang/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
    M clang/test/OpenMP/task_messages.cpp
    M clang/test/SemaCXX/block-call.cpp
    M clang/test/SemaCXX/constant-expression-cxx11.cpp
    M clang/test/SemaCXX/cxx11-crashes.cpp
    M clang/test/SemaCXX/cxx2a-explicit-bool.cpp
    M clang/test/SemaCXX/for-range-dereference.cpp
    M clang/test/SemaCXX/member-init.cpp
    A clang/test/SemaCXX/recovery-initializer.cpp
    M clang/test/SemaObjCXX/parameterized_classes_arc.mm

  Log Message:
  -----------
  [AST] dont invaliate VarDecl when the initializer contains errors.

Summary:
This patch contains 2 separate changes:
1) the initializer of a variable should play no part in decl "invalid" bit;
2) preserve the invalid initializer via recovery exprs;

With 1), we will regress the diagnostics (one big regression is that we loose
the "selected 'begin' function with iterator type" diagnostic in for-range stmt;
but with 2) together, we don't have regressions (the new diagnostics seems to be
improved).

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

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




More information about the All-commits mailing list