kythe.io@v0.0.68-0.20240422202219-7225dbc01741/kythe/cxx/extractor/path_utils.h (about) 1 /* 2 * Copyright 2015 The Kythe Authors. All rights reserved. 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 17 #ifndef KYTHE_CXX_EXTRACTOR_PATH_UTILS_H_ 18 #define KYTHE_CXX_EXTRACTOR_PATH_UTILS_H_ 19 20 #include <string> 21 22 #include "clang/Basic/FileEntry.h" 23 #include "llvm/ADT/SmallString.h" 24 #include "llvm/ADT/StringRef.h" 25 26 namespace clang { 27 class FileEntry; 28 class Preprocessor; 29 } // namespace clang 30 31 namespace kythe { 32 namespace cxx_extractor { 33 34 /// \brief Looks up a file for an #include-ish pragma. 35 /// \param preprocessor The preprocessor to use to consume the filename tokens. 36 /// \param search_path The path used to find the file in the filesystem. 37 /// \param relative_path The path to the file, relative to search_path. 38 /// \param filename The filename used to consult the filesystem. 39 /// \return The FileEntry we found or null if we didn't find one. 40 clang::OptionalFileEntryRef LookupFileForIncludePragma( 41 clang::Preprocessor* preprocessor, llvm::SmallVectorImpl<char>* search_path, 42 llvm::SmallVectorImpl<char>* relative_path, 43 llvm::SmallVectorImpl<char>* filename); 44 } // namespace cxx_extractor 45 } // namespace kythe 46 47 #endif // KYTHE_CXX_EXTRACTOR_PATH_UTILS_H_