Skip to content

Commit

Permalink
Address comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-dilorenzo committed May 30, 2024
1 parent 7a626ac commit c7877c9
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions control-plane/p4RuntimeSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ class P4RuntimeAnalyzer {
}
}

// @platform_property annotation
// Parse `@platform_property` annotation into the PkgInfo.
for (auto *annotation : decl->getAnnotations()->annotations) {
if (annotation->name != "platform_property") continue;
auto *platform_properties = pkginfo->mutable_platform_properties();
Expand All @@ -960,14 +960,13 @@ class P4RuntimeAnalyzer {
auto setInt32Field = [kv, &platform_properties](cstring fName) {
auto *v = kv->expression->to<IR::Constant>();
if (v == nullptr) {
::error(
ErrorType::ERR_UNSUPPORTED,
"Value for '%1%' key in @platform_property annotation is not a integer",
kv);
::error(ErrorType::ERR_UNSUPPORTED,
"Value for '%1%' key in @platform_property annotation is not an "
"integer",
kv);
return;
}
// use Protobuf reflection library to minimize code
// duplication.
// use Protobuf reflection library to minimize code duplication.
auto *descriptor = platform_properties->GetDescriptor();
auto *f = descriptor->FindFieldByName(static_cast<std::string>(fName));
platform_properties->GetReflection()->SetInt32(platform_properties, f,
Expand Down

0 comments on commit c7877c9

Please sign in to comment.