clang  10.0.0svn
Module.cpp
Go to the documentation of this file.
1 //===- Module.cpp - Module description ------------------------------------===//
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 implements the Module class, which describes a module that has
10 // been loaded from an AST file.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 #include "ASTReaderInternals.h"
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/Support/Compiler.h"
19 #include "llvm/Support/raw_ostream.h"
20 
21 using namespace clang;
22 using namespace serialization;
23 using namespace reader;
24 
26  delete static_cast<ASTIdentifierLookupTable *>(IdentifierLookupTable);
27  delete static_cast<HeaderFileInfoLookupTable *>(HeaderFileInfoTable);
28  delete static_cast<ASTSelectorLookupTable *>(SelectorLookupTable);
29 }
30 
31 template<typename Key, typename Offset, unsigned InitialCapacity>
32 static void
33 dumpLocalRemap(StringRef Name,
35  if (Map.begin() == Map.end())
36  return;
37 
39 
40  llvm::errs() << " " << Name << ":\n";
41  for (typename MapType::const_iterator I = Map.begin(), IEnd = Map.end();
42  I != IEnd; ++I) {
43  llvm::errs() << " " << I->first << " -> " << I->second << "\n";
44  }
45 }
46 
47 LLVM_DUMP_METHOD void ModuleFile::dump() {
48  llvm::errs() << "\nModule: " << FileName << "\n";
49  if (!Imports.empty()) {
50  llvm::errs() << " Imports: ";
51  for (unsigned I = 0, N = Imports.size(); I != N; ++I) {
52  if (I)
53  llvm::errs() << ", ";
54  llvm::errs() << Imports[I]->FileName;
55  }
56  llvm::errs() << "\n";
57  }
58 
59  // Remapping tables.
60  llvm::errs() << " Base source location offset: " << SLocEntryBaseOffset
61  << '\n';
62  dumpLocalRemap("Source location offset local -> global map", SLocRemap);
63 
64  llvm::errs() << " Base identifier ID: " << BaseIdentifierID << '\n'
65  << " Number of identifiers: " << LocalNumIdentifiers << '\n';
66  dumpLocalRemap("Identifier ID local -> global map", IdentifierRemap);
67 
68  llvm::errs() << " Base macro ID: " << BaseMacroID << '\n'
69  << " Number of macros: " << LocalNumMacros << '\n';
70  dumpLocalRemap("Macro ID local -> global map", MacroRemap);
71 
72  llvm::errs() << " Base submodule ID: " << BaseSubmoduleID << '\n'
73  << " Number of submodules: " << LocalNumSubmodules << '\n';
74  dumpLocalRemap("Submodule ID local -> global map", SubmoduleRemap);
75 
76  llvm::errs() << " Base selector ID: " << BaseSelectorID << '\n'
77  << " Number of selectors: " << LocalNumSelectors << '\n';
78  dumpLocalRemap("Selector ID local -> global map", SelectorRemap);
79 
80  llvm::errs() << " Base preprocessed entity ID: " << BasePreprocessedEntityID
81  << '\n'
82  << " Number of preprocessed entities: "
83  << NumPreprocessedEntities << '\n';
84  dumpLocalRemap("Preprocessed entity ID local -> global map",
85  PreprocessedEntityRemap);
86 
87  llvm::errs() << " Base type index: " << BaseTypeIndex << '\n'
88  << " Number of types: " << LocalNumTypes << '\n';
89  dumpLocalRemap("Type index local -> global map", TypeRemap);
90 
91  llvm::errs() << " Base decl ID: " << BaseDeclID << '\n'
92  << " Number of decls: " << LocalNumDecls << '\n';
93  dumpLocalRemap("Decl ID local -> global map", DeclRemap);
94 }
llvm::OnDiskChainedHashTable< HeaderFileInfoTrait > HeaderFileInfoLookupTable
The on-disk hash table used for known header files.
void dump()
Dump debugging output for this module.
Definition: Module.cpp:47
Dataflow Directional Tag Classes.
static void dumpLocalRemap(StringRef Name, const ContinuousRangeMap< Key, Offset, InitialCapacity > &Map)
Definition: Module.cpp:33
llvm::OnDiskChainedHashTable< ASTSelectorLookupTrait > ASTSelectorLookupTable
The on-disk hash table used for the global method pool.
A map from continuous integer ranges to some value, with a very specialized interface.
llvm::OnDiskIterableChainedHashTable< ASTIdentifierLookupTrait > ASTIdentifierLookupTable
The on-disk hash table used to contain information about all of the identifiers in the program...