blob: 2471a17a30fef282e9e561f8af1f54ef43ce865d [file] [log] [blame]
Sam McCallb536a2a2017-12-19 12:23:48 +00001//===--- SourceCode.h - Manipulating source code as strings -----*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// Various code that examines C++ source code without using heavy AST machinery
11// (and often not even the lexer). To be used sparingly!
12//
13//===----------------------------------------------------------------------===//
14#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_SOURCECODE_H
15#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_SOURCECODE_H
16#include "Protocol.h"
17
18namespace clang {
19namespace clangd {
20
21/// Turn a [line, column] pair into an offset in Code.
22size_t positionToOffset(llvm::StringRef Code, Position P);
23
24/// Turn an offset in Code into a [line, column] pair.
25Position offsetToPosition(llvm::StringRef Code, size_t Offset);
26
27} // namespace clangd
28} // namespace clang
29#endif