[Lldb-commits] [lldb] [lldb][DWARFASTParserClang][NFCI] Make ParsedDWARFTypeAttributes parameter const (PR #73833)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Wed Nov 29 10:05:32 PST 2023
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/73833
This will make future refactorings of `ParseSubroutine` simpler.
Depends on https://github.com/llvm/llvm-project/pull/73832
>From a8aa1c80c5ce7debaea356815d8a3b0a83b976f0 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Wed, 29 Nov 2023 17:23:19 +0000
Subject: [PATCH] [lldb][DWARFASTParserClang][NFC] Make
ParsedDWARFTypeAttributes parameter const
This will make future refactorings of `ParseSubroutine` simpler.
---
.../Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp | 12 +++++++-----
.../Plugins/SymbolFile/DWARF/DWARFASTParserClang.h | 2 +-
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 4d7d27b64e4c7f2..6d6ac910feeb65b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -980,8 +980,9 @@ ConvertDWARFCallingConventionToClang(const ParsedDWARFTypeAttributes &attrs) {
return clang::CC_C;
}
-TypeSP DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
- ParsedDWARFTypeAttributes &attrs) {
+TypeSP
+DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
+ const ParsedDWARFTypeAttributes &attrs) {
Log *log = GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
SymbolFileDWARF *dwarf = die.GetDWARF();
@@ -1206,14 +1207,15 @@ TypeSP DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
// Neither GCC 4.2 nor clang++ currently set a valid
// accessibility in the DWARF for C++ methods...
// Default to public for now...
- if (attrs.accessibility == eAccessNone)
- attrs.accessibility = eAccessPublic;
+ const auto accessibility = attrs.accessibility == eAccessNone
+ ? eAccessPublic
+ : attrs.accessibility;
clang::CXXMethodDecl *cxx_method_decl =
m_ast.AddMethodToCXXRecordType(
class_opaque_type.GetOpaqueQualType(),
attrs.name.GetCString(), attrs.mangled_name,
- clang_type, attrs.accessibility, attrs.is_virtual,
+ clang_type, accessibility, attrs.is_virtual,
is_static, attrs.is_inline, attrs.is_explicit,
is_attr_used, attrs.is_artificial);
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
index 81b705a036189eb..7b495419cf3241b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h
@@ -368,7 +368,7 @@ class DWARFASTParserClang : public lldb_private::plugin::dwarf::DWARFASTParser {
const lldb_private::plugin::dwarf::DWARFDIE &die,
ParsedDWARFTypeAttributes &attrs);
lldb::TypeSP ParseSubroutine(const lldb_private::plugin::dwarf::DWARFDIE &die,
- ParsedDWARFTypeAttributes &attrs);
+ const ParsedDWARFTypeAttributes &attrs);
lldb::TypeSP ParseArrayType(const lldb_private::plugin::dwarf::DWARFDIE &die,
const ParsedDWARFTypeAttributes &attrs);
lldb::TypeSP
More information about the lldb-commits
mailing list