[PATCH] D42731: [IR] - Make User construction exception safe

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 15 09:51:57 PST 2018

rnk added a comment.

Seems reasonable, a few nits.

It would be nice if we could add a test for this scenario that runs when EH is enabled, but everything I can think of seems too heavyweight and non-portable to be worth it.

Comment at: include/llvm/IR/GlobalVariable.h:79
+  // delete space for exactly one operand as created in the corresponding new operator
+  void operator delete(void* ptr){
+    assert(ptr != nullptr && "must not be nullptr");
LLVM usually binds pointers and references to the identifier, not the type. clang-format with LLVM style will do this for you here and elsewhere.

Comment at: include/llvm/IR/User.h:104
+  void operator delete(void* Usr, unsigned) {
+    // called when constructor throws.
+    // Note: If a subclass manipulates the information which is required to calculate the 
Make this comment a complete sentence with a leading capital, or delete it. It's slightly redundant with the doc comment.



More information about the llvm-commits mailing list