diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2017-07-31 22:35:33 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2017-07-31 22:35:33 +0000 |
commit | 396943a75b0f3210adbba122a4d9b4b381b99cb4 (patch) | |
tree | 8851986b184046d4b51fce01358dcdd2c4c9a9d5 /clang/lib/CodeGen/CGClass.cpp | |
parent | 81fd449238e42fe3f34292bc34b0a15a27b3d44f (diff) | |
download | bcm5719-llvm-396943a75b0f3210adbba122a4d9b4b381b99cb4.tar.gz bcm5719-llvm-396943a75b0f3210adbba122a4d9b4b381b99cb4.zip |
Re-apply r309622 with a fix for MSVC.
Patch by Vlad Tsyrklevich!
llvm-svn: 309635
Diffstat (limited to 'clang/lib/CodeGen/CGClass.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGClass.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp index 50d702c6226..e27e518c7ea 100644 --- a/clang/lib/CodeGen/CGClass.cpp +++ b/clang/lib/CodeGen/CGClass.cpp @@ -2523,8 +2523,10 @@ LeastDerivedClassWithSameLayout(const CXXRecordDecl *RD) { void CodeGenFunction::EmitTypeMetadataCodeForVCall(const CXXRecordDecl *RD, llvm::Value *VTable, SourceLocation Loc) { - if (CGM.getCodeGenOpts().WholeProgramVTables && - CGM.HasHiddenLTOVisibility(RD)) { + if (SanOpts.has(SanitizerKind::CFIVCall)) + EmitVTablePtrCheckForCall(RD, VTable, CodeGenFunction::CFITCK_VCall, Loc); + else if (CGM.getCodeGenOpts().WholeProgramVTables && + CGM.HasHiddenLTOVisibility(RD)) { llvm::Metadata *MD = CGM.CreateMetadataIdentifierForType(QualType(RD->getTypeForDecl(), 0)); llvm::Value *TypeId = @@ -2536,9 +2538,6 @@ void CodeGenFunction::EmitTypeMetadataCodeForVCall(const CXXRecordDecl *RD, {CastedVTable, TypeId}); Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::assume), TypeTest); } - - if (SanOpts.has(SanitizerKind::CFIVCall)) - EmitVTablePtrCheckForCall(RD, VTable, CodeGenFunction::CFITCK_VCall, Loc); } void CodeGenFunction::EmitVTablePtrCheckForCall(const CXXRecordDecl *RD, |