[PATCH] D52084: [clangd] NFC: Update documentation of Iterator's dump format
Kirill Bobyrev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 18 07:02:54 PDT 2018
kbobyrev updated this revision to Diff 165964.
kbobyrev added a comment.
@ioeric does this format look better?
https://reviews.llvm.org/D52084
Files:
clang-tools-extra/clangd/index/dex/Iterator.h
clang-tools-extra/clangd/index/dex/PostingList.cpp
clang-tools-extra/unittests/clangd/DexTests.cpp
Index: clang-tools-extra/unittests/clangd/DexTests.cpp
===================================================================
--- clang-tools-extra/unittests/clangd/DexTests.cpp
+++ clang-tools-extra/unittests/clangd/DexTests.cpp
@@ -262,13 +262,15 @@
const PostingList L4({0, 1, 5});
const PostingList L5({});
- EXPECT_EQ(llvm::to_string(*(L0.iterator())), "[4]");
+ EXPECT_EQ(llvm::to_string(*(L0.iterator())), "[4 ...]");
auto Nested =
createAnd(createAnd(L1.iterator(), L2.iterator()),
createOr(L3.iterator(), L4.iterator(), L5.iterator()));
- EXPECT_EQ(llvm::to_string(*Nested), "(& (| [5] [1] [END]) (& [1] [1]))");
+ EXPECT_EQ(
+ llvm::to_string(*Nested),
+ "(& (| [... 5 ...] [... 1 ...] [END]) (& [1 ...] [1 ...]))");
}
TEST(DexIterators, Limit) {
Index: clang-tools-extra/clangd/index/dex/PostingList.cpp
===================================================================
--- clang-tools-extra/clangd/index/dex/PostingList.cpp
+++ clang-tools-extra/clangd/index/dex/PostingList.cpp
@@ -61,8 +61,10 @@
private:
llvm::raw_ostream &dump(llvm::raw_ostream &OS) const override {
OS << '[';
+ if (Index != std::begin(Documents))
+ OS << "... ";
if (Index != std::end(Documents))
- OS << *Index;
+ OS << *Index << " ...";
else
OS << "END";
OS << ']';
Index: clang-tools-extra/clangd/index/dex/Iterator.h
===================================================================
--- clang-tools-extra/clangd/index/dex/Iterator.h
+++ clang-tools-extra/clangd/index/dex/Iterator.h
@@ -93,9 +93,8 @@
///
/// Where Type is the iterator type representation: "&" for And, "|" for Or,
/// ChildN is N-th iterator child. Raw iterators over PostingList are
- /// represented as "[ID1, ID2, ..., {IDN}, ... END]" where IDN is N-th
- /// PostingList entry and the element which is pointed to by the PostingList
- /// iterator is enclosed in {} braces.
+ /// represented as "[... ID ...]" where ID is the element under iterator
+ /// cursor.
friend llvm::raw_ostream &operator<<(llvm::raw_ostream &OS,
const Iterator &Iterator) {
return Iterator.dump(OS);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52084.165964.patch
Type: text/x-patch
Size: 2206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180918/890b7e92/attachment.bin>
More information about the cfe-commits
mailing list