@@ -3041,9 +3041,12 @@ void CodeGenModule::createFunctionTypeMetadataForIcall(const FunctionDecl *FD,
3041
3041
if (isa<CXXMethodDecl>(FD) && !cast<CXXMethodDecl>(FD)->isStatic ())
3042
3042
return ;
3043
3043
3044
- llvm::Metadata *MD = CreateMetadataIdentifierForType (FD->getType ());
3044
+ QualType FnType = FD->getType ();
3045
+ llvm::Metadata *MD = CreateMetadataIdentifierForType (FnType);
3045
3046
F->addTypeMetadata (0 , MD);
3046
- F->addTypeMetadata (0 , CreateMetadataIdentifierGeneralized (FD->getType ()));
3047
+
3048
+ QualType GenPtrFnType = GeneralizeFunctionType (getContext (), FD->getType ());
3049
+ F->addTypeMetadata (0 , CreateMetadataIdentifierGeneralized (GenPtrFnType));
3047
3050
3048
3051
// Emit a hash-based bit set entry for cross-DSO calls.
3049
3052
if (CodeGenOpts.SanitizeCfiCrossDso )
@@ -7936,8 +7939,10 @@ CodeGenModule::CreateMetadataIdentifierImpl(QualType T, MetadataTypeMap &Map,
7936
7939
7937
7940
llvm::Metadata *CodeGenModule::CreateMetadataIdentifierForFnType (QualType T) {
7938
7941
assert (isa<FunctionType>(T));
7939
- if (getCodeGenOpts ().SanitizeCfiICallGeneralizePointers )
7942
+ if (getCodeGenOpts ().SanitizeCfiICallGeneralizePointers ) {
7943
+ T = GeneralizeFunctionType (getContext (), T);
7940
7944
return CreateMetadataIdentifierGeneralized (T);
7945
+ }
7941
7946
return CreateMetadataIdentifierForType (T);
7942
7947
}
7943
7948
@@ -7951,8 +7956,8 @@ CodeGenModule::CreateMetadataIdentifierForVirtualMemPtrType(QualType T) {
7951
7956
}
7952
7957
7953
7958
llvm::Metadata *CodeGenModule::CreateMetadataIdentifierGeneralized (QualType T) {
7954
- return CreateMetadataIdentifierImpl (GeneralizeFunctionType ( getContext (), T) ,
7955
- GeneralizedMetadataIdMap, " .generalized" );
7959
+ return CreateMetadataIdentifierImpl (T, GeneralizedMetadataIdMap ,
7960
+ " .generalized" );
7956
7961
}
7957
7962
7958
7963
// / Returns whether this module needs the "all-vtables" type identifier.
0 commit comments