[DebugInfo] Fix DWARF expressions for __block vars that are not on the heap
authorRaphael Isemann <teemperor@gmail.com>
Mon, 17 May 2021 12:02:48 +0000 (14:02 +0200)
committerRaphael Isemann <teemperor@gmail.com>
Mon, 17 May 2021 12:32:07 +0000 (14:32 +0200)
commit888ce70af288168136cf1ca658c3cf6d6759bb3f
tree666ee7d1bf35f688c1e73e6d4d8dd226e471ec78
parentdb81e88f25f227a007c1202bd8a88aff722ddc6b
[DebugInfo] Fix DWARF expressions for __block vars that are not on the heap

`__block` variables used to be always stored on the head instead of stack.
D51564 allowed `__block` variables to the stored on the stack like normal
variablesif they not captured by any escaping block, but the debug-info
generation code wasn't made aware of it so we still unconditionally emit DWARF
expressions pointing to the heap.

This patch makes CGDebugInfo use the `EscapingByref` introduced in D51564 that
tracks whether the `__block` variable is actually on the heap. If it's stored on
the stack instead we just use the debug info we would generate for normal
variables instead.

Reviewed By: ahatanak, aprantl

Differential Revision: https://reviews.llvm.org/D99946
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGen/debug-info-block-expr.c