[Lldb-commits] [lldb] [WIP][lldb] Use forward decls with redeclared definitions instead of minimal import for records (PR #95100)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 11 05:04:11 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 97cfe549c9a9ec3880c984bd4d2ddbbd92dcb9a0 2d90c9f4bf29f7de7db3df115d505db4b674649c -- lldb/source/Plugins/TypeSystem/Clang/ImporterBackedASTSource.cpp lldb/source/Plugins/TypeSystem/Clang/ImporterBackedASTSource.h lldb/unittests/TypeSystem/Clang/TestClangRedeclarations.cpp lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.h lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangExternalASTSourceCallbacks.h lldb/source/Plugins/ExpressionParser/Clang/ClangUtil.cpp lldb/source/Plugins/ExpressionParser/Clang/ClangUtil.h lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h b/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
index bc950cc7a0..98d2ff66b7 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ASTUtils.h
@@ -9,8 +9,8 @@
#ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_ASTUTILS_H
#define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_ASTUTILS_H
-#include "clang/Basic/ASTSourceDescriptor.h"
#include "Plugins/TypeSystem/Clang/ImporterBackedASTSource.h"
+#include "clang/Basic/ASTSourceDescriptor.h"
#include "clang/Basic/Module.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/MultiplexExternalSemaSource.h"
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
index 913fd50d4c..722df69615 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
@@ -836,10 +836,9 @@ bool ClangASTImporter::CompleteObjCInterfaceDecl(
if (result)
return true;
- llvm::handleAllErrors(result.takeError(),
- [](const clang::ASTImportError &e) {
- llvm::errs() << "ERR: " << e.toString() << "\n";
- });
+ llvm::handleAllErrors(result.takeError(), [](const clang::ASTImportError &e) {
+ llvm::errs() << "ERR: " << e.toString() << "\n";
+ });
return false;
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 08e0ec6ffc..f7179b14c1 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -277,7 +277,8 @@ static void PrepareContextToReceiveMembers(TypeSystemClang &ast,
// We have already completed the type, or we have found its definition and are
// ready to complete it later (cf. ParseStructureLikeDIE).
- if (tag_decl_ctx->getDefinition() != nullptr || tag_decl_ctx->isBeingDefined())
+ if (tag_decl_ctx->getDefinition() != nullptr ||
+ tag_decl_ctx->isBeingDefined())
return;
// We reach this point of the tag was present in the debug info as a
@@ -491,7 +492,7 @@ TypeSP DWARFASTParserClang::ParseTypeFromDWARF(const SymbolContext &sc,
if (type_ptr)
return type_ptr->shared_from_this();
// Set a bit that lets us know that we are currently parsing this
- //dwarf->GetDIEToType()[die.GetDIE()] = DIE_IS_BEING_PARSED;
+ // dwarf->GetDIEToType()[die.GetDIE()] = DIE_IS_BEING_PARSED;
ParsedDWARFTypeAttributes attrs(die);
@@ -1228,8 +1229,8 @@ DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
llvm::PrettyStackTraceFormat stack_trace(
"SymbolFileDWARF::ParseType() is adding a method "
"%s to class %s in DIE 0x%8.8" PRIx64 " from %s",
- attrs.name.GetCString(),
- class_type->GetName().GetCString(), die.GetID(),
+ attrs.name.GetCString(), class_type->GetName().GetCString(),
+ die.GetID(),
dwarf->GetObjectFile()->GetFileSpec().GetPath().c_str());
const bool is_attr_used = false;
@@ -1243,10 +1244,10 @@ DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die,
clang::CXXMethodDecl *cxx_method_decl =
m_ast.AddMethodToCXXRecordType(
class_opaque_type.GetOpaqueQualType(),
- attrs.name.GetCString(), attrs.mangled_name,
- clang_type, accessibility, attrs.is_virtual,
- is_static, attrs.is_inline, attrs.is_explicit,
- is_attr_used, attrs.is_artificial);
+ attrs.name.GetCString(), attrs.mangled_name, clang_type,
+ accessibility, attrs.is_virtual, is_static,
+ attrs.is_inline, attrs.is_explicit, is_attr_used,
+ attrs.is_artificial);
type_handled = cxx_method_decl != nullptr;
// Artificial methods are always handled even when we
@@ -1904,8 +1905,8 @@ DWARFASTParserClang::ParseStructureLikeDIE(const SymbolContext &sc,
clang_type_was_created = true;
clang_type = m_ast.CreateRecordType(
decl_ctx, GetOwningClangModule(die), attrs.accessibility,
- attrs.name.GetCString(), tag_decl_kind, attrs.class_language,
- &metadata, attrs.exports_symbols);
+ attrs.name.GetCString(), tag_decl_kind, attrs.class_language, &metadata,
+ attrs.exports_symbols);
RegisterDIE(die.GetDIE(), clang_type);
if (!should_directly_complete)
if (auto *source = llvm::dyn_cast_or_null<ImporterBackedASTSource>(
@@ -1970,15 +1971,15 @@ DWARFASTParserClang::ParseStructureLikeDIE(const SymbolContext &sc,
} else if (clang_type_was_created && !should_directly_complete) {
if (attrs.class_language != eLanguageTypeObjC &&
attrs.class_language != eLanguageTypeObjC_plus_plus)
- // Leave this as a forward declaration until we need to know the
- // details of the type. lldb_private::Type will automatically call
- // the SymbolFile virtual function
- // "SymbolFileDWARF::CompleteType(Type *)" When the definition
- // needs to be defined.
- assert(!dwarf->GetForwardDeclCompilerTypeToDIE().count(
- ClangUtil::RemoveFastQualifiers(clang_type)
- .GetOpaqueQualType()) &&
- "Type already in the forward declaration map!");
+ // Leave this as a forward declaration until we need to know the
+ // details of the type. lldb_private::Type will automatically call
+ // the SymbolFile virtual function
+ // "SymbolFileDWARF::CompleteType(Type *)" When the definition
+ // needs to be defined.
+ assert(!dwarf->GetForwardDeclCompilerTypeToDIE().count(
+ ClangUtil::RemoveFastQualifiers(clang_type)
+ .GetOpaqueQualType()) &&
+ "Type already in the forward declaration map!");
// Can't assume m_ast.GetSymbolFile() is actually a
// SymbolFileDWARF, it can be a SymbolFileDWARFDebugMap for Apple
// binaries.
@@ -2258,15 +2259,13 @@ bool DWARFASTParserClang::CompleteRecordType(const DWARFDIE &die,
// declarations. If we don't do this, clang will crash with an
// assertion in the call to clang_type.TransferBaseClasses()
for (const auto &base_class : bases) {
- clang::TypeSourceInfo *type_source_info =
- base_class->getTypeSourceInfo();
+ clang::TypeSourceInfo *type_source_info = base_class->getTypeSourceInfo();
if (type_source_info)
TypeSystemClang::RequireCompleteType(
m_ast.GetType(type_source_info->getType()));
}
- m_ast.TransferBaseClasses(clang_type.GetOpaqueQualType(),
- std::move(bases));
+ m_ast.TransferBaseClasses(clang_type.GetOpaqueQualType(), std::move(bases));
}
adjustArgPassing(m_ast, attrs, clang_type);
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 56a23e96c3..98c4f2b223 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -5385,7 +5385,8 @@ TypeSystemClang::GetNumChildren(lldb::opaque_compiler_type_t type,
objc_class_type->getInterface();
if (class_interface_decl) {
- class_interface_decl = class_interface_decl->getDefinition();;
+ class_interface_decl = class_interface_decl->getDefinition();
+ ;
clang::ObjCInterfaceDecl *superclass_interface_decl =
class_interface_decl->getSuperClass();
@@ -8186,7 +8187,7 @@ clang::ObjCMethodDecl *TypeSystemClang::AddMethodToObjCObjectType(
clang::ObjCInterfaceDecl *class_interface_decl = GetAsObjCInterfaceDecl(type);
if (class_interface_decl)
- if (auto * def = class_interface_decl->getDefinition())
+ if (auto *def = class_interface_decl->getDefinition())
class_interface_decl = def;
if (class_interface_decl == nullptr)
``````````
</details>
https://github.com/llvm/llvm-project/pull/95100
More information about the lldb-commits
mailing list