[ASTReader] Add a convenience function to retrieve all the input files of a module...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 18 Nov 2014 05:24:18 +0000 (05:24 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 18 Nov 2014 05:24:18 +0000 (05:24 +0000)
llvm-svn: 222224

clang/include/clang/Serialization/ASTReader.h
clang/lib/Serialization/ASTReader.cpp

index 447a6f4..1b0347e 100644 (file)
@@ -2147,6 +2147,10 @@ public:
 
   //RIDErief Loads comments ranges.
   void ReadComments() override;
+
+  /// Return all input files for the given module file.
+  void getInputFiles(ModuleFile &F,
+                     SmallVectorImpl<serialization::InputFile> &Files);
 };
 
 /// \brief Helper class that saves the current stream position and
index 645a1a4..9c95a0c 100644 (file)
@@ -8142,6 +8142,14 @@ void ASTReader::ReadComments() {
   }
 }
 
+void ASTReader::getInputFiles(ModuleFile &F,
+                             SmallVectorImpl<serialization::InputFile> &Files) {
+  for (unsigned I = 0, E = F.InputFilesLoaded.size(); I != E; ++I) {
+    unsigned ID = I+1;
+    Files.push_back(getInputFile(F, ID));
+  }
+}
+
 std::string ASTReader::getOwningModuleNameForDiagnostic(const Decl *D) {
   // If we know the owning module, use it.
   if (Module *M = D->getOwningModule())