================ @@ -6027,6 +6027,33 @@ static bool EvaluateBinaryTypeTrait(Sema &Self, TypeTrait BTT, const TypeSourceI return cast<CXXRecordDecl>(rhsRecord->getDecl()) ->isDerivedFrom(cast<CXXRecordDecl>(lhsRecord->getDecl())); } + case BTT_IsVirtualBaseOf: { + const RecordType *BaseRecord = LhsT->getAs<RecordType>(); + const RecordType *DerivedRecord = RhsT->getAs<RecordType>(); + + if (!BaseRecord || !DerivedRecord) { + DiagnoseVLAInCXXTypeTrait(Self, Lhs, tok::kw___is_virtual_base_of); + DiagnoseVLAInCXXTypeTrait(Self, Rhs, tok::kw___is_virtual_base_of); + return false; + } + + if (BaseRecord->isUnionType() || DerivedRecord->isUnionType()) + return false; + + if (!BaseRecord->isStructureOrClassType() || + !DerivedRecord->isStructureOrClassType()) + return false; ---------------- Endilll wrote:
`isStructureOrClassType` is defined as follows: https://github.com/llvm/llvm-project/blob/0ee32c45730c94be1b7d5fa60a0e8dff5751d014/clang/lib/AST/Type.cpp#L657-L663 So (1) ObjC doesn't have to inherit from `RecordType` to get involved, and (2) the function has a misleading name. https://github.com/llvm/llvm-project/pull/100393 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits