зеркало из https://github.com/microsoft/clang-1.git
Add a debugging dump for Module (also emitted as part of the AST
reader statistics), to show the local-to-global mappings. The only such mapping we have (at least, for now) is for source location offsets. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136687 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
f33740efdb
Коммит
8df5c9b5d6
|
@ -176,8 +176,7 @@ enum ModuleKind {
|
|||
/// Each instance of the Module class corresponds to a single AST file, which
|
||||
/// may be a precompiled header, precompiled preamble, or an AST file of some
|
||||
/// sort loaded as the main file, all of which are specific formulations of
|
||||
/// the general notion of a "module". A module may depend on another module
|
||||
/// (FIXME: or a set of other modules).
|
||||
/// the general notion of a "module". A module may depend on another module.
|
||||
class Module {
|
||||
public:
|
||||
Module(ModuleKind Kind);
|
||||
|
@ -403,6 +402,9 @@ public:
|
|||
|
||||
/// \brief List of modules which this module depends on
|
||||
llvm::SetVector<Module *> Imports;
|
||||
|
||||
/// \brief Dump debugging output for this module.
|
||||
void dump();
|
||||
};
|
||||
|
||||
/// \brief The manager for modules loaded by the ASTReader.
|
||||
|
|
|
@ -4364,7 +4364,7 @@ dumpModuleIDMap(StringRef Name,
|
|||
}
|
||||
|
||||
void ASTReader::dump() {
|
||||
llvm::errs() << "*** AST File Remapping:\n";
|
||||
llvm::errs() << "*** PCH/Module Remappings:\n";
|
||||
dumpModuleIDMap("Global bit offset map", GlobalBitOffsetsMap);
|
||||
dumpModuleIDMap("Global source location entry map", GlobalSLocEntryMap);
|
||||
dumpModuleIDMap("Global type map", GlobalTypeMap);
|
||||
|
@ -4375,6 +4375,12 @@ void ASTReader::dump() {
|
|||
dumpModuleIDMap("Global macro definition map", GlobalMacroDefinitionMap);
|
||||
dumpModuleIDMap("Global preprocessed entity map",
|
||||
GlobalPreprocessedEntityMap);
|
||||
|
||||
llvm::errs() << "\n*** PCH/Modules Loaded:";
|
||||
for (ModuleManager::ModuleConstIterator M = ModuleMgr.begin(),
|
||||
MEnd = ModuleMgr.end();
|
||||
M != MEnd; ++M)
|
||||
(*M)->dump();
|
||||
}
|
||||
|
||||
/// Return the amount of memory used by memory buffers, breaking down
|
||||
|
@ -5477,6 +5483,40 @@ Module::~Module() {
|
|||
delete static_cast<ASTSelectorLookupTable *>(SelectorLookupTable);
|
||||
}
|
||||
|
||||
template<typename Key, typename Offset, unsigned InitialCapacity>
|
||||
static void
|
||||
dumpLocalRemap(StringRef Name,
|
||||
const ContinuousRangeMap<Key, Offset, InitialCapacity> &Map) {
|
||||
if (Map.begin() == Map.end())
|
||||
return;
|
||||
|
||||
typedef ContinuousRangeMap<Key, Offset, InitialCapacity> MapType;
|
||||
llvm::errs() << " " << Name << ":\n";
|
||||
for (typename MapType::const_iterator I = Map.begin(), IEnd = Map.end();
|
||||
I != IEnd; ++I) {
|
||||
llvm::errs() << " " << I->first << " -> " << I->second
|
||||
<< "\n";
|
||||
}
|
||||
}
|
||||
|
||||
void Module::dump() {
|
||||
llvm::errs() << "\nModule: " << FileName << "\n";
|
||||
if (!Imports.empty()) {
|
||||
llvm::errs() << " Imports: ";
|
||||
for (unsigned I = 0, N = Imports.size(); I != N; ++I) {
|
||||
if (I)
|
||||
llvm::errs() << ", ";
|
||||
llvm::errs() << Imports[I]->FileName;
|
||||
}
|
||||
llvm::errs() << "\n";
|
||||
}
|
||||
|
||||
// Remapping tables.
|
||||
llvm::errs() << " Base source location offset: " << SLocEntryBaseOffset
|
||||
<< '\n';
|
||||
dumpLocalRemap("Source location offset map", SLocRemap);
|
||||
}
|
||||
|
||||
Module *ModuleManager::lookup(StringRef Name) {
|
||||
const FileEntry *Entry = FileMgr.getFile(Name);
|
||||
return Modules[Entry];
|
||||
|
|
Загрузка…
Ссылка в новой задаче