aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/DataFormatters/FormatManager.cpp
AgeCommit message (Collapse)AuthorFilesLines
2025-07-31[lldb] Add support for displaying `__float128` variables (#98369)beetrees1-0/+1
2025-07-25[lldb] Use std::make_shared where possible (NFC) (#150714)Jonas Devlieghere1-3/+2
This is a continuation of 68fd102, which did the same thing but only for StopInfo. Using make_shared is both safer and more efficient: - With make_shared, the object and the control block are allocated together, which is more efficient. - With make_shared, the enable_shared_from_this base class is properly linked to the control block before the constructor finishes, so shared_from_this() will be safe to use (though still not recommended during construction).
2025-05-28[lldb][Formatters] Add --pointer-match-depth option to `type summary add` ↵Zequan Wu1-16/+24
command. (#138209) Currently, the type `T`'s summary formatter will be matched for `T`, `T*`, `T**` and so on. This is unexpected in many data formatters. Such unhandled cases could cause the data formatter to crash. An example would be the lldb's built-in data formatter for `std::optional`: ``` $ cat main.cpp #include <optional> int main() { std::optional<int> o_null; auto po_null = &o_null; auto ppo_null = &po_null; auto pppo_null = &ppo_null; return 0; } $ clang++ -g main.cpp && lldb -o "b 8" -o "r" -o "v pppo_null" [lldb crash] ``` This change adds an options `--pointer-match-depth` to `type summary add` command to allow users to specify how many layer of pointers can be dereferenced at most when matching a summary formatter of type `T`, as Jim suggested [here](https://github.com/llvm/llvm-project/pull/124048/#issuecomment-2611164133). By default, this option has value 1 which means summary formatter for `T` could also be used for `T*` but not `T**` nor beyond. This option is no-op when `--skip-pointers` is set as well. I didn't add such option for `type synthetic add`, `type format add`, `type filter add`, because it useful for those command. Instead, they all have the pointer match depth of 1. When printing a type `T*`, lldb never print the children of `T` even if there is a synthetic formatter registered for `T`.
2024-10-24[lldb] Move ValueObject into its own library (NFC) (#113393)Jonas Devlieghere1-1/+1
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-06-03[lldb] Avoid (unlimited) GetNumChildren calls when printing values (#93946)Pavel Labath1-3/+7
For some data formatters, even getting the number of children can be an expensive operations (e.g., needing to walk a linked list to determine the number of elements). This is then wasted work when we know we will be printing only small number of them. This patch replaces the calls to GetNumChildren (at least those on the "frame var" path) with the calls to the capped version, passing the value of `max-children-count` setting (plus one)
2024-05-31[lldb] FormatManager::GetPossibleMatches assumes all ValueObjects have ↵jimingham1-1/+7
targets. (#93880) But one made in a situation where that's impossible might only have an error, and no symbol context, so that's not necessarily true. Check for the target's validity before using it. Fixes issue #93313
2024-03-08Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected ↵Adrian Prantl1-3/+8
(#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-8/+3
llvm::Expected (#84219)" This reverts commit 99118c809367d518ffe4de60c16da953744b68b9.
2024-03-08Change GetNumChildren()/CalculateNumChildren() methods return llvm::Expected ↵Adrian Prantl1-3/+8
(#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-02-08[lldb] Refactor GetFormatFromCString to always check for partial matches ↵Dave Lee1-10/+7
(NFC) (#81018) Refactors logic in `ParseInternal` that was previously calling `GetFormatFromCString` twice, once with `partial_match_ok` set to false, and the second time set to true. With this change, lldb formats (ie `%@`, `%S`, etc) are checked first. If a format is not one of those, then `GetFormatFromCString` is called once, and now always checks for partial matches.
2023-06-30[lldb] Add log indicating which kind of data formatterDave Lee1-10/+18
The `formatter` logs include a function name, but these functions are mostly templates and the template type parameter is not printed, which is useful context. This change adds a new log which is printed upon entry of `FormatManager::Get`, which shows the formatter context as either `format`, `summary`, or `synthetic`. Differential Revision: https://reviews.llvm.org/D154128
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-05Replace deprecated startswith_insensitive with starts_with_insensitiveFangrui Song1-1/+1
2023-04-12[lldb] Change formatter helper function parameter list to remove ConstStringAlex Langford1-28/+15
All of these functions take a ConstString for the type_name, but this isn't really needed for two reasons: 1.) This parameter is always constructed from a static c-string constant. 2.) They are passed along to to `AddTypeSummary` as a StringRef anyway. Differential Revision: https://reviews.llvm.org/D148050
2022-10-19[lldb] Add matching based on Python callbacks for data formatters.Jorge Gorbe Moya1-5/+11
This patch adds a new matching method for data formatters, in addition to the existing exact typename and regex-based matching. The new method allows users to specify the name of a Python callback function that takes a `SBType` object and decides whether the type is a match or not. Here is an overview of the changes performed: - Add a new `eFormatterMatchCallback` matching type, and logic to handle it in `TypeMatcher` and `SBTypeNameSpecifier`. - Extend `FormattersMatchCandidate` instances with a pointer to the current `ScriptInterpreter` and the `TypeImpl` corresponding to the candidate type, so we can run registered callbacks and pass the type to them. All matcher search functions now receive a `FormattersMatchCandidate` instead of a type name. - Add some glue code to ScriptInterpreterPython and the SWIG bindings to allow calling a formatter matching callback. Most of this code is modeled after the equivalent code for watchpoint callback functions. - Add an API test for the new callback-based matching feature. For more context, please check the RFC thread where this feature was originally discussed: https://discourse.llvm.org/t/rfc-python-callback-for-data-formatters-type-matching/64204/11 Differential Revision: https://reviews.llvm.org/D135648
2022-10-10[NFCI] More TypeCategoryImpl refactoring.Jorge Gorbe Moya1-8/+6
The main aim of this patch is to delete the remaining instances of code reaching into the internals of `TypeCategoryImpl`. I made the following changes: - Add some more methods to `TieredFormatterContainer` and `TypeCategoryImpl` to expose functionality that is implemented in `FormattersContainer`. - Add new overloads of `TypeCategoryImpl::AddTypeXXX` to make it easier to add formatters to categories without reaching into the internal `FormattersContainer` objects. - Remove the `GetTypeXXXContainer` and `GetRegexTypeXXXContainer` accessors from `TypeCategoryImpl` and update all call sites to use the new methods instead. Differential Revision: https://reviews.llvm.org/D135399
2022-09-08[lldb] Use std::size instead of llvm::array_lengthofJoe Loser1-1/+1
LLVM contains a helpful function for getting the size of a C-style array: `llvm::array_lengthof`. This is useful prior to C++17, but not as helpful for C++17 or later: `std::size` already has support for C-style arrays. Change call sites to use `std::size` instead. Differential Revision: https://reviews.llvm.org/D133501
2022-08-09Move FormattersMatchCandidate flags to a struct.Jorge Gorbe Moya1-39/+23
This removes some error-prone repetition in FormatManager::GetPossibleMatches, where the same three boolean flags are passed in a row multiple times as arguments to recursive calls to GetPossibleMatches. Instead of: ``` // same flags, but with did_strip_typedef set to true. GetPossibleMatches(..., did_strip_ptr, did_strip_ref, true); ``` we can now say ``` GetPossibleMatches(..., current_flags.WithStrippedTypedef()); ``` which hopefully makes the intent clearer, and more readable in case we add another flag. Reviewed by: DavidSpickett, labath Differential Revision: https://reviews.llvm.org/D131459
2022-03-29[lldb] Remove usages of case-insensitive c-string functionsPavel Labath1-4/+4
They are not portable (which meant we had a hand-rolled implementation for windows), and llvm::StringRef provides equivalent functionality.
2022-02-03[lldb] Rename Logging.h to LLDBLog.h and clean up includesPavel Labath1-3/+2
Most of our code was including Log.h even though that is not where the "lldb" log channel is defined (Log.h defines the generic logging infrastructure). This worked because Log.h included Logging.h, even though it should. After the recent refactor, it became impossible the two files include each other in this direction (the opposite inclusion is needed), so this patch removes the workaround that was put in place and cleans up all files to include the right thing. It also renames the file to LLDBLog to better reflect its purpose.
2022-02-02[lldb] Convert "LLDB" log channel to the new APIPavel Labath1-2/+2
2022-01-26Revert "Rename llvm::array_lengthof into llvm::size to match std::size from ↵Benjamin Kramer1-1/+1
C++17" This reverts commit ef8206320769ad31422a803a0d6de6077fd231d2. - It conflicts with the existing llvm::size in STLExtras, which will now never be called. - Calling it without llvm:: breaks C++17 compat
2022-01-26Rename llvm::array_lengthof into llvm::size to match std::size from C++17serge-sans-paille1-1/+1
As a conquence move llvm::array_lengthof from STLExtras.h to STLForwardCompat.h (which is included by STLExtras.h so no build breakage expected).
2022-01-06[lldb] Remove summary for signed char *Pavel Labath1-1/+1
It conflicts with the summary for BOOL * (aka signed char *). This partially reverts D112709.
2021-12-20[lldb] Summary provider for char flexible array membersPavel Labath1-6/+2
Add a summary provider which can print char[] members at the ends of structs. Differential Revision: https://reviews.llvm.org/D113174
2021-12-17[lldb] Fix matchers for char array formattersPavel Labath1-1/+4
They were being applied too narrowly (they didn't cover signed char *, for instance), and too broadly (they covered SomeTemplate<char[6]>) at the same time. Differential Revision: https://reviews.llvm.org/D112709
2021-10-22[lldb/Formatters] Remove space from vector type string summaries (NFCI)Med Ismail Bennani1-6/+3
This patch changes the string summaries for vector types by removing the space between the type and the bracket, conforming to 277623f4d5a6. This should also fix TestCompactVectors failure. Differential Revision: https://reviews.llvm.org/D112340 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2021-10-21Recommit: Compress formatting of array type names (int [4] -> int[4])David Blaikie1-1/+3
Based on post-commit review discussion on 2bd84938470bf2e337801faafb8a67710f46429d with Richard Smith. Other uses of forcing HasEmptyPlaceHolder to false seem OK to me - they're all around pointer/reference types where the pointer/reference token will appear at the rightmost side of the left side of the type name, so they make nested types (eg: the "int" in "int *") behave as though there is a non-empty placeholder (because the "*" is essentially the placeholder as far as the "int" is concerned). This was originally committed in 277623f4d5a672d707390e2c3eaf30a9eb4b075c Reverted in f9ad1d1c775a8e264bebc15d75e0c6e5c20eefc7 due to breakages outside of clang - lldb seems to have some strange/strong dependence on "char [N]" versus "char[N]" when printing strings (not due to that name appearing in DWARF, but probably due to using clang to stringify type names) that'll need to be addressed, plus a few other odds and ends in other subprojects (clang-tools-extra, compiler-rt, etc).
2021-10-11[lldb] Make char[N] formatters respect the end of the array (PR44649)Pavel Labath1-1/+1
I believe this is a more natural behavior, and it also matches what gdb does. Differential Revision: https://reviews.llvm.org/D111399
2020-07-23Reland [lldb] Unify type name matching in FormattersContainer IIRaphael Isemann1-4/+0
This was originally reverted because the m_valid member in TypeMatcher was unused in builds with disabled asserts. Now the member is gone and the default constructor is deleted (thanks Eric for the idea!). Summary: FormattersContainer stores LLDB's formatters. It's implemented as a templated map-like data structures that supports any kind of value type and only allows ConstString and RegularExpression as the key types. The keys are used for matching type names (e.g., the ConstString key `std::vector` matches the type with the same name while RegularExpression keys match any type where the RegularExpression instance matches). The fact that a single FormattersContainer can only match either by string comparison or regex matching (depending on the KeyType) causes us to always have two FormatterContainer instances in all the formatting code. This also leads to us having every type name matching logic in LLDB twice. For example, TypeCategory has to implement every method twice (one string matching one, one regex matching one). This patch changes FormattersContainer to instead have a single `TypeMatcher` key that wraps the logic for string-based and regex-based type matching and is now the only possible KeyType for the FormattersContainer. This means that a single FormattersContainer can now match types with both regex and string comparison. To summarize the changes in this patch: * Remove all the `*_Impl` methods from `FormattersContainer` * Instead call the FormatMap functions from `FormattersContainer` with a `TypeMatcher` type that does the respective matching. * Replace `ConstString` with `TypeMatcher` in the few places that directly interact with `FormattersContainer`. I'm working on some follow up patches that I split up because they deserve their own review: * Unify FormatMap and FormattersContainer (they are nearly identical now). * Delete the duplicated half of all the type matching code that can now use one interface. * Propagate TypeMatcher through all the formatter code interfaces instead of always offering two functions for everything. There is one ugly design part that I couldn't get rid of yet and that is that we have to support getting back the string used to construct a `TypeMatcher` later on. The reason for this is that LLDB only supports referencing existing type matchers by just typing their respective input string again (without even supplying if it's a regex or not). Reviewers: davide, mib Reviewed By: mib Subscribers: mgorny, JDevlieghere Differential Revision: https://reviews.llvm.org/D84151
2020-07-23Temporarily Revert "Reland [lldb] Unify type name matching in ↵Eric Christopher1-0/+4
FormattersContainer" as it breaks bots with due to m_valid being an unused class member except in assert builds. This reverts commit 074b121642b286afb16adeebda5ec8236f7b8ea9.
2020-07-22Thread ExecutionContextScope through GetByteSize where possible (NFC-ish)Adrian Prantl1-1/+3
This patch has no effect for C and C++. In more dynamic languages, such as Objective-C and Swift GetByteSize() needs to call into the language runtime, so it's important to pass one in where possible. My primary motivation for this is some work I'm doing on the Swift branch, however, it looks like we are also seeing warnings in Objective-C that this may resolve. Everything in the SymbolFile hierarchy still passes in nullptrs, because we don't have an execution context in SymbolFile, since SymbolFile transcends processes. Differential Revision: https://reviews.llvm.org/D84267
2020-07-22Reland [lldb] Unify type name matching in FormattersContainerRaphael Isemann1-4/+0
This was originally reverted because the Linux bots were red after this landed, but it seems that was actually caused by a different commit. I double checked that this works on Linux, so let's reland this on Linux. Summary: FormattersContainer stores LLDB's formatters. It's implemented as a templated map-like data structures that supports any kind of value type and only allows ConstString and RegularExpression as the key types. The keys are used for matching type names (e.g., the ConstString key `std::vector` matches the type with the same name while RegularExpression keys match any type where the RegularExpression instance matches). The fact that a single FormattersContainer can only match either by string comparison or regex matching (depending on the KeyType) causes us to always have two FormatterContainer instances in all the formatting code. This also leads to us having every type name matching logic in LLDB twice. For example, TypeCategory has to implement every method twice (one string matching one, one regex matching one). This patch changes FormattersContainer to instead have a single `TypeMatcher` key that wraps the logic for string-based and regex-based type matching and is now the only possible KeyType for the FormattersContainer. This means that a single FormattersContainer can now match types with both regex and string comparison. To summarize the changes in this patch: * Remove all the `*_Impl` methods from `FormattersContainer` * Instead call the FormatMap functions from `FormattersContainer` with a `TypeMatcher` type that does the respective matching. * Replace `ConstString` with `TypeMatcher` in the few places that directly interact with `FormattersContainer`. I'm working on some follow up patches that I split up because they deserve their own review: * Unify FormatMap and FormattersContainer (they are nearly identical now). * Delete the duplicated half of all the type matching code that can now use one interface. * Propagate TypeMatcher through all the formatter code interfaces instead of always offering two functions for everything. There is one ugly design part that I couldn't get rid of yet and that is that we have to support getting back the string used to construct a `TypeMatcher` later on. The reason for this is that LLDB only supports referencing existing type matchers by just typing their respective input string again (without even supplying if it's a regex or not). Reviewers: davide, mib Reviewed By: mib Subscribers: mgorny, JDevlieghere Differential Revision: https://reviews.llvm.org/D84151
2020-07-21Revert "[lldb] Unify type name matching in FormattersContainer"Raphael Isemann1-0/+4
This reverts commit 5b0de5756ccc7a540926e4eeaa3b398539d88cd8. Apparently that caused some test to get stuck on Linuxx. Reverting for now.
2020-07-21[lldb] Unify type name matching in FormattersContainerRaphael Isemann1-4/+0
Summary: FormattersContainer stores LLDB's formatters. It's implemented as a templated map-like data structures that supports any kind of value type and only allows ConstString and RegularExpression as the key types. The keys are used for matching type names (e.g., the ConstString key `std::vector` matches the type with the same name while RegularExpression keys match any type where the RegularExpression instance matches). The fact that a single FormattersContainer can only match either by string comparison or regex matching (depending on the KeyType) causes us to always have two FormatterContainer instances in all the formatting code. This also leads to us having every type name matching logic in LLDB twice. For example, TypeCategory has to implement every method twice (one string matching one, one regex matching one). This patch changes FormattersContainer to instead have a single `TypeMatcher` key that wraps the logic for string-based and regex-based type matching and is now the only possible KeyType for the FormattersContainer. This means that a single FormattersContainer can now match types with both regex and string comparison. To summarize the changes in this patch: * Remove all the `*_Impl` methods from `FormattersContainer` * Instead call the FormatMap functions from `FormattersContainer` with a `TypeMatcher` type that does the respective matching. * Replace `ConstString` with `TypeMatcher` in the few places that directly interact with `FormattersContainer`. I'm working on some follow up patches that I split up because they deserve their own review: * Unify FormatMap and FormattersContainer (they are nearly identical now). * Delete the duplicated half of all the type matching code that can now use one interface. * Propagate TypeMatcher through all the formatter code interfaces instead of always offering two functions for everything. There is one ugly design part that I couldn't get rid of yet and that is that we have to support getting back the string used to construct a `TypeMatcher` later on. The reason for this is that LLDB only supports referencing existing type matchers by just typing their respective input string again (without even supplying if it's a regex or not). Reviewers: davide, mib Reviewed By: mib Subscribers: mgorny, JDevlieghere Differential Revision: https://reviews.llvm.org/D84151
2020-04-15[lldb][NFC] Remove FormatterChoiceCriterionRaphael Isemann1-16/+5
Summary: The formatters code has a lot of 'reason' or 'why' values that we keep or-ing FormatterChoiceCriterion enum values into. These values are only read by a single log statement and don't have any functional purpose. It also seems the implementation is not finished (for example, display names and type names don't have any dedicated enum values). Also everything is of course not tested or documented. Let's just remove all of this. Reviewers: labath, JDevlieghere, jingham, davide, vsk Reviewed By: labath, vsk Subscribers: JDevlieghere Differential Revision: https://reviews.llvm.org/D77968
2020-02-19[lldb] Let TypeSystemClang::GetDisplayTypeName remove anonymous and inline ↵Raphael Isemann1-1/+1
namespaces. Summary: Currently when printing data types we include implicit scopes such as inline namespaces or anonymous namespaces. This leads to command output like this (for `std::set<X>` with X being in an anonymous namespace): ``` (lldb) print my_set (std::__1::set<(anonymous namespace)::X, std::__1::less<(anonymous namespace)::X>, std::__1::allocator<(anonymous namespace)::X> >) $0 = size=0 {} ``` This patch removes all the implicit scopes when printing type names in TypeSystemClang::GetDisplayTypeName so that our output now looks like this: ``` (lldb) print my_set (std::set<X, std::less<X>, std::allocator<X> >) $0 = size=0 {} ``` As previously GetDisplayTypeName and GetTypeName had the same output we actually often used the two as if they are the same method (they were in fact using the same implementation), so this patch also fixes the places where we actually want the display type name and not the actual type name. Note that this doesn't touch the `GetTypeName` class that for example the data formatters use, so this patch is only changes the way we display types to the user. The full type name can also still be found when passing '-R' to see the raw output of a variable in case someone is somehow interested in that. Partly fixes rdar://problem/59292534 Reviewers: shafik, jingham Reviewed By: shafik Subscribers: christof, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D74478
2020-02-12[lldb][NFC] Remove GetConstTypeName and GetConstQualifiedTypeName from ↵Raphael Isemann1-1/+1
CompilerType Beside these two functions just being wrappers around GetTypeName they are also just a leftover from migrating the CompilerType interface to ConstString.
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-10Data formatters: Look through array element typedefsJaroslav Sevcik1-1/+23
Summary: Motivation: When formatting an array of typedefed chars, we would like to display the array as a string. The string formatter currently does not trigger because the formatter lookup does not resolve typedefs for array elements (this behavior is inconsistent with pointers, for those we do look through pointee typedefs). This patch tries to make the array formatter lookup somewhat consistent with the pointer formatter lookup. Reviewers: teemperor, clayborg Reviewed By: teemperor, clayborg Subscribers: clayborg, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D72133
2019-12-11Remove TypeValidators (NFC in terms of the testsuite)Adrian Prantl1-30/+0
This is a half-implemented feature that as far as we can tell was never used by anything since its original inclusion in 2014. This patch removes it to make remaining the code easier to understand. Differential Revision: https://reviews.llvm.org/D71310
2019-12-10[FormatManager] Move Language lookup into the obviously non-cached part (NFC)Adrian Prantl1-16/+16
This refactoring makes the lookup caching easier to reason about. This has no observable effect although it does slightly change what is being cached. - Before this patch a negative lookup in the LanguageCategory would be cached, but a positive wouldn't. - After this patch LanguageCategory lookups aren't cached by FormatManager, period. (LanguageCategory has its own FormatCache for this!) Differential Revision: https://reviews.llvm.org/D71289
2019-12-10Do not cache hardcoded formats in FormatManagerAdrian Prantl1-12/+18
The cache in FormatCache uses only a type name as key. The hardcoded formats, synthetic children, etc inspect an entire ValueObject to determine their eligibility, which isn't modelled in the cache. This leads to bugs such as the one in this patch (where two similarly named types in different files have different hardcoded summary providers). The problem is exaggerated in the Swift language plugin due to the language's dynamic nature. rdar://problem/57756763 Differential Revision: https://reviews.llvm.org/D71233
2019-12-10Replace redundant code in FormatManager and FormatCache with templates (NFC)Adrian Prantl1-245/+36
This is a preparatory patch for an upcoming bugfix. FormatManager and friends have four identical implementations of many accessor functions to deal with the four types of shared pointers in the FormatCache. This patch replaces these implementations with templates. While this patch drastically reduces the amount of source code and its maintainablity, it doesn't actually improve code size. I'd argue, this is still an improvement. rdar://problem/57756763 Differential Revision: https://reviews.llvm.org/D71231
2019-12-09[FormatManager] GetCandidateLanguages shouldn't know about ValueObject.Davide Italiano1-3/+3
Reviewers: jingham, teemperor, JDevlieghere, aprantl Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71236
2019-12-09[FormatManager] Provide a single entrypoint for GetCandidateLanguages().Davide Italiano1-5/+1
2019-09-04Code cleanup: Change FormattersContainer::KeyType from SP to rvalueJan Kratochvil1-6/+3
There is now std::shared_ptr passed around which is expensive for manycore CPUs. Most of the times (except for 3 cases) it is now just std::moved with no CPU locks needed. It also makes it possible to sort the keys (which is now not needed much after D66398). Differential revision: https://reviews.llvm.org/D67049 llvm-svn: 370863
2019-08-22[FormatManage] Fix the format info orderJonas Devlieghere1-2/+3
The format info entries need to match the order of the enum entries. This should fix the two failing data-formatter tests. llvm-svn: 369617
2019-08-22[FormatManager] Add static_assert to keep formats in sync.Jonas Devlieghere1-1/+5
This adds a static assert that ensures that there's a format info entry for every format enum value. This should prevent others from making the same mistake I made and Jason kindly fixed in r369611. (Thanks!) llvm-svn: 369614
2019-08-22The g_format_infos table needs to be updated in concert with theJason Molenda1-0/+1
enum Format entries; else we can crash in a place like FormatManager::GetFormatAsCString(). We should add bounds checks to prevent this more reliably, but for tonight I'm just adding this entry to keep an address-sanitizer test run working. llvm-svn: 369611