summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-06-09 20:24:21 +0300
committerAndrei Karas <akaras@inbox.ru>2015-06-09 20:24:21 +0300
commit480eb8add80045d6b4fd0804f7ec35a652e4fcf0 (patch)
treed575ecac8170f3b1bac2c49f6dd0fc654cd1f198
parent7f3d24b7b0fe495b55626a21c9696b995f6082cf (diff)
downloadparanucker-480eb8add80045d6b4fd0804f7ec35a652e4fcf0.tar.gz
paranucker-480eb8add80045d6b4fd0804f7ec35a652e4fcf0.tar.bz2
paranucker-480eb8add80045d6b4fd0804f7ec35a652e4fcf0.tar.xz
paranucker-480eb8add80045d6b4fd0804f7ec35a652e4fcf0.zip
Add location variable to all nodes. And fill it with raw location.
-rw-r--r--src/nodes/base/node.h2
-rw-r--r--src/parsers/blocknode.cpp1
-rw-r--r--src/parsers/generic.cpp1
3 files changed, 4 insertions, 0 deletions
diff --git a/src/nodes/base/node.h b/src/nodes/base/node.h
index d29cb5a..ad8fe10 100644
--- a/src/nodes/base/node.h
+++ b/src/nodes/base/node.h
@@ -37,6 +37,7 @@ struct Node
childs(),
gccNode(nullptr),
nodeType(ERROR_MARK),
+ location(0),
line(-1),
column(-1),
treeNumber(0),
@@ -67,6 +68,7 @@ struct Node
std::vector<Node*> childs;
tree gccNode;
tree_code nodeType;
+ location_t location;
int line;
int column;
int treeNumber;
diff --git a/src/parsers/blocknode.cpp b/src/parsers/blocknode.cpp
index 0b8e93a..b83cf81 100644
--- a/src/parsers/blocknode.cpp
+++ b/src/parsers/blocknode.cpp
@@ -35,6 +35,7 @@ void parseBlockNode(BlockNode *node)
node->file = LOCATION_FILE(loc);
node->line = LOCATION_LINE(loc);
node->column = LOCATION_COLUMN(loc);
+ node->location = loc;
}
Log::dump(node);
diff --git a/src/parsers/generic.cpp b/src/parsers/generic.cpp
index a749fad..f1a13e8 100644
--- a/src/parsers/generic.cpp
+++ b/src/parsers/generic.cpp
@@ -176,6 +176,7 @@ void fillLocation(Node *node)
}
location_t loc = DECL_SOURCE_LOCATION(node->gccNode);
+ node->location = loc;
node->file = LOCATION_FILE(loc);
node->line = LOCATION_LINE(loc);
node->column = LOCATION_COLUMN(loc);