llvm-project/lldb/include/lldb
Raphael Isemann c9a39a896c [lldb] Add a display name to ClangASTContext instances
Summary:
I often struggle to understand what exactly LLDB is doing by looking at our expression evaluation logging as our messages look like this:
```
CompleteTagDecl[2] on (ASTContext*)0x7ff31f01d240 Completing (TagDecl*)0x7ff31f01d568 named DeclName1
```

From the log messages it's unclear what this ASTContext is. Is it the scratch context, the expression context, some decl vendor context or a context from a module?
The pointer value isn't helpful for anyone unless I'm in a debugger where I could inspect the memory at the address. But even with a debugger it's not easy to
figure out what this ASTContext is without having deeper understanding about all the different ASTContext instances in LLDB (e.g., valid SourceLocation
from the file system usually means that this is the Objective-C decl vendor, a file name from multiple expressions is probably the scratch context, etc.).

This patch adds a name field to ClangASTContext instances that we can use to store a name which can be used for logging and debugging. With this
our log messages now look like this:
```
CompleteTagDecl[2] on scratch ASTContext. Completing (TagDecl*)0x7ff31f01d568 named Foo
```
We can now also just print a ClangASTContext from the debugger and see a useful name in the `m_display_name` field, e.g.
```
  m_display_name = "AST for /Users/user/test/main.o";
```

Reviewers: shafik, labath, JDevlieghere, mib

Reviewed By: shafik

Subscribers: clayborg, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D72391
2020-01-22 08:54:10 +01:00
..
API [lldb/Reproducers] Add a flag to always generating a reproducer 2020-01-15 19:45:54 -08:00
Breakpoint Change Target::FindBreakpointsByName to return Expected<vector> 2019-12-04 09:57:15 -05:00
Core [lldb/IOHandler] Improve synchronization between IO handlers. 2020-01-20 11:17:55 -08:00
DataFormatters Remove TypeValidators (NFC in terms of the testsuite) 2019-12-11 09:27:12 -08:00
Expression [lldb/DWARF] Fix mixed v4+v5 location lists 2020-01-09 13:19:29 +01:00
Host [lldb][NFC] Take a llvm::Triple in ClangASTContext constructor 2020-01-07 10:50:59 +01:00
Initialization [NFC] Remove ASCII lines from comments 2019-04-10 20:48:55 +00:00
Interpreter [lldb/CommandInterpreter] Remove flag that's always true (NFC) 2020-01-14 22:28:49 -08:00
Symbol [lldb] Add a display name to ClangASTContext instances 2020-01-22 08:54:10 +01:00
Target [lldb] Add a setting to not install the main executable 2020-01-21 19:26:18 +00:00
Utility [lldb/Reproducers] Print more info for reproducer status 2020-01-15 20:25:44 -08:00
lldb-defines.h [NFC] Remove ASCII lines from comments 2019-04-10 20:48:55 +00:00
lldb-enumerations.h [lldb/DWARF] Move location list sections into DWARFContext 2020-01-14 15:19:29 +01:00
lldb-forward.h Remove TypeValidators (NFC in terms of the testsuite) 2019-12-11 09:27:12 -08:00
lldb-private-defines.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
lldb-private-enumerations.h Generalize FindTypes with CompilerContext to support fuzzy lookup 2019-08-21 18:06:56 +00:00
lldb-private-forward.h [NFC] Remove ASCII lines from comments 2019-04-10 20:48:55 +00:00
lldb-private-interfaces.h [lldb] Modernize OptionValue::SetValueChangedCallback 2020-01-09 14:17:17 +01:00
lldb-private-types.h [NFC] Remove ASCII lines from comments 2019-04-10 20:48:55 +00:00
lldb-private.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
lldb-public.h Fix file names in file headers. NFC 2019-05-13 04:42:32 +00:00
lldb-types.h [NFC] Remove ASCII lines from comments 2019-04-10 20:48:55 +00:00
lldb-versioning.h [NFC] Remove ASCII lines from comments 2019-04-10 20:48:55 +00:00
module.modulemap [Reproducers] Make ReproducerInstrumentation a textual header 2019-03-11 23:09:09 +00:00