17#include "llvm/ADT/iterator_range.h"
18#include "llvm/Config/llvm-config.h"
19#include "llvm/Support/FileSystem.h"
20#include "llvm/Support/Path.h"
21#include "llvm/Support/raw_ostream.h"
33 : Collector(Collector), FileMgr(FileMgr) {}
37 bool IsExplicitModule)
override {
47struct ModuleDependencyPPCallbacks :
public PPCallbacks {
52 : Collector(Collector),
SM(
SM) {}
58 StringRef RelativePath,
const Module *SuggestedModule,
70 : Collector(Collector) {}
73 if (llvm::sys::path::is_absolute(HeaderPath))
85 std::make_unique<ModuleDependencyListener>(*
this, R.
getFileManager()));
92 std::make_unique<ModuleDependencyMMCallbacks>(*
this));
98 if (llvm::sys::fs::real_path(
Path, TmpDest))
108 if (!llvm::sys::fs::real_path(UpperDest, RealDest) &&
Path == RealDest)
121 VFSWriter.setOverlayDir(VFSDir);
129 VFSWriter.setUseExternalNames(
false);
133 llvm::sys::path::append(YAMLPath,
"vfs.yaml");
134 llvm::raw_fd_ostream OS(YAMLPath, EC, llvm::sys::fs::OF_TextWithCRLF);
142std::error_code ModuleDependencyCollector::copyToRoot(StringRef Src,
144 using namespace llvm::sys;
145 llvm::FileCollector::PathCanonicalizer::PathStorage Paths =
146 Canonicalizer.canonicalize(Src);
153 path::append(CacheDst, path::relative_path(Paths.CopyFrom));
157 if (!fs::exists(Dst))
158 return std::error_code();
159 path::append(CacheDst, Dst);
160 Paths.CopyFrom = Dst;
164 if (std::error_code EC = fs::create_directories(path::parent_path(CacheDst),
167 if (std::error_code EC = fs::copy_file(Paths.CopyFrom, CacheDst))
176 return std::error_code();
llvm::MachO::FileType FileType
static bool isCaseSensitivePath(StringRef Path)
Defines the clang::Preprocessor interface.
Abstract interface for callback invocations by the ASTReader.
virtual bool needsInputFileVisitation()
Returns true if this ASTReaderListener wants to receive the input files of the AST file via visitInpu...
virtual bool visitInputFile(StringRef Filename, bool isSystem, bool isOverridden, bool isExplicitModule)
if needsInputFileVisitation returns true, this is called for each non-system input file of the AST Fi...
virtual bool needsSystemInputFileVisitation()
Returns true if this ASTReaderListener wants to receive the system input files of the AST file via vi...
Reads an AST files chain containing the contents of a translation unit.
void addListener(std::unique_ptr< ASTReaderListener > L)
Add an AST callback listener.
FileManager & getFileManager() const
Represents a character-granular source range.
A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's...
StringRef getNameAsRequested() const
The name of this FileEntry, as originally requested without applying any remappings for VFS 'use-exte...
Implements support for file system lookup, file system caching, and directory search management.
OptionalFileEntryRef getOptionalFileRef(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Get a FileEntryRef if it exists, without doing anything on error.
Record the location of an inclusion directive, such as an #include or #import statement.
Collects the dependencies for imported modules into a directory.
void attachToASTReader(ASTReader &R) override
virtual void addFileMapping(StringRef VPath, StringRef RPath)
void attachToPreprocessor(Preprocessor &PP) override
virtual void addFile(StringRef Filename, StringRef FileDst={})
virtual bool insertSeen(StringRef Filename)
virtual void writeFileMap()
A mechanism to observe the actions of the module map parser as it reads module map files.
virtual void moduleMapAddHeader(StringRef Filename)
Called when a header is added during module map parsing.
virtual void moduleMapAddUmbrellaHeader(FileEntryRef Header)
Called when an umbrella header is added during module map parsing.
void addModuleMapCallbacks(std::unique_ptr< ModuleMapCallbacks > Callback)
Add a module map callback.
Describes a module or submodule.
This interface provides a way to observe the actions of the preprocessor as it does its thing.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
void addPPCallbacks(std::unique_ptr< PPCallbacks > C)
SourceManager & getSourceManager() const
HeaderSearch & getHeaderSearchInfo() const
Encodes a location in the source.
This class handles loading and caching of source files into memory.
Token - This structure provides full information about a lexed token.
CharacteristicKind
Indicates whether a file or directory holds normal user code, system code, or system code which is im...
The JSON file list parser is used to communicate input to InstallAPI.
LLVM_READONLY char toUppercase(char c)
Converts the given ASCII character to its uppercase equivalent.