[PATCH] D49589: [UBSan] Strengthen pointer checks in 'new' expressions
    John McCall via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Sat Jul 21 12:33:06 PDT 2018
    
    
  
rjmccall added inline comments.
================
Comment at: lib/CodeGen/CodeGenFunction.h:380
+  /// True if sanitizer checks for current pointer value are generated.
+  bool PointerChecksAreEmitted = false;
+
----------------
I don't think this is a good way of doing this.  Using global state makes this unnecessarily difficult to reason about and can have unintended effects.  For example, you are unintentionally suppressing any checks that would be done as part of e.g. evaluating default arguments to the default constructor.
You should pass a parameter down that says whether checks are necessary.  You can also use that parameter to e.g. suppress checks when constructing local variables and temporaries, although you may already have an alternative mechanism for doing that.
Repository:
  rC Clang
https://reviews.llvm.org/D49589
    
    
More information about the cfe-commits
mailing list