[all-commits] [llvm/llvm-project] 606a73: [PR47636] Fix tryEmitPrivate to handle non-constan...

Erich Keane via All-commits all-commits at lists.llvm.org
Thu Sep 24 12:09:59 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 606a734755d1fb6c35a17680d0c251f834b79334
      https://github.com/llvm/llvm-project/commit/606a734755d1fb6c35a17680d0c251f834b79334
  Author: Erich Keane <erich.keane at intel.com>
  Date:   2020-09-24 (Thu, 24 Sep 2020)

  Changed paths:
    M clang/lib/CodeGen/CGExprConstant.cpp
    A clang/test/CodeGenCXX/pr47636.cpp

  Log Message:
  -----------
  [PR47636] Fix tryEmitPrivate to handle non-constantarraytypes

As mentioned in the bug report, tryEmitPrivate chokes on the
MaterializeTemporaryExpr in the reproducers, since it assumes that if
there are elements, than it must be a ConstantArrayType. However, the
MaterializeTemporaryExpr (which matches exactly the AST when it is NOT a
global/static) has an incomplete array type.

This changes the section where the number-of-elements is non-zero to
properly handle non-CAT types by just extracting it as an array type
(since all we needed was the element type out of it).




More information about the All-commits mailing list