diff options
Diffstat (limited to 'llvm/lib/DebugInfo/LogicalView/Core/LVElement.cpp')
| -rw-r--r-- | llvm/lib/DebugInfo/LogicalView/Core/LVElement.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/llvm/lib/DebugInfo/LogicalView/Core/LVElement.cpp b/llvm/lib/DebugInfo/LogicalView/Core/LVElement.cpp index a320752befc4..cfe304eead51 100644 --- a/llvm/lib/DebugInfo/LogicalView/Core/LVElement.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Core/LVElement.cpp @@ -17,6 +17,7 @@ #include "llvm/DebugInfo/LogicalView/Core/LVType.h" using namespace llvm; +using namespace llvm::codeview; using namespace llvm::logicalview; #define DEBUG_TYPE "Element" @@ -103,6 +104,14 @@ void LVElement::setFilename(StringRef Filename) { FilenameIndex = getStringIndex(Filename); } +void LVElement::setInnerComponent(StringRef Name) { + if (Name.size()) { + StringRef InnerComponent; + std::tie(std::ignore, InnerComponent) = getInnerComponent(Name); + setName(InnerComponent); + } +} + // Return the string representation of a DIE offset. std::string LVElement::typeOffsetAsString() const { if (options().getAttributeOffset()) { @@ -126,6 +135,19 @@ StringRef LVElement::accessibilityString(uint32_t Access) const { } } +std::optional<uint32_t> LVElement::getAccessibilityCode(MemberAccess Access) { + switch (Access) { + case MemberAccess::Private: + return dwarf::DW_ACCESS_private; + case MemberAccess::Protected: + return dwarf::DW_ACCESS_protected; + case MemberAccess::Public: + return dwarf::DW_ACCESS_public; + default: + return std::nullopt; + } +} + StringRef LVElement::externalString() const { return getIsExternal() ? "extern" : StringRef(); } @@ -160,6 +182,21 @@ StringRef LVElement::virtualityString(uint32_t Virtuality) const { } } +std::optional<uint32_t> LVElement::getVirtualityCode(MethodKind Virtuality) { + switch (Virtuality) { + case MethodKind::Virtual: + return dwarf::DW_VIRTUALITY_virtual; + case MethodKind::PureVirtual: + return dwarf::DW_VIRTUALITY_pure_virtual; + case MethodKind::IntroducingVirtual: + case MethodKind::PureIntroducingVirtual: + // No direct equivalents in DWARF. Assume Virtual. + return dwarf::DW_VIRTUALITY_virtual; + default: + return std::nullopt; + } +} + void LVElement::resolve() { if (getIsResolved()) return; |
