Skip to content

Commit

Permalink
fix constructor errors
Browse files Browse the repository at this point in the history
Signed-off-by: Nitish <snapdgnn@proton.me>
  • Loading branch information
snapdgn committed Aug 8, 2024
1 parent fa7389f commit 37344eb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions backends/p4fmt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set(REFCHECK_SRCS
refcheck.cpp
options.cpp
p4fmt.cpp
attach.cpp
)

# p4fmt
Expand Down
4 changes: 2 additions & 2 deletions backends/p4fmt/attach.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ void Attach::attachCommentsToNode(const IR::Node *node) {
}
}

Attach::Attach(){};
Attach::~Attach(){};
Attach::Attach() = default;
Attach::~Attach() = default;

template <typename T>
bool Attach::preorderImpl(const T *node) {
Expand Down
6 changes: 1 addition & 5 deletions backends/p4fmt/attach.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ namespace P4 {
class Attach : public Inspector {
public:
Attach();
Attach(const Attach &) = default;
Attach(Attach &&) = delete;
Attach &operator=(const Attach &) = delete;
Attach &operator=(Attach &&) = delete;
~Attach() override;
~Attach();

template <typename T>
bool preorderImpl(const T *node);
Expand Down
8 changes: 6 additions & 2 deletions backends/p4fmt/p4fmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ std::stringstream getFormattedOutput(std::filesystem::path inputFile) {
return formattedOutput;
}

PassManager passes({P4::Attach(), P4::ToP4(&formattedOutput, false)});
program = program->apply(passes);
auto top4 = P4::ToP4(&formattedOutput, false);
auto attach = P4::Attach();
// attach comments to nodes
program->apply(attach);
// Print the program before running front end passes.
program->apply(top4);

if (::errorCount() > 0) {
::error("Failed to format p4 program.");
Expand Down

0 comments on commit 37344eb

Please sign in to comment.