clang-tools
16.0.0git
llvm-project
clang-tools-extra
clangd
index
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
17
void
SymbolLocation::Position::setLine
(uint32_t L) {
18
if
(L >
MaxLine
)
19
L =
MaxLine
;
20
LineColumnPacked = (L <<
ColumnBits
) |
column
();
21
}
22
void
SymbolLocation::Position::setColumn
(uint32_t Col) {
23
if
(Col > MaxColumn)
24
Col = MaxColumn;
25
LineColumnPacked = (LineColumnPacked & ~MaxColumn) | Col;
26
}
27
28
llvm::raw_ostream &
operator<<
(llvm::raw_ostream &
OS
,
const
SymbolLocation
&L) {
29
if
(!L)
30
return
OS
<<
"(none)"
;
31
return
OS
<< L.FileURI <<
"["
<< L.Start.line() <<
":"
<< L.Start.column()
32
<<
"-"
<< L.End.line() <<
":"
<< L.End.column() <<
")"
;
33
}
34
35
}
// namespace clangd
36
}
// namespace clang
clang::clangd::SymbolLocation
Definition:
SymbolLocation.h:19
SymbolLocation.h
clang::clangd::SymbolLocation::Position::MaxLine
static constexpr uint32_t MaxLine
Definition:
SymbolLocation.h:45
clang::clangd::SymbolLocation::Position::ColumnBits
static constexpr unsigned ColumnBits
Definition:
SymbolLocation.h:44
clang::clangd::SymbolLocation::Position::setColumn
void setColumn(uint32_t Column)
Definition:
SymbolLocation.cpp:22
clang::clangd::operator<<
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
Definition:
CodeComplete.cpp:2184
clang::clangd::SymbolLocation::Position::column
uint32_t column() const
Definition:
SymbolLocation.h:37
clang::clangd::SymbolLocation::Position::setLine
void setLine(uint32_t Line)
Definition:
SymbolLocation.cpp:17
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition:
ApplyReplacements.h:27
OS
llvm::raw_string_ostream OS
Definition:
TraceTests.cpp:160
clang::clangd::SymbolLocation::Position::MaxColumn
static constexpr uint32_t MaxColumn
Definition:
SymbolLocation.h:46
Generated on Fri Aug 19 2022 00:11:55 for clang-tools by
1.8.17