[llvm] [NFC][Offload] Fix possible edge cases in offload-tblgen (PR #146511)

Ross Brunton via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 1 05:35:23 PDT 2025


================
@@ -157,9 +157,14 @@ class ParamRec {
   bool isHandleType() const { return getType().ends_with("_handle_t"); }
   bool isFptrType() const { return getType().ends_with("_cb_t"); }
   StringRef getDesc() const { return rec->getValueAsString("desc"); }
-  bool isIn() const { return dyn_cast<BitInit>(flags->getBit(0))->getValue(); }
-  bool isOut() const { return dyn_cast<BitInit>(flags->getBit(1))->getValue(); }
-  bool isOpt() const { return dyn_cast<BitInit>(flags->getBit(2))->getValue(); }
+  bool getFlagBit(unsigned int Bit) const {
+    if (auto *BitValue = dyn_cast<BitInit>(flags->getBit(Bit)))
+      return BitValue->getValue();
+    return false;
----------------
RossBrunton wrote:

Should this hit an assert?

https://github.com/llvm/llvm-project/pull/146511


More information about the llvm-commits mailing list