clang::QualType class_type = GetOrCreateType(mpi.ContainingType);
if (class_type.isNull())
return {};
+ if (clang::TagDecl *tag = class_type->getAsTagDecl()) {
+ clang::MSInheritanceAttr::Spelling spelling;
+ switch (mpi.Representation) {
+ case llvm::codeview::PointerToMemberRepresentation::SingleInheritanceData:
+ case llvm::codeview::PointerToMemberRepresentation::
+ SingleInheritanceFunction:
+ spelling =
+ clang::MSInheritanceAttr::Spelling::Keyword_single_inheritance;
+ break;
+ case llvm::codeview::PointerToMemberRepresentation::
+ MultipleInheritanceData:
+ case llvm::codeview::PointerToMemberRepresentation::
+ MultipleInheritanceFunction:
+ spelling =
+ clang::MSInheritanceAttr::Spelling::Keyword_multiple_inheritance;
+ break;
+ case llvm::codeview::PointerToMemberRepresentation::
+ VirtualInheritanceData:
+ case llvm::codeview::PointerToMemberRepresentation::
+ VirtualInheritanceFunction:
+ spelling =
+ clang::MSInheritanceAttr::Spelling::Keyword_virtual_inheritance;
+ break;
+ case llvm::codeview::PointerToMemberRepresentation::Unknown:
+ spelling =
+ clang::MSInheritanceAttr::Spelling::Keyword_unspecified_inheritance;
+ break;
+ default:
+ spelling = clang::MSInheritanceAttr::Spelling::SpellingNotCalculated;
+ break;
+ }
+ tag->addAttr(clang::MSInheritanceAttr::CreateImplicit(
+ m_clang.getASTContext(), spelling));
+ }
return m_clang.getASTContext().getMemberPointerType(
pointee_type, class_type.getTypePtr());
}
Anonymous<A::B::C<void>> AnonABCVoid;
Anonymous<A::B::C<void>>::D AnonABCVoidD;
+// The following tests that MSInheritanceAttr are set for record decls.
+class SI { int si; };
+struct SI2 { int si2; };
+class MI : SI, SI2 { int mi; };
+class MI2 : MI { int mi2; };
+class VI : virtual MI { int vi; };
+class VI2 : virtual SI, virtual SI2 { int vi; };
+class/* __unspecified_inheritance*/ UI;
+
+typedef void (SI::*SITYPE)();
+typedef void (MI::*MITYPE)();
+typedef void (MI2::*MI2TYPE)();
+typedef void (VI::*VITYPE)();
+typedef void (VI2::*VI2TYPE)();
+typedef void (UI::*UITYPE)();
+SITYPE mp1 = nullptr;
+MITYPE mp2 = nullptr;
+MI2TYPE mp3 = nullptr;
+VITYPE mp4 = nullptr;
+VI2TYPE mp5 = nullptr;
+UITYPE mp6 = nullptr;
+MITYPE *mp7 = nullptr;
+VI2TYPE *mp8 = nullptr;
+int SI::*mp9 = nullptr;
+
// FIXME: Enum size isn't being correctly determined.
// FIXME: Can't read memory for variable values.
// CHECK: (Anonymous<int>) AnonInt = (AnonymousMember = 0)
// CHECK: (Anonymous<A::B::C<void>>) AnonABCVoid = (AnonymousMember = 0)
// CHECK: (Anonymous<A::B::C<void>>::D) AnonABCVoidD = (AnonymousDMember = 0)
+// CHECK: (void (SI::*)()) mp1 = 00 00 00 00 00 00 00 00
+// CHECK: (void (MI::*)()) mp2 = 00 00 00 00 00 00 00 00
+// CHECK: (void (MI2::*)()) mp3 = 00 00 00 00 00 00 00 00
+// CHECK: (void (VI::*)()) mp4 = 00 00 00 00 00 00 00 00
+// CHECK: (void (VI2::*)()) mp5 = 00 00 00 00 00 00 00 00
+// CHECK: (void (UI::*)()) mp6 = 00 00 00 00 00 00 00 00
+// CHECK: (void (MI::**)()) mp7 = 0x0000000000000000
+// CHECK: (void (VI2::**)()) mp8 = 0x0000000000000000
+// CHECK: (int SI::*) mp9 = ff ff ff ff
// CHECK: Dumping clang ast for 1 modules.
// CHECK: TranslationUnitDecl {{.*}}
// CHECK: |-CXXRecordDecl {{.*}} class TrivialC definition