clang-tools 20.0.0git
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
11namespace clang {
12namespace clangd {
13
14constexpr uint32_t SymbolLocation::Position::MaxLine;
16
18 if (L > MaxLine)
19 L = MaxLine;
20 LineColumnPacked = (L << ColumnBits) | column();
21}
23 if (Col > MaxColumn)
24 Col = MaxColumn;
25 LineColumnPacked = (LineColumnPacked & ~MaxColumn) | Col;
26}
27
28llvm::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
llvm::raw_string_ostream OS
Definition: TraceTests.cpp:160
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
static constexpr uint32_t MaxLine
static constexpr unsigned ColumnBits
static constexpr uint32_t MaxColumn