Skip to content

Commit d97d4d8

Browse files
committed
[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
1 parent cd0d095 commit d97d4d8

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

llvm/lib/IR/Value.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ void Value::setName(const Twine &NewName) {
377377
}
378378

379379
void Value::takeName(Value *V) {
380+
assert(V != this && "Illegal call to this->takeName(this)!");
380381
ValueSymbolTable *ST = nullptr;
381382
// If this value has a name, drop it.
382383
if (hasName()) {

0 commit comments

Comments
 (0)