Skip to content

Commit 293ff41

Browse files
[CAS] Fix a regression in HashMapTrie visitor for not visiting root
Fix a regression that a `visitSubTrie` is not called on root node. Add a test to verify the TriePrinter actually prints all the node correctly.
1 parent e49a3ec commit 293ff41

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

llvm/lib/CAS/OnDiskHashMappedTrie.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,6 +1262,9 @@ Error TrieVisitor::visit() {
12621262
if (auto Err = validateSubTrie(Root, /*IsRoot=*/true))
12631263
return Err;
12641264

1265+
if (auto Err = visitSubTrie("", Root))
1266+
return Err;
1267+
12651268
SmallVector<SubtrieHandle> Subs;
12661269
SmallVector<std::string> Prefixes;
12671270
const size_t NumSlots = Root.getNumSlots();

llvm/test/tools/llvm-cas/dump.test

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
RUN: rm -rf %t
2+
RUN: mkdir %t
3+
4+
RUN: llvm-cas --cas %t/cas --make-blob \
5+
RUN: --data - </dev/null
6+
7+
RUN: llvm-cas --cas %t/cas --make-blob \
8+
RUN: --data %s
9+
10+
RUN: llvm-cas --cas %t/cas --dump | FileCheck %s
11+
12+
// check the dump format.
13+
CHECK: index:
14+
CHECK-NEXT: hash-num-bits=
15+
CHECK-NEXT: root addr=
16+
// it should has at least one index
17+
CHECK-NEXT: - index=
18+
19+
// two records
20+
CHECK: record
21+
CHECK-NEXT: - addr=
22+
CHECK-NEXT: - addr=
23+
24+
// both should be small enough to be in data pool
25+
CHECK: pool:
26+
CHECK-NEXT: - addr=
27+
CHECK-NEXT: - addr=

0 commit comments

Comments
 (0)