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 6eafe2cb7a3286c1b13eea7d8370374553fe81a9 f06cd76bd05f95277dced786ac3ca3e83f2e8779 -- lldb/include/lldb/Core/ValueObjectVTable.h lldb/source/Core/ValueObjectVTable.cpp lldb/test/API/functionalities/vtable/main.cpp lldb/include/lldb/API/SBValue.h lldb/include/lldb/Core/ValueObject.h lldb/include/lldb/Core/ValueObjectChild.h lldb/include/lldb/Symbol/Type.h lldb/include/lldb/Symbol/TypeSystem.h lldb/include/lldb/Target/LanguageRuntime.h lldb/include/lldb/lldb-enumerations.h lldb/source/API/SBValue.cpp lldb/source/Commands/CommandObjectFrame.cpp lldb/source/Core/ValueObject.cpp lldb/source/DataFormatters/CXXFunctionPointer.cpp lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h lldb/source/Symbol/Type.cpp `````````` </details> <details> <summary> View the diff from clang-format here. </summary> ``````````diff diff --git a/lldb/include/lldb/Target/LanguageRuntime.h b/lldb/include/lldb/Target/LanguageRuntime.h index a2a9c0163..749f78170 100644 --- a/lldb/include/lldb/Target/LanguageRuntime.h +++ b/lldb/include/lldb/Target/LanguageRuntime.h @@ -78,9 +78,8 @@ public: virtual bool GetObjectDescription(Stream &str, Value &value, ExecutionContextScope *exe_scope) = 0; - struct VTableInfo { - Address addr; /// Address of the vtable's virtual function table + Address addr; /// Address of the vtable's virtual function table Symbol *symbol; /// The vtable symbol from the symbol table }; /// Get the vtable information for a given value. diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index 34d01d759..8f6367da8 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/source/API/SBValue.cpp @@ -1038,9 +1038,9 @@ lldb::ValueObjectSP SBValue::GetSP(ValueLocker &locker) const { // IsValid means that the SBValue has a value in it. But that's not the // only time that ValueObjects are useful. We also want to return the value // if there's an error state in it. - if (!m_opaque_sp || (!m_opaque_sp->IsValid() - && (m_opaque_sp->GetRootSP() - && !m_opaque_sp->GetRootSP()->GetError().Fail()))) { + if (!m_opaque_sp || (!m_opaque_sp->IsValid() && + (m_opaque_sp->GetRootSP() && + !m_opaque_sp->GetRootSP()->GetError().Fail()))) { locker.GetError().SetErrorString("No value"); return ValueObjectSP(); } diff --git a/lldb/source/Core/ValueObjectVTable.cpp b/lldb/source/Core/ValueObjectVTable.cpp index 177ae4167..fb4dc7530 100644 --- a/lldb/source/Core/ValueObjectVTable.cpp +++ b/lldb/source/Core/ValueObjectVTable.cpp @@ -82,7 +82,6 @@ protected: return false; } - // Set our value to be the load address of the function pointer in memory // and our type to be the function pointer type. m_value.SetValueType(Value::ValueType::LoadAddress); @@ -107,7 +106,7 @@ protected: // the language from it correctly. ValueObject *val = parent->GetParent(); auto type_system = target_sp->GetScratchTypeSystemForLanguage( - val ? val->GetObjectRuntimeLanguage() : eLanguageTypeC_plus_plus); + val ? val->GetObjectRuntimeLanguage() : eLanguageTypeC_plus_plus); if (type_system) { m_value.SetCompilerType( (*type_system)->CreateGenericFunctionPrototype().GetPointerType()); @@ -122,7 +121,7 @@ protected: if (m_error.Success()) { const bool thread_and_frame_only_if_stopped = true; ExecutionContext exe_ctx( - GetExecutionContextRef().Lock(thread_and_frame_only_if_stopped)); + GetExecutionContextRef().Lock(thread_and_frame_only_if_stopped)); m_error = m_value.GetValueAsData(&exe_ctx, m_data, GetModule().get()); } SetValueDidChange(true); @@ -257,7 +256,7 @@ bool ValueObjectVTable::UpdateValue() { m_value.SetValueType(Value::ValueType::LoadAddress); m_value.GetScalar() = parent->GetAddressOf(); auto type_system_or_err = - target_sp->GetScratchTypeSystemForLanguage(eLanguageTypeC_plus_plus); + target_sp->GetScratchTypeSystemForLanguage(eLanguageTypeC_plus_plus); if (type_system_or_err) { m_value.SetCompilerType( (*type_system_or_err)->GetBasicTypeFromAST(eBasicTypeUnsignedLong)); diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp index 17c8b4357..eee70bf74 100644 --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -54,8 +54,9 @@ bool ItaniumABILanguageRuntime::CouldHaveDynamicValue(ValueObject &in_value) { check_objc); } -TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfo( - ValueObject &in_value, const VTableInfo &vtable_info) { +TypeAndOrName +ItaniumABILanguageRuntime::GetTypeInfo(ValueObject &in_value, + const VTableInfo &vtable_info) { if (vtable_info.addr.IsSectionOffset()) { // See if we have cached info for this type already TypeAndOrName type_info = GetDynamicTypeInfo(vtable_info.addr); @@ -69,8 +70,7 @@ TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfo( LLDB_LOGF(log, "0x%16.16" PRIx64 ": static-type = '%s' has vtable symbol '%s'\n", - in_value.GetPointerValue(), - in_value.GetTypeName().GetCString(), + in_value.GetPointerValue(), in_value.GetTypeName().GetCString(), symbol_name.str().c_str()); // We are a C++ class, that's good. Get the class name and look it // up: @@ -91,15 +91,15 @@ TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfo( ModuleSP module_sp = vtable_info.symbol->CalculateSymbolContextModule(); if (module_sp) module_sp->FindTypes(ConstString(lookup_name), exact_match, 1, - searched_symbol_files, class_types); + searched_symbol_files, class_types); // If we didn't find a symbol, then move on to the entire module // list in the target and get as many unique matches as possible Target &target = m_process->GetTarget(); if (class_types.Empty()) target.GetImages().FindTypes(nullptr, ConstString(lookup_name), - exact_match, UINT32_MAX, - searched_symbol_files, class_types); + exact_match, UINT32_MAX, + searched_symbol_files, class_types); lldb::TypeSP type_sp; if (class_types.Empty()) { @@ -112,13 +112,13 @@ TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfo( if (type_sp) { if (TypeSystemClang::IsCXXClassType( type_sp->GetForwardCompilerType())) { - LLDB_LOGF( - log, - "0x%16.16" PRIx64 - ": static-type = '%s' has dynamic type: uid={0x%" PRIx64 - "}, type-name='%s'\n", - in_value.GetPointerValue(), in_value.GetTypeName().AsCString(), - type_sp->GetID(), type_sp->GetName().GetCString()); + LLDB_LOGF(log, + "0x%16.16" PRIx64 + ": static-type = '%s' has dynamic type: uid={0x%" PRIx64 + "}, type-name='%s'\n", + in_value.GetPointerValue(), + in_value.GetTypeName().AsCString(), type_sp->GetID(), + type_sp->GetName().GetCString()); type_info.SetTypeSP(type_sp); } } @@ -128,14 +128,13 @@ TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfo( for (i = 0; i < class_types.GetSize(); i++) { type_sp = class_types.GetTypeAtIndex(i); if (type_sp) { - LLDB_LOGF( - log, - "0x%16.16" PRIx64 - ": static-type = '%s' has multiple matching dynamic " - "types: uid={0x%" PRIx64 "}, type-name='%s'\n", - in_value.GetPointerValue(), - in_value.GetTypeName().AsCString(), - type_sp->GetID(), type_sp->GetName().GetCString()); + LLDB_LOGF(log, + "0x%16.16" PRIx64 + ": static-type = '%s' has multiple matching dynamic " + "types: uid={0x%" PRIx64 "}, type-name='%s'\n", + in_value.GetPointerValue(), + in_value.GetTypeName().AsCString(), type_sp->GetID(), + type_sp->GetName().GetCString()); } } } @@ -145,14 +144,13 @@ TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfo( if (type_sp) { if (TypeSystemClang::IsCXXClassType( type_sp->GetForwardCompilerType())) { - LLDB_LOGF( - log, - "0x%16.16" PRIx64 ": static-type = '%s' has multiple " - "matching dynamic types, picking " - "this one: uid={0x%" PRIx64 "}, type-name='%s'\n", - in_value.GetPointerValue(), - in_value.GetTypeName().AsCString(), - type_sp->GetID(), type_sp->GetName().GetCString()); + LLDB_LOGF(log, + "0x%16.16" PRIx64 ": static-type = '%s' has multiple " + "matching dynamic types, picking " + "this one: uid={0x%" PRIx64 "}, type-name='%s'\n", + in_value.GetPointerValue(), + in_value.GetTypeName().AsCString(), type_sp->GetID(), + type_sp->GetName().GetCString()); type_info.SetTypeSP(type_sp); } } @@ -187,7 +185,8 @@ llvm::Error ItaniumABILanguageRuntime::TypeHasVTable(CompilerType type) { // Make sure this is a class or a struct first by checking the type class // bitfield that gets returned. if ((type.GetTypeClass() & (eTypeClassStruct | eTypeClassClass)) == 0) { - return llvm::createStringError(std::errc::invalid_argument, + return llvm::createStringError( + std::errc::invalid_argument, "type \"%s\" is not a class or struct or a pointer to one", original_type.GetTypeName().AsCString("<invalid>")); } @@ -195,8 +194,8 @@ llvm::Error ItaniumABILanguageRuntime::TypeHasVTable(CompilerType type) { // Check if the type has virtual functions by asking it if it is polymorphic. if (!type.IsPolymorphicClass()) { return llvm::createStringError(std::errc::invalid_argument, - "type \"%s\" doesn't have a vtable", - type.GetTypeName().AsCString("<invalid>")); + "type \"%s\" doesn't have a vtable", + type.GetTypeName().AsCString("<invalid>")); } return llvm::Error::success(); } @@ -209,8 +208,8 @@ llvm::Error ItaniumABILanguageRuntime::TypeHasVTable(CompilerType type) { // and is can pass in instances of classes which is not suitable for dynamic // type detection, these cases should pass true for \a check_type. llvm::Expected<LanguageRuntime::VTableInfo> - ItaniumABILanguageRuntime::GetVTableInfo(ValueObject &in_value, - bool check_type) { +ItaniumABILanguageRuntime::GetVTableInfo(ValueObject &in_value, + bool check_type) { CompilerType type = in_value.GetCompilerType(); if (check_type) { @@ -228,8 +227,8 @@ llvm::Expected<LanguageRuntime::VTableInfo> if (type.IsPointerOrReferenceType()) original_ptr = in_value.GetPointerValue(&address_type); else - original_ptr = in_value.GetAddressOf(/*scalar_is_load_address=*/true, - &address_type); + original_ptr = + in_value.GetAddressOf(/*scalar_is_load_address=*/true, &address_type); if (original_ptr == LLDB_INVALID_ADDRESS || address_type != eAddressTypeLoad) return llvm::createStringError(std::errc::invalid_argument, "failed to get the address of the value"); @@ -239,17 +238,19 @@ llvm::Expected<LanguageRuntime::VTableInfo> process->ReadPointerFromMemory(original_ptr, error); if (!error.Success() || vtable_load_addr == LLDB_INVALID_ADDRESS) - return llvm::createStringError(std::errc::invalid_argument, + return llvm::createStringError( + std::errc::invalid_argument, "failed to read vtable pointer from memory at 0x%" PRIx64, original_ptr); -; + ; // Find the symbol that contains the "vtable_load_addr" address Address vtable_addr; if (!process->GetTarget().ResolveLoadAddress(vtable_load_addr, vtable_addr)) return llvm::createStringError(std::errc::invalid_argument, - "failed to resolve vtable pointer 0x%" - PRIx64 "to a section", vtable_load_addr); + "failed to resolve vtable pointer 0x%" PRIx64 + "to a section", + vtable_load_addr); // Check our cache first to see if we already have this info { @@ -272,8 +273,9 @@ llvm::Expected<LanguageRuntime::VTableInfo> return info; } return llvm::createStringError(std::errc::invalid_argument, - "symbol found that contains 0x%" PRIx64 " is not a vtable symbol", - vtable_load_addr); + "symbol found that contains 0x%" PRIx64 + " is not a vtable symbol", + vtable_load_addr); } bool ItaniumABILanguageRuntime::GetDynamicTypeAndAddress( @@ -348,8 +350,8 @@ bool ItaniumABILanguageRuntime::GetDynamicTypeAndAddress( // So the dynamic type is a value that starts at offset_to_top above // the original address. lldb::addr_t dynamic_addr = in_value.GetPointerValue() + offset_to_top; - if (!m_process->GetTarget().ResolveLoadAddress( - dynamic_addr, dynamic_address)) { + if (!m_process->GetTarget().ResolveLoadAddress(dynamic_addr, + dynamic_address)) { dynamic_address.SetRawAddress(dynamic_addr); } return true; @@ -671,11 +673,11 @@ ValueObjectSP ItaniumABILanguageRuntime::GetExceptionObjectForThread( ValueObjectSP exception = ValueObject::CreateValueObjectFromData( "exception", exception_isw.GetAsData(m_process->GetByteOrder()), exe_ctx, voidstar); - ValueObjectSP dyn_exception - = exception->GetDynamicValue(eDynamicDontRunTarget); + ValueObjectSP dyn_exception = + exception->GetDynamicValue(eDynamicDontRunTarget); // If we succeed in making a dynamic value, return that: if (dyn_exception) - return dyn_exception; + return dyn_exception; return exception; } diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h index 0f7e73cfe..04c1e7cce 100644 --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.h @@ -47,7 +47,6 @@ public: return runtime->isA(&ID); } - llvm::Expected<LanguageRuntime::VTableInfo> GetVTableInfo(ValueObject &in_value, bool check_type) override; diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index f037708ef..f95ebb892 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -4719,14 +4719,13 @@ CompilerType TypeSystemClang::GetBasicTypeFromAST(lldb::BasicType basic_type) { CompilerType TypeSystemClang::CreateGenericFunctionPrototype() { clang::ASTContext &ast = getASTContext(); const FunctionType::ExtInfo generic_ext_info( - /*noReturn=*/false, - /*hasRegParm=*/false, - /*regParm=*/0, - CallingConv::CC_C, - /*producesResult=*/false, - /*noCallerSavedRegs=*/false, - /*NoCfCheck=*/false, - /*cmseNSCall=*/false); + /*noReturn=*/false, + /*hasRegParm=*/false, + /*regParm=*/0, CallingConv::CC_C, + /*producesResult=*/false, + /*noCallerSavedRegs=*/false, + /*NoCfCheck=*/false, + /*cmseNSCall=*/false); QualType func_type = ast.getFunctionNoProtoType(ast.VoidTy, generic_ext_info); return GetType(func_type); } diff --git a/lldb/test/API/functionalities/vtable/main.cpp b/lldb/test/API/functionalities/vtable/main.cpp index 498a5765a..327128ffc 100644 --- a/lldb/test/API/functionalities/vtable/main.cpp +++ b/lldb/test/API/functionalities/vtable/main.cpp @@ -23,6 +23,7 @@ public: // valid vtable from this object. class NotVirtual { Rectangle m_rect; + public: NotVirtual() = default; }; @@ -32,7 +33,7 @@ int main(int argc, const char **argv) { Rectangle rect; Shape *shape_ptr = ▭ Shape &shape_ref = shape; - shape_ptr = &shape; // Shape is Rectangle + shape_ptr = &shape; // Shape is Rectangle NotVirtual not_virtual; // Shape is Shape - return 0; // At the end + return 0; // At the end } `````````` </details> https://github.com/llvm/llvm-project/pull/67599 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits