[PATCH] D16823: [cfi] Safe handling of unaddressable vtable pointers (clang).

Alexey Samsonov via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 3 10:38:41 PST 2016


samsonov accepted this revision.
samsonov added a reviewer: samsonov.
samsonov added a comment.
This revision is now accepted and ready to land.

LGTM


================
Comment at: lib/CodeGen/CGClass.cpp:2608
@@ -2607,3 +2607,3 @@
   auto TypeId = CGM.CreateCfiIdForTypeMetadata(MD);
   if (CGM.getCodeGenOpts().SanitizeCfiCrossDso && TypeId) {
     EmitCfiSlowPathCheck(M, BitSetTest, TypeId, CastedVTable, StaticData);
----------------
Can we rewrite this as if-elseif-else block now?

================
Comment at: lib/CodeGen/CGExpr.cpp:2642
@@ +2641,3 @@
+      llvm::MDString::get(CGM.getLLVMContext(), "all-vtables"));
+  llvm::Value *ValidVtable = Builder.CreateZExt(
+      Builder.CreateCall(CGM.getIntrinsic(llvm::Intrinsic::bitset_test),
----------------
eugenis wrote:
> samsonov wrote:
> > This is almost the same as EmitVTablePtrCheck, but with ZExt? Is the difference intentional/important? Is it possible to extract this logic (getting "all-vtables" metadata and running bitset test) to a function?
> Not important. Zext makes the test a bit simpler.
> Extracting these two lines to a function is surely possible, but is it worth it?
> 
Probably not, as long as we have the test coverage.


Repository:
  rL LLVM

http://reviews.llvm.org/D16823





More information about the cfe-commits mailing list