[Lldb-commits] [lldb] [lldb] Upgrade CompilerType::GetBitSize to return llvm::Expected (PR #129601)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 4 20:51:46 PST 2025


================
@@ -769,19 +771,20 @@ CompilerType::GetBasicTypeFromAST(lldb::BasicType basic_type) const {
 }
 // Exploring the type
 
-std::optional<uint64_t>
+llvm::Expected<uint64_t>
 CompilerType::GetBitSize(ExecutionContextScope *exe_scope) const {
   if (IsValid())
     if (auto type_system_sp = GetTypeSystem())
       return type_system_sp->GetBitSize(m_type, exe_scope);
-  return {};
+  return llvm::createStringError("invalid type; cannot determine size");
----------------
JDevlieghere wrote:

```suggestion
  return llvm::createStringError("invalid type: cannot determine size");
```
We generally concatenate errors with `:` rather than `;`. Will require updating the two tests below. 

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


More information about the lldb-commits mailing list