[all-commits] [llvm/llvm-project] 58f831: More robust fix for crash on invalid range-based f...

Richard Smith via All-commits all-commits at lists.llvm.org
Mon Jun 8 13:12:07 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 58f831d2b3885bbbc2366045e46211c507fa5f8b
      https://github.com/llvm/llvm-project/commit/58f831d2b3885bbbc2366045e46211c507fa5f8b
  Author: Richard Smith <richard at metafoo.co.uk>
  Date:   2020-06-08 (Mon, 08 Jun 2020)

  Changed paths:
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaStmt.cpp
    M clang/lib/Sema/TreeTransform.h
    M clang/test/SemaCXX/cxx11-crashes.cpp
    M clang/test/SemaCXX/for-range-crash.cpp

  Log Message:
  -----------
  More robust fix for crash on invalid range-based for statement.

Reliably mark the loop variable declaration in a range for as having an
invalid initializer if anything goes wrong building the initializer. We
previously based this determination on whether an error was emitted,
which is not a reliable signal due to error suppression (during error
recovery etc).

Also, properly mark the variable as having initializer errors rather
than simply marking it invalid. This is necessary to mark any structured
bindings as invalid too.

This generalizes the previous fix in
936ec89e91e2dda8b6110b1fd1f9920509d7a17b.




More information about the All-commits mailing list