Skip to content

Commit

Permalink
cg: Add special case for spelling of builtin attribute.
Browse files Browse the repository at this point in the history
The Builtin attribute doesn't have spelling because it isn't possible to write it in code.
  • Loading branch information
Jezurko committed Oct 11, 2023
1 parent 63492c6 commit 236c9f6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/vast/CodeGen/CodeGenDeclVisitor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 236c9f6

Please sign in to comment.