This is an archive of the discontinued LLVM Phabricator instance.

[Demangle] Add another test for ItaniumPartialDemangler
ClosedPublic

Authored by sgraenitz on Aug 8 2018, 1:46 PM.

Details

Summary

Show the behavior of print operations in the ItaniumPartialDemangler. It's a summary of what the current integration in LLDB assumes. For new users this may be a useful example.

Diff Detail

Event Timeline

sgraenitz created this revision.Aug 8 2018, 1:46 PM
erik.pilkington accepted this revision.Aug 8 2018, 2:09 PM

LGTM, thanks for doing this!

unittests/Demangle/PartialDemangleTest.cpp
188

Does LLDB actually pass in a N that is less than the length of Buf? Its not wrong to do that per se, realloc will sort it out, but it seems kinda strange.

This revision is now accepted and ready to land.Aug 8 2018, 2:09 PM
sgraenitz added inline comments.Aug 8 2018, 3:35 PM
unittests/Demangle/PartialDemangleTest.cpp
188

My first version used only one variable for N, so the pretended buffer size was decreasing continuously while the actual buffer remained unchanged.. That caused unnecessary allocations. I fixed that a few days ago. Basically it's these three cases to consider:
https://github.com/llvm-mirror/lldb/blob/a063373af4d295e48017ca218d1030aac13b0af5/source/Core/RichManglingContext.cpp#L91

This revision was automatically updated to reflect the committed changes.

BTW: warning I saw during recent build:

[98/790] Building CXX object tools/lldb/source/Core/CMakeFiles/lldbCore.dir/RichManglingContext.cpp.o
/home/gclayton/local/src/llvm/svn/llvm/tools/lldb/source/Core/RichManglingContext.cpp: In member function ‘bool lldb_private::RichManglingContext::IsCtorOrDtor() const’:
/home/gclayton/local/src/llvm/svn/llvm/tools/lldb/source/Core/RichManglingContext.cpp:77:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
/home/gclayton/local/src/llvm/svn/llvm/tools/lldb/source/Core/RichManglingContext.cpp: In member function ‘bool lldb_private::RichManglingContext::IsFunction() const’:
/home/gclayton/local/src/llvm/svn/llvm/tools/lldb/source/Core/RichManglingContext.cpp:89:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^