clang  12.0.0git
ModuleManager.cpp
Go to the documentation of this file.
1 //===- ModuleManager.cpp - Module Manager ---------------------------------===//
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 // This file defines the ModuleManager class, which manages a set of loaded
10 // modules for the ASTReader.
11 //
12 //===----------------------------------------------------------------------===//
13 
16 #include "clang/Basic/LLVM.h"
17 #include "clang/Lex/HeaderSearch.h"
18 #include "clang/Lex/ModuleMap.h"
23 #include "llvm/ADT/STLExtras.h"
24 #include "llvm/ADT/SetVector.h"
25 #include "llvm/ADT/SmallPtrSet.h"
26 #include "llvm/ADT/SmallVector.h"
27 #include "llvm/ADT/StringRef.h"
28 #include "llvm/ADT/iterator.h"
29 #include "llvm/Support/Chrono.h"
30 #include "llvm/Support/DOTGraphTraits.h"
31 #include "llvm/Support/ErrorOr.h"
32 #include "llvm/Support/GraphWriter.h"
33 #include "llvm/Support/MemoryBuffer.h"
34 #include "llvm/Support/VirtualFileSystem.h"
35 #include <algorithm>
36 #include <cassert>
37 #include <memory>
38 #include <string>
39 #include <system_error>
40 
41 using namespace clang;
42 using namespace serialization;
43 
45  auto Entry = FileMgr.getFile(Name, /*OpenFile=*/false,
46  /*CacheFailure=*/false);
47  if (Entry)
48  return lookup(*Entry);
49 
50  return nullptr;
51 }
52 
54  if (const Module *Mod = HeaderSearchInfo.getModuleMap().findModule(Name))
55  if (const FileEntry *File = Mod->getASTFile())
56  return lookup(File);
57 
58  return nullptr;
59 }
60 
62  auto Known = Modules.find(File);
63  if (Known == Modules.end())
64  return nullptr;
65 
66  return Known->second;
67 }
68 
69 std::unique_ptr<llvm::MemoryBuffer>
70 ModuleManager::lookupBuffer(StringRef Name) {
71  auto Entry = FileMgr.getFile(Name, /*OpenFile=*/false,
72  /*CacheFailure=*/false);
73  if (!Entry)
74  return nullptr;
75  return std::move(InMemoryBuffers[*Entry]);
76 }
77 
78 static bool checkSignature(ASTFileSignature Signature,
79  ASTFileSignature ExpectedSignature,
80  std::string &ErrorStr) {
81  if (!ExpectedSignature || Signature == ExpectedSignature)
82  return false;
83 
84  ErrorStr =
85  Signature ? "signature mismatch" : "could not read module signature";
86  return true;
87 }
88 
89 static void updateModuleImports(ModuleFile &MF, ModuleFile *ImportedBy,
90  SourceLocation ImportLoc) {
91  if (ImportedBy) {
92  MF.ImportedBy.insert(ImportedBy);
93  ImportedBy->Imports.insert(&MF);
94  } else {
95  if (!MF.DirectlyImported)
96  MF.ImportLoc = ImportLoc;
97 
98  MF.DirectlyImported = true;
99  }
100 }
101 
104  SourceLocation ImportLoc, ModuleFile *ImportedBy,
105  unsigned Generation,
106  off_t ExpectedSize, time_t ExpectedModTime,
107  ASTFileSignature ExpectedSignature,
108  ASTFileSignatureReader ReadSignature,
109  ModuleFile *&Module,
110  std::string &ErrorStr) {
111  Module = nullptr;
112 
113  // Look for the file entry. This only fails if the expected size or
114  // modification time differ.
115  const FileEntry *Entry;
116  if (Type == MK_ExplicitModule || Type == MK_PrebuiltModule) {
117  // If we're not expecting to pull this file out of the module cache, it
118  // might have a different mtime due to being moved across filesystems in
119  // a distributed build. The size must still match, though. (As must the
120  // contents, but we can't check that.)
121  ExpectedModTime = 0;
122  }
123  // Note: ExpectedSize and ExpectedModTime will be 0 for MK_ImplicitModule
124  // when using an ASTFileSignature.
125  if (lookupModuleFile(FileName, ExpectedSize, ExpectedModTime, Entry)) {
126  ErrorStr = "module file out of date";
127  return OutOfDate;
128  }
129 
130  if (!Entry && FileName != "-") {
131  ErrorStr = "module file not found";
132  return Missing;
133  }
134 
135  // Check whether we already loaded this module, before
136  if (ModuleFile *ModuleEntry = Modules.lookup(Entry)) {
137  // Check the stored signature.
138  if (checkSignature(ModuleEntry->Signature, ExpectedSignature, ErrorStr))
139  return OutOfDate;
140 
141  Module = ModuleEntry;
142  updateModuleImports(*ModuleEntry, ImportedBy, ImportLoc);
143  return AlreadyLoaded;
144  }
145 
146  // Allocate a new module.
147  auto NewModule = std::make_unique<ModuleFile>(Type, Generation);
148  NewModule->Index = Chain.size();
149  NewModule->FileName = FileName.str();
150  NewModule->File = Entry;
151  NewModule->ImportLoc = ImportLoc;
152  NewModule->InputFilesValidationTimestamp = 0;
153 
154  if (NewModule->Kind == MK_ImplicitModule) {
155  std::string TimestampFilename = NewModule->getTimestampFilename();
156  llvm::vfs::Status Status;
157  // A cached stat value would be fine as well.
158  if (!FileMgr.getNoncachedStatValue(TimestampFilename, Status))
159  NewModule->InputFilesValidationTimestamp =
160  llvm::sys::toTimeT(Status.getLastModificationTime());
161  }
162 
163  // Load the contents of the module
164  if (std::unique_ptr<llvm::MemoryBuffer> Buffer = lookupBuffer(FileName)) {
165  // The buffer was already provided for us.
166  NewModule->Buffer = &ModuleCache->addBuiltPCM(FileName, std::move(Buffer));
167  // Since the cached buffer is reused, it is safe to close the file
168  // descriptor that was opened while stat()ing the PCM in
169  // lookupModuleFile() above, it won't be needed any longer.
170  Entry->closeFile();
171  } else if (llvm::MemoryBuffer *Buffer =
172  getModuleCache().lookupPCM(FileName)) {
173  NewModule->Buffer = Buffer;
174  // As above, the file descriptor is no longer needed.
175  Entry->closeFile();
176  } else if (getModuleCache().shouldBuildPCM(FileName)) {
177  // Report that the module is out of date, since we tried (and failed) to
178  // import it earlier.
179  Entry->closeFile();
180  return OutOfDate;
181  } else {
182  // Open the AST file.
183  llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> Buf((std::error_code()));
184  if (FileName == "-") {
185  Buf = llvm::MemoryBuffer::getSTDIN();
186  } else {
187  // Get a buffer of the file and close the file descriptor when done.
188  // The file is volatile because in a parallel build we expect multiple
189  // compiler processes to use the same module file rebuilding it if needed.
190  //
191  // RequiresNullTerminator is false because module files don't need it, and
192  // this allows the file to still be mmapped.
193  Buf = FileMgr.getBufferForFile(NewModule->File,
194  /*IsVolatile=*/true,
195  /*RequiresNullTerminator=*/false);
196  }
197 
198  if (!Buf) {
199  ErrorStr = Buf.getError().message();
200  return Missing;
201  }
202 
203  NewModule->Buffer = &getModuleCache().addPCM(FileName, std::move(*Buf));
204  }
205 
206  // Initialize the stream.
207  NewModule->Data = PCHContainerRdr.ExtractPCH(*NewModule->Buffer);
208 
209  // Read the signature eagerly now so that we can check it. Avoid calling
210  // ReadSignature unless there's something to check though.
211  if (ExpectedSignature && checkSignature(ReadSignature(NewModule->Data),
212  ExpectedSignature, ErrorStr))
213  return OutOfDate;
214 
215  // We're keeping this module. Store it everywhere.
216  Module = Modules[Entry] = NewModule.get();
217 
218  updateModuleImports(*NewModule, ImportedBy, ImportLoc);
219 
220  if (!NewModule->isModule())
221  PCHChain.push_back(NewModule.get());
222  if (!ImportedBy)
223  Roots.push_back(NewModule.get());
224 
225  Chain.push_back(std::move(NewModule));
226  return NewlyLoaded;
227 }
228 
230  auto Last = end();
231  if (First == Last)
232  return;
233 
234  // Explicitly clear VisitOrder since we might not notice it is stale.
235  VisitOrder.clear();
236 
237  // Collect the set of module file pointers that we'll be removing.
239  (llvm::pointer_iterator<ModuleIterator>(First)),
240  (llvm::pointer_iterator<ModuleIterator>(Last)));
241 
242  auto IsVictim = [&](ModuleFile *MF) {
243  return victimSet.count(MF);
244  };
245  // Remove any references to the now-destroyed modules.
246  for (auto I = begin(); I != First; ++I) {
247  I->Imports.remove_if(IsVictim);
248  I->ImportedBy.remove_if(IsVictim);
249  }
250  Roots.erase(std::remove_if(Roots.begin(), Roots.end(), IsVictim),
251  Roots.end());
252 
253  // Remove the modules from the PCH chain.
254  for (auto I = First; I != Last; ++I) {
255  if (!I->isModule()) {
256  PCHChain.erase(llvm::find(PCHChain, &*I), PCHChain.end());
257  break;
258  }
259  }
260 
261  // Delete the modules and erase them from the various structures.
262  for (ModuleIterator victim = First; victim != Last; ++victim) {
263  Modules.erase(victim->File);
264 
265  if (modMap) {
266  StringRef ModuleName = victim->ModuleName;
267  if (Module *mod = modMap->findModule(ModuleName)) {
268  mod->setASTFile(nullptr);
269  }
270  }
271  }
272 
273  // Delete the modules.
274  Chain.erase(Chain.begin() + (First - begin()), Chain.end());
275 }
276 
277 void
279  std::unique_ptr<llvm::MemoryBuffer> Buffer) {
280  const FileEntry *Entry =
281  FileMgr.getVirtualFile(FileName, Buffer->getBufferSize(), 0);
282  InMemoryBuffers[Entry] = std::move(Buffer);
283 }
284 
285 ModuleManager::VisitState *ModuleManager::allocateVisitState() {
286  // Fast path: if we have a cached state, use it.
287  if (FirstVisitState) {
288  VisitState *Result = FirstVisitState;
289  FirstVisitState = FirstVisitState->NextState;
290  Result->NextState = nullptr;
291  return Result;
292  }
293 
294  // Allocate and return a new state.
295  return new VisitState(size());
296 }
297 
298 void ModuleManager::returnVisitState(VisitState *State) {
299  assert(State->NextState == nullptr && "Visited state is in list?");
300  State->NextState = FirstVisitState;
301  FirstVisitState = State;
302 }
303 
305  GlobalIndex = Index;
306  if (!GlobalIndex) {
307  ModulesInCommonWithGlobalIndex.clear();
308  return;
309  }
310 
311  // Notify the global module index about all of the modules we've already
312  // loaded.
313  for (ModuleFile &M : *this)
314  if (!GlobalIndex->loadedModuleFile(&M))
315  ModulesInCommonWithGlobalIndex.push_back(&M);
316 }
317 
319  if (!GlobalIndex || GlobalIndex->loadedModuleFile(MF))
320  return;
321 
322  ModulesInCommonWithGlobalIndex.push_back(MF);
323 }
324 
326  InMemoryModuleCache &ModuleCache,
327  const PCHContainerReader &PCHContainerRdr,
328  const HeaderSearch &HeaderSearchInfo)
329  : FileMgr(FileMgr), ModuleCache(&ModuleCache),
330  PCHContainerRdr(PCHContainerRdr), HeaderSearchInfo(HeaderSearchInfo) {}
331 
332 ModuleManager::~ModuleManager() { delete FirstVisitState; }
333 
334 void ModuleManager::visit(llvm::function_ref<bool(ModuleFile &M)> Visitor,
335  llvm::SmallPtrSetImpl<ModuleFile *> *ModuleFilesHit) {
336  // If the visitation order vector is the wrong size, recompute the order.
337  if (VisitOrder.size() != Chain.size()) {
338  unsigned N = size();
339  VisitOrder.clear();
340  VisitOrder.reserve(N);
341 
342  // Record the number of incoming edges for each module. When we
343  // encounter a module with no incoming edges, push it into the queue
344  // to seed the queue.
346  Queue.reserve(N);
347  llvm::SmallVector<unsigned, 4> UnusedIncomingEdges;
348  UnusedIncomingEdges.resize(size());
349  for (ModuleFile &M : llvm::reverse(*this)) {
350  unsigned Size = M.ImportedBy.size();
351  UnusedIncomingEdges[M.Index] = Size;
352  if (!Size)
353  Queue.push_back(&M);
354  }
355 
356  // Traverse the graph, making sure to visit a module before visiting any
357  // of its dependencies.
358  while (!Queue.empty()) {
359  ModuleFile *CurrentModule = Queue.pop_back_val();
360  VisitOrder.push_back(CurrentModule);
361 
362  // For any module that this module depends on, push it on the
363  // stack (if it hasn't already been marked as visited).
364  for (auto M = CurrentModule->Imports.rbegin(),
365  MEnd = CurrentModule->Imports.rend();
366  M != MEnd; ++M) {
367  // Remove our current module as an impediment to visiting the
368  // module we depend on. If we were the last unvisited module
369  // that depends on this particular module, push it into the
370  // queue to be visited.
371  unsigned &NumUnusedEdges = UnusedIncomingEdges[(*M)->Index];
372  if (NumUnusedEdges && (--NumUnusedEdges == 0))
373  Queue.push_back(*M);
374  }
375  }
376 
377  assert(VisitOrder.size() == N && "Visitation order is wrong?");
378 
379  delete FirstVisitState;
380  FirstVisitState = nullptr;
381  }
382 
383  VisitState *State = allocateVisitState();
384  unsigned VisitNumber = State->NextVisitNumber++;
385 
386  // If the caller has provided us with a hit-set that came from the global
387  // module index, mark every module file in common with the global module
388  // index that is *not* in that set as 'visited'.
389  if (ModuleFilesHit && !ModulesInCommonWithGlobalIndex.empty()) {
390  for (unsigned I = 0, N = ModulesInCommonWithGlobalIndex.size(); I != N; ++I)
391  {
392  ModuleFile *M = ModulesInCommonWithGlobalIndex[I];
393  if (!ModuleFilesHit->count(M))
394  State->VisitNumber[M->Index] = VisitNumber;
395  }
396  }
397 
398  for (unsigned I = 0, N = VisitOrder.size(); I != N; ++I) {
399  ModuleFile *CurrentModule = VisitOrder[I];
400  // Should we skip this module file?
401  if (State->VisitNumber[CurrentModule->Index] == VisitNumber)
402  continue;
403 
404  // Visit the module.
405  assert(State->VisitNumber[CurrentModule->Index] == VisitNumber - 1);
406  State->VisitNumber[CurrentModule->Index] = VisitNumber;
407  if (!Visitor(*CurrentModule))
408  continue;
409 
410  // The visitor has requested that cut off visitation of any
411  // module that the current module depends on. To indicate this
412  // behavior, we mark all of the reachable modules as having been visited.
413  ModuleFile *NextModule = CurrentModule;
414  do {
415  // For any module that this module depends on, push it on the
416  // stack (if it hasn't already been marked as visited).
417  for (llvm::SetVector<ModuleFile *>::iterator
418  M = NextModule->Imports.begin(),
419  MEnd = NextModule->Imports.end();
420  M != MEnd; ++M) {
421  if (State->VisitNumber[(*M)->Index] != VisitNumber) {
422  State->Stack.push_back(*M);
423  State->VisitNumber[(*M)->Index] = VisitNumber;
424  }
425  }
426 
427  if (State->Stack.empty())
428  break;
429 
430  // Pop the next module off the stack.
431  NextModule = State->Stack.pop_back_val();
432  } while (true);
433  }
434 
435  returnVisitState(State);
436 }
437 
438 bool ModuleManager::lookupModuleFile(StringRef FileName,
439  off_t ExpectedSize,
440  time_t ExpectedModTime,
441  const FileEntry *&File) {
442  if (FileName == "-") {
443  File = nullptr;
444  return false;
445  }
446 
447  // Open the file immediately to ensure there is no race between stat'ing and
448  // opening the file.
449  auto FileOrErr = FileMgr.getFile(FileName, /*OpenFile=*/true,
450  /*CacheFailure=*/false);
451  if (!FileOrErr) {
452  File = nullptr;
453  return false;
454  }
455  File = *FileOrErr;
456 
457  if ((ExpectedSize && ExpectedSize != File->getSize()) ||
458  (ExpectedModTime && ExpectedModTime != File->getModificationTime()))
459  // Do not destroy File, as it may be referenced. If we need to rebuild it,
460  // it will be destroyed by removeModules.
461  return true;
462 
463  return false;
464 }
465 
466 #ifndef NDEBUG
467 namespace llvm {
468 
469  template<>
471  using NodeRef = ModuleFile *;
472  using ChildIteratorType = llvm::SetVector<ModuleFile *>::const_iterator;
473  using nodes_iterator = pointer_iterator<ModuleManager::ModuleConstIterator>;
474 
476  return Node->Imports.begin();
477  }
478 
480  return Node->Imports.end();
481  }
482 
483  static nodes_iterator nodes_begin(const ModuleManager &Manager) {
484  return nodes_iterator(Manager.begin());
485  }
486 
487  static nodes_iterator nodes_end(const ModuleManager &Manager) {
488  return nodes_iterator(Manager.end());
489  }
490  };
491 
492  template<>
494  explicit DOTGraphTraits(bool IsSimple = false)
495  : DefaultDOTGraphTraits(IsSimple) {}
496 
497  static bool renderGraphFromBottomUp() { return true; }
498 
499  std::string getNodeLabel(ModuleFile *M, const ModuleManager&) {
500  return M->ModuleName;
501  }
502  };
503 
504 } // namespace llvm
505 
507  llvm::ViewGraph(*this, "Modules");
508 }
509 #endif
Implements support for file system lookup, file system caching, and directory search management...
Definition: FileManager.h:172
llvm::SetVector< ModuleFile * >::const_iterator ChildIteratorType
ModuleFile * lookup(const FileEntry *File) const
Returns the module associated with the given module file.
Defines the clang::FileManager interface and associated types.
time_t getModificationTime() const
Definition: FileManager.h:109
Specialize PointerLikeTypeTraits to allow LazyGenerationalUpdatePtr to be placed into a PointerUnion...
Definition: Dominators.h:30
void closeFile() const
Definition: FileManager.h:120
std::string ModuleName
The name of the module.
Definition: ModuleFile.h:124
The module file is out-of-date.
The base class of the type hierarchy.
Definition: Type.h:1472
unsigned Index
The index of this module in the list of modules.
Definition: ModuleFile.h:115
ModuleFile * lookupByFileName(StringRef FileName) const
Returns the module associated with the given file name.
DOTGraphTraits(bool isSimple=false)
Manages the set of modules loaded by an AST reader.
Definition: ModuleManager.h:48
ModuleMap & getModuleMap()
Retrieve the module map.
Definition: HeaderSearch.h:665
void removeModules(ModuleIterator First, ModuleMap *modMap)
Remove the modules starting from First (to the end).
SourceLocation ImportLoc
The source location where this module was first imported.
Definition: ModuleFile.h:213
AddModuleResult
The result of attempting to add a new module.
ModuleIterator begin()
Forward iterator to traverse all loaded modules.
LineState State
void viewGraph()
View the graphviz representation of the module graph.
void visit(llvm::function_ref< bool(ModuleFile &M)> Visitor, llvm::SmallPtrSetImpl< ModuleFile *> *ModuleFilesHit=nullptr)
Visit each of the modules.
The signature of a module, which is a hash of the AST content.
Definition: Module.h:56
void setGlobalIndex(GlobalModuleIndex *Index)
Set the global module index.
Describes a module or submodule.
Definition: Module.h:87
virtual llvm::StringRef ExtractPCH(llvm::MemoryBufferRef Buffer) const =0
Returns the serialized AST inside the PCH container Buffer.
Module * findModule(StringRef Name) const
Retrieve a module with the given name.
Definition: ModuleMap.cpp:790
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
bool lookupModuleFile(StringRef FileName, off_t ExpectedSize, time_t ExpectedModTime, const FileEntry *&File)
Attempt to resolve the given module file name to a file entry.
ModuleIterator end()
Forward iterator end-point to traverse all loaded modules.
This abstract interface provides operations for unwrapping containers for serialized ASTs (precompile...
Encapsulates the information needed to find the file referenced by a #include or #include_next, (sub-)framework lookup, etc.
Definition: HeaderSearch.h:158
ASTFileSignature(*)(StringRef) ASTFileSignatureReader
ModuleKind
Specifies the kind of module that has been loaded.
Definition: ModuleFile.h:41
File is from a prebuilt module path.
Definition: ModuleFile.h:58
DynTypedNode Node
static nodes_iterator nodes_end(const ModuleManager &Manager)
llvm::MemoryBuffer & addPCM(llvm::StringRef Filename, std::unique_ptr< llvm::MemoryBuffer > Buffer)
Store the PCM under the Filename.
InMemoryModuleCache & getModuleCache() const
Information about a module that has been loaded by the ASTReader.
Definition: ModuleFile.h:106
AddModuleResult addModule(StringRef FileName, ModuleKind Type, SourceLocation ImportLoc, ModuleFile *ImportedBy, unsigned Generation, off_t ExpectedSize, time_t ExpectedModTime, ASTFileSignature ExpectedSignature, ASTFileSignatureReader ReadSignature, ModuleFile *&Module, std::string &ErrorStr)
Attempts to create a new module and add it to the list of known modules.
In-memory cache for modules.
void addInMemoryBuffer(StringRef FileName, std::unique_ptr< llvm::MemoryBuffer > Buffer)
Add an in-memory buffer the list of known buffers.
static nodes_iterator nodes_begin(const ModuleManager &Manager)
Encodes a location in the source.
File is an implicitly-loaded module.
Definition: ModuleFile.h:43
Cached information about one file (either on disk or in the virtual file system). ...
Definition: FileManager.h:79
static ChildIteratorType child_begin(NodeRef Node)
std::error_code getNoncachedStatValue(StringRef Path, llvm::vfs::Status &Result)
Get the &#39;stat&#39; information for the given Path.
const FileEntry * getVirtualFile(StringRef Filename, off_t Size, time_t ModificationTime)
Retrieve a file entry for a "virtual" file that acts as if there were a file with the given name on d...
llvm::SetVector< ModuleFile * > ImportedBy
List of modules which depend on this module.
Definition: ModuleFile.h:489
A global index for a set of module files, providing information about the identifiers within those mo...
The module file was just loaded in response to this call.
pointer_iterator< ModuleManager::ModuleConstIterator > nodes_iterator
Dataflow Directional Tag Classes.
llvm::ErrorOr< std::unique_ptr< llvm::MemoryBuffer > > getBufferForFile(const FileEntry *Entry, bool isVolatile=false, bool RequiresNullTerminator=true)
Open the specified file as a MemoryBuffer, returning a new MemoryBuffer if successful, otherwise returning null.
ModuleManager(FileManager &FileMgr, InMemoryModuleCache &ModuleCache, const PCHContainerReader &PCHContainerRdr, const HeaderSearch &HeaderSearchInfo)
off_t getSize() const
Definition: FileManager.h:106
File is an explicitly-loaded module.
Definition: ModuleFile.h:46
ModuleFile * lookupByModuleName(StringRef ModName) const
Returns the module associated with the given module name.
static void updateModuleImports(ModuleFile &MF, ModuleFile *ImportedBy, SourceLocation ImportLoc)
void moduleFileAccepted(ModuleFile *MF)
Notification from the AST reader that the given module file has been "accepted", and will not (can no...
llvm::ErrorOr< const FileEntry * > getFile(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Lookup, cache, and verify the specified file (real or virtual).
std::string getNodeLabel(ModuleFile *M, const ModuleManager &)
unsigned size() const
Number of modules loaded.
The module file had already been loaded.
static ChildIteratorType child_end(NodeRef Node)
llvm::pointee_iterator< SmallVectorImpl< std::unique_ptr< ModuleFile > >::iterator > ModuleIterator
bool DirectlyImported
Whether this module has been directly imported by the user.
Definition: ModuleFile.h:177
llvm::SetVector< ModuleFile * > Imports
List of modules which this module depends on.
Definition: ModuleFile.h:492
std::unique_ptr< llvm::MemoryBuffer > lookupBuffer(StringRef Name)
Returns the in-memory (virtual file) buffer with the given name.
bool loadedModuleFile(ModuleFile *File)
Note that the given module file has been loaded.
static bool checkSignature(ASTFileSignature Signature, ASTFileSignature ExpectedSignature, std::string &ErrorStr)