Haojian Wu | e259a5f | 2019-09-25 10:30:22 +0000 | [diff] [blame] | 1 | //===--- HeaderSourceSwitch.h - ----------------------------------*- 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 | |
Haojian Wu | c00627f | 2019-09-25 12:54:53 +0000 | [diff] [blame] | 9 | #ifndef LLVM_CLANG_TOOLS_EXTRA_UNITTESTS_CLANGD_HEADERSOURCESWITCH_H |
| 10 | #define LLVM_CLANG_TOOLS_EXTRA_UNITTESTS_CLANGD_HEADERSOURCESWITCH_H |
| 11 | |
Haojian Wu | e259a5f | 2019-09-25 10:30:22 +0000 | [diff] [blame] | 12 | #include "ParsedAST.h" |
| 13 | #include "llvm/ADT/Optional.h" |
| 14 | |
| 15 | namespace clang { |
| 16 | namespace clangd { |
| 17 | |
| 18 | /// Given a header file, returns the best matching source file, and vice visa. |
| 19 | /// It only uses the filename heuristics to do the inference. |
| 20 | llvm::Optional<Path> getCorrespondingHeaderOrSource( |
| 21 | const Path &OriginalFile, |
| 22 | llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS); |
| 23 | |
Haojian Wu | fdbe5b4b | 2019-09-30 10:48:02 +0000 | [diff] [blame] | 24 | /// Given a header file, returns the best matching source file, and vice visa. |
| 25 | /// The heuristics incorporate with the AST and the index (if provided). |
| 26 | llvm::Optional<Path> getCorrespondingHeaderOrSource(const Path &OriginalFile, |
| 27 | ParsedAST &AST, |
| 28 | const SymbolIndex *Index); |
| 29 | |
| 30 | /// Returns all indexable decls that are present in the main file of the AST. |
| 31 | /// Exposed for unittests. |
| 32 | std::vector<const Decl *> getIndexableLocalDecls(ParsedAST &AST); |
| 33 | |
Haojian Wu | e259a5f | 2019-09-25 10:30:22 +0000 | [diff] [blame] | 34 | } // namespace clangd |
| 35 | } // namespace clang |
Haojian Wu | c00627f | 2019-09-25 12:54:53 +0000 | [diff] [blame] | 36 | |
| 37 | #endif // LLVM_CLANG_TOOLS_EXTRA_UNITTESTS_CLANGD_HEADERSOURCESWITCH_H |