clang 20.0.0git
DirectoryScanner.h
Go to the documentation of this file.
1//===- InstallAPI/DirectoryScanner.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///
9/// The DirectoryScanner for collecting library files on the file system.
10///
11//===----------------------------------------------------------------------===//
12#ifndef LLVM_CLANG_INSTALLAPI_DIRECTORYSCANNER_H
13#define LLVM_CLANG_INSTALLAPI_DIRECTORYSCANNER_H
14
17
18namespace clang::installapi {
19
21 /// Scanning Framework directory.
23 /// Scanning Dylib directory.
25};
26
28public:
30 : FM(FM), Mode(Mode) {}
31
32 /// Scan for all input files throughout directory.
33 ///
34 /// \param Directory Path of input directory.
35 llvm::Error scan(StringRef Directory);
36
37 /// Take over ownership of stored libraries.
38 std::vector<Library> takeLibraries() { return std::move(Libraries); };
39
40 /// Get all the header files in libraries.
41 ///
42 /// \param Libraries Reference of collection of libraries.
43 static HeaderSeq getHeaders(ArrayRef<Library> Libraries);
44
45private:
46 /// Collect files for dylibs in usr/(local)/lib within directory.
47 llvm::Error scanForUnwrappedLibraries(StringRef Directory);
48
49 /// Collect files for any frameworks within directory.
50 llvm::Error scanForFrameworks(StringRef Directory);
51
52 /// Get a library from the libraries collection.
53 Library &getOrCreateLibrary(StringRef Path, std::vector<Library> &Libs) const;
54
55 /// Collect multiple frameworks from directory.
56 llvm::Error scanMultipleFrameworks(StringRef Directory,
57 std::vector<Library> &Libs) const;
58 /// Collect files from nested frameworks.
59 llvm::Error scanSubFrameworksDirectory(StringRef Directory,
60 std::vector<Library> &Libs) const;
61
62 /// Collect files from framework path.
63 llvm::Error scanFrameworkDirectory(StringRef Path, Library &Framework) const;
64
65 /// Collect header files from path.
66 llvm::Error scanHeaders(StringRef Path, Library &Lib, HeaderType Type,
67 StringRef BasePath,
68 StringRef ParentPath = StringRef()) const;
69
70 /// Collect files from Version directories inside Framework directories.
71 llvm::Error scanFrameworkVersionsDirectory(StringRef Path,
72 Library &Lib) const;
73 FileManager &FM;
74 ScanMode Mode;
75 StringRef RootPath;
76 std::vector<Library> Libraries;
77};
78
79} // namespace clang::installapi
80
81#endif // LLVM_CLANG_INSTALLAPI_DIRECTORYSCANNER_H
IndirectLocalPath & Path
Defines the clang::FileManager interface and associated types.
Implements support for file system lookup, file system caching, and directory search management.
Definition: FileManager.h:53
The base class of the type hierarchy.
Definition: Type.h:1829
llvm::Error scan(StringRef Directory)
Scan for all input files throughout directory.
std::vector< Library > takeLibraries()
Take over ownership of stored libraries.
DirectoryScanner(FileManager &FM, ScanMode Mode=ScanMode::ScanFrameworks)
static HeaderSeq getHeaders(ArrayRef< Library > Libraries)
Get all the header files in libraries.
The DirectoryScanner for collecting library files on the file system.
Definition: Context.h:20
@ ScanFrameworks
Scanning Framework directory.
@ ScanDylibs
Scanning Dylib directory.
std::vector< HeaderFile > HeaderSeq
Definition: HeaderFile.h:150