ilya-biryukov added a comment. I've added a FIXME to the class. Also want to add some basic tests before landing this.
================ Comment at: clang-tools-extra/unittests/clangd/Annotations.h:8 //===----------------------------------------------------------------------===// -// -// Annotations lets you mark points and ranges inside source code, for tests: -// -// Annotations Example(R"cpp( -// int complete() { x.pri^ } // ^ indicates a point -// void err() { [["hello" == 42]]; } // [[this is a range]] -// $definition^class Foo{}; // points can be named: "definition" -// $fail[[static_assert(false, "")]] // ranges can be named too: "fail" -// )cpp"); -// -// StringRef Code = Example.code(); // annotations stripped. -// std::vector<Position> PP = Example.points(); // all unnamed points -// Position P = Example.point(); // there must be exactly one -// Range R = Example.range("fail"); // find named ranges -// -// Points/ranges are coordinates into `code()` which is stripped of annotations. -// -// Ranges may be nested (and points can be inside ranges), but there's no way -// to define general overlapping ranges. -// +// A clangd-specific version of llvm/Testing/Support/Annotations.h, replaces +// offsets and offset-based ranges with types from the LSP protocol. ---------------- sammccall wrote: > The choice to shadow the base methods is interesting. I guess we can always > use llvm::Annotations if we want byte offsets (I know there are some), not > sure if we ever want a mix. > Anyway this is nice and clean, and minimizes the diff. We can change later if > we care. Exactly my thoughts. I don't expect us to have places that need both the offsets and the positions. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D59814/new/ https://reviews.llvm.org/D59814 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits