21
21
22
22
#include " parser-gcc.hh" // for GccPostProcessor
23
23
24
+ using std::string;
25
+
24
26
struct GccTreeDecoder ::Private {
25
27
GccPostProcessor postProc;
26
28
};
@@ -34,23 +36,23 @@ GccTreeDecoder::~GccTreeDecoder() = default;
34
36
35
37
static bool gccReadLocRegion (
36
38
DefEvent *pEvt,
37
- const pt::ptree &beg ,
38
- const pt::ptree &end )
39
+ const pt::ptree &start ,
40
+ const pt::ptree &finish )
39
41
{
40
42
// read file name
41
- pEvt->fileName = valueOf<std:: string>(beg , " file" , " <unknown>" );
42
- if (pEvt->fileName != valueOf<std:: string>(end , " file" , " <unknown>" ))
43
+ pEvt->fileName = valueOf<string>(start , " file" , " <unknown>" );
44
+ if (pEvt->fileName != valueOf<string>(finish , " file" , " <unknown>" ))
43
45
return false ;
44
46
45
47
// read line
46
- if ((pEvt->line = valueOf<int >(beg , " line" ))) {
47
- const int endLine = valueOf<int >(end , " line" );
48
+ if ((pEvt->line = valueOf<int >(start , " line" ))) {
49
+ const int endLine = valueOf<int >(finish , " line" );
48
50
pEvt->vSize = diffNums (pEvt->line , endLine);
49
51
}
50
52
51
53
// read column
52
- if ((pEvt->column = valueOf<int >(beg , " byte-column" ))) {
53
- const int endColumn = valueOf<int >(end , " byte-column" );
54
+ if ((pEvt->column = valueOf<int >(start , " byte-column" ))) {
55
+ const int endColumn = valueOf<int >(finish , " byte-column" );
54
56
pEvt->hSize = diffNums (pEvt->column , endColumn);
55
57
}
56
58
@@ -59,18 +61,16 @@ static bool gccReadLocRegion(
59
61
60
62
static void gccReadLocation (DefEvent *pEvt, const pt::ptree *locs)
61
63
{
62
- using std::string;
63
-
64
64
if (locs->empty ())
65
65
return ;
66
66
67
67
const pt::ptree &firstLoc = locs->begin ()->second ;
68
68
69
69
// try to read a region between start..finish
70
- const pt::ptree *beg , *end ;
71
- if (findChildOf (&beg , firstLoc, " start" )
72
- && findChildOf (&end , firstLoc, " finish" )
73
- && gccReadLocRegion (pEvt, *beg , *end ))
70
+ const pt::ptree *start , *finish ;
71
+ if (findChildOf (&start , firstLoc, " start" )
72
+ && findChildOf (&finish , firstLoc, " finish" )
73
+ && gccReadLocRegion (pEvt, *start , *finish ))
74
74
return ;
75
75
76
76
// fallback to caret
@@ -84,8 +84,6 @@ static void gccReadLocation(DefEvent *pEvt, const pt::ptree *locs)
84
84
85
85
static bool gccReadEvent (DefEvent *pEvt, const pt::ptree &evtNode)
86
86
{
87
- using std::string;
88
-
89
87
// read kind (error, warning, note)
90
88
string &evtName = pEvt->event ;
91
89
evtName = valueOf<string>(evtNode, " kind" );
0 commit comments