[Lldb-commits] [PATCH] D54074: CPlusPlusLanguage: Use new demangler API to implement type substitution

Stefan Gränitz via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 6 03:25:49 PST 2018

sgraenitz added inline comments.

Comment at: source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp:337
+    if (llvm::StringRef(First, Last - First).startswith(Search)) {
+      Result += llvm::StringRef(Written, First - Written);
+      Result += Replace;
shafik wrote:
> also `First - Written` is used twice but it is not obvious what the means, naming it via a member function might be helpful.
`First` points to the first char of the input (`Mangled`).
`Written` points to the char of the input, up until we have constructed the respective output already.

Quite similar to the previous implementation. Difference is: it used a `std::back_insert_iterator`, but I wouldn't say that made it simpler. Intelligibility may benefit from comment as in the past:

// Write the unmatched part of the original. Then write the
// replacement string. Finally skip the search string in the original.

IMHO it's not a high prio.


More information about the lldb-commits mailing list