[all-commits] [llvm/llvm-project] b5aef9: [Clang] Fix instantiation of OpaqueValueExprs (Bug...

Jason Rice via All-commits all-commits at lists.llvm.org
Sat Nov 6 01:09:35 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b5aef90d4656c5188759d03e2c5c3dc3d8bb398b
      https://github.com/llvm/llvm-project/commit/b5aef90d4656c5188759d03e2c5c3dc3d8bb398b
  Author: Jason Rice <ricejasonf at gmail.com>
  Date:   2021-11-06 (Sat, 06 Nov 2021)

  Changed paths:
    M clang/lib/Sema/TreeTransform.h
    A clang/test/CodeGenCXX/pr45964-decomp-transform.cpp

  Log Message:
  -----------
  [Clang] Fix instantiation of OpaqueValueExprs (Bug #45964)

The structured bindings decomposition of a non-dependent array in a dependent context (a template) were, upon instantiation, creating nested OpaqueValueExprs that would trigger assertions in CodeGen. Additionally the OpaqueValuesExpr's contained SourceExpr is being emitted in CodeGen, but there was no code for its transform in template instantiation. This would trigger other assertions such as when emitting a DeclRefExpr that refers to a VarDecl that is not marked as ODR-used.

This is all based on cursory deduction, but with the way the code flows from SemaTemplateInstantiate back to SemaInit, it is apparent that the nesting of OpaqueValueExpr is unintentional.

This commit fixes https://bugs.llvm.org/show_bug.cgi?id=45964 and possible other issues involving OpaqueValueExprs in template instantiations might be resolved.

Reviewed By: aaron.ballman, rjmccall

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




More information about the All-commits mailing list