[Lldb-commits] [lldb] b5a7d1e - [lldb] Fix SymbolFilePDBTests build for StringRef FileSpec getters (#208857)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Jul 10 16:56:12 PDT 2026
Author: Jonas Devlieghere
Date: 2026-07-10T23:56:07Z
New Revision: b5a7d1e675f222f7e6a3d3e6536e2214c415e1b6
URL: https://github.com/llvm/llvm-project/commit/b5a7d1e675f222f7e6a3d3e6536e2214c415e1b6
DIFF: https://github.com/llvm/llvm-project/commit/b5a7d1e675f222f7e6a3d3e6536e2214c415e1b6.diff
LOG: [lldb] Fix SymbolFilePDBTests build for StringRef FileSpec getters (#208857)
f9b5264523b1 changed FileSpec::GetDirectory() to return llvm::StringRef
instead of ConstString. ConstString had an operator bool, so the guard
```
if (left.GetDirectory() && right.GetDirectory())
```
compiled. StringRef has neither a bool conversion nor operator&&, so the
test no longer builds. Check for a non-empty directory instead, which
preserves the original "if BOTH have a directory" intent.
Added:
Modified:
lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
Removed:
################################################################################
diff --git a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
index 7dd0a4a0f1871..bb1e0d8cd1fea 100644
--- a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
+++ b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
@@ -94,7 +94,7 @@ class SymbolFilePDBTests : public testing::Test {
if (!left.FileEquals(right))
return false;
// If BOTH have a directory, also compare the directories.
- if (left.GetDirectory() && right.GetDirectory())
+ if (!left.GetDirectory().empty() && !right.GetDirectory().empty())
return left.DirectoryEquals(right);
// If one has a directory but not the other, they match.
More information about the lldb-commits
mailing list