[NFC] Remove magic bool param in RAUW

Use an enum class instead.

llvm-svn: 339366
This commit is contained in:
JF Bastien 2018-08-09 18:28:54 +00:00
parent 75c2ca3638
commit e69ae76b20
2 changed files with 6 additions and 5 deletions

View File

@ -254,7 +254,8 @@ public:
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:

View File

@ -405,7 +405,7 @@ static bool contains(Value *Expr, Value *V) {
}
#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!");
@ -415,7 +415,7 @@ void Value::doRAUW(Value *New, bool NoMetadata) {
// 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()) {
@ -437,11 +437,11 @@ void Value::doRAUW(Value *New, bool NoMetadata) {
}
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.