private:
void destroyValueName();
- void doRAUW(Value *New, bool NoMetadata);
+ enum class ReplaceMetadataUses { No, Yes };
+ void doRAUW(Value *New, ReplaceMetadataUses);
void setNameImpl(const Twine &Name);
public:
}
#endif // NDEBUG
-void Value::doRAUW(Value *New, bool NoMetadata) {
+void Value::doRAUW(Value *New, ReplaceMetadataUses ReplaceMetaUses) {
assert(New && "Value::replaceAllUsesWith(<null>) is invalid!");
assert(!contains(New, this) &&
"this->replaceAllUsesWith(expr(this)) is NOT valid!");
// Notify all ValueHandles (if present) that this value is going away.
if (HasValueHandle)
ValueHandleBase::ValueIsRAUWd(this, New);
- if (!NoMetadata && isUsedByMetadata())
+ if (ReplaceMetaUses == ReplaceMetadataUses::Yes && isUsedByMetadata())
ValueAsMetadata::handleRAUW(this, New);
while (!materialized_use_empty()) {
}
void Value::replaceAllUsesWith(Value *New) {
- doRAUW(New, false /* NoMetadata */);
+ doRAUW(New, ReplaceMetadataUses::Yes);
}
void Value::replaceNonMetadataUsesWith(Value *New) {
- doRAUW(New, true /* NoMetadata */);
+ doRAUW(New, ReplaceMetadataUses::No);
}
// Like replaceAllUsesWith except it does not handle constants or basic blocks.