[Lldb-commits] [PATCH] D108228: Fix error handling in the libcxx std::string formatter

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 17 11:39:30 PDT 2021


jingham created this revision.
jingham added a reviewer: JDevlieghere.
jingham requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The formatter tries to get the data field of the std::string, and to check whether that fails it just checks that the ValueObjectSP returned is not empty.  But we never return empty ValueObjectSP's to indicate failure, since doing so would lose the Error object that tells you why fetching the ValueObject failed.

This patch adds a check for ValueObject::GetError().Success().

I also added a test case for this failure, and reworked the test case a bit (to use run_to_source_breakpoint).  I also renamed a couple of single letter locals which don't follow the lldb coding conventions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108228

Files:
  lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
  lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
  lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/main.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108228.366967.patch
Type: text/x-patch
Size: 6611 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210817/3201dcbd/attachment-0001.bin>


More information about the lldb-commits mailing list