Hi samsonov, rsmith,

Initial patch attempts to skip Ubsan's vptr checks on ctors and dtors as many 
(seemingly harmless) undefined behaviors were observed in ctors and dtors. This 
feature should be opted out with some other compiler flags (e.g., -mllvm for 
Asan), but right now there are no such flags in this patch.

http://reviews.llvm.org/D4528

Files:
  lib/CodeGen/CodeGenFunction.cpp

Index: lib/CodeGen/CodeGenFunction.cpp
===================================================================
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -535,7 +535,9 @@
   CurFnInfo = &FnInfo;
   assert(CurFn->isDeclaration() && "Function already has body?");
 
-  if (CGM.getSanitizerBlacklist().isIn(*Fn))
+  if (CGM.getSanitizerBlacklist().isIn(*Fn) ||
+      (SanOpts->Vptr && D &&
+       (isa<CXXConstructorDecl>(D) || isa<CXXDestructorDecl>(D))))
     SanOpts = &SanitizerOptions::Disabled;
 
   // Pass inline keyword to optimizer if it appears explicitly on any
Index: lib/CodeGen/CodeGenFunction.cpp
===================================================================
--- lib/CodeGen/CodeGenFunction.cpp
+++ lib/CodeGen/CodeGenFunction.cpp
@@ -535,7 +535,9 @@
   CurFnInfo = &FnInfo;
   assert(CurFn->isDeclaration() && "Function already has body?");
 
-  if (CGM.getSanitizerBlacklist().isIn(*Fn))
+  if (CGM.getSanitizerBlacklist().isIn(*Fn) ||
+      (SanOpts->Vptr && D &&
+       (isa<CXXConstructorDecl>(D) || isa<CXXDestructorDecl>(D))))
     SanOpts = &SanitizerOptions::Disabled;
 
   // Pass inline keyword to optimizer if it appears explicitly on any
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to