[PATCH] D99299: Normalize interaction with boolean attributes

serge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 22 01:16:45 PDT 2021


serge-sans-paille added inline comments.


================
Comment at: llvm/lib/IR/Attributes.cpp:660-663
+bool AttributeImpl::getValueAsBool() const {
+  assert(getValueAsString().empty() || getValueAsString() == "false" || getValueAsString() == "true");
+  return getValueAsString() == "true";
+}
----------------
dblaikie wrote:
> Is it maybe worth using named constants rather than string literals, so this true and false matches up with the true/false in StrBoolAttr? (I assume that's where these strings are produced?)
> 
Agreed. The whole strbool attribute stuff looks very inefficient to me! I'll investigate that aspect.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99299/new/

https://reviews.llvm.org/D99299



More information about the cfe-commits mailing list