10#include "llvm/Support/VirtualFileSystem.h"
11#include "llvm/TextAPI/Utils.h"
17 return llvm::Regex(
"/(.+)\\.framework/(.+)?Headers/(.+)");
22 std::string Pattern =
"/include/";
23 auto PathPrefix = FullPath.find(Pattern);
24 if (PathPrefix != StringRef::npos) {
25 PathPrefix += Pattern.size();
26 return FullPath.drop_front(PathPrefix).str();
33 if (Matches.size() != 4)
36 return Matches[1].drop_front(Matches[1].rfind(
'/') + 1).str() +
"/" +
41 return StringSwitch<bool>(sys::path::extension(Path))
42 .Cases({
".h",
".H",
".hh",
".hpp",
".hxx"},
true)
50 for (llvm::vfs::recursive_directory_iterator i(FS, Directory, EC), ie;
51 i != ie; i.increment(EC)) {
53 return errorCodeToError(EC);
56 if (FS.status(i->path()) == std::errc::no_such_file_or_directory)
59 StringRef Path = i->path();
61 Files.emplace_back(Path);
68 : GlobString(GlobString), Rule(
std::move(Rule)), Type(Type) {}
82 auto Rule = MachO::createRegexFromGlob(GlobString);
84 return Rule.takeError();
86 return std::make_unique<HeaderGlob>(GlobString, std::move(*Rule), Type);
llvm::MachO::PathSeq PathSeq
Implements support for file system lookup, file system caching, and directory search management.
llvm::vfs::FileSystem & getVirtualFileSystem() const
The DirectoryScanner for collecting library files on the file system.
llvm::Expected< PathSeq > enumerateFiles(clang::FileManager &FM, StringRef Directory)
Given input directory, collect all header files.
std::optional< std::string > createIncludeHeaderName(const StringRef FullPath)
Assemble expected way header will be included by clients.
bool isHeaderFile(StringRef Path)
Determine if Path is a header file.
@ Match
This is not an overload because the signature exactly matches an existing declaration.
@ Default
Set to the current date and time.
Diagnostic wrappers for TextAPI types for error reporting.