clang-tools  9.0.0
SymbolLocation.cpp
Go to the documentation of this file.
1 //===--- SymbolLocation.cpp --------------------------------------*- 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 
9 #include "SymbolLocation.h"
10 
11 namespace clang {
12 namespace clangd {
13 
14 constexpr uint32_t SymbolLocation::Position::MaxLine;
15 constexpr uint32_t SymbolLocation::Position::MaxColumn;
16 
18  if (L > MaxLine) {
19  Line = MaxLine;
20  return;
21  }
22  Line = L;
23 }
25  if (Col > MaxColumn) {
26  Column = MaxColumn;
27  return;
28  }
29  Column = Col;
30 }
31 
32 llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const SymbolLocation &L) {
33  if (!L)
34  return OS << "(none)";
35  return OS << L.FileURI << "[" << L.Start.line() << ":" << L.Start.column()
36  << "-" << L.End.line() << ":" << L.End.column() << ")";
37 }
38 
39 } // namespace clangd
40 } // namespace clang
static constexpr uint32_t MaxColumn
static constexpr uint32_t MaxLine
Position Start
The symbol range, using half-open range [Start, End).
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)