brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 058cb1e Raw
34 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include "SymbolLocation.h"10 11namespace clang {12namespace clangd {13 14void SymbolLocation::Position::setLine(uint32_t L) {15  if (L > MaxLine)16    L = MaxLine;17  LineColumnPacked = (L << ColumnBits) | column();18}19void SymbolLocation::Position::setColumn(uint32_t Col) {20  if (Col > MaxColumn)21    Col = MaxColumn;22  LineColumnPacked = (LineColumnPacked & ~MaxColumn) | Col;23}24 25llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const SymbolLocation &L) {26  if (!L)27    return OS << "(none)";28  return OS << L.FileURI << "[" << L.Start.line() << ":" << L.Start.column()29            << "-" << L.End.line() << ":" << L.End.column() << ")";30}31 32} // namespace clangd33} // namespace clang34