labath added inline comments.

================
Comment at: lldb/source/Plugins/Process/Linux/Procfs.cpp:22
 Expected<ArrayRef<uint8_t>> lldb_private::process_linux::GetProcfsCpuInfo() {
   static Optional<std::vector<uint8_t>> cpu_info;
+  static Optional<std::string> error;
----------------
How about storing this as `ErrorOr<std::vector<uint8_t>>` (that's what 
`getProcFile` returns anyway), and initializing it via an immediately-evaluated 
lambda ?
I.e., something like
```
auto cpu_info = [] -> ErrorOr<std::vector<uint8_t>> {
  if (auto buffer_or_error = getProcFile("cpuinfo")) {
    return std::vector<uint8_t>(...);
  } else {
    return buffer_or_error.getError();
  }
}();
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131081/new/

https://reviews.llvm.org/D131081

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to