Author: zturner Date: Thu Dec 20 15:32:37 2018 New Revision: 349854 URL: http://llvm.org/viewvc/llvm-project?rev=349854&view=rev Log: [NativePDB] Create VarDecls for global variables.
Previously we would create these for local variables but not for global variables. Also updated existing tests which created global variables to check for them in the resulting AST. Modified: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp lldb/trunk/lit/SymbolFile/NativePDB/globals-fundamental.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.h lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Modified: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit?rev=349854&r1=349853&r2=349854&view=diff ============================================================================== --- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit (original) +++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-fundamental.lldbinit Thu Dec 20 15:32:37 2018 @@ -216,5 +216,7 @@ target variable CRC32_42 target variable CRWC1 target variable CRWCP +target modules dump ast + quit \ No newline at end of file Modified: lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp?rev=349854&r1=349853&r2=349854&view=diff ============================================================================== --- lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp (original) +++ lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp Thu Dec 20 15:32:37 2018 @@ -285,6 +285,7 @@ constexpr References ReferencesInstance; // CHECK: | |-FieldDecl {{.*}} k 'long long' // CHECK: | |-FieldDecl {{.*}} l 'char' // CHECK: | `-FieldDecl {{.*}} m 'long long' +// CHECK: |-VarDecl {{.*}} ClassWithPaddingInstance 'const ClassWithPadding' // CHECK: |-CXXRecordDecl {{.*}} class ClassNoPadding definition // CHECK: | |-FieldDecl {{.*}} a 'unsigned char' // CHECK: | |-FieldDecl {{.*}} b 'char' @@ -302,23 +303,27 @@ constexpr References ReferencesInstance; // CHECK: | |-FieldDecl {{.*}} n 'unsigned long long' // CHECK: | |-FieldDecl {{.*}} o 'long long' // CHECK: | `-FieldDecl {{.*}} p 'int [5]' +// CHECK: |-VarDecl {{.*}} ClassNoPaddingInstance 'const ClassNoPadding' // CHECK: |-EnumDecl {{.*}} EnumType // CHECK: | |-EnumConstantDecl {{.*}} A 'EnumType' // CHECK: | `-EnumConstantDecl {{.*}} B 'EnumType' // CHECK: |-CXXRecordDecl {{.*}} struct DerivedClass definition // CHECK: | |-public 'BaseClass<int>' // CHECK: | `-FieldDecl {{.*}} DerivedMember 'int' +// CHECK: |-VarDecl {{.*}} DC 'const DerivedClass' // CHECK: |-CXXRecordDecl {{.*}} struct BaseClass<int> definition // CHECK: | `-FieldDecl {{.*}} BaseMember 'int' // CHECK: |-CXXRecordDecl {{.*}} struct EBO definition // CHECK: | |-public 'EmptyBase' // CHECK: | `-FieldDecl {{.*}} Member 'int' +// CHECK: |-VarDecl {{.*}} EBOC 'const EBO' // CHECK: |-CXXRecordDecl {{.*}} struct EmptyBase definition // CHECK: |-CXXRecordDecl {{.*}} struct PaddedBases definition // CHECK: | |-public 'BaseClass<char>' // CHECK: | |-public 'BaseClass<short>' // CHECK: | |-public 'BaseClass<int>' // CHECK: | `-FieldDecl {{.*}} DerivedMember 'long long' +// CHECK: |-VarDecl {{.*}} PBC 'const PaddedBases' // CHECK: |-CXXRecordDecl {{.*}} struct BaseClass<char> definition // CHECK: | `-FieldDecl {{.*}} BaseMember 'int' // CHECK: |-CXXRecordDecl {{.*}} struct BaseClass<short> definition @@ -326,6 +331,7 @@ constexpr References ReferencesInstance; // CHECK: |-CXXRecordDecl {{.*}} struct <unnamed-type-UnnamedClassInstance> definition // CHECK: | |-FieldDecl {{.*}} x 'int' // CHECK: | `-FieldDecl {{.*}} EBOC 'EBO' +// CHECK: |-VarDecl {{.*}} UnnamedClassInstance 'const <unnamed-type-UnnamedClassInstance>' // CHECK: |-CXXRecordDecl {{.*}} struct Pointers definition // CHECK: | |-FieldDecl {{.*}} a 'void *' // CHECK: | |-FieldDecl {{.*}} b 'char *' @@ -341,6 +347,7 @@ constexpr References ReferencesInstance; // CHECK: | |-FieldDecl {{.*}} m 'double *' // CHECK: | |-FieldDecl {{.*}} n 'unsigned long long *' // CHECK: | `-FieldDecl {{.*}} o 'long long *' +// CHECK: |-VarDecl {{.*}} PointersInstance 'const Pointers' // CHECK: |-CXXRecordDecl {{.*}} struct References definition // CHECK: | |-FieldDecl {{.*}} a 'char &' // CHECK: | |-FieldDecl {{.*}} b 'bool &' @@ -355,6 +362,7 @@ constexpr References ReferencesInstance; // CHECK: | |-FieldDecl {{.*}} k 'double &' // CHECK: | |-FieldDecl {{.*}} l 'unsigned long long &' // CHECK: | `-FieldDecl {{.*}} m 'long long &' +// CHECK: |-VarDecl {{.*}} ReferencesInstance 'const References' // CHECK: `-<undeserialized declarations> int main(int argc, char **argv) { Modified: lldb/trunk/lit/SymbolFile/NativePDB/globals-fundamental.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/globals-fundamental.cpp?rev=349854&r1=349853&r2=349854&view=diff ============================================================================== --- lldb/trunk/lit/SymbolFile/NativePDB/globals-fundamental.cpp (original) +++ lldb/trunk/lit/SymbolFile/NativePDB/globals-fundamental.cpp Thu Dec 20 15:32:37 2018 @@ -660,6 +660,219 @@ const wchar_t &CRWCP = WCP; // FIXME: (const wchar_t &) CRWCP = {{.*}} (&::CRWCP = L'P') +// CHECK: TranslationUnitDecl {{.*}} +// CHECK-NEXT: |-VarDecl {{.*}} BFalse 'bool' +// CHECK-NEXT: |-VarDecl {{.*}} BTrue 'bool' +// CHECK-NEXT: |-VarDecl {{.*}} CA 'char' +// CHECK-NEXT: |-VarDecl {{.*}} CZ 'char' +// CHECK-NEXT: |-VarDecl {{.*}} SCa 'signed char' +// CHECK-NEXT: |-VarDecl {{.*}} SCz 'signed char' +// CHECK-NEXT: |-VarDecl {{.*}} UC24 'unsigned char' +// CHECK-NEXT: |-VarDecl {{.*}} UC42 'unsigned char' +// CHECK-NEXT: |-VarDecl {{.*}} C16_24 'char16_t' +// CHECK-NEXT: |-VarDecl {{.*}} C32_42 'char32_t' +// CHECK-NEXT: |-VarDecl {{.*}} WC1 'wchar_t' +// CHECK-NEXT: |-VarDecl {{.*}} WCP 'wchar_t' +// CHECK-NEXT: |-VarDecl {{.*}} SMax 'short' +// CHECK-NEXT: |-VarDecl {{.*}} SMin 'short' +// CHECK-NEXT: |-VarDecl {{.*}} USMax 'unsigned short' +// CHECK-NEXT: |-VarDecl {{.*}} USMin 'unsigned short' +// CHECK-NEXT: |-VarDecl {{.*}} IMax 'int' +// CHECK-NEXT: |-VarDecl {{.*}} IMin 'int' +// CHECK-NEXT: |-VarDecl {{.*}} UIMax 'unsigned int' +// CHECK-NEXT: |-VarDecl {{.*}} UIMin 'unsigned int' +// CHECK-NEXT: |-VarDecl {{.*}} LMax 'long' +// CHECK-NEXT: |-VarDecl {{.*}} LMin 'long' +// CHECK-NEXT: |-VarDecl {{.*}} ULMax 'unsigned long' +// CHECK-NEXT: |-VarDecl {{.*}} ULMin 'unsigned long' +// CHECK-NEXT: |-VarDecl {{.*}} LLMax 'long long' +// CHECK-NEXT: |-VarDecl {{.*}} LLMin 'long long' +// CHECK-NEXT: |-VarDecl {{.*}} ULLMax 'unsigned long long' +// CHECK-NEXT: |-VarDecl {{.*}} ULLMin 'unsigned long long' +// CHECK-NEXT: |-VarDecl {{.*}} F 'float' +// CHECK-NEXT: |-VarDecl {{.*}} D 'double' +// CHECK-NEXT: |-VarDecl {{.*}} CBFalse 'const bool' +// CHECK-NEXT: |-VarDecl {{.*}} CBTrue 'const bool' +// CHECK-NEXT: |-VarDecl {{.*}} CCA 'const char' +// CHECK-NEXT: |-VarDecl {{.*}} CCZ 'const char' +// CHECK-NEXT: |-VarDecl {{.*}} CSCa 'const signed char' +// CHECK-NEXT: |-VarDecl {{.*}} CSCz 'const signed char' +// CHECK-NEXT: |-VarDecl {{.*}} CUC24 'const unsigned char' +// CHECK-NEXT: |-VarDecl {{.*}} CUC42 'const unsigned char' +// CHECK-NEXT: |-VarDecl {{.*}} CC16_24 'const char16_t' +// CHECK-NEXT: |-VarDecl {{.*}} CC32_42 'const char32_t' +// CHECK-NEXT: |-VarDecl {{.*}} CWC1 'const wchar_t' +// CHECK-NEXT: |-VarDecl {{.*}} CWCP 'const wchar_t' +// CHECK-NEXT: |-VarDecl {{.*}} CSMax 'const short' +// CHECK-NEXT: |-VarDecl {{.*}} CSMin 'const short' +// CHECK-NEXT: |-VarDecl {{.*}} CUSMax 'const unsigned short' +// CHECK-NEXT: |-VarDecl {{.*}} CUSMin 'const unsigned short' +// CHECK-NEXT: |-VarDecl {{.*}} CIMax 'const int' +// CHECK-NEXT: |-VarDecl {{.*}} CIMin 'const int' +// CHECK-NEXT: |-VarDecl {{.*}} CUIMax 'const unsigned int' +// CHECK-NEXT: |-VarDecl {{.*}} CUIMin 'const unsigned int' +// CHECK-NEXT: |-VarDecl {{.*}} CLMax 'const long' +// CHECK-NEXT: |-VarDecl {{.*}} CLMin 'const long' +// CHECK-NEXT: |-VarDecl {{.*}} CULMax 'const unsigned long' +// CHECK-NEXT: |-VarDecl {{.*}} CULMin 'const unsigned long' +// CHECK-NEXT: |-VarDecl {{.*}} CLLMax 'const long long' +// CHECK-NEXT: |-VarDecl {{.*}} CLLMin 'const long long' +// CHECK-NEXT: |-VarDecl {{.*}} CULLMax 'const unsigned long long' +// CHECK-NEXT: |-VarDecl {{.*}} CULLMin 'const unsigned long long' +// CHECK-NEXT: |-VarDecl {{.*}} CF 'const float' +// CHECK-NEXT: |-VarDecl {{.*}} CD 'const double' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprBFalse 'const bool' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprBTrue 'const bool' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprCA 'const char' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprCZ 'const char' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprSCa 'const signed char' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprSCz 'const signed char' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprUC24 'const unsigned char' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprUC42 'const unsigned char' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprC16_24 'const char16_t' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprC32_42 'const char32_t' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprWC1 'const wchar_t' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprWCP 'const wchar_t' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprSMax 'const short' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprSMin 'const short' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprUSMax 'const unsigned short' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprUSMin 'const unsigned short' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprIMax 'const int' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprIMin 'const int' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprUIMax 'const unsigned int' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprUIMin 'const unsigned int' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprLMax 'const long' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprLMin 'const long' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprULMax 'const unsigned long' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprULMin 'const unsigned long' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprLLMax 'const long long' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprLLMin 'const long long' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprULLMax 'const unsigned long long' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprULLMin 'const unsigned long long' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprF 'const float' +// CHECK-NEXT: |-VarDecl {{.*}} ConstexprD 'const double' +// CHECK-NEXT: |-VarDecl {{.*}} PBFalse 'bool *' +// CHECK-NEXT: |-VarDecl {{.*}} PBTrue 'bool *' +// CHECK-NEXT: |-VarDecl {{.*}} PCA 'char *' +// CHECK-NEXT: |-VarDecl {{.*}} PCZ 'char *' +// CHECK-NEXT: |-VarDecl {{.*}} PSCa 'signed char *' +// CHECK-NEXT: |-VarDecl {{.*}} PSCz 'signed char *' +// CHECK-NEXT: |-VarDecl {{.*}} PUC24 'unsigned char *' +// CHECK-NEXT: |-VarDecl {{.*}} PUC42 'unsigned char *' +// CHECK-NEXT: |-VarDecl {{.*}} PC16_24 'char16_t *' +// CHECK-NEXT: |-VarDecl {{.*}} PC32_42 'char32_t *' +// CHECK-NEXT: |-VarDecl {{.*}} PWC1 'wchar_t *' +// CHECK-NEXT: |-VarDecl {{.*}} PWCP 'wchar_t *' +// CHECK-NEXT: |-VarDecl {{.*}} PSMax 'short *' +// CHECK-NEXT: |-VarDecl {{.*}} PSMin 'short *' +// CHECK-NEXT: |-VarDecl {{.*}} PUSMax 'unsigned short *' +// CHECK-NEXT: |-VarDecl {{.*}} PUSMin 'unsigned short *' +// CHECK-NEXT: |-VarDecl {{.*}} PIMax 'int *' +// CHECK-NEXT: |-VarDecl {{.*}} PIMin 'int *' +// CHECK-NEXT: |-VarDecl {{.*}} PUIMax 'unsigned int *' +// CHECK-NEXT: |-VarDecl {{.*}} PUIMin 'unsigned int *' +// CHECK-NEXT: |-VarDecl {{.*}} PLMax 'long *' +// CHECK-NEXT: |-VarDecl {{.*}} PLMin 'long *' +// CHECK-NEXT: |-VarDecl {{.*}} PULMax 'unsigned long *' +// CHECK-NEXT: |-VarDecl {{.*}} PULMin 'unsigned long *' +// CHECK-NEXT: |-VarDecl {{.*}} PLLMax 'long long *' +// CHECK-NEXT: |-VarDecl {{.*}} PLLMin 'long long *' +// CHECK-NEXT: |-VarDecl {{.*}} PULLMax 'unsigned long long *' +// CHECK-NEXT: |-VarDecl {{.*}} PULLMin 'unsigned long long *' +// CHECK-NEXT: |-VarDecl {{.*}} PF 'float *' +// CHECK-NEXT: |-VarDecl {{.*}} PD 'double *' +// CHECK-NEXT: |-VarDecl {{.*}} CPBFalse 'const bool *' +// CHECK-NEXT: |-VarDecl {{.*}} CPBTrue 'const bool *' +// CHECK-NEXT: |-VarDecl {{.*}} CPCA 'const char *' +// CHECK-NEXT: |-VarDecl {{.*}} CPCZ 'const char *' +// CHECK-NEXT: |-VarDecl {{.*}} CPSCa 'const signed char *' +// CHECK-NEXT: |-VarDecl {{.*}} CPSCz 'const signed char *' +// CHECK-NEXT: |-VarDecl {{.*}} CPUC24 'const unsigned char *' +// CHECK-NEXT: |-VarDecl {{.*}} CPUC42 'const unsigned char *' +// CHECK-NEXT: |-VarDecl {{.*}} CPC16_24 'const char16_t *' +// CHECK-NEXT: |-VarDecl {{.*}} CPC32_42 'const char32_t *' +// CHECK-NEXT: |-VarDecl {{.*}} CPWC1 'const wchar_t *' +// CHECK-NEXT: |-VarDecl {{.*}} CPWCP 'const wchar_t *' +// CHECK-NEXT: |-VarDecl {{.*}} CPSMax 'const short *' +// CHECK-NEXT: |-VarDecl {{.*}} CPSMin 'const short *' +// CHECK-NEXT: |-VarDecl {{.*}} CPUSMax 'const unsigned short *' +// CHECK-NEXT: |-VarDecl {{.*}} CPUSMin 'const unsigned short *' +// CHECK-NEXT: |-VarDecl {{.*}} CPIMax 'const int *' +// CHECK-NEXT: |-VarDecl {{.*}} CPIMin 'const int *' +// CHECK-NEXT: |-VarDecl {{.*}} CPUIMax 'const unsigned int *' +// CHECK-NEXT: |-VarDecl {{.*}} CPUIMin 'const unsigned int *' +// CHECK-NEXT: |-VarDecl {{.*}} CPLMax 'const long *' +// CHECK-NEXT: |-VarDecl {{.*}} CPLMin 'const long *' +// CHECK-NEXT: |-VarDecl {{.*}} CPULMax 'const unsigned long *' +// CHECK-NEXT: |-VarDecl {{.*}} CPULMin 'const unsigned long *' +// CHECK-NEXT: |-VarDecl {{.*}} CPLLMax 'const long long *' +// CHECK-NEXT: |-VarDecl {{.*}} CPLLMin 'const long long *' +// CHECK-NEXT: |-VarDecl {{.*}} CPULLMax 'const unsigned long long *' +// CHECK-NEXT: |-VarDecl {{.*}} CPULLMin 'const unsigned long long *' +// CHECK-NEXT: |-VarDecl {{.*}} CPF 'const float *' +// CHECK-NEXT: |-VarDecl {{.*}} CPD 'const double *' +// CHECK-NEXT: |-VarDecl {{.*}} RBFalse 'bool &' +// CHECK-NEXT: |-VarDecl {{.*}} RBTrue 'bool &' +// CHECK-NEXT: |-VarDecl {{.*}} RCA 'char &' +// CHECK-NEXT: |-VarDecl {{.*}} RCZ 'char &' +// CHECK-NEXT: |-VarDecl {{.*}} RSCa 'signed char &' +// CHECK-NEXT: |-VarDecl {{.*}} RSCz 'signed char &' +// CHECK-NEXT: |-VarDecl {{.*}} RUC24 'unsigned char &' +// CHECK-NEXT: |-VarDecl {{.*}} RUC42 'unsigned char &' +// CHECK-NEXT: |-VarDecl {{.*}} RSMax 'short &' +// CHECK-NEXT: |-VarDecl {{.*}} RSMin 'short &' +// CHECK-NEXT: |-VarDecl {{.*}} RUSMax 'unsigned short &' +// CHECK-NEXT: |-VarDecl {{.*}} RUSMin 'unsigned short &' +// CHECK-NEXT: |-VarDecl {{.*}} RIMax 'int &' +// CHECK-NEXT: |-VarDecl {{.*}} RIMin 'int &' +// CHECK-NEXT: |-VarDecl {{.*}} RUIMax 'unsigned int &' +// CHECK-NEXT: |-VarDecl {{.*}} RUIMin 'unsigned int &' +// CHECK-NEXT: |-VarDecl {{.*}} RLMax 'long &' +// CHECK-NEXT: |-VarDecl {{.*}} RLMin 'long &' +// CHECK-NEXT: |-VarDecl {{.*}} RULMax 'unsigned long &' +// CHECK-NEXT: |-VarDecl {{.*}} RULMin 'unsigned long &' +// CHECK-NEXT: |-VarDecl {{.*}} RLLMax 'long long &' +// CHECK-NEXT: |-VarDecl {{.*}} RLLMin 'long long &' +// CHECK-NEXT: |-VarDecl {{.*}} RULLMax 'unsigned long long &' +// CHECK-NEXT: |-VarDecl {{.*}} RULLMin 'unsigned long long &' +// CHECK-NEXT: |-VarDecl {{.*}} RF 'float &' +// CHECK-NEXT: |-VarDecl {{.*}} RD 'double &' +// CHECK-NEXT: |-VarDecl {{.*}} CRBFalse 'const bool &' +// CHECK-NEXT: |-VarDecl {{.*}} CRBTrue 'const bool &' +// CHECK-NEXT: |-VarDecl {{.*}} CRCA 'const char &' +// CHECK-NEXT: |-VarDecl {{.*}} CRCZ 'const char &' +// CHECK-NEXT: |-VarDecl {{.*}} CRSCa 'const signed char &' +// CHECK-NEXT: |-VarDecl {{.*}} CRSCz 'const signed char &' +// CHECK-NEXT: |-VarDecl {{.*}} CRUC24 'const unsigned char &' +// CHECK-NEXT: |-VarDecl {{.*}} CRUC42 'const unsigned char &' +// CHECK-NEXT: |-VarDecl {{.*}} CRSMax 'const short &' +// CHECK-NEXT: |-VarDecl {{.*}} CRSMin 'const short &' +// CHECK-NEXT: |-VarDecl {{.*}} CRUSMax 'const unsigned short &' +// CHECK-NEXT: |-VarDecl {{.*}} CRUSMin 'const unsigned short &' +// CHECK-NEXT: |-VarDecl {{.*}} CRIMax 'const int &' +// CHECK-NEXT: |-VarDecl {{.*}} CRIMin 'const int &' +// CHECK-NEXT: |-VarDecl {{.*}} CRUIMax 'const unsigned int &' +// CHECK-NEXT: |-VarDecl {{.*}} CRUIMin 'const unsigned int &' +// CHECK-NEXT: |-VarDecl {{.*}} CRLMax 'const long &' +// CHECK-NEXT: |-VarDecl {{.*}} CRLMin 'const long &' +// CHECK-NEXT: |-VarDecl {{.*}} CRULMax 'const unsigned long &' +// CHECK-NEXT: |-VarDecl {{.*}} CRULMin 'const unsigned long &' +// CHECK-NEXT: |-VarDecl {{.*}} CRLLMax 'const long long &' +// CHECK-NEXT: |-VarDecl {{.*}} CRLLMin 'const long long &' +// CHECK-NEXT: |-VarDecl {{.*}} CRULLMax 'const unsigned long long &' +// CHECK-NEXT: |-VarDecl {{.*}} CRULLMin 'const unsigned long long &' +// CHECK-NEXT: |-VarDecl {{.*}} CRF 'const float &' +// CHECK-NEXT: |-VarDecl {{.*}} CRD 'const double &' +// CHECK-NEXT: |-VarDecl {{.*}} RC16_24 'char16_t &' +// CHECK-NEXT: |-VarDecl {{.*}} RC32_42 'char32_t &' +// CHECK-NEXT: |-VarDecl {{.*}} RWC1 'wchar_t &' +// CHECK-NEXT: |-VarDecl {{.*}} RWCP 'wchar_t &' +// CHECK-NEXT: |-VarDecl {{.*}} CRC16_24 'const char16_t &' +// CHECK-NEXT: |-VarDecl {{.*}} CRC32_42 'const char32_t &' +// CHECK-NEXT: |-VarDecl {{.*}} CRWC1 'const wchar_t &' +// CHECK-NEXT: |-VarDecl {{.*}} CRWCP 'const wchar_t &' +// CHECK-NEXT: `-<undeserialized declarations> + // CHECK: (lldb) quit int main(int argc, char **argv) { Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp?rev=349854&r1=349853&r2=349854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp Thu Dec 20 15:32:37 2018 @@ -586,6 +586,18 @@ PdbAstBuilder::GetOrCreateBlockDecl(PdbC return block_decl; } +clang::VarDecl *PdbAstBuilder::CreateVariableDecl(PdbSymUid uid, CVSymbol sym, + clang::DeclContext &scope) { + VariableInfo var_info = GetVariableNameInfo(sym); + clang::QualType qt = GetOrCreateType(var_info.type); + + clang::VarDecl *var_decl = m_clang.CreateVariableDeclaration( + &scope, var_info.name.str().c_str(), qt); + + m_uid_to_decl[toOpaqueUid(uid)] = var_decl; + return var_decl; +} + clang::VarDecl * PdbAstBuilder::GetOrCreateLocalVariableDecl(PdbCompilandSymId scope_id, PdbCompilandSymId var_id) { @@ -594,15 +606,17 @@ PdbAstBuilder::GetOrCreateLocalVariableD clang::DeclContext *scope = GetOrCreateDeclContextForUid(scope_id); - CVSymbol var = m_index.ReadSymbolRecord(var_id); - VariableInfo var_info = GetVariableNameInfo(var); - clang::QualType qt = GetOrCreateType(var_info.type); + CVSymbol sym = m_index.ReadSymbolRecord(var_id); + return CreateVariableDecl(PdbSymUid(var_id), sym, *scope); +} - clang::VarDecl *var_decl = - m_clang.CreateVariableDeclaration(scope, var_info.name.str().c_str(), qt); +clang::VarDecl * +PdbAstBuilder::GetOrCreateGlobalVariableDecl(PdbGlobalSymId var_id) { + if (clang::Decl *decl = TryGetDecl(var_id)) + return llvm::dyn_cast<clang::VarDecl>(decl); - m_uid_to_decl[toOpaqueUid(var_id)] = var_decl; - return var_decl; + CVSymbol sym = m_index.ReadSymbolRecord(var_id); + return CreateVariableDecl(PdbSymUid(var_id), sym, GetTranslationUnitDecl()); } clang::QualType PdbAstBuilder::GetBasicType(lldb::BasicType type) { Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h?rev=349854&r1=349853&r2=349854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h Thu Dec 20 15:32:37 2018 @@ -68,6 +68,7 @@ public: clang::BlockDecl *GetOrCreateBlockDecl(PdbCompilandSymId block_id); clang::VarDecl *GetOrCreateLocalVariableDecl(PdbCompilandSymId scope_id, PdbCompilandSymId var_id); + clang::VarDecl *GetOrCreateGlobalVariableDecl(PdbGlobalSymId var_id); clang::QualType GetBasicType(lldb::BasicType type); clang::QualType GetOrCreateType(PdbTypeSymId type); @@ -106,6 +107,9 @@ private: clang::FunctionDecl &function_decl, uint32_t param_count); clang::Decl *GetOrCreateSymbolForId(PdbCompilandSymId id); + clang::VarDecl *CreateVariableDecl(PdbSymUid uid, + llvm::codeview::CVSymbol sym, + clang::DeclContext &scope); void BuildParentMap(); std::pair<clang::DeclContext *, std::string> Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp?rev=349854&r1=349853&r2=349854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.cpp Thu Dec 20 15:32:37 2018 @@ -202,3 +202,7 @@ CVSymbol PdbIndex::ReadSymbolRecord(PdbC lldbassert(iter != cci->m_debug_stream.getSymbolArray().end()); return *iter; } + +CVSymbol PdbIndex::ReadSymbolRecord(PdbGlobalSymId global) const { + return symrecords().readRecord(global.offset); +} Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.h?rev=349854&r1=349853&r2=349854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbIndex.h Thu Dec 20 15:32:37 2018 @@ -150,6 +150,7 @@ public: std::vector<SymbolAndUid> FindSymbolsByVa(lldb::addr_t va); llvm::codeview::CVSymbol ReadSymbolRecord(PdbCompilandSymId cu_sym) const; + llvm::codeview::CVSymbol ReadSymbolRecord(PdbGlobalSymId global) const; llvm::Optional<uint16_t> GetModuleIndexForAddr(uint16_t segment, uint32_t offset) const; Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp?rev=349854&r1=349853&r2=349854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp Thu Dec 20 15:32:37 2018 @@ -488,6 +488,30 @@ VariableInfo lldb_private::npdb::GetVari return result; } + if (sym.kind() == S_GDATA32 || sym.kind() == S_LDATA32) { + DataSym data(SymbolRecordKind::DataSym); + cantFail(SymbolDeserializer::deserializeAs<DataSym>(sym, data)); + result.type = data.Type; + result.name = data.Name; + return result; + } + + if (sym.kind() == S_GTHREAD32 || sym.kind() == S_LTHREAD32) { + ThreadLocalDataSym data(SymbolRecordKind::ThreadLocalDataSym); + cantFail(SymbolDeserializer::deserializeAs<ThreadLocalDataSym>(sym, data)); + result.type = data.Type; + result.name = data.Name; + return result; + } + + if (sym.kind() == S_CONSTANT) { + ConstantSym constant(SymbolRecordKind::ConstantSym); + cantFail(SymbolDeserializer::deserializeAs<ConstantSym>(sym, constant)); + result.type = constant.Type; + result.name = constant.Name; + return result; + } + lldbassert(false && "Invalid variable record kind!"); return {}; } Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp?rev=349854&r1=349853&r2=349854&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Thu Dec 20 15:32:37 2018 @@ -759,6 +759,8 @@ VariableSP SymbolFileNativePDB::CreateGl std::make_shared<SymbolFileType>(*this, toOpaqueUid(tid)); Variable::RangeList ranges; + m_ast->GetOrCreateGlobalVariableDecl(var_id); + DWARFExpression location = MakeGlobalLocationExpression( section, offset, GetObjectFile()->GetModule()); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits