Skip to content

Commit

Permalink
Temporary check
Browse files Browse the repository at this point in the history
  • Loading branch information
fruffy committed Dec 12, 2024
1 parent faec211 commit 2bf40dc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
29 changes: 15 additions & 14 deletions ir/json_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ limitations under the License.
#define IR_JSON_GENERATOR_H_

#include <optional>
#include <set>
#include <string>
#include <unordered_set>
#include <variant>

#include "ir/node.h"
#include "ir/inode.h"
#include "lib/bitvec.h"
#include "lib/cstring.h"
#include "lib/indent.h"
Expand Down Expand Up @@ -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 <typename T>
Expand Down
3 changes: 1 addition & 2 deletions ir/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ cstring IR::Node::prepareSourceInfoForJSON(Util::SourceInfo &si, unsigned *lineN
if (!si.isValid()) {
return nullptr;
}
if (is<IR::AssignmentStatement>()) {
auto assign = to<IR::AssignmentStatement>();
if (auto assign = to<IR::AssignmentStatement>()) {
si = (assign->left->srcInfo + si) + assign->right->srcInfo;
}
return si.toSourcePositionData(lineNumber, columnNumber);
Expand Down

0 comments on commit 2bf40dc

Please sign in to comment.