Skip to content

Commit

Permalink
Ignore typeless structs in unstructured annotations (#5058)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Dodd <cdodd@nvidia.com>
Co-authored-by: Emre Orbay <eorbay@nvidia.com>
  • Loading branch information
ChrisDodd and Emre Orbay authored Dec 19, 2024
1 parent f971ca6 commit d8c1d1b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions frontends/p4/specializeGenericTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ const IR::Node *ReplaceTypeUses::postorder(IR::Type_Specialized *type) {
}

const IR::Node *ReplaceTypeUses::postorder(IR::StructExpression *expression) {
const IR::Annotation *anNode = findContext<IR::Annotation>();
if (anNode != nullptr && !anNode->structured) return expression;

auto st = getOriginal<IR::StructExpression>()->structType;
if (!st) {
::P4::error(ErrorType::ERR_TYPE_ERROR,
Expand Down

0 comments on commit d8c1d1b

Please sign in to comment.