Created
October 3, 2014 20:40
-
-
Save anonymous/dc0000d3b801a7bedff0 to your computer and use it in GitHub Desktop.
GC warnings processing script for DMD.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.stdio, std.string, std.regex, std.algorithm, std.range; | |
struct Result{ | |
string file, line, reason; | |
} | |
void main(){ | |
auto re = regex(`(.*\\\w+)\.d\((\d+)\):\s*vgc:\s*(.*)`); | |
//writeln(`std\variant.d(236): vgc: 'new' causes GC allocation`.match(re)); | |
Result[] results; | |
foreach(line; stdin.byLine){ | |
auto m = line.idup.matchFirst(re); | |
if(m){ | |
results ~= Result(m[1].replace("\\", "/"), m[2], m[3]); | |
} | |
} | |
sort!((a,b) => a.file < b.file && a.line < b.line)(results); | |
results = uniq(results).array; | |
string linkTempalte = | |
`[%s:L%s](https://github.com/D-Programming-Language/phobos/blob/master/%s.d#L%s)`; | |
writeln("|module| function |reason|action|"); | |
writeln("|------|----------|------|------|"); | |
foreach(r; results){ | |
//writeln(r.file, ",", r.line, ",", r.reason); | |
auto mod = r.file.replace("/", "."); | |
auto link = format(linkTempalte, mod, r.line, r.file, r.line); | |
writefln("| %s | | %s | |", link, r.reason,); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment