[PATCH] Don't instrument UBSan-generated code with ASan.

Richard Smith richard at metafoo.co.uk
Wed Jul 16 17:26:59 PDT 2014


================
Comment at: tools/clang/lib/CodeGen/CGExprScalar.cpp:839
@@ -837,2 +838,3 @@
 void ScalarExprEmitter::EmitBinOpCheck(Value *Check, const BinOpInfo &Info) {
+  assert(CGF.IsSanitizerScope);
   StringRef CheckName;
----------------
Several callers of this are only guarding their call to this function; how about sinking the `SanitizerScope` down into here (and teaching the scope to cope with multiple `SanitizerScope` objects being live at once)?

================
Comment at: tools/clang/lib/CodeGen/CodeGenFunction.cpp:1660
@@ +1659,3 @@
+    I->setMetadata(
+        CGM.getModule().getMDKindID("ubsan"),
+        llvm::MDNode::get(CGM.getLLVMContext(), ArrayRef<llvm::Value *>()));
----------------
It seems more future-safe to pick a more general name for this, describing its functionality not this particular use case. Maybe `"nosanitize"`?

http://reviews.llvm.org/D4544






More information about the cfe-commits mailing list