[PATCH] D99299: Normalize interaction with boolean attributes
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 11 07:32:23 PDT 2021
nikic added inline comments.
================
Comment at: llvm/lib/IR/Attributes.cpp:653
+bool AttributeImpl::getValueAsBool() const {
+ assert(getValueAsString().empty() || getValueAsString() == "false" || getValueAsString() == "true");
+ return getValueAsString() == "true";
----------------
By the way, why is empty string allowed as a value here? Are there existing uses of empty string as false?
================
Comment at: llvm/lib/IR/Verifier.cpp:1706
+ if (A.getKindAsString() == #DISPLAY_NAME) \
+ (void)A.getValueAsBool(); // asserts if the representation is invalid
+
----------------
This should use CheckFailed rather than asserting.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D99299/new/
https://reviews.llvm.org/D99299
More information about the llvm-commits
mailing list