[llvm] Correct lie in contract (PR #82517)
Dave Abrahams via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 21 10:23:56 PST 2024
https://github.com/dabrahams created https://github.com/llvm/llvm-project/pull/82517
The method asserts when passed a null pointer.
>From 3f0835884362a3912457940cc32a35b0673add8f Mon Sep 17 00:00:00 2001
From: Dave Abrahams <dabrahams at adobe.com>
Date: Wed, 21 Feb 2024 10:23:23 -0800
Subject: [PATCH] Correct lie in contract
The method asserts when passed a null pointer.
---
llvm/include/llvm/IR/GlobalVariable.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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);
More information about the llvm-commits
mailing list