Now that llvm demangler supports more generic customization, we can
implement type substitution directly on top of this API. This will allow
us to remove the specialized hooks which were added to the demangler to
support this use case.
Details
- Reviewers
sgraenitz erik.pilkington JDevlieghere - Commits
- rGe0d2733bf63f: CPlusPlusLanguage: Use new demangler API to implement type substitution
rLLDB346233: CPlusPlusLanguage: Use new demangler API to implement type substitution
rL346233: CPlusPlusLanguage: Use new demangler API to implement type substitution
Diff Detail
- Build Status
Buildable 24549 Build 24548: arc lint + arc unit
Event Timeline
Hi Pavel, thanks for working on this. The code looks really great. I have no actual concerns about landing it like this.
Two minor remarks:
- We still have no coverage for substitution failures in CPlusPlusLanguageTest.cpp test case FindAlternateFunctionManglings.
- We create a new BumpPtrAllocator for each TypeSubstitutor::substitute(), right? Well, the impact on performance is probably on a different order of magnitude than we are concerned about here.
This will allow us to remove the specialized hooks which were added to the demangler to support this use case.
Right, it bridged the time between removing FastDemangle from LLDB and getting the new ManglingParser in LLVM. IIUC this basically means reverting https://reviews.llvm.org/D50586.
Thanks for the review.
I think that creating the new BumpPtrAllocator every call doesn't matter much here, this function
get's called only on a few symbols for each evaluated expression. However, it also wasn't too
hard to reuse it (at least at the level of FindAlternateFunctionManglings), so I just did that.
I also added a simple failure test for this function.
Nice. For parameter lists of reset and substitute indentation could be fixed, but otherwise this looks really good to me.
source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp | ||
---|---|---|
337 | First points to the first char of the input (Mangled). 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. |
Thanks for the review. I have added some comments, and moved appending of the unmodified portion of the name into a separate function to aid readability.
Can you just use numLeft() here? It would be less opaque.