1 //===--- Annotations.h - Annotated source code for tests ---------*- C++-*-===//
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
7 //===----------------------------------------------------------------------===//
8 // A clangd-specific version of llvm/Testing/Annotations/Annotations.h, replaces
9 // offsets and offset-based ranges with types from the LSP protocol.
10 //===---------------------------------------------------------------------===//
12 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_UNITTESTS_ANNOTATIONS_H
13 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_UNITTESTS_ANNOTATIONS_H
16 #include "llvm/Testing/Annotations/Annotations.h"
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
;
27 using llvm::Annotations::Annotations
;
29 Position
point(llvm::StringRef Name
= "") const;
30 std::pair
<Position
, llvm::StringRef
>
31 pointWithPayload(llvm::StringRef Name
= "") const;
32 std::vector
<Position
> points(llvm::StringRef Name
= "") const;
33 std::vector
<std::pair
<Position
, llvm::StringRef
>>
34 pointsWithPayload(llvm::StringRef Name
= "") const;
36 clangd::Range
range(llvm::StringRef Name
= "") const;
37 std::pair
<clangd::Range
, llvm::StringRef
>
38 rangeWithPayload(llvm::StringRef Name
= "") const;
39 std::vector
<clangd::Range
> ranges(llvm::StringRef Name
= "") const;
40 std::vector
<std::pair
<clangd::Range
, llvm::StringRef
>>
41 rangesWithPayload(llvm::StringRef Name
= "") const;
47 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_UNITTESTS_ANNOTATIONS_H