makeNameAttr: better error message

This commit is contained in:
Ivan Krysak
2026-06-10 05:52:23 +00:00
committed by Pietro Fezzardi
parent a7820ae28b
commit 0d2ae728f3
+7 -1
View File
@@ -60,7 +60,13 @@ MutableStringAttr makeNameAttr(mlir::MLIRContext *Context,
llvm::StringRef Handle,
llvm::StringRef Name) {
auto Attr = makeNameAttr<T>(Context, Handle);
revng_assert(Attr.getValue().empty());
if (not Attr.getValue().empty()) {
std::string Error = "Name attribute already has a value that differs "
"from the new one: '"
+ Attr.getValue().str() + "' vs '" + Name.str() + "'";
revng_abort(Error.c_str());
}
Attr.setValue(Name);
return Attr;
}