comparison gcc/go/gofrontend/go-linemap.h @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 04ced10e8804
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
61 // "foo.go:10". Returns an empty string for predeclared, builtin or 61 // "foo.go:10". Returns an empty string for predeclared, builtin or
62 // unknown locations. 62 // unknown locations.
63 virtual std::string 63 virtual std::string
64 to_string(Location) = 0; 64 to_string(Location) = 0;
65 65
66 // Return the line number for a given location (for debugging dumps) 66 // Return the file name for a given location.
67 virtual std::string
68 location_file(Location) = 0;
69
70 // Return the line number for a given location.
67 virtual int 71 virtual int
68 location_line(Location) = 0; 72 location_line(Location) = 0;
69 73
70 protected: 74 protected:
71 // Return a special Location used for predeclared identifiers. This 75 // Return a special Location used for predeclared identifiers. This
138 { 142 {
139 go_assert(Linemap::instance_ != NULL); 143 go_assert(Linemap::instance_ != NULL);
140 return Linemap::instance_->to_string(loc); 144 return Linemap::instance_->to_string(loc);
141 } 145 }
142 146
143 // Return line number for location 147 // Return the file name of a location.
148 static std::string
149 location_to_file(Location loc)
150 {
151 go_assert(Linemap::instance_ != NULL);
152 return Linemap::instance_->location_file(loc);
153 }
154
155 // Return line number of a location.
144 static int 156 static int
145 location_to_line(Location loc) 157 location_to_line(Location loc)
146 { 158 {
147 go_assert(Linemap::instance_ != NULL); 159 go_assert(Linemap::instance_ != NULL);
148 return Linemap::instance_->location_line(loc); 160 return Linemap::instance_->location_line(loc);