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

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 20 10:08:36 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;
----------------
Michael137 wrote:

Aah you're right, missed the fallthrough here. Could fold the `GetTypeBitSize` call into the if-statement, like you did for `ObjCLanguageRuntime::Get`. But either way, LGTM

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


More information about the lldb-commits mailing list