[lldb][PDB] Constexpr static member values as AST literals
authorAleksandr Urakov <Aleksandr.Urakov@jetbrains.com>
Thu, 25 Jun 2020 08:22:05 +0000 (11:22 +0300)
committerAleksandr Urakov <Aleksandr.Urakov@jetbrains.com>
Thu, 25 Jun 2020 08:27:16 +0000 (11:27 +0300)
commit895529cfd8756e2b4dc609f5af92e0d8ae280ed8
tree71913dce28735449cd5add00df31ec560c35039e
parent2c061998b55707b1b6f3a587ccc155fbbebd0a4e
[lldb][PDB] Constexpr static member values as AST literals

Summary:
When evaluating an expression referencing a constexpr static member variable, an
error is issued because the PDB does not specify a symbol with an address that
can be relocated against.

Rather than attempt to resolve the variable's value within the IR execution, the
values of all constants can be looked up and incorporated into the AST of the
record type as a literal, mirroring the original compiler AST.

This change applies to DIA and native PDB loaders.

Patch By: jackoalan

Reviewers: aleksandr.urakov, jasonmolenda, zturner, jdoerfert, teemperor

Reviewed By: aleksandr.urakov

Subscribers: sstefan1, lldb-commits, llvm-commits, #lldb

Tags: #lldb, #llvm

Differential Revision: https://reviews.llvm.org/D82160
lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
lldb/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.h
lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/test/Shell/SymbolFile/PDB/Inputs/AstRestoreTest.cpp
lldb/test/Shell/SymbolFile/PDB/ast-restore.test
llvm/include/llvm/DebugInfo/PDB/PDBTypes.h