nixd
Loading...
Searching...
No Matches
Path.h
Go to the documentation of this file.
1//===--- Path.h - Helper typedefs --------------------------------*- 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#pragma once
10
11#include "llvm/ADT/StringRef.h"
12#include "llvm/Support/Path.h"
13#include <string>
14
15/// Whether current platform treats paths case insensitively.
16#if defined(_WIN32) || defined(__APPLE__)
17#define CLANGD_PATH_CASE_INSENSITIVE
18#endif
19
20namespace lspserver {
21
22/// A typedef to represent a file path. Used solely for more descriptive
23/// signatures.
24using Path = std::string;
25/// A typedef to represent a ref to file path. Used solely for more descriptive
26/// signatures.
27using PathRef = llvm::StringRef;
28
29// For platforms where paths are case-insensitive (but case-preserving),
30// we need to do case-insensitive comparisons and use lowercase keys.
31// FIXME: Make Path a real class with desired semantics instead.
34
35/// Checks if \p Ancestor is a proper ancestor of \p Path. This is just a
36/// smarter lexical prefix match, e.g: foo/bar/baz doesn't start with foo/./bar.
37/// Both \p Ancestor and \p Path must be absolute.
40 llvm::sys::path::Style Style = llvm::sys::path::Style::native);
41
42/// Variant of parent_path that operates only on absolute paths.
43/// Unlike parent_path doesn't consider C: a parent of C:\.
45} // namespace lspserver
Whether current platform treats paths case insensitively.
Definition Connection.h:11
std::string Path
Definition Path.h:24
PathRef absoluteParent(PathRef Path)
bool fromJSON(const llvm::json::Value &, URIForFile &, llvm::json::Path)
bool pathEqual(PathRef, PathRef)
std::string maybeCaseFoldPath(PathRef Path)
llvm::StringRef PathRef
Definition Path.h:27
bool pathStartsWith(PathRef Ancestor, PathRef Path, llvm::sys::path::Style Style=llvm::sys::path::Style::native)