[MS] Fix constexpr data member pointer conversions
authorReid Kleckner <rnk@google.com>
Tue, 29 Oct 2019 00:05:34 +0000 (17:05 -0700)
committerReid Kleckner <rnk@google.com>
Tue, 29 Oct 2019 23:58:00 +0000 (16:58 -0700)
commit07ee46d613d7c1862878d7c7d1208a7b3e37459d
tree55142146f32a60aa83f81f7717ac074ef5e3bb81
parent44bac3ed5291031174ff62a2e841210ff8aedb66
[MS] Fix constexpr data member pointer conversions

Constexpr data member conversions work by starting with the class that
originally introduced the field, and converting from there to the type
that the user desires. Before this change, Clang was using the
inheritance model from the final destination class type instead of the
model from the class that originally introduced the field. To fix this,
find the relevant FieldDecl and take its parent class instead of using
the member pointer type the user provided.

Indirect field decls require some special handling to find the parent
class.

Fixes PR43803
clang/lib/CodeGen/MicrosoftCXXABI.cpp
clang/test/CodeGenCXX/microsoft-abi-member-pointers.cpp