From 480eb8add80045d6b4fd0804f7ec35a652e4fcf0 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 9 Jun 2015 20:24:21 +0300 Subject: Add location variable to all nodes. And fill it with raw location. --- src/nodes/base/node.h | 2 ++ src/parsers/blocknode.cpp | 1 + src/parsers/generic.cpp | 1 + 3 files changed, 4 insertions(+) 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 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); -- cgit v1.2.3-70-g09d2