summaryrefslogtreecommitdiffstats
path: root/lldb/source/Symbol
Commit message (Collapse)AuthorAgeFilesLines
* [lldb/DWARF] Move location list sections into DWARFContextPavel Labath2020-01-141-0/+2
| | | | | | These are the last sections not managed by the DWARFContext object. I also introduce separate SectionType enums for dwo section variants, as this is necessary for proper handling of single-file split dwarf.
* [lldb][NFC] Make name parameter in AddMethodToCXXRecordType a StringRefRaphael Isemann2020-01-141-7/+6
|
* [lldb][NFC] Cleanup ClangASTContext::CompleteTagDeclarationDefinitionRaphael Isemann2020-01-141-57/+52
| | | | | | | | | Makes this function exit early instead of nesting if statements. Also removed all the if (tag_type->getDecl()) checks. If we created a TagType with a nullptr as a Decl then Clang would have already deferenced that nullptr during TagType creation so there is no point in gracefully handling a nullptr here.
* [lldb] Fix lookup of symbols with the same address range but different bindingJan Kratochvil2020-01-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a failing testcase on Fedora 30 x86_64 (regression Fedora 29->30): PASS: ./bin/lldb ./lldb-test-build.noindex/functionalities/unwind/noreturn/TestNoreturnUnwind.test_dwarf/a.out -o 'settings set symbols.enable-external-lookup false' -o r -o bt -o quit * frame #0: 0x00007ffff7aa6e75 libc.so.6`__GI_raise + 325 frame #1: 0x00007ffff7a91895 libc.so.6`__GI_abort + 295 frame #2: 0x0000000000401140 a.out`func_c at main.c:12:2 frame #3: 0x000000000040113a a.out`func_b at main.c:18:2 frame #4: 0x0000000000401134 a.out`func_a at main.c:26:2 frame #5: 0x000000000040112e a.out`main(argc=<unavailable>, argv=<unavailable>) at main.c:32:2 frame #6: 0x00007ffff7a92f33 libc.so.6`__libc_start_main + 243 frame #7: 0x000000000040106e a.out`_start + 46 vs. FAIL - unrecognized abort() function: ./bin/lldb ./lldb-test-build.noindex/functionalities/unwind/noreturn/TestNoreturnUnwind.test_dwarf/a.out -o 'settings set symbols.enable-external-lookup false' -o r -o bt -o quit * frame #0: 0x00007ffff7aa6e75 libc.so.6`.annobin_raise.c + 325 frame #1: 0x00007ffff7a91895 libc.so.6`.annobin_loadmsgcat.c_end.unlikely + 295 frame #2: 0x0000000000401140 a.out`func_c at main.c:12:2 frame #3: 0x000000000040113a a.out`func_b at main.c:18:2 frame #4: 0x0000000000401134 a.out`func_a at main.c:26:2 frame #5: 0x000000000040112e a.out`main(argc=<unavailable>, argv=<unavailable>) at main.c:32:2 frame #6: 0x00007ffff7a92f33 libc.so.6`.annobin_libc_start.c + 243 frame #7: 0x000000000040106e a.out`.annobin_init.c.hot + 46 The extra ELF symbols are there due to Annobin (I did not investigate why this problem happened specifically since F-30 and not since F-28). It is due to: Symbol table '.dynsym' contains 2361 entries: Valu e Size Type Bind Vis Name 0000000000022769 5 FUNC LOCAL DEFAULT _nl_load_domain.cold 000000000002276e 0 NOTYPE LOCAL HIDDEN .annobin_abort.c.unlikely ... 000000000002276e 0 NOTYPE LOCAL HIDDEN .annobin_loadmsgcat.c_end.unlikely ... 000000000002276e 0 NOTYPE LOCAL HIDDEN .annobin_textdomain.c_end.unlikely 000000000002276e 548 FUNC GLOBAL DEFAULT abort 000000000002276e 548 FUNC GLOBAL DEFAULT abort@@GLIBC_2.2.5 000000000002276e 548 FUNC LOCAL DEFAULT __GI_abort 0000000000022992 0 NOTYPE LOCAL HIDDEN .annobin_abort.c_end.unlikely GDB has some more complicated preferences between overlapping and/or sharing address symbols, I have made here so far the most simple fix for this case. Differential revision: https://reviews.llvm.org/D63540
* [lldb] Make CompleteTagDeclsScope completion order deterministicRaphael Isemann2020-01-101-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | Summary: We iterate over `m_decls_to_complete` to complete declarations. As `m_decls_to_complete` is a set the iteration order can be non-deterministic. The order is currently only non-deterministic when we have a large set of decls that need to be completed (i.e. more than 32 decls, as otherwise the SmallPtrSet is just a linear-searched list). This doesn't really fix any specific bug or has any really observable change in behavior as the order in which we import should not influence any semantics. However the order we create decls/types is now always deterministic which should make debugging easier. Reviewers: labath, mib, shafik, davide Reviewed By: shafik, davide Subscribers: davide, abidh, JDevlieghere, lldb-commits, mgrang Tags: #lldb Differential Revision: https://reviews.llvm.org/D72495
* [lldb] Remove FieldDecl stealing hack by rerouting indirect imports to the ↵Raphael Isemann2020-01-101-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | original AST Summary: This is a port of D67803 that was about preventing indirect importing to our scratch context when evaluating expressions. D67803 already has a pretty long explanation of how this works, but the idea is that instead of importing declarations indirectly over the expression AST (i.e., Debug info AST -> Expression AST -> scratch AST) we instead directly import the declaration from the debug info AST to the scratch AST. The difference from D67803 is that here we have to do this in the ASTImporterDelegate (which is our ASTImporter subclass we use in LLDB). It has the same information as the ExternalASTMerger in D67803 as it can access the ClangASTImporter (which also keeps track of where Decls originally came from). With this patch we can also delete the FieldDecl stealing hack in the ClangASTSource (this was only necessary as the indirect imports caused the creation of duplicate Record declarations but we needed the fields in the Record decl we originally found in the scratch ASTContext). This also fixes the current gmodules failures where we fail to find std::vector fields after an indirect import over the expression AST (where it seems even our FieldDecl stealing hack can't save us from). Reviewers: shafik, aprantl Reviewed By: shafik Subscribers: JDevlieghere, lldb-commits, mib, labath, friss Tags: #lldb Differential Revision: https://reviews.llvm.org/D72507
* Data formatters: Look through array element typedefsJaroslav Sevcik2020-01-101-3/+2
| | | | | | | | | | | | | | | | | 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
* [lldb] Remove various dead Compare functionsAlex Langford2020-01-082-21/+0
|
* [lldb][NFC] Remove redundant ClangASTContext constructor that takes ArchSpecRaphael Isemann2020-01-081-27/+16
| | | | | | | ArchSpec has a superset of the information of llvm::Triple but the ClangASTContext just uses the Triple part of it. This deletes the ArchSpec constructor and all the code creating ArchSpecs and instead just uses the llvm::Triple constructor for ClangASTContext.
* [lldb] Initialize some bitfields in FuncUnwinders.cppPavel Labath2020-01-071-0/+2
| | | | This got flagged by msan.
* [lldb][NFC] Take a llvm::Triple in ClangASTContext constructorRaphael Isemann2020-01-071-3/+3
| | | | | | This constructor is supposed to take a string representing an llvm::Triple. We might as well take a llvm::Triple here which saves us all the string conversions in the call sites and we make this more type safe.
* [lldb] Fix crash in AccessDeclContextSanity when copying ↵Raphael Isemann2020-01-021-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | FunctionTemplateDecl inside a record. Summary: We currently don't set access specifiers for function template declarations. This seems to be fine as long as the function template is not declared inside any record in which case Clang asserts with the following once we try to query it's access: ``` Assertion failed: (Access != AS_none && "Access specifier is AS_none inside a record decl"), function AccessDeclContextSanity, ``` This patch just marks these function template declarations as public to make Clang happy. Reviewers: shafik, teemperor Reviewed By: teemperor Subscribers: JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71909
* [lldb][NFC] Create type-safe function for creating a CompilerType from a ↵Raphael Isemann2020-01-021-273/+196
| | | | | | | | | | | | | | | | | | | | | | QualType LLDB frequently converts QualType to CompilerType. This is currently done like this: result = CompilerType(this, qual_type_var.getAsOpaquePtr()) There are a few shortcomings in this current approach: 1. CompilerType's constructor takes a void* pointer so it isn't type safe. 2. We can't add any sanity checks to the CompilerType constructor (e.g. that the type actually belongs to the passed ClangASTContext) without expanding the TypeSystem API. 3. The logic for converting QualType->CompilerType is spread out over all of LLDB so changing it is difficult (e.g., what if we want to just pass the type ptr and not the 1type_ptr | qual_flags1 to CompilerType). This patch adds a `ClangASTContext::GetType` function similar to the other GetTypeForDecl functions that does this conversion in a type safe way. It also adds a sanity check for Tag-based types that the type actually belongs to the current ClangASTContext (Types don't seem to know their ASTContext, so we have to workaround by looking at the decl for the underlying TagDecl. This doesn't cover all types we construct but it's better than no sanity check).
* [lldb][NFC] Simplify CompilerType constructors/destructors and fix unused ↵Raphael Isemann2020-01-011-6/+0
| | | | | | | | | variable warning CompilerType has no virtual functions and no statements in its constructors, so we can simplify this code. This also allows Clang to emit unused variable warnings for CompilerType, so I also removed one unused variable that otherwise causes -Werror builds to fail.
* [lldb][NFC] Make some checks more readable in Variable::PrivateAutoCompleteRaphael Isemann2020-01-011-3/+3
|
* [lldb][NFC] Simplify ClangASTContext::GetTypeForDeclRaphael Isemann2019-12-301-17/+5
| | | | Also removes the GetASTContext call from this code.
* [lldb][NFC] Make integer types functions in ClangASTContext not staticRaphael Isemann2019-12-291-45/+32
| | | | | | These functions need a ClangASTContext instance that we would otherwise recalculate by calling GetASTContext (which is no longer necessary with this patch).
* [lldb][NFC] Delete static versions of ClangASTContext::CreateFunctionTypeRaphael Isemann2019-12-291-10/+10
| | | | We can always call the member function version of this function.
* [lldb][NFC] Remove most GetASTContext calls in AST metadata codeRaphael Isemann2019-12-292-25/+18
|
* [lldb] Remove some calls to GetASTContextRaphael Isemann2019-12-261-7/+4
| | | | | | | GetASTContext is really expensive to call as it makes use of the global mapping from ASTContext to ClangASTContext. This replaces all calls where we already have the ClangASTContext around and don't need to call GetASTContext again.
* [lldb][NFC] Use StringRef in ↵Raphael Isemann2019-12-251-44/+38
| | | | ClangASTContext::GetBuiltinTypeForDWARFEncodingAndBitSize
* [lldb][NFC] Move ClangASTContext::m_scratch_ast_source_up to the appropriate ↵Raphael Isemann2019-12-241-8/+13
| | | | | | | | | class m_scratch_ast_source_up is only used by ClangASTContextForExpressions so it should also be declared only in that class. Also make all other members of ClangASTContext private and move the initialization code for ClangASTContextForExpressions into the constructor.
* [lldb][NFC] Remove ClangExternalASTSourceCommonRaphael Isemann2019-12-243-48/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | ClangExternalASTSourceCommon's purpose is to store a map from Decl*/Type* to ClangASTMetadata. Usually this data is accessed via the ClangASTContext interface which then grabs the current ExternalASTSource of its ASTContext, tries to cast it to ClangExternalASTSourceCommon and then accesses the metadata map. If the casting fails the setter does nothing and the getter returns a nullptr as if there was no known metadata for a type/decl. This system breaks as soon as any non-LLDB ExternalASTSource is added via a multiplexer to our existing ExternalASTSource (in which case we suddenly loose all out metadata as the casting always fails with an ExternalASTSource that is not inheriting from ClangExternalASTSourceCommon). This patch moves the metadata map to the ClangASTContext. This gets rid of all the fragile casting, the requirement that every ExternalASTSource in LLDB has to inherit from ClangExternalASTSourceCommon and simplifies the metadata implementation to a simple map lookup. As ClangExternalASTSourceCommon had no other purpose than storing metadata, this patch deletes this class and replaces all uses with clang::ExternalASTSource. No other code changes in this commit beside the AppleObjCDeclVendor which was the only code that did not use the ClangASTContext interface but directly accessed the ClangExternalASTSourceCommon.
* [lldb][NFC] Remove unused callback functionality from ClangASTContextRaphael Isemann2019-12-231-5/+0
|
* [lldb][NFC] Simplify ClangExternalASTSourceCallbacksRaphael Isemann2019-12-232-78/+18
| | | | | | | | | | | | | | | This class is only used by the ClangASTContext so we might as well simplify this whole logic by just passing a ClangASTContext instead of a list of callbacks and a void* pointer. If we ever need this to support other classes then we can define some interface that ClangASTContext implements but for now this isn't needed. I also removed any code for m_callback_find_by_name as this was always a nullptr in LLDB and removed all overriden implementations that just redefined the default no-op implementation that the ExternalASTSource provides. Also removed the assert.h workarounds.
* [lldb][NFC] Remove wrong and unused ClangASTContext::CopyDecl methodRaphael Isemann2019-12-231-16/+0
|
* [lldb][NFC] Delete all 'else return ...' in CompilerDeclContext.cppRaphael Isemann2019-12-231-8/+4
|
* [lldb] Add sanity check to CreateDeclContext and fixed illformed ↵Raphael Isemann2019-12-231-0/+2
| | | | | | | | | | | | | | | | | | | | | CompilerContext in ClangExpressionDeclMap. This adds a check that the ClangASTContext actually fits to the DeclContext that we want to create a CompilerDeclContext for. If the ClangASTContext (and its associated ASTContext) does not fit to the DeclContext (that is, the DeclContext wasn't created by the ASTContext), all computations using this malformed CompilerDeclContext will yield unpredictable results. Also fixes the only place that actually hits this assert which is the construction of a CompilerDeclContext in ClangExpressionDeclMap where we pass an unrelated ASTContext instead of the ASTContext of the current expression. I had to revert my previous change to DWARFASTParserClangTests.cpp back to using the unsafe direct construction of CompilerDeclContext as this assert won't work if the DeclContext we pass isn't a valid DeclContext in the first place.
* [lldb][NFC] Simplify ClangASTContext::GetTranslationUnitDeclRaphael Isemann2019-12-231-7/+1
| | | | | | | | | | | | | | | | | These two functions are just calling their equivalent function in ASTContext and implicitly convert the result to a DeclContext* (a parent class of TranslationUnitDecl). This leads to the absurd situation that we had to cast the result of GetTranslationUnitDecl to a TranslationUnitDecl*. The only reason we did this implicit conversion to the parent class was that the void* conversion for the CompilerDeclContext constructor was sound (which otherwise would receive a Decl* pointer when called with a TranslationUnitDecl*). Now that the CompilerDeclContext constructor is type safe we can properly implement these functions by actually returning the right type. Also deletes the static inconvenience method that was not used anywhere.
* [lldb][NFC] Make CompilerDeclContext construction type safeRaphael Isemann2019-12-231-7/+9
| | | | | | | | | | | | | | | The CompilerDeclContext constructor takes a void* pointer which means that all callers of this constructor need to first explicitly convert all pointers to clang::DeclContext*. This causes that we for example can't just pass a TranslationUnitDecl* to the constructor without first casting it to its parent class (as it inherits from both Decl and DeclContext so the void* pointer is actually a Decl*). This patch introduces a utility function in the ClangASTContext which gets rid of the requirement to cast all pointers to clang::DeclContext. Also moves all constructor calls to use this function instead which is NFC (beside the change in DWARFASTParserClangTests.cpp).
* [lldb] Remove unused CompilerDeclContext::IsStructUnionOrClassRaphael Isemann2019-12-222-14/+0
|
* [lldb][NFC] Return a reference from ClangASTContext::getASTContext and ↵Raphael Isemann2019-12-212-520/+500
| | | | | | | | | | | remove dead nullptr checks ClangASTContext::getASTContext() currently returns a ptr but we have an assert there since a while that the ASTContext is not a nullptr. This causes that we still have a lot of code that is doing nullptr checks on the result of getASTContext() which is all unreachable code. This patch changes the return value to a reference to make it clear this can't be a nullptr and deletes all the nullptr checks.
* [lldb][NFC] Remove all ASTContext getter wrappers from ClangASTContextRaphael Isemann2019-12-211-94/+53
| | | | | | | | | | | | Their naming is misleading as they only return the ClangASTContext-owned variables. For ClangASTContext instances constructed for a given clang::ASTContext they silently generated duplicated instances (e.g., a second IdentifierTable) that were essentially unusable. This removes all these getters as they are anyway not very useful in comparison to just calling the clang::ASTContext getters. The initialization code has been moved to the CreateASTContext initialization method so that all code for making our own clang::ASTContext is in one place.
* [lldb][NFC] Remove redundant ASTContext args to CopyDecl/DeportDeclRaphael Isemann2019-12-201-3/+3
| | | | | | We already pass a Decl here and the additional ASTContext needs to match the Decl. We might as well just pass the Decl and then extract the ASTContext from that.
* [lldb][NFC] Change if statements in ClangASTImporter to follow LLVM code styleRaphael Isemann2019-12-191-18/+10
|
* [lldb][NFC] Use StringRef in CreateRecordType and CreateObjCClassRaphael Isemann2019-12-171-6/+9
|
* [lldb][NFC] Rename ClangASTImporter::InsertRecordDecl to SetRecordLayout and ↵Raphael Isemann2019-12-171-1/+1
| | | | | | | document it This function is just setting the layout for the given RecordDecl so the current name is not very descriptive. Also add some documentation for it.
* [lldb][NFC] Allow creating ClangExpressionDeclMap and ClangASTSource without ↵Raphael Isemann2019-12-171-2/+2
| | | | | | | | | | a Target and add basic unit test The ClangExpressionDeclMap should be testable from a unit test. This is currently impossible as they have both dependencies on Target/ExecutionContext from their constructor. This patch allows constructing these classes without an active Target and adds the missing tests for running without a target that we can do at least a basic lookup test without crashing.
* [lldb] Remove modern-type-lookupRaphael Isemann2019-12-171-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As discussed on the mailing list [1] we have to make a decision for how to proceed with the modern-type-lookup. This patch removes modern-type-lookup from LLDB. This just removes all the code behind the modern-type-lookup setting but it does *not* remove any code from Clang (i.e., the ExternalASTMerger and the clang-import-test stay around for now). The motivation for this is that I don't think that the current approach of implementing modern-type-lookup will work out. Especially creating a completely new lookup system behind some setting that is never turned on by anyone and then one day make one big switch to the new system seems wrong. It doesn't fit into the way LLVM is developed and has so far made the transition work much more complicated than it has to be. A lot of the benefits that were supposed to come with the modern-type-lookup are related to having a better organization in the way types move across LLDB and having less dependencies on unrelated LLDB code. By just looking at the current code (mostly the ClangASTImporter) I think we can reach the same goals by just incrementally cleaning up, documenting, refactoring and actually testing the existing code we have. [1] http://lists.llvm.org/pipermail/lldb-dev/2019-December/015831.html Reviewers: shafik, martong Subscribers: rnkovacs, christof, arphaman, JDevlieghere, usaxena95, lldb-commits, friss Tags: #lldb Differential Revision: https://reviews.llvm.org/D71562
* [lldb][NFC] Remove implementation of GetOriginalDecl and just call ↵Raphael Isemann2019-12-171-12/+1
| | | | | | | | GetDeclOrigin instead Those functions have the same semantics beside some small optimization of not creating a new empty ASTContextMetadataSP value in the metadata map. We never actually hit this optimization according to test coverage so let's just call GetDeclOrigin instead.
* [lldb] Add support for calling objc_direct methods from LLDB's expression ↵Raphael Isemann2019-12-171-1/+13
| | | | | | | | | | | | | | | | | | | | | evaluator. Summary: D69991 introduced `__attribute__((objc_direct))` that allows directly calling methods without message passing. This patch adds support for calling methods with this attribute to LLDB's expression evaluator. The patch can be summarised in that LLDB just adds the same attribute to our module AST when we find a method with `__attribute__((objc_direct))` in our debug information. Reviewers: aprantl, shafik Reviewed By: shafik Subscribers: JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71196
* [lldb][NFC] Remove all overloads of Copy/DeportType in ClangASTImporterRaphael Isemann2019-12-161-55/+38
| | | | | | | The overloads that don't take a CompilerType serve no purpose as we always have a CompilerType in the scope where we call them. Instead just call the overload that takes a CompilerType and delete the now unused other overloaded methods.
* [lldb] Centralize desugaring of decltype-like types in ClangASTContextPavel Labath2019-12-161-74/+12
| | | | | | | | | | | | | | | | | | | | | | Summary: These types were handled in some places, but not others. This resulted in (for example) not being able to display members of structs whose types were defined using these constructs. Using getLocallyUnqualifiedSingleStepDesugaredType for these types is not fully equivalent, as it will only desugar them if the types are not instantiation-dependent, whereas previously we did that unconditionally. It's not clear to me which behavior is correct here, but the test suite does not seem to care either way. Reviewers: teemperor, shafik Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71405
* [lldb][NFC] Move definition of ClangASTMetadata out of ↵Raphael Isemann2019-12-164-24/+37
| | | | | | | | | | ClangExternalASTSourceCommon.h Changing metadata of a ClangASTContext currently requires to include the unrelated ClangExternalASTSourceCommon.h header because it actually defines the ClangASTMetadata class. This also removes the dependency from ClangASTImporter to ClangExternalASTSourceCommon.
* [lldb][NFC] Remove ClangASTImporter::ResolveDeclOriginRaphael Isemann2019-12-161-6/+6
| | | | ResolveDeclOrigin was just an inconvenience method around GetDeclOrigin.
* [lldb][NFC] Replace ClangASTImporter's use of map/set with SmallPtrSet and ↵Raphael Isemann2019-12-161-5/+3
| | | | | | | | DenseMap We have several pointer->pointer mappings in the ClangASTImporter implemented using STL data structures. This moves these variables to the appropriate LLVM data structures that are intended for mapping pointers.
* [lldb] Remove RTTI in ClangExternalASTSourceCommon based on a global map of ↵Raphael Isemann2019-12-152-58/+14
| | | | | | | | | | | | | | | | | | | | | | known instances Summary: Currently we do our RTTI check for ClangExternalASTSourceCommon by using this global map of ClangExternalASTSourceCommon where every instance is registering and deregistering itself on creation/destruction. Then we can do the RTTI check by looking up in this map from ClangASTContext. This patch removes this whole thing and just adds LLVM-style RTTI support to ClangExternalASTSourceCommon which is possible with D71397. Reviewers: labath, aprantl Reviewed By: labath Subscribers: JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71398
* [lldb][NFC] Make metadata tracking type safeRaphael Isemann2019-12-132-17/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: LLDB associates additional information with Types and Declarations which it calls ClangASTMetadata. ClangASTMetadata is stored by the ClangASTSourceCommon which is implemented by having a large map of `void *` keys to associated `ClangASTMetadata` values. To make this whole mechanism even unsafer we also decided to use `clang::Decl *` as one of pointers we throw in there (beside `clang::Type *`). The Decl class hierarchy uses multiple inheritance which means that not all pointers have the same address when they are implicitly converted to pointers of their parent classes. For example `clang::Decl *` and `clang::DeclContext *` won't end up being the same address when they are implicitly converted from one of the many Decl-subclasses that inherit from both. As we use the addresses as the keys in our Metadata map, this means that any implicit type conversions to parent classes (or anything else that changes the addresses) will break our metadata tracking in obscure ways. Just to illustrate how broken this whole mechanism currently is: ```lang=cpp // m_ast is our ClangASTContext. Let's double check that from GetTranslationUnitDecl // in ClangASTContext and ASTContext return the same thing (one method just calls the other). assert(m_ast->GetTranslationUnitDecl() == m_ast->getASTContext()->getTranslationUnitDecl()); // Ok, both methods have the same TU*. Let's store metadata with the result of one method call. m_ast->SetMetadataAsUserID(m_ast->GetTranslationUnitDecl(), 1234U); // Retrieve the same Metadata for the TU by using the TU* from the other method... which fails? EXPECT_EQ(m_ast->GetMetadata(m_ast->getASTContext()->getTranslationUnitDecl())->GetUserID(), 1234U); // Turns out that getTranslationUnitDecl one time returns a TranslationUnitDecl* but the other time // we return one of the parent classes of TranslationUnitDecl (DeclContext). ``` This patch splits up the `void *` API into two where one does the `clang::Type *` tracking and one the `clang::Decl *` mapping. Type and Decl are disjoint class hierarchies so there is no implicit conversion possible that could influence the address values. I had to change the storing of `clang::QualType` opaque pointers to their `clang::Type *` equivalents as opaque pointers are already `void *` pointers to begin with. We don't seem to ever set any qualifier in any of these QualTypes to this conversion should be NFC. Reviewers: labath, shafik, aprantl Reviewed By: labath Subscribers: JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71409
* [lldb] Remove ClangASTMetricsRaphael Isemann2019-12-121-38/+0
| | | | | | | | | | | | | | Summary: Not once have I looked at these numbers in a log and considered them useful. Also this should not have been implemented via an unguarded list of globals. Reviewers: martong, shafik Reviewed By: shafik Subscribers: rnkovacs, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71336
* [lldb] "See through" atomic types in ClangASTContextPavel Labath2019-12-121-52/+48
| | | | | | | | | | | | | | | | | Summary: This enables us to display the contents of atomic structs. Calling the removal of _Atomic "desugaring" is not fully correct as it does more than remove sugar, but it is the right thing to do for most of the things that we care about. We can change this back once we decide to support atomic types more comprehensively. Reviewers: teemperor, shafik Subscribers: jfb, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D71262
OpenPOWER on IntegriCloud