2019-09-25 18:30:22 +08:00
|
|
|
//===--- HeaderSourceSwitch.h - ----------------------------------*- C++-*-===//
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2021-12-02 21:43:13 +08:00
|
|
|
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEADERSOURCESWITCH_H
|
|
|
|
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEADERSOURCESWITCH_H
|
2019-09-25 20:54:53 +08:00
|
|
|
|
2019-09-25 18:30:22 +08:00
|
|
|
#include "ParsedAST.h"
|
|
|
|
#include "llvm/ADT/Optional.h"
|
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace clangd {
|
|
|
|
|
|
|
|
/// Given a header file, returns the best matching source file, and vice visa.
|
|
|
|
/// It only uses the filename heuristics to do the inference.
|
|
|
|
llvm::Optional<Path> getCorrespondingHeaderOrSource(
|
2021-01-07 10:40:20 +08:00
|
|
|
PathRef OriginalFile, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS);
|
2019-09-25 18:30:22 +08:00
|
|
|
|
2019-09-30 18:48:02 +08:00
|
|
|
/// Given a header file, returns the best matching source file, and vice visa.
|
|
|
|
/// The heuristics incorporate with the AST and the index (if provided).
|
2021-01-07 10:40:20 +08:00
|
|
|
llvm::Optional<Path> getCorrespondingHeaderOrSource(PathRef OriginalFile,
|
2019-09-30 18:48:02 +08:00
|
|
|
ParsedAST &AST,
|
|
|
|
const SymbolIndex *Index);
|
|
|
|
|
|
|
|
/// Returns all indexable decls that are present in the main file of the AST.
|
|
|
|
/// Exposed for unittests.
|
|
|
|
std::vector<const Decl *> getIndexableLocalDecls(ParsedAST &AST);
|
|
|
|
|
2019-09-25 18:30:22 +08:00
|
|
|
} // namespace clangd
|
|
|
|
} // namespace clang
|
2019-09-25 20:54:53 +08:00
|
|
|
|
2021-12-02 21:43:13 +08:00
|
|
|
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_HEADERSOURCESWITCH_H
|