Fix foreach of assocArr inside a constraint block (#5727) (#5841)

This commit is contained in:
Yilou Wang
2025-03-11 13:32:34 -04:00
committed by GitHub
parent 6ecdd14fdb
commit 7fe51583e5
4 changed files with 33 additions and 2 deletions
+15
View File
@@ -56,6 +56,7 @@
#include <cctype>
#include <cerrno>
#include <cstdlib>
#include <iostream>
#include <limits>
#include <list>
#include <sstream>
@@ -916,6 +917,20 @@ void _vl_vsformat(std::string& output, const std::string& format, va_list ap) VL
}
break;
}
case 'p': { // 'x' but parameter is string
const int lbits = va_arg(ap, int);
const std::string* const cstr = va_arg(ap, const std::string*);
std::ostringstream oss;
for (unsigned char c : *cstr) { oss << std::hex << static_cast<int>(c); }
std::string hex_str = oss.str();
if (width > 0 && widthSet) {
hex_str = hex_str.size() > width
? hex_str.substr(0, width)
: std::string(width - hex_str.size(), '0') + hex_str;
output += hex_str;
}
break;
}
default: {
// Deal with all read-and-print somethings
const int lbits = va_arg(ap, int);