diff --git a/include/vast/CodeGen/CodeGenDeclVisitor.hpp b/include/vast/CodeGen/CodeGenDeclVisitor.hpp index 78ad56da95..e35a83e916 100644 --- a/include/vast/CodeGen/CodeGenDeclVisitor.hpp +++ b/include/vast/CodeGen/CodeGenDeclVisitor.hpp @@ -805,10 +805,17 @@ namespace vast::cg { mlir::NamedAttrList attrs = op->getAttrs(); for (auto attr : decl->getAttrs()) { auto visited = visit(attr); + auto spelling = attr->getSpelling(); + // Bultin attr doesn't have spelling because it can not be written in code + if (auto builtin = clang::dyn_cast< clang::BuiltinAttr >(attr)) { + spelling = "builtin"; + } + if (auto prev = attrs.getNamed(spelling)) { VAST_CHECK(visited == prev.value().getValue(), "Conflicting redefinition of attribute {0}", spelling); } + attrs.set(spelling, visited); } op->setAttrs(attrs);