[Mlir-commits] [clang] [llvm] [mlir] [debuginfo][coro] Emit debug info labels for coroutine resume points (PR #141937)

Adrian Vogelsgesang llvmlistbot at llvm.org
Tue Jul 1 13:30:24 PDT 2025


================
@@ -2240,14 +2242,28 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
     break;
   }
   case bitc::METADATA_LABEL: {
-    if (Record.size() != 5)
+    if (Record.size() < 5 || Record.size() > 7)
       return error("Invalid record");
 
     IsDistinct = Record[0] & 1;
+    uint64_t Line = Record[4];
+    uint64_t Column = Record.size() > 5 ? Record[5] : 0;
+    bool IsArtificial = Record[0] & 2;
+    std::optional<unsigned> CoroSuspendIdx;
+    if (Record.size() > 6) {
+      unsigned RawSuspendIdx = Record[6];
+      if (RawSuspendIdx != std::numeric_limits<unsigned>::max()) {
+        if (RawSuspendIdx > (uint64_t)std::numeric_limits<unsigned>::max())
+          return error("CoroSuspendIdx value is too large");
----------------
vogelsgesang wrote:

indeed, RawSuspendIdx should have been uint64_t, and I should have checked for numeric_limits<uint64_t>::max here. Fixed. Thanks for catching this! :)

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


More information about the Mlir-commits mailing list