xref: /aosp_15_r20/build/make/tools/ide_query/cc_analyzer/include_scanner.h (revision 9e94795a3d4ef5c1d47486f9a02bb378756cea8a)
1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef _TOOLS_IDE_QUERY_CC_ANALYZER_INCLUDE_SCANNER_H_
17 #define _TOOLS_IDE_QUERY_CC_ANALYZER_INCLUDE_SCANNER_H_
18 
19 #include <string>
20 #include <utility>
21 #include <vector>
22 
23 #include "clang/Tooling/CompilationDatabase.h"
24 #include "llvm/ADT/IntrusiveRefCntPtr.h"
25 #include "llvm/Support/Error.h"
26 #include "llvm/Support/VirtualFileSystem.h"
27 
28 namespace tools::ide_query::cc_analyzer {
29 
30 // Returns absolute paths and contents for all the includes necessary for
31 // compiling source file in command.
32 llvm::Expected<std::vector<std::pair<std::string, std::string>>> ScanIncludes(
33     const clang::tooling::CompileCommand &cmd,
34     llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs);
35 
36 }  // namespace tools::ide_query::cc_analyzer
37 
38 #endif
39