Files
clang-p2996/lldb/lit/SymbolFile/PDB/Inputs/AstRestoreTest.cpp
Aleksandr Urakov 709426b33a [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
2018-09-10 08:08:43 +00:00

48 lines
697 B
C++

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;
}