diff options
| author | JF Bastien <jfbastien@apple.com> | 2018-08-09 18:28:54 +0000 |
|---|---|---|
| committer | JF Bastien <jfbastien@apple.com> | 2018-08-09 18:28:54 +0000 |
| commit | e69ae76b20f1c417a21524b630aeac34c82fd5fc (patch) | |
| tree | 88898b320446ad7bd4a47ee42dd55d19082ab6f0 | |
| parent | 75c2ca36387c662215d0545101d25e82cd0927dd (diff) | |
| download | bcm5719-llvm-e69ae76b20f1c417a21524b630aeac34c82fd5fc.tar.gz bcm5719-llvm-e69ae76b20f1c417a21524b630aeac34c82fd5fc.zip | |
[NFC] Remove magic bool param in RAUW
Use an enum class instead.
llvm-svn: 339366
| -rw-r--r-- | llvm/include/llvm/IR/Value.h | 3 | ||||
| -rw-r--r-- | llvm/lib/IR/Value.cpp | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/llvm/include/llvm/IR/Value.h b/llvm/include/llvm/IR/Value.h index f396db995ab..4f3a45c684f 100644 --- a/llvm/include/llvm/IR/Value.h +++ b/llvm/include/llvm/IR/Value.h @@ -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: diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp index 295d6ecf0db..6dc48ad97cc 100644 --- a/llvm/lib/IR/Value.cpp +++ b/llvm/lib/IR/Value.cpp @@ -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. |

