diff options
| author | Aleksandr Urakov <aleksandr.urakov@jetbrains.com> | 2018-09-10 08:08:43 +0000 |
|---|---|---|
| committer | Aleksandr Urakov <aleksandr.urakov@jetbrains.com> | 2018-09-10 08:08:43 +0000 |
| commit | 709426b33a17d69b102f9ab80abda1749636c259 (patch) | |
| tree | c9dee5eef4148aed830c50e3b6cd971e247acd72 /lldb/lit/SymbolFile/PDB/Inputs/AstRestoreTest.cpp | |
| parent | 59491a1fa955da7a5baa9182722f655cb4496881 (diff) | |
| download | bcm5719-llvm-709426b33a17d69b102f9ab80abda1749636c259.tar.gz bcm5719-llvm-709426b33a17d69b102f9ab80abda1749636c259.zip | |
[PDB] Restore AST from PDB symbols
Summary:
This patch adds an implementation of retrieving of declarations and declaration
contexts based on PDB symbols.
PDB has different type symbols for const-qualified types, and this
implementation ensures that only one declaration was created for both const
and non-const types, but creates different compiler types for them.
The implementation also processes the case when there are two symbols
corresponding to a variable. It's possible e.g. for class static variables,
they has one global symbol and one symbol belonging to a class.
PDB has no info about namespaces, so this implementation parses the full symbol
name and tries to figure out if the symbol belongs to namespace or not,
and then creates nested namespaces if necessary.
Reviewers: asmith, zturner, labath
Reviewed By: asmith
Subscribers: aleksandr.urakov, teemperor, lldb-commits, stella.stamenova
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D51162
llvm-svn: 341782
Diffstat (limited to 'lldb/lit/SymbolFile/PDB/Inputs/AstRestoreTest.cpp')
| -rw-r--r-- | lldb/lit/SymbolFile/PDB/Inputs/AstRestoreTest.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/lldb/lit/SymbolFile/PDB/Inputs/AstRestoreTest.cpp b/lldb/lit/SymbolFile/PDB/Inputs/AstRestoreTest.cpp new file mode 100644 index 00000000000..8a56fd7e048 --- /dev/null +++ b/lldb/lit/SymbolFile/PDB/Inputs/AstRestoreTest.cpp @@ -0,0 +1,47 @@ +namespace N0 { +namespace N1 { + +namespace { +enum Enum { Enum_0 = 1, Enum_1 = 2, Enum_2 = 4, Enum_3 = 8 }; +} + +Enum Global = Enum_3; + +struct Base { + Enum m_e = Enum_1; +}; + +class Class : public Base { +public: + Class(Enum e) : m_ce(e) {} + + static int StaticFunc(const Class &c) { + return c.PrivateFunc(c.m_inner) + Global + ClassStatic; + } + + const Enum m_ce; + + static int ClassStatic; + +private: + struct Inner { + char x; + short y; + int z; + }; + + int PrivateFunc(const Inner &i) const { return i.z; } + + Inner m_inner{}; +}; +int Class::ClassStatic = 7; + +void foo() { Class::StaticFunc(Class(Enum_0)); } + +} // namespace N1 +} // namespace N0 + +int main() { + N0::N1::foo(); + return 0; +} |

