clang-tools  14.0.0git
Annotations.h
Go to the documentation of this file.
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
clang::clangd::Annotations::ranges
std::vector< clangd::Range > ranges(llvm::StringRef Name="") const
Definition: Annotations.cpp:41
clang::clangd::Annotations::points
std::vector< Position > points(llvm::StringRef Name="") const
Definition: Annotations.cpp:19
Protocol.h
clang::clangd::Position
Definition: Protocol.h:148
clang::clangd::Annotations
Same as llvm::Annotations, but adjusts functions to LSP-specific types for positions and ranges.
Definition: Annotations.h:23
clang::clangd::Annotations::range
clangd::Range range(llvm::StringRef Name="") const
Definition: Annotations.cpp:37
clang::clangd::Annotations::point
Position point(llvm::StringRef Name="") const
Definition: Annotations.cpp:15
Name
static constexpr llvm::StringLiteral Name
Definition: UppercaseLiteralSuffixCheck.cpp:28
clang::clangd::Range
Definition: Protocol.h:177
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27