[llvm] Correct lie in contract (PR #82517)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 10:24:46 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-ir

Author: Dave Abrahams (dabrahams)

<details>
<summary>Changes</summary>

The method asserts when passed a null pointer.

---
Full diff: https://github.com/llvm/llvm-project/pull/82517.diff


1 Files Affected:

- (modified) llvm/include/llvm/IR/GlobalVariable.h (+2-2) 


``````````diff
diff --git a/llvm/include/llvm/IR/GlobalVariable.h b/llvm/include/llvm/IR/GlobalVariable.h
index bcaf8e91432ba9..d76db8463c9dfa 100644
--- a/llvm/include/llvm/IR/GlobalVariable.h
+++ b/llvm/include/llvm/IR/GlobalVariable.h
@@ -146,8 +146,8 @@ class GlobalVariable : public GlobalObject, public ilist_node<GlobalVariable> {
     assert(hasInitializer() && "GV doesn't have initializer!");
     return static_cast<Constant*>(Op<0>().get());
   }
-  /// setInitializer - Sets the initializer for this global variable, removing
-  /// any existing initializer if InitVal==NULL.  If this GV has type T*, the
+  /// setInitializer - Sets the initializer for this global variable to 
+  /// InitVal, which must be non-null.  If this GV has type T*, the
   /// initializer must have type T.
   void setInitializer(Constant *InitVal);
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/82517


More information about the llvm-commits mailing list