================ @@ -4725,67 +4725,69 @@ TypeSystemClang::GetFloatTypeSemantics(size_t byte_size) { return llvm::APFloatBase::Bogus(); } +std::optional<uint64_t> +TypeSystemClang::GetObjCBitSize(QualType qual_type, + ExecutionContextScope *exe_scope) { + assert(qual_type->isObjCObjectOrInterfaceType()); + ExecutionContext exe_ctx(exe_scope); + Process *process = exe_ctx.GetProcessPtr(); + if (process) { + if (ObjCLanguageRuntime *objc_runtime = + ObjCLanguageRuntime::Get(*process)) { + if (std::optional<uint64_t> bit_size = + objc_runtime->GetTypeBitSize(GetType(qual_type))) + return *bit_size; + } + } else { + static bool g_printed = false; + if (!g_printed) { + StreamString s; + DumpTypeDescription(qual_type.getAsOpaquePtr(), s); + + llvm::outs() << "warning: trying to determine the size of type "; + llvm::outs() << s.GetString() << "\n"; + llvm::outs() << "without a valid ExecutionContext. this is not " + "reliable. please file a bug against LLDB.\n"; + llvm::outs() << "backtrace:\n"; + llvm::sys::PrintStackTrace(llvm::outs()); + llvm::outs() << "\n"; ---------------- JDevlieghere wrote:
Rather than printing to stdout, this should use the global diagnostics (`Debugger::ReportWarning`). The function takes an optional `std::once_flag` to do the same thing you're doing here. https://github.com/llvm/llvm-project/pull/100674 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits