//===--- SourceMgrUtils.cpp - SourceMgr LSP Utils -------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "mlir/Tools/lsp-server-support/SourceMgrUtils.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/Path.h" #include <optional> usingnamespacemlir; usingnamespacemlir::lsp; //===----------------------------------------------------------------------===// // Utils //===----------------------------------------------------------------------===// /// Find the end of a string whose contents start at the given `curPtr`. Returns /// the position at the end of the string, after a terminal or invalid character /// (e.g. `"` or `\0`). static const char *lexLocStringTok(const char *curPtr) { … } SMRange lsp::convertTokenLocToRange(SMLoc loc, StringRef identifierChars) { … } std::optional<std::string> lsp::extractSourceDocComment(llvm::SourceMgr &sourceMgr, SMLoc loc) { … } bool lsp::contains(SMRange range, SMLoc loc) { … } //===----------------------------------------------------------------------===// // SourceMgrInclude //===----------------------------------------------------------------------===// Hover SourceMgrInclude::buildHover() const { … } void lsp::gatherIncludeFiles(llvm::SourceMgr &sourceMgr, SmallVectorImpl<SourceMgrInclude> &includes) { … }