aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
AgeCommit message (Collapse)AuthorFilesLines
2025-08-11[lldb] Fix libstdc++ std::string formatter after #147835 (#152993)David Spickett1-3/+4
https://github.com/llvm/llvm-project/pull/147835 made changes that caused libstdc++ std::string tests to fail: ``` ====================================================================== FAIL: test_unavailable_summary_libstdcxx_dwo (TestDataFormatterStdString.StdStringDataFormatterTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1805, in test_method return attrvalue(self) File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py", line 223, in test_unavailable_summary_libstdcxx self.do_test_summary_unavailable() File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py", line 213, in do_test_summary_unavailable self.assertEqual(summary, "Summary Unavailable", "No summary for bad value") AssertionError: '(null)' != 'Summary Unavailable' - (null) + Summary Unavailable : No summary for bad value Config=aarch64-/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang ---------------------------------------------------------------------- ``` This test constructs an invalid std::string by starting with a null pointer. Somehow this improvement in Clang uncovered a bug in the formatter. Perhaps because we now know the type of the field we tried to access is char *, so fall back to a C string formatter that produces `(null)`. The formatter tries to access `_M_p` and checked whether the resulting ValueObjectSP was null, but not that it did not contain an error value. I think that error value can be there if you are able to access one part of the path, `_M_dataplus`, but another part fails. Since the layout looks like this: ``` struct _Alloc_hider : { pointer _M_p; // The actual data. }; _Alloc_hider _M_dataplus; void _M_data(pointer __p) { _M_dataplus._M_p = __p; } ``` So I think we were able to read `_M_dataplus` just by offset, but then failed because it contains, or points to something containing nulls or a null pointer. Or perhaps an error value means we know what the class member is, but could not read from it. I found this by comparing with the libcxx formatter, so I've copied the same handling from there to fix the issue.
2025-07-16[LLDB] Convert libstdc++ std::variant summary to C++ (#148929)nerix1-0/+46
This PR converts the `std::variant` summary from Python to C++. Split from #148554. MSVC's STL and libstdc++ use the same type name for `std::variant`, thus they need one "dispatcher" function that checks the type and calls the appropriate summary. For summaries, both need to be implemented in C++. This is mostly a 1:1 translation. The main difference is that in C++, the summary returns `false` if it can't inspect the object properly (e.g. a member could not be found). In Python, this wasn't possible.
2025-07-08[lldb][Formatters] Consistently unwrap pointer element_type in ↵Michael Buch1-6/+7
std::shared_ptr formatters (#147340) Follow-up to https://github.com/llvm/llvm-project/pull/147165#pullrequestreview-2992585513 Currently when we explicitly dereference a std::shared_ptr, both the libstdc++ and libc++ formatters will cast the type of the synthetic pointer child to whatever the `std::shared_ptr::element_type` is aliased to. E.g., ``` (lldb) v p (std::shared_ptr<int>) p = 10 strong=1 weak=0 { pointer = 0x000000010016c6a0 } (lldb) v *p (int) *p = 10 ``` However, when we print (or dereference) `p.pointer`, the type devolves to something less user-friendly: ``` (lldb) v p.pointer (std::shared_ptr<int>::element_type *) p.pointer = 0x000000010016c6a0 (lldb) v *p.pointer (std::shared_ptr<int>::element_type) *p.pointer = 10 ``` This patch changes both formatters to store the casted type. Then `GetChildAtIndex` will consistently use the unwrapped type.
2025-07-07[lldb][Formatters] Add shared/weak count to libstdc++ std::shared_ptr ↵Michael Buch1-17/+26
summary (#147166) Depends on https://github.com/llvm/llvm-project/pull/147165 This adds weak/strong counts to the std::shared_ptr summary of the libstdcxx formatters. We already do this for libcxx. This will make it easier to consolidate the tests into a generic one (see https://github.com/llvm/llvm-project/pull/147141).
2025-07-07[lldb][Formatters] Make libc++ and libstdc++ std::shared_ptr formatters ↵Michael Buch1-11/+16
consistent with each other (#147165) This patch adjusts the libcxx and libstdcxx std::shared_ptr formatters to look the same. Changes to libcxx: * Now creates a synthetic child called `pointer` (like we already do for `std::unique_ptr`) Changes to libstdcxx: * When asked to dereference the pointer, cast the type of the result ValueObject to the element type (which we get from the template argument to std::shared_ptr). Before: ``` (std::__shared_ptr<int, __gnu_cxx::_S_atomic>::element_type) *foo = 123 ``` After: ``` (int) *foo = 123 ``` Tested in https://github.com/llvm/llvm-project/pull/147141
2025-07-02[LLDB] Simplify libstdc++ string summaries (#146562)nerix1-115/+5
From #143177. This combines the summaries for the pre- and post C++ 11 `std::string` as well as `std::wstring`. In all cases, the data pointer is reachable through `_M_dataplus._M_p`. It has the correct type (i.e. `char*`/`wchar_t*`) and it's null terminated, so LLDB knows how to format it as expected when using `GetSummaryAsCString`.
2025-06-02[lldb] Refactor away UB in SBValue::GetLoadAddress (#141799)Pavel Labath1-13/+5
The problem was in calling GetLoadAddress on a value in the error state, where `ValueObject::GetLoadAddress` could end up accessing the uninitialized "address type" by-ref return value from `GetAddressOf`. This probably happened because each function expected the other to initialize it. We can guarantee initialization by turning this into a proper return value. I've added a test, but it only (reliably) crashes if lldb is built with ubsan.
2025-05-30[LLDB] Avoid crashes when inspecting MSVC STL types (#140761)nerix1-0/+3
When inspecting/printing types from MSVC's STL, LLDB would crash because it assumes these types were from libstdc++. Specifically, `std::shared_ptr` and `std::optional` would crash because of a null pointer dereference. I added a minimal test that tests the types with C++ helpers for libstdc++ (only tests for crashes). - Fixes #115216 - Fixes #120310 This still has one unresolved discussion: What about MS STL types? This is https://github.com/llvm/llvm-project/issues/24834, but there was a bit of discussion in #120310 as well. The main issue is that MSVC's STL uses the same type names as libstdc++ (i.e. neither uses an inline namespace like libc++ for some types).
2025-04-30[lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (#136693)Charles Zablit1-10/+15
This patch replaces the use of `UINT32_MAX` as the error return value of `GetIndexOfChildWithName` with `llvm::Expected`. # Tasks to do in another PR 1. Replace `CalculateNumChildrenIgnoringErrors` with `CalculateNumChildren`. See [this comment](https://github.com/llvm/llvm-project/pull/136693#discussion_r2056319358). 2. Update `lldb_private::formatters::ExtractIndexFromString` to use `llvm::Expected`. See [this comment](https://github.com/llvm/llvm-project/pull/136693#discussion_r2054217536). 3. Create a new class which carries both user and internal errors. See [this comment](https://github.com/llvm/llvm-project/pull/136693#discussion_r2056439608).
2025-03-05[lldb] Upgrade CompilerType::GetBitSize to return llvm::Expected (#129601)Adrian Prantl1-1/+2
This patch pushes the error handling boundary for the GetBitSize() methods from Runtime into the Type and CompilerType APIs. This makes it easier to diagnose problems thanks to more meaningful error messages being available. GetBitSize() is often the first thing LLDB asks about a type, so this method is particularly important for a better user experience. rdar://145667239
2025-02-17[lldb] Provide default impl for MightHaveChildren (NFC) (#119977)Dave Lee1-10/+0
The vast majority of `SyntheticChildrenFrontEnd` subclasses provide children, and as such implement `MightHaveChildren` with a constant value of `true`. This change makes `true` the default value. With this change, `MightHaveChildren` only needs to be implemented by synthetic providers that can return `false`, which is only 3 subclasses.
2024-10-24[lldb] Move ValueObject into its own library (NFC) (#113393)Jonas Devlieghere1-2/+2
ValueObject is part of lldbCore for historical reasons, but conceptually it deserves to be its own library. This does introduce a (link-time) circular dependency between lldbCore and lldbValueObject, which is unfortunate but probably unavoidable because so many things in LLDB rely on ValueObject. We already have cycles and these libraries are never built as dylibs so while this doesn't improve the situation, it also doesn't make things worse. The header includes were updated with the following command: ``` find . -type f -exec sed -i.bak "s%include \"lldb/Core/ValueObject%include \"lldb/ValueObject/ValueObject%" '{}' \; ```
2024-03-08Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected ↵Adrian Prantl1-5/+12
(#84219) Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected This is an NFC change that does not yet add any error handling or change any code to return any errors. This is the second big change in the patch series started with https://github.com/llvm/llvm-project/pull/83501 A follow-up PR will wire up error handling.
2024-03-08Revert "Change GetNumChildren()/CalculateNumChildren() methods return ↵Florian Mayer1-12/+5
llvm::Expected (#84219)" This reverts commit 99118c809367d518ffe4de60c16da953744b68b9.
2024-03-08Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected ↵Adrian Prantl1-5/+12
(#84219) Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected This is an NFC change that does not yet add any error handling or change any code to return any errors. This is the second big change in the patch series started with https://github.com/llvm/llvm-project/pull/83501 A follow-up PR will wire up error handling.
2024-03-07Change GetChildAtIndex to take a uint32_tAdrian Prantl1-5/+5
2024-03-07Change the return type of SyntheticFrontend::CalculateNumChildren to int32_tAdrian Prantl1-5/+5
This way it is consistent with ValueObject and TypeSystem.
2024-02-08[lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return ↵Michael Buch1-22/+22
an enum (#80167) This patch changes the return value of `SyntheticChildrenFrontend::Update` to a scoped enum that aims to describe what the return value means.
2023-09-21Lazy deference underlying object for shared/weak/unique_ptr synthetic… ↵jeffreytan811-11/+11
(#67069) We noticed some performance issue while in lldb-vscode for grabing the name of the SBValue. Profiling shows SBValue::GetName() can cause synthetic children provider of shared/unique_ptr to deference underlying object and complete it type. This patch lazily moves the dereference from synthetic child provider's Update() method to GetChildAtIndex() so that SBValue::GetName() won't trigger the slow code path. Here is the culprit slow code path: ``` ... frame #59: 0x00007ff4102e0660 liblldb.so.15`SymbolFileDWARF::CompleteType(this=<unavailable>, compiler_type=0x00007ffdd9829450) at SymbolFileDWARF.cpp:1567:25 [opt] ... frame #67: 0x00007ff40fdf9bd4 liblldb.so.15`lldb_private::ValueObject::Dereference(this=0x0000022bb5dfe980, error=0x00007ffdd9829970) at ValueObject.cpp:2672:41 [opt] frame #68: 0x00007ff41011bb0a liblldb.so.15`(anonymous namespace)::LibStdcppSharedPtrSyntheticFrontEnd::Update(this=0x000002298fb94380) at LibStdcpp.cpp:403:40 [opt] frame #69: 0x00007ff41011af9a liblldb.so.15`lldb_private::formatters::LibStdcppSharedPtrSyntheticFrontEndCreator(lldb_private::CXXSyntheticChildren*, std::shared_ptr<lldb_private::ValueObject>) [inlined] (anonymous namespace)::LibStdcppSharedPtrSyntheticFrontEnd::LibStdcppSharedPtrSyntheticFrontEnd(this=0x000002298fb94380, valobj_sp=<unavailable>) at LibStdcpp.cpp:371:5 [opt] ... frame #78: 0x00007ff40fdf6e42 liblldb.so.15`lldb_private::ValueObject::CalculateSyntheticValue(this=0x000002296c66a500) at ValueObject.cpp:1836:27 [opt] frame #79: 0x00007ff40fdf1939 liblldb.so.15`lldb_private::ValueObject::GetSyntheticValue(this=<unavailable>) at ValueObject.cpp:1867:3 [opt] frame #80: 0x00007ff40fc89008 liblldb.so.15`ValueImpl::GetSP(this=0x0000022c71b90de0, stop_locker=0x00007ffdd9829d00, lock=0x00007ffdd9829d08, error=0x00007ffdd9829d18) at SBValue.cpp:141:46 [opt] frame #81: 0x00007ff40fc7d82a liblldb.so.15`lldb::SBValue::GetSP(ValueLocker&) const [inlined] ValueLocker::GetLockedSP(this=0x00007ffdd9829d00, in_value=<unavailable>) at SBValue.cpp:208:21 [opt] frame #82: 0x00007ff40fc7d817 liblldb.so.15`lldb::SBValue::GetSP(this=0x00007ffdd9829d90, locker=0x00007ffdd9829d00) const at SBValue.cpp:1047:17 [opt] frame #83: 0x00007ff40fc7da6f liblldb.so.15`lldb::SBValue::GetName(this=0x00007ffdd9829d90) at SBValue.cpp:294:32 [opt] ... ``` Differential Revision: https://reviews.llvm.org/D159542
2023-06-13[lldb] Default can_create to true in GetChildAtIndex (NFC)Dave Lee1-1/+1
Existing callers of `GetChildAtIndex` pass true for can_create. This change makes true the default value, callers don't have to pass an opaque true. See also D151966 for the same change to `GetChildMemberWithName`. Differential Revision: https://reviews.llvm.org/D152031
2023-06-13[lldb] Default can_create to true in GetChildMemberWithName (NFC)Dave Lee1-3/+3
It turns out all existing callers of `GetChildMemberWithName` pass true for `can_create`. This change makes `true` the default value, callers don't have to pass an opaque true. Differential Revision: https://reviews.llvm.org/D151966
2023-06-01[lldb] Take StringRef names in GetChildAtNamePath (NFC)Dave Lee1-3/+2
Following D151810, this changes `GetChildAtNamePath` to take a path of `StringRef` values instead of `ConstString`. Differential Revision: https://reviews.llvm.org/D151813
2023-05-31[lldb] Take StringRef name in GetChildMemberWithName (NFC)Dave Lee1-5/+3
`GetChildMemberWithName` does not need a `ConstString`. This change makes the function take a `StringRef` instead, which alleviates the need for callers to construct a `ConstString`. I don't expect this change to improve performance, only ergonomics. This is in support of Alex's effort to replace `ConstString` where appropriate. There are related `ValueObject` functions that can also be changed, if this is accepted. Differential Revision: https://reviews.llvm.org/D151615
2023-05-24[lldb][DataFormatter] Add dereference support to libstdcpp std::shared_ptr ↵Michael Buch1-9/+42
formatter This mimicks the implementation of the libstdcpp std::unique_ptr formatter. This has been attempted several years ago in `0789722d85cf1f1fdbe2ffb2245ea0ba034a9f94` but was reverted in `e7dd3972094c2f2fb42dc9d4d5344e54a431e2ce`. The difference to the original patch is that we now maintain a `$$dereference$$` member and we only store weak pointers to the other children inside the synthetic frontend. This is what the libc++ formatters do to prevent the recursion mentioned in the revert commit.
2023-05-12Fix libstdc++ data formatter for reference/pointer to std::stringJeffrey Tan1-2/+9
This patch fixes libstdc++ data formatter for reference/pointer to std::string. The failure testcases are added which succeed with the patch. Differential Revision: https://reviews.llvm.org/D150313
2023-01-07[lldb] Use std::optional instead of llvm::Optional (NFC)Kazu Hirata1-1/+1
This patch replaces (llvm::|)Optional< with std::optional<. I'll post a separate patch to clean up the "using" declarations, #include "llvm/ADT/Optional.h", etc. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-07[lldb] Add #include <optional> (NFC)Kazu Hirata1-0/+1
This patch adds #include <optional> to those files containing llvm::Optional<...> or Optional<...>. I'll post a separate patch to actually replace llvm::Optional with std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-09-09Adapt LLDB dataformatters for libcxx change D129386Adrian Prantl1-9/+8
Differential Revision: https://reviews.llvm.org/D133618
2022-03-14[LLDB] Applying clang-tidy modernize-use-default-member-init over LLDBShafik Yaghmour1-3/+3
Applied modernize-use-default-member-init clang-tidy check over LLDB. It appears in many files we had already switched to in class member init but never updated the constructors to reflect that. This check is already present in the lldb/.clang-tidy config. Differential Revision: https://reviews.llvm.org/D121481
2021-11-18[lldb] (Partially) enable formatting of utf strings before the program is ↵Pavel Labath1-2/+2
started The StringPrinter class was using a Process instance to read memory. This automatically prevented it from working before starting the program. This patch changes the class to use the Target object for reading memory, as targets are always available. This required moving ReadStringFromMemory from Process to Target. This is sufficient to make frame/target variable work, but further changes are necessary for the expression evaluator. Preliminary analysis indicates the failures are due to the expression result ValueObjects failing to provide an address, presumably because we're operating on file addresses before starting. I haven't looked into what would it take to make that work. Differential Revision: https://reviews.llvm.org/D113098
2020-03-19Reland [lldb] Fix string summary of an empty NSPathStore2Raphael Isemann1-0/+2
(This is D68010 but I also set the new parameter in LibStdcpp.cpp to fix the Debian tests). Summary: Printing a summary for an empty NSPathStore2 string currently prints random bytes behind the empty string pointer from memory (rdar://55575888). It seems the reason for this is that the SourceSize parameter in the `ReadStringAndDumpToStreamOptions` - which is supposed to contain the string length - actually uses the length 0 as a magic value for saying "read as much as possible from the buffer" which is clearly wrong for empty strings. This patch adds another flag that indicates if we have know the string length or not and makes this behaviour dependent on that (which seemingly was the original purpose of this magic value). Reviewers: aprantl, JDevlieghere, shafik Reviewed By: aprantl Subscribers: christof, abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68010
2020-01-31[lldb] Move clang-based files out of SymbolAlex Langford1-1/+1
Summary: This change represents the move of ClangASTImporter, ClangASTMetadata, ClangExternalASTSourceCallbacks, ClangUtil, CxxModuleHandler, and TypeSystemClang from lldbSource to lldbPluginExpressionParserClang.h This explicitly removes knowledge of clang internals from lldbSymbol, moving towards a more generic core implementation of lldb. Reviewers: JDevlieghere, davide, aprantl, teemperor, clayborg, labath, jingham, shafik Subscribers: emaste, mgorny, arphaman, jfb, usaxena95, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D73661
2020-01-24[lldb][NFC] Fix all formatting errors in .cpp file headersRaphael Isemann1-1/+1
Summary: A *.cpp file header in LLDB (and in LLDB) should like this: ``` //===-- TestUtilities.cpp -------------------------------------------------===// ``` However in LLDB most of our source files have arbitrary changes to this format and these changes are spreading through LLDB as folks usually just use the existing source files as templates for their new files (most notably the unnecessary editor language indicator `-*- C++ -*-` is spreading and in every review someone is pointing out that this is wrong, resulting in people pointing out that this is done in the same way in other files). This patch removes most of these inconsistencies including the editor language indicators, all the different missing/additional '-' characters, files that center the file name, missing trailing `===//` (mostly caused by clang-format breaking the line). Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere Reviewed By: JDevlieghere Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D73258
2020-01-23[lldb][NFC] Rename ClangASTContext to TypeSystemClangRaphael Isemann1-1/+1
Summary: This commit renames ClangASTContext to TypeSystemClang to better reflect what this class is actually supposed to do (implement the TypeSystem interface for Clang). It also gets rid of the very confusing situation that we have both a `clang::ASTContext` and a `ClangASTContext` in clang (which sometimes causes Clang people to think I'm fiddling with Clang's ASTContext when I'm actually just doing LLDB work). I also have plans to potentially have multiple clang::ASTContext instances associated with one ClangASTContext so the ASTContext naming will then become even more confusing to people. Reviewers: #lldb, aprantl, shafik, clayborg, labath, JDevlieghere, davide, espindola, jdoerfert, xiaobai Reviewed By: clayborg, labath, xiaobai Subscribers: wuzish, emaste, nemanjai, mgorny, kbarton, MaskRay, arphaman, jfb, usaxena95, jingham, xiaobai, abidh, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D72684
2019-04-26Allow direct comparison of ConstString against StringRefRaphael Isemann1-4/+4
Summary: When we want to compare a ConstString against a string literal (or any other non-ConstString), we currently have to explicitly turn the other string into a ConstString. This makes sense as comparing ConstStrings against each other is only a fast pointer comparison. However, currently we (rather incorrectly) use in several places in LLDB temporary ConstStrings when we just want to compare a given ConstString against a hardcoded value, for example like this: ``` if (extension != ConstString(".oat") && extension != ConstString(".odex")) ``` Obviously this kind of defeats the point of ConstStrings. In the comparison above we would construct two temporary ConstStrings every time we hit the given code. Constructing a ConstString is relatively expensive: we need to go to the StringPool, take a read and possibly an exclusive write-lock and then look up our temporary string in the string map of the pool. So we do a lot of heavy work for essentially just comparing a <6 characters in two strings. I initially wanted to just fix these issues by turning the temporary ConstString in static variables/ members, but that made the code much less readable. Instead I propose to add a new overload for the ConstString comparison operator that takes a StringRef. This comparison operator directly compares the ConstString content against the given StringRef without turning the StringRef into a ConstString. This means that the example above can look like this now: ``` if (extension != ".oat" && extension != ".odex") ``` It also no longer has to unlock/lock two locks and call multiple functions in other TUs for constructing the temporary ConstString instances. Instead this should end up just being a direct string comparison of the two given strings on most compilers. This patch also directly updates all uses of temporary and short ConstStrings in LLDB to use this new comparison operator. It also adds a some unit tests for the new and old comparison operator. Reviewers: #lldb, JDevlieghere, espindola, amccarth Reviewed By: JDevlieghere, amccarth Subscribers: amccarth, clayborg, JDevlieghere, emaste, arichardson, MaskRay, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D60667 llvm-svn: 359281
2019-03-06Pass ConstString by value (NFC)Adrian Prantl1-5/+5
My apologies for the large patch. With the exception of ConstString.h itself it was entirely produced by sed. ConstString has exactly one const char * data member, so passing a ConstString by reference is not any more efficient than copying it by value. In both cases a single pointer is passed. But passing it by value makes it harder to accidentally return the address of a local object. (This fixes rdar://problem/48640859 for the Apple folks) Differential Revision: https://reviews.llvm.org/D59030 llvm-svn: 355553
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth1-4/+3
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2019-01-15Replace auto -> llvm::Optional<uint64_t>Adrian Prantl1-1/+1
This addresses post-commit feedback for https://reviews.llvm.org/D56688 llvm-svn: 351237
2019-01-15Make CompilerType::getBitSize() / getByteSize() return an optional result. NFCAdrian Prantl1-2/+5
The code in LLDB assumes that CompilerType and friends use the size 0 as a sentinel value to signal an error. This works for C++, where no zero-sized type exists, but in many other programming languages (including I believe C) types of size zero are possible and even common. This is a particular pain point in swift-lldb, where extra code exists to double-check that a type is *really* of size zero and not an error at various locations. To remedy this situation, this patch starts by converting CompilerType::getBitSize() and getByteSize() to return an optional result. To avoid wasting space, I hand-rolled my own optional data type assuming that no type is larger than what fits into 63 bits. Follow-up patches would make similar changes to the ValueObject hierarchy. rdar://problem/47178964 Differential Revision: https://reviews.llvm.org/D56688 llvm-svn: 351214
2018-11-11Remove header grouping comments.Jonas Devlieghere1-4/+0
This patch removes the comments grouping header includes. They were added after running IWYU over the LLDB codebase. However they add little value, are often outdates and burdensome to maintain. llvm-svn: 346626
2017-11-13CompilerType: Add ability to retrieve an integral template argumentPavel Labath1-5/+2
Summary: Despite it's name, GetTemplateArgument was only really working for Type template arguments. This adds the ability to retrieve integral arguments as well (which I've needed for the std::bitset data formatter). I've done this by splitting the function into three pieces. The idea is that one first calls GetTemplateArgumentKind (first function) to determine the what kind of a parameter this is. Based on that, one can then use specialized functions to retrieve the correct value. Currently, I only implement two of these: GetTypeTemplateArgument and GetIntegralTemplateArgument. Reviewers: jingham, clayborg Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D39844 llvm-svn: 318040
2017-05-12Rename Error -> Status.Zachary Turner1-5/+5
This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. llvm-svn: 302872
2017-03-04Move DataBuffer / DataExtractor and friends from Core -> Utility.Zachary Turner1-1/+1
llvm-svn: 296943
2017-02-14Remove dependencies from Utility to Core and Target.Zachary Turner1-1/+1
With this patch, the only dependency left is from Utility to Host. After this is broken, Utility will finally be standalone. Differential Revision: https://reviews.llvm.org/D29909 llvm-svn: 295088
2017-02-02Move classes from Core -> Utility.Zachary Turner1-2/+2
This moves the following classes from Core -> Utility. ConstString Error RegularExpression Stream StreamString The goal here is to get lldbUtility into a state where it has no dependendencies except on itself and LLVM, so it can be the starting point at which to start untangling LLDB's dependencies. These are all low level and very widely used classes, and previously lldbUtility had dependencies up to lldbCore in order to use these classes. So moving then down to lldbUtility makes sense from both the short term and long term perspective in solving this problem. Differential Revision: https://reviews.llvm.org/D29427 llvm-svn: 293941
2016-11-07Simplify the PrintableRepresentationSpecialCases code; we never used the ↵Enrico Granata1-1/+2
ePrintableRepresentationSpecialCasesOnly value and with enum classes the names doesn't need to be that long llvm-svn: 286176
2016-10-25Revert "Improve the libstdc++ smart pointer formatters"Pavel Labath1-0/+92
This reverts commit r284828, as it causes an infinite loop in TestPrintStackTraces (funnily enough, only when logging is enabled). llvm-svn: 285068
2016-10-21Improve the libstdc++ smart pointer formattersTamas Berghammer1-92/+0
* Display the strong/weak count in the summary * Display the pointed object as a synthetic member * Create synthetic children for weak/strong count Differential revision: https://reviews.llvm.org/D25726 llvm-svn: 284828
2016-09-06*** This commit represents a complete reformatting of the LLDB source codeKate Stone1-370/+324
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
2016-07-06Add data formatter for libstdc++ shared_ptr and weak_ptrTamas Berghammer1-20/+134
Differential revision: http://reviews.llvm.org/D21984 llvm-svn: 274617