Skip to content

Commit

Permalink
Add missing const on the policy interface return type
Browse files Browse the repository at this point in the history
  • Loading branch information
vlstill committed Feb 13, 2024
1 parent b883c3d commit 0902ee2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontends/common/constantFolding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const IR::Expression *DoConstantFolding::getConstant(const IR::Expression *expr)
}

const IR::Node *DoConstantFolding::postorder(IR::PathExpression *e) {
if (auto *r = policy->hook(*this, e)) return r;
if (const auto *r = policy->hook(*this, e)) return r;
if (refMap == nullptr || assignmentTarget) return e;
auto decl = refMap->getDeclaration(e->path);
if (decl == nullptr) return e;
Expand Down
2 changes: 1 addition & 1 deletion frontends/common/constantFolding.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ namespace P4 {
class ConstantFoldingPolicy {
public:
/// The default hook does not modify anything.
virtual IR::Node *hook(Visitor &, IR::PathExpression *) { return nullptr; }
virtual const IR::Node *hook(Visitor &, IR::PathExpression *) { return nullptr; }
};

/** @brief statically evaluates many constant expressions.
Expand Down

0 comments on commit 0902ee2

Please sign in to comment.