[Lldb-commits] [lldb] [lldb] Make LanguageRuntime::GetTypeBitSize return an optional (NFC) (PR #96013)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 20 09:22:11 PDT 2024


================
@@ -4744,11 +4744,12 @@ TypeSystemClang::GetBitSize(lldb::opaque_compiler_type_t type,
       ExecutionContext exe_ctx(exe_scope);
       Process *process = exe_ctx.GetProcessPtr();
       if (process) {
-        ObjCLanguageRuntime *objc_runtime = ObjCLanguageRuntime::Get(*process);
-        if (objc_runtime) {
-          uint64_t bit_size = 0;
-          if (objc_runtime->GetTypeBitSize(GetType(qual_type), bit_size))
-            return bit_size;
+        if (ObjCLanguageRuntime *objc_runtime =
+                ObjCLanguageRuntime::Get(*process)) {
+          std::optional<uint64_t> bit_size =
+              objc_runtime->GetTypeBitSize(GetType(qual_type));
+          if (bit_size)
+            return *bit_size;
----------------
JDevlieghere wrote:

That might be the right thing to do, but would be a change in behavior, as now, if it fails, we'll fall through to the `default` case first. 

https://github.com/llvm/llvm-project/pull/96013


More information about the lldb-commits mailing list