}
// TODO(mdempsky): Print line pragma details too.
file := filepath.Base(pos.Filename())
+ // Note: this output will be parsed by ssa/html.go:(*HTMLWriter).WriteAST. Keep in sync.
fmt.Fprintf(w, "%s:%d:%d", file, pos.Line(), pos.Col())
}
}
if strings.HasPrefix(l, "buildssa") {
escaped = fmt.Sprintf("<b>%v</b>", l)
} else {
- // Parse the line number from the format l(123).
- idx := strings.Index(l, " l(")
- if idx != -1 {
- subl := l[idx+3:]
- idxEnd := strings.Index(subl, ")")
- if idxEnd != -1 {
- if _, err := strconv.Atoi(subl[:idxEnd]); err == nil {
- lineNo = subl[:idxEnd]
- }
+ // Parse the line number from the format file:line:col.
+ // See the implementation in ir/fmt.go:dumpNodeHeader.
+ sl := strings.Split(l, ":")
+ if len(sl) >= 3 {
+ if _, err := strconv.Atoi(sl[len(sl)-2]); err == nil {
+ lineNo = sl[len(sl)-2]
}
}
escaped = html.EscapeString(l)