This is an archive of the discontinued LLVM Phabricator instance.

[Demangle] Add prepend functionality to OutputString
ClosedPublic

Authored by ljmf00 on Oct 16 2021, 12:37 PM.

Details

Reviewers
dblaikie
Geod24
Group Reviewers
Restricted Project
Commits
rG2d77b272a8f9: [Demangle] Add prepend functionality to OutputString
Summary

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 .

Diff Detail

Event Timeline

ljmf00 requested review of this revision.Oct 16 2021, 12:37 PM
ljmf00 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptOct 16 2021, 12:37 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript
dblaikie accepted this revision.Oct 17 2021, 11:06 AM

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
102

Could probably skip this. Falls out naturally from the implementation.

104–106

Could use memmove for this?

ljmf00 updated this revision to Diff 381370.Oct 21 2021, 1:14 PM

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.

ljmf00 updated this revision to Diff 381453.Oct 21 2021, 6:33 PM

Just ran clang-format

ljmf00 updated this revision to Diff 381454.Oct 21 2021, 6:35 PM

Renamed OutputString test to OutputBuffer test

Geod24 accepted this revision.Oct 21 2021, 7:32 PM

LGTM

@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?

dblaikie accepted this revision.Oct 25 2021, 11:54 AM

Looks good, thanks!

Looks good, thanks!

Can you or someone with permission, land it? Thanks :)

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?

ljmf00 updated this revision to Diff 382475.Oct 26 2021, 3:33 PM

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.

This revision was not accepted when it landed; it landed in state Needs Review.Oct 26 2021, 4:24 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.