[Lldb-commits] [lldb] 3da4f9c - [lldb][NFC] Move non-clang specific method to the generic DWARF Parser
Luís Ferreira via lldb-commits
lldb-commits at lists.llvm.org
Thu Jun 2 09:43:08 PDT 2022
Author: Luís Ferreira
Date: 2022-06-02T16:39:39Z
New Revision: 3da4f9c57b15b3d76b8acbaa8c2b420ad525fa25
URL: https://github.com/llvm/llvm-project/commit/3da4f9c57b15b3d76b8acbaa8c2b420ad525fa25
DIFF: https://github.com/llvm/llvm-project/commit/3da4f9c57b15b3d76b8acbaa8c2b420ad525fa25.diff
LOG: [lldb][NFC] Move non-clang specific method to the generic DWARF Parser
This patch renames DW_ACCESS_to_AccessType function and move it to the abstract
DWARFASTParser, since there is no clang-specific code there. This is useful for
plugins other than Clang.
Reviewed By: shafik, bulbazord
Differential Revision: https://reviews.llvm.org/D114719
Added:
Modified:
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
index fe9b0b7044a4..364d34c73375 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.cpp
@@ -98,3 +98,18 @@ DWARFASTParser::ParseChildArrayInfo(const DWARFDIE &parent_die,
}
return array_info;
}
+
+AccessType
+DWARFASTParser::GetAccessTypeFromDWARF(uint32_t dwarf_accessibility) {
+ switch (dwarf_accessibility) {
+ case DW_ACCESS_public:
+ return eAccessPublic;
+ case DW_ACCESS_private:
+ return eAccessPrivate;
+ case DW_ACCESS_protected:
+ return eAccessProtected;
+ default:
+ break;
+ }
+ return eAccessNone;
+}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
index 00123a4b9216..97b0ea1874e1 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h
@@ -14,6 +14,7 @@
#include "lldb/Symbol/SymbolFile.h"
#include "lldb/Symbol/CompilerDecl.h"
#include "lldb/Symbol/CompilerDeclContext.h"
+#include "lldb/lldb-enumerations.h"
class DWARFDIE;
namespace lldb_private {
@@ -54,6 +55,8 @@ class DWARFASTParser {
static llvm::Optional<lldb_private::SymbolFile::ArrayInfo>
ParseChildArrayInfo(const DWARFDIE &parent_die,
const lldb_private::ExecutionContext *exe_ctx = nullptr);
+
+ static lldb::AccessType GetAccessTypeFromDWARF(uint32_t dwarf_accessibility);
};
#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSER_H
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index e5f7b8a8201d..dc3941526b7c 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -8,6 +8,7 @@
#include <cstdlib>
+#include "DWARFASTParser.h"
#include "DWARFASTParserClang.h"
#include "DWARFDebugInfo.h"
#include "DWARFDeclContext.h"
@@ -63,20 +64,6 @@ DWARFASTParserClang::DWARFASTParserClang(TypeSystemClang &ast)
DWARFASTParserClang::~DWARFASTParserClang() = default;
-static AccessType DW_ACCESS_to_AccessType(uint32_t dwarf_accessibility) {
- switch (dwarf_accessibility) {
- case DW_ACCESS_public:
- return eAccessPublic;
- case DW_ACCESS_private:
- return eAccessPrivate;
- case DW_ACCESS_protected:
- return eAccessProtected;
- default:
- break;
- }
- return eAccessNone;
-}
-
static bool DeclKindIsCXXClass(clang::Decl::Kind decl_kind) {
switch (decl_kind) {
case clang::Decl::CXXRecord:
@@ -314,7 +301,7 @@ ParsedDWARFTypeAttributes::ParsedDWARFTypeAttributes(const DWARFDIE &die) {
break;
case DW_AT_accessibility:
- accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+ accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
break;
case DW_AT_artificial:
@@ -1423,7 +1410,7 @@ void DWARFASTParserClang::ParseInheritance(
break;
case DW_AT_accessibility:
- accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+ accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
break;
case DW_AT_virtuality:
@@ -2478,7 +2465,7 @@ MemberAttributes::MemberAttributes(const DWARFDIE &die,
break;
case DW_AT_accessibility:
- accessibility = DW_ACCESS_to_AccessType(form_value.Unsigned());
+ accessibility = DWARFASTParser::GetAccessTypeFromDWARF(form_value.Unsigned());
break;
case DW_AT_artificial:
is_artificial = form_value.Boolean();
More information about the lldb-commits
mailing list