elsteveogrande added inline comments.
> PrintPreprocessedOutput.cpp:329-330
> +static std::string sanitizePath(StringRef Path) {
> + std::string Result;
> + Result.reserve(Path.size() * 2);
> + while (!Path.empty()) {
Note: I'm //pretty// sure this is about as efficient as it gets for
string-building (and then also, string-builds will tend to happen only once per
include). The string has its internal char-vector-like structure, pre-sized to
a generous amount, so extra futzing should not occur, making this `O(length of
strings appended to it)`; and the return should optimize away so that it's not
copied.
More importantly though, this is now quite a bit cleaner.
https://reviews.llvm.org/D25153
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits