commit 9a081afc4f05ff948170765450682559297eb00d
parent d5d54f3475202b781199a9e80d7d89d72bec4f5b
Author: kyle <kyle@getaddrinfo.net>
Date: Sun, 1 Nov 2015 16:12:30 -0700
instrumenter: don't add ")" when adding "(lines[xx] = 1, " failed
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/instrument/instrumenter.cpp b/instrument/instrumenter.cpp
@@ -57,7 +57,10 @@ instrumenter::VisitStmt(Stmt *s)
return true;
ss << "(lines[" << line << "] = 1, ";
- TheRewriter.InsertTextBefore(stmt_to_inst->getLocStart(), ss.str());
+ if (TheRewriter.InsertTextBefore(stmt_to_inst->getLocStart(), ss.str()))
+ // writing failed, don't attempt to add ")"
+ return true;
+
TheRewriter.InsertTextAfter(real_loc_end(stmt_to_inst), ")");
return true;