Implement the functionallity of prepend, required by D demangler.
Please read discussion https://reviews.llvm.org/D111414 for context.
See also https://reviews.llvm.org/D111947 .
Details
- Reviewers
dblaikie Geod24 - Group Reviewers
Restricted Project - Commits
- rG2d77b272a8f9: [Demangle] Add prepend functionality to OutputString
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Looks alright - guess some other boundary testing could be done (testing without anything in the buffer, testing when prepend causes the buffer to grow V when it's already big enough) but it's probably fine as-is.
libcxxabi/src/demangle/Utility.h | ||
---|---|---|
101 | Could probably skip this. Falls out naturally from the implementation. | |
103–105 | Could use memmove for this? |
I added more tests to cover the requested situations. I also forgot to add a free after a malloc on the testsuite. I also changed the manual for loop to memmove to benefit from optimized implementations.
@dblaikie I changed what you requested, which includes the use of memmove and adding some tests to cover empty buffers and reinsertion after resetting the position. Can you re-review please?
I'm having trouble applying this patch locally - I get:
$ arc patch D111948 Created and checked out branch arcpatch-D111948. Created and checked out branch arcpatch-D111947. Checking patch llvm/unittests/Demangle/OutputStreamTest.cpp => llvm/unittests/Demangle/OutputBufferTest.cpp... Checking patch llvm/unittests/Demangle/ItaniumDemangleTest.cpp... Checking patch llvm/unittests/Demangle/CMakeLists.txt... Checking patch llvm/lib/Demangle/RustDemangle.cpp... Checking patch llvm/lib/Demangle/MicrosoftDemangleNodes.cpp... Checking patch llvm/lib/Demangle/MicrosoftDemangle.cpp... Checking patch llvm/lib/Demangle/ItaniumDemangle.cpp... Checking patch llvm/include/llvm/Demangle/Utility.h... Checking patch llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h... Checking patch llvm/include/llvm/Demangle/ItaniumDemangle.h... Checking patch libcxxabi/src/demangle/Utility.h... Checking patch libcxxabi/src/demangle/ItaniumDemangle.h... Applied patch llvm/unittests/Demangle/OutputStreamTest.cpp => llvm/unittests/Demangle/OutputBufferTest.cpp cleanly. Applied patch llvm/unittests/Demangle/ItaniumDemangleTest.cpp cleanly. Applied patch llvm/unittests/Demangle/CMakeLists.txt cleanly. Applied patch llvm/lib/Demangle/RustDemangle.cpp cleanly. Applied patch llvm/lib/Demangle/MicrosoftDemangleNodes.cpp cleanly. Applied patch llvm/lib/Demangle/MicrosoftDemangle.cpp cleanly. Applied patch llvm/lib/Demangle/ItaniumDemangle.cpp cleanly. Applied patch llvm/include/llvm/Demangle/Utility.h cleanly. Applied patch llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h cleanly. Applied patch llvm/include/llvm/Demangle/ItaniumDemangle.h cleanly. Applied patch libcxxabi/src/demangle/Utility.h cleanly. Applied patch libcxxabi/src/demangle/ItaniumDemangle.h cleanly. Cherry Pick Failed! Exception Command failed with error #1! COMMAND git cherry-pick 'arcpatch-D111947' STDOUT On branch arcpatch-D111948 You are currently cherry-picking commit f03e9f1cbed8. (all conflicts fixed: run "git cherry-pick --continue") (use "git cherry-pick --skip" to skip this patch) (use "git cherry-pick --abort" to cancel the cherry-pick operation) nothing to commit, working tree clean STDERR The previous cherry-pick is now empty, possibly due to conflict resolution. If you wish to commit it anyway, use: git commit --allow-empty Otherwise, please use 'git cherry-pick --skip' (Run with `--trace` for a full exception trace.)
Perhaps it needs to be rebased or something?
Should be good now. For some reason, adding the rename patch to the parent patch stack did that. I reproduced the arc patch D111948 and it works now. I rebased anyway.
Could probably skip this. Falls out naturally from the implementation.