@@ -2474,7 +2474,13 @@ class ItaniumRTTIBuilder {
2474
2474
2475
2475
// / PTI_ContainingClassIncomplete - Containing class is incomplete.
2476
2476
// / (in pointer to member).
2477
- PTI_ContainingClassIncomplete = 0x10
2477
+ PTI_ContainingClassIncomplete = 0x10 ,
2478
+
2479
+ // / PTI_TransactionSafe - Pointee is transaction_safe function (C++ TM TS).
2480
+ // PTI_TransactionSafe = 0x20,
2481
+
2482
+ // / PTI_Noexcept - Pointee is noexcept function (C++1z).
2483
+ PTI_Noexcept = 0x40 ,
2478
2484
};
2479
2485
2480
2486
// VMI type info flags.
@@ -3124,21 +3130,6 @@ llvm::Constant *ItaniumRTTIBuilder::BuildTypeInfo(QualType Ty, bool Force,
3124
3130
return llvm::ConstantExpr::getBitCast (GV, CGM.Int8PtrTy );
3125
3131
}
3126
3132
3127
- // / ComputeQualifierFlags - Compute the pointer type info flags from the
3128
- // / given qualifier.
3129
- static unsigned ComputeQualifierFlags (Qualifiers Quals) {
3130
- unsigned Flags = 0 ;
3131
-
3132
- if (Quals.hasConst ())
3133
- Flags |= ItaniumRTTIBuilder::PTI_Const;
3134
- if (Quals.hasVolatile ())
3135
- Flags |= ItaniumRTTIBuilder::PTI_Volatile;
3136
- if (Quals.hasRestrict ())
3137
- Flags |= ItaniumRTTIBuilder::PTI_Restrict;
3138
-
3139
- return Flags;
3140
- }
3141
-
3142
3133
// / BuildObjCObjectTypeInfo - Build the appropriate kind of type_info
3143
3134
// / for the given Objective-C object type.
3144
3135
void ItaniumRTTIBuilder::BuildObjCObjectTypeInfo (const ObjCObjectType *OT) {
@@ -3322,23 +3313,44 @@ void ItaniumRTTIBuilder::BuildVMIClassTypeInfo(const CXXRecordDecl *RD) {
3322
3313
}
3323
3314
}
3324
3315
3316
+ // / Compute the flags for a __pbase_type_info, and remove the corresponding
3317
+ // / pieces from \p Type.
3318
+ static unsigned extractPBaseFlags (ASTContext &Ctx, QualType &Type) {
3319
+ unsigned Flags = 0 ;
3320
+
3321
+ if (Type.isConstQualified ())
3322
+ Flags |= ItaniumRTTIBuilder::PTI_Const;
3323
+ if (Type.isVolatileQualified ())
3324
+ Flags |= ItaniumRTTIBuilder::PTI_Volatile;
3325
+ if (Type.isRestrictQualified ())
3326
+ Flags |= ItaniumRTTIBuilder::PTI_Restrict;
3327
+ Type = Type.getUnqualifiedType ();
3328
+
3329
+ // Itanium C++ ABI 2.9.5p7:
3330
+ // When the abi::__pbase_type_info is for a direct or indirect pointer to an
3331
+ // incomplete class type, the incomplete target type flag is set.
3332
+ if (ContainsIncompleteClassType (Type))
3333
+ Flags |= ItaniumRTTIBuilder::PTI_Incomplete;
3334
+
3335
+ if (auto *Proto = Type->getAs <FunctionProtoType>()) {
3336
+ if (Proto->isNothrow (Ctx)) {
3337
+ Flags |= ItaniumRTTIBuilder::PTI_Noexcept;
3338
+ Type = Ctx.getFunctionType (
3339
+ Proto->getReturnType (), Proto->getParamTypes (),
3340
+ Proto->getExtProtoInfo ().withExceptionSpec (EST_None));
3341
+ }
3342
+ }
3343
+
3344
+ return Flags;
3345
+ }
3346
+
3325
3347
// / BuildPointerTypeInfo - Build an abi::__pointer_type_info struct,
3326
3348
// / used for pointer types.
3327
3349
void ItaniumRTTIBuilder::BuildPointerTypeInfo (QualType PointeeTy) {
3328
- Qualifiers Quals;
3329
- QualType UnqualifiedPointeeTy =
3330
- CGM.getContext ().getUnqualifiedArrayType (PointeeTy, Quals);
3331
-
3332
3350
// Itanium C++ ABI 2.9.5p7:
3333
3351
// __flags is a flag word describing the cv-qualification and other
3334
3352
// attributes of the type pointed to
3335
- unsigned Flags = ComputeQualifierFlags (Quals);
3336
-
3337
- // Itanium C++ ABI 2.9.5p7:
3338
- // When the abi::__pbase_type_info is for a direct or indirect pointer to an
3339
- // incomplete class type, the incomplete target type flag is set.
3340
- if (ContainsIncompleteClassType (UnqualifiedPointeeTy))
3341
- Flags |= PTI_Incomplete;
3353
+ unsigned Flags = extractPBaseFlags (CGM.getContext (), PointeeTy);
3342
3354
3343
3355
llvm::Type *UnsignedIntLTy =
3344
3356
CGM.getTypes ().ConvertType (CGM.getContext ().UnsignedIntTy );
@@ -3348,7 +3360,7 @@ void ItaniumRTTIBuilder::BuildPointerTypeInfo(QualType PointeeTy) {
3348
3360
// __pointee is a pointer to the std::type_info derivation for the
3349
3361
// unqualified type being pointed to.
3350
3362
llvm::Constant *PointeeTypeInfo =
3351
- ItaniumRTTIBuilder (CXXABI).BuildTypeInfo (UnqualifiedPointeeTy );
3363
+ ItaniumRTTIBuilder (CXXABI).BuildTypeInfo (PointeeTy );
3352
3364
Fields.push_back (PointeeTypeInfo);
3353
3365
}
3354
3366
@@ -3358,23 +3370,12 @@ void
3358
3370
ItaniumRTTIBuilder::BuildPointerToMemberTypeInfo (const MemberPointerType *Ty) {
3359
3371
QualType PointeeTy = Ty->getPointeeType ();
3360
3372
3361
- Qualifiers Quals;
3362
- QualType UnqualifiedPointeeTy =
3363
- CGM.getContext ().getUnqualifiedArrayType (PointeeTy, Quals);
3364
-
3365
3373
// Itanium C++ ABI 2.9.5p7:
3366
3374
// __flags is a flag word describing the cv-qualification and other
3367
3375
// attributes of the type pointed to.
3368
- unsigned Flags = ComputeQualifierFlags (Quals );
3376
+ unsigned Flags = extractPBaseFlags (CGM. getContext (), PointeeTy );
3369
3377
3370
3378
const RecordType *ClassType = cast<RecordType>(Ty->getClass ());
3371
-
3372
- // Itanium C++ ABI 2.9.5p7:
3373
- // When the abi::__pbase_type_info is for a direct or indirect pointer to an
3374
- // incomplete class type, the incomplete target type flag is set.
3375
- if (ContainsIncompleteClassType (UnqualifiedPointeeTy))
3376
- Flags |= PTI_Incomplete;
3377
-
3378
3379
if (IsIncompleteClassType (ClassType))
3379
3380
Flags |= PTI_ContainingClassIncomplete;
3380
3381
@@ -3386,7 +3387,7 @@ ItaniumRTTIBuilder::BuildPointerToMemberTypeInfo(const MemberPointerType *Ty) {
3386
3387
// __pointee is a pointer to the std::type_info derivation for the
3387
3388
// unqualified type being pointed to.
3388
3389
llvm::Constant *PointeeTypeInfo =
3389
- ItaniumRTTIBuilder (CXXABI).BuildTypeInfo (UnqualifiedPointeeTy );
3390
+ ItaniumRTTIBuilder (CXXABI).BuildTypeInfo (PointeeTy );
3390
3391
Fields.push_back (PointeeTypeInfo);
3391
3392
3392
3393
// Itanium C++ ABI 2.9.5p9:
0 commit comments