[clang] [LLVM][ADT] Add specialization of `DenseMapInfo` for `SourceRange` (PR #174524)
Victor Chernyakin via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 6 08:52:48 PST 2026
================
@@ -379,6 +379,20 @@ TEST_F(SourceManagerTest, getInvalidBOM) {
"UTF-32 (LE)");
}
+TEST_F(SourceManagerTest, sourceRangeWorksWithDenseSet) {
+ llvm::DenseSet<SourceRange> Set;
+ SourceRange TestRange = {SourceLocation::getFromRawEncoding(10),
+ SourceLocation::getFromRawEncoding(11)};
+ ASSERT_EQ(Set.size(), 0U);
----------------
localspook wrote:
Comparing against 0 produces a better error message if the test fails: the actual size of the container will be printed out. Checking `.empty()` on the other hand would only tell you that the container's size isn't zero.
https://github.com/llvm/llvm-project/pull/174524
More information about the cfe-commits
mailing list