majnemer added inline comments.
> PrintPreprocessedOutput.cpp:331-349 > + const size_t N = Path.size(); > + size_t I = 0; > + while (I < N) { > + if (Path[I] == '\\' || Path[I] == '\"') { > + // Have to escape backslashes or double-quotes. > + // Send out backslash to escape the next char. > + Buffer.push_back('\\'); I think this loop would be easier to understand like so: while (!Path.empty()) { if (Path.consume_front("\\")) { Buffer.push_back("\\\\"); } else if (Path.consume_front("\"")) { Buffer.push_back("\\\""); } else if (Path.consume_front("*/")) { Buffer.push_back("*\\/"); } else { Buffer.push_back(Path.front()); Path = Path.drop_front(); } } The big takeaway is that we now avoid messy `I + 1 < N` type checks. https://reviews.llvm.org/D25153 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits