Sam McCall | b536a2a | 2017-12-19 12:23:48 +0000 | [diff] [blame^] | 1 | //===--- 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 | |
| 18 | namespace clang { |
| 19 | namespace clangd { |
| 20 | |
| 21 | /// Turn a [line, column] pair into an offset in Code. |
| 22 | size_t positionToOffset(llvm::StringRef Code, Position P); |
| 23 | |
| 24 | /// Turn an offset in Code into a [line, column] pair. |
| 25 | Position offsetToPosition(llvm::StringRef Code, size_t Offset); |
| 26 | |
| 27 | } // namespace clangd |
| 28 | } // namespace clang |
| 29 | #endif |