[Lldb-commits] [lldb] [LLDB][PDB] Warn if DIA plugin is requested but not available (PR #160067)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 22 07:02:53 PDT 2025


================
@@ -117,11 +117,16 @@ bool ShouldUseNativeReaderByDefault() {
         !env_value.equals_insensitive("1") &&
         !env_value.equals_insensitive("true"))
       g_use_native_by_default = false;
+
+#if !LLVM_ENABLE_DIA_SDK || !defined(_WIN32)
+    // if the environment value is unset, the native reader is requested
+    if (env_value.empty())
+      g_use_native_by_default = true;
+#endif
----------------
Michael137 wrote:

I think this function would be clearer if we rewrote it using an immediately-invoked-lambda:
```
static bool g_use_native_by_default = [] {
  llvm::StringRef env_value = ::getenv("LLDB_USE_NATIVE_PDB_READER");
#if !LLVM_ENABLE_DIA_SDK || !defined(_WIN32)
    // if the environment value is unset, the native reader is requested
    if (env_value.empty())
      return true;
#endif

  ...
}();
```

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


More information about the lldb-commits mailing list