[CodeGen] Use the mangle context owned by CodeGenModule to correctly
authorAkira Hatanaka <ahatanaka@apple.com>
Sat, 20 Oct 2018 05:45:01 +0000 (05:45 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Sat, 20 Oct 2018 05:45:01 +0000 (05:45 +0000)
commit32e0a584f8ee86bca6714693dfdbb007d667119f
treee4dcb121caf82694bdf2d1f176fb47df08d5830e
parent4d8ced1807a044a349825ead80b7a15f1872e000
[CodeGen] Use the mangle context owned by CodeGenModule to correctly
mangle types of lambda objects captured by a block instead of creating a
new mangle context everytime a captured field type is mangled.

This fixes a bug in IRGen's block helper merging code that was
introduced in r339438 where two blocks capturing two distinct lambdas
would end up sharing helper functions and the block descriptor. This
happened because the ID number used to distinguish lambdas defined
in the same context is reset everytime a mangled context is created.

rdar://problem/45314494

llvm-svn: 344833
clang/lib/CodeGen/CGBlocks.cpp
clang/test/CodeGenObjCXX/lambda-to-block.mm