Escape backslashes and quotes in symbol name strings

This commit is contained in:
Max Brunsfeld 2015-11-09 09:33:24 -08:00
parent 84f939ab4d
commit e11515fb74
4 changed files with 191 additions and 0 deletions

View file

@ -411,8 +411,10 @@ class CCodeGenerator {
}
string sanitize_name_for_string(string name) {
util::str_replace(&name, "\\", "\\\\");
util::str_replace(&name, "\n", "\\n");
util::str_replace(&name, "\r", "\\r");
util::str_replace(&name, "\"", "\\\"");
return name;
}