fix unnamed fiefield issue and add tests for __builtin_preserve_access_index intrinsic
authorYonghong Song <yhs@fb.com>
Tue, 16 Jul 2019 17:24:33 +0000 (17:24 +0000)
committerYonghong Song <yhs@fb.com>
Tue, 16 Jul 2019 17:24:33 +0000 (17:24 +0000)
commit4754814c5a68cf609f83b491feb38ad53c5acd4e
treea0fee3d41ecc2d0b0d2fd617734500f59f94f688
parentc65a9db43e17f0acdd39b76498d1c23e4a70f9a1
fix unnamed fiefield issue and add tests for __builtin_preserve_access_index intrinsic

The original commit is r366076. It is temporarily reverted (r366155)
due to test failure. This resubmit makes test more robust by accepting
regex instead of hardcoded names/references in several places.

This is a followup patch for https://reviews.llvm.org/D61809.
Handle unnamed bitfield properly and add more test cases.

Fixed the unnamed bitfield issue. The unnamed bitfield is ignored
by debug info, so we need to ignore such a struct/union member
when we try to get the member index in the debug info.

D61809 contains two test cases but not enough as it does
not checking generated IRs in the fine grain level, and also
it does not have semantics checking tests.
This patch added unit tests for both code gen and semantics checking for
the new intrinsic.

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 366231
clang/lib/CodeGen/CGExpr.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/test/CodeGen/builtin-preserve-access-index.c [new file with mode: 0644]
clang/test/Sema/builtin-preserve-access-index.c [new file with mode: 0644]