1 //===--- Annotations.h - Annotated source code for tests ---------*- C++-*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 // A clangd-specific version of llvm/Testing/Support/Annotations.h, replaces 9 // offsets and offset-based ranges with types from the LSP protocol. 10 //===---------------------------------------------------------------------===// 11 12 #ifndef LLVM_CLANG_TOOLS_EXTRA_UNITTESTS_CLANGD_ANNOTATIONS_H 13 #define LLVM_CLANG_TOOLS_EXTRA_UNITTESTS_CLANGD_ANNOTATIONS_H 14 15 #include "Protocol.h" 16 #include "llvm/Testing/Support/Annotations.h" 17 18 namespace clang { 19 namespace clangd { 20 21 /// Same as llvm::Annotations, but adjusts functions to LSP-specific types for 22 /// positions and ranges. 23 class Annotations : public llvm::Annotations { 24 using Base = llvm::Annotations; 25 26 public: 27 using llvm::Annotations::Annotations; 28 29 Position point(llvm::StringRef Name = "") const; 30 std::vector<Position> points(llvm::StringRef Name = "") const; 31 32 clangd::Range range(llvm::StringRef Name = "") const; 33 std::vector<clangd::Range> ranges(llvm::StringRef Name = "") const; 34 }; 35 36 } // namespace clangd 37 } // namespace clang 38 39 #endif // LLVM_CLANG_TOOLS_EXTRA_UNITTESTS_CLANGD_ANNOTATIONS_H 40