[cfe-commits] r136476 - in /cfe/trunk: include/clang/Serialization/ASTReader.h lib/Serialization/ASTReader.cpp
Jonathan D. Turner
jonathan.d.turner at gmail.com
Fri Jul 29 11:09:09 PDT 2011
Author: jonturner
Date: Fri Jul 29 13:09:09 2011
New Revision: 136476
URL: http://llvm.org/viewvc/llvm-project?rev=136476&view=rev
Log:
Renamed Loaded member to ImportedBy, as it's easier to read. Added another set to represent the modules a module imports.
Modified:
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/lib/Serialization/ASTReader.cpp
Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=136476&r1=136475&r2=136476&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Fri Jul 29 13:09:09 2011
@@ -32,6 +32,7 @@
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/APSInt.h"
#include "llvm/ADT/OwningPtr.h"
+#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Bitcode/BitstreamReader.h"
@@ -397,9 +398,11 @@
/// preprocessing record.
unsigned NumPreallocatedPreprocessingEntities;
- /// \brief All the modules that loaded this one. Can contain NULL for
- /// directly loaded modules.
- SmallVector<Module *, 1> Loaders;
+ /// \brief List of modules which depend on this module
+ llvm::SetVector<Module *> ImportedBy;
+
+ /// \brief List of modules which this module depends on
+ llvm::SetVector<Module *> Imports;
};
/// \brief The manager for modules loaded by the ASTReader.
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=136476&r1=136475&r2=136476&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Fri Jul 29 13:09:09 2011
@@ -1380,9 +1380,10 @@
SourceLocation ASTReader::getImportLocation(Module *F) {
if (F->ImportLoc.isValid())
return F->ImportLoc;
+
// Otherwise we have a PCH. It's considered to be "imported" at the first
// location of its includer.
- if (F->Loaders.empty() || !F->Loaders[0]) {
+ if (F->ImportedBy.empty() || !F->ImportedBy[0]) {
// Main file is the importer. We assume that it is the first entry in the
// entry table. We can't ask the manager, because at the time of PCH loading
// the main file entry doesn't exist yet.
@@ -1390,7 +1391,8 @@
// offsets 0 and 1.
return SourceLocation::getFromRawEncoding(2U);
}
- return F->Loaders[0]->FirstLoc;
+ //return F->Loaders[0]->FirstLoc;
+ return F->ImportedBy[0]->FirstLoc;
}
/// ReadBlockAbbrevs - Enter a subblock of the specified BlockID with the
@@ -5466,8 +5468,11 @@
const FileEntry *Entry = FileMgr.getFile(FileName);
Modules[Entry] = Current;
- Current->Loaders.push_back(Prev);
-
+ if (Prev) {
+ Current->ImportedBy.insert(Prev);
+ Prev->Imports.insert(Current);
+ }
+
return *Current;
}
More information about the cfe-commits
mailing list