aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Value.cpp
diff options
context:
space:
mode:
authorDmitry Vassiliev <dvassiliev@accesssoftek.com>2022-02-13 21:47:37 +0300
committerDmitry Vassiliev <dvassiliev@accesssoftek.com>2022-02-13 21:47:37 +0300
commitd97d4d8d754df16ae9e333c2b97af8e5993b759f (patch)
tree5fb3921af1b9c8e7afe77d91a3b73a242cc0568f /llvm/lib/IR/Value.cpp
parentcd0d095c07b6dc925354cb8a9a54cafe654a6c4d (diff)
downloadllvm-d97d4d8d754df16ae9e333c2b97af8e5993b759f.zip
llvm-d97d4d8d754df16ae9e333c2b97af8e5993b759f.tar.gz
llvm-d97d4d8d754df16ae9e333c2b97af8e5993b759f.tar.bz2
[NFC][IR] Value: assert this->takeName(this)
Need to add an assert about this->takeName(this). This restriction is already documented, so this is just an NFC check. Without this assertion (as prescribed by original comments for this API), name deletion or down-stream assert failures may occur in other routines: e.g. at the beginning of replaceAllUsesWith() below. Reviewed By: aeubanks Differential Revision: https://reviews.llvm.org/D119636
Diffstat (limited to 'llvm/lib/IR/Value.cpp')
-rw-r--r--llvm/lib/IR/Value.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index 18aef37..df286df 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -377,6 +377,7 @@ void Value::setName(const Twine &NewName) {
}
void Value::takeName(Value *V) {
+ assert(V != this && "Illegal call to this->takeName(this)!");
ValueSymbolTable *ST = nullptr;
// If this value has a name, drop it.
if (hasName()) {