From 2bf40dc13a3c78a44fc29acac18ddd8579d2971b Mon Sep 17 00:00:00 2001 From: fruffy Date: Thu, 12 Dec 2024 21:03:39 +0100 Subject: [PATCH] Temporary check --- ir/json_generator.h | 29 +++++++++++++++-------------- ir/node.cpp | 3 +-- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ir/json_generator.h b/ir/json_generator.h index 68d73d158d5..053520bce6b 100644 --- a/ir/json_generator.h +++ b/ir/json_generator.h @@ -18,11 +18,12 @@ limitations under the License. #define IR_JSON_GENERATOR_H_ #include +#include #include #include #include -#include "ir/node.h" +#include "ir/inode.h" #include "lib/bitvec.h" #include "lib/cstring.h" #include "lib/indent.h" @@ -247,19 +248,19 @@ class JSONGenerator { out << std::endl << --indent << "}"; } - void generate(const IR::Node &v) { - out << "{" << std::endl; - ++indent; - if (node_refs.find(v.id) != node_refs.end()) { - out << indent << "\"Node_ID\" : " << v.id; - } else { - node_refs.insert(v.id); - v.toJSON(*this); - if (dumpSourceInfo) { - v.sourceInfoToJSON(*this); - } - } - out << std::endl << --indent << "}"; + void generate(const IR::INode &v) { + // out << "{" << std::endl; + // ++indent; + // if (node_refs.find(v.id) != node_refs.end()) { + // out << indent << "\"Node_ID\" : " << v.id; + // } else { + // node_refs.insert(v.id); + // v.toJSON(*this); + // if (dumpSourceInfo) { + // v.sourceInfoToJSON(*this); + // } + // } + // out << std::endl << --indent << "}"; } template diff --git a/ir/node.cpp b/ir/node.cpp index 0046acff2aa..44d5d6903b1 100644 --- a/ir/node.cpp +++ b/ir/node.cpp @@ -100,8 +100,7 @@ cstring IR::Node::prepareSourceInfoForJSON(Util::SourceInfo &si, unsigned *lineN if (!si.isValid()) { return nullptr; } - if (is()) { - auto assign = to(); + if (auto assign = to()) { si = (assign->left->srcInfo + si) + assign->right->srcInfo; } return si.toSourcePositionData(lineNumber, columnNumber);