From: David Majnemer Date: Mon, 23 Jun 2014 17:30:27 +0000 (+0000) Subject: MS ABI: Add an additional test for typeid X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9784b810524025a48f1c49cc3bc634ebf0e9a663;p=clang MS ABI: Add an additional test for typeid This tests typeid with polymorphic arguments which have an extendable virtual function table. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211505 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/CodeGenCXX/microsoft-abi-typeid.cpp b/test/CodeGenCXX/microsoft-abi-typeid.cpp index 3875c56ca4..0b73f91dff 100644 --- a/test/CodeGenCXX/microsoft-abi-typeid.cpp +++ b/test/CodeGenCXX/microsoft-abi-typeid.cpp @@ -7,6 +7,7 @@ struct V { virtual void f(); }; struct A : virtual V { A(); }; extern A a; +extern V v; extern int b; A* fn(); @@ -43,3 +44,9 @@ const std::type_info* test3_typeid() { return &typeid(*fn()); } const std::type_info* test4_typeid() { return &typeid(b); } // CHECK: define %struct.type_info* @"\01?test4_typeid@@YAPBUtype_info@@XZ"() // CHECK: ret %struct.type_info* bitcast (%"MSRTTITypeDescriptor\02"* @"\01??_R0H@8" to %struct.type_info*) + +const std::type_info* test5_typeid() { return &typeid(v); } +// CHECK: define %struct.type_info* @"\01?test5_typeid@@YAPBUtype_info@@XZ"() +// CHECK: [[RT:%.*]] = tail call i8* @__RTtypeid(i8* bitcast (%struct.V* @"\01?v@@3UV@@A" to i8*)) +// CHECK-NEXT: [[RET:%.*]] = bitcast i8* [[RT]] to %struct.type_info* +// CHECK-NEXT: ret %struct.type_info* [[RET]]