/// \brief The number of macros de-serialized from the PCH file.
unsigned NumMacrosRead;
+
/// \brief The total number of macros stored in the PCH file.
unsigned TotalNumMacros;
+ /// Number of lexical decl contexts read/total.
+ unsigned NumLexicalDeclContextsRead, TotalLexicalDeclContexts;
+
+ /// Number of visible decl contexts read/total.
+ unsigned NumVisibleDeclContextsRead, TotalVisibleDeclContexts;
+
/// \brief FIXME: document!
llvm::SmallVector<uint64_t, 4> SpecialTypes;
explicit PCHReader(Preprocessor &PP, ASTContext &Context)
: SemaObj(0), PP(PP), Context(Context), Consumer(0),
- IdentifierTableData(0), NumStatementsRead(0) { }
+ IdentifierTableData(0), NumStatementsRead(0), NumMacrosRead(0),
+ NumLexicalDeclContextsRead(0), NumVisibleDeclContextsRead(0) { }
~PCHReader() {}
/// \brief The number of macros written to the PCH file.
unsigned NumMacros;
+ /// \brief The number of lexical declcontexts written to the PCH
+ /// file.
+ unsigned NumLexicalDeclContexts;
+
+ /// \brief The number of visible declcontexts written to the PCH
+ /// file.
+ unsigned NumVisibleDeclContexts;
+
void WriteTargetTriple(const TargetInfo &Target);
void WriteLanguageOptions(const LangOptions &LangOpts);
void WriteSourceManagerBlock(SourceManager &SourceMgr);
case pch::STATISTICS:
TotalNumStatements = Record[0];
TotalNumMacros = Record[1];
+ TotalLexicalDeclContexts = Record[2];
+ TotalVisibleDeclContexts = Record[3];
break;
case pch::TENTATIVE_DEFINITIONS:
// Load all of the declaration IDs
Decls.clear();
Decls.insert(Decls.end(), Record.begin(), Record.end());
+ ++NumLexicalDeclContextsRead;
return false;
}
LoadedDecls.push_back(Record[Idx++]);
}
+ ++NumVisibleDeclContextsRead;
return false;
}
std::fprintf(stderr, " %u/%u macros read (%f%%)\n",
NumMacrosRead, TotalNumMacros,
((float)NumMacrosRead/TotalNumMacros * 100));
+ std::fprintf(stderr, " %u/%u lexical declcontexts read (%f%%)\n",
+ NumLexicalDeclContextsRead, TotalLexicalDeclContexts,
+ ((float)NumLexicalDeclContextsRead/TotalLexicalDeclContexts
+ * 100));
+ std::fprintf(stderr, " %u/%u visible declcontexts read (%f%%)\n",
+ NumVisibleDeclContextsRead, TotalVisibleDeclContexts,
+ ((float)NumVisibleDeclContextsRead/TotalVisibleDeclContexts
+ * 100));
std::fprintf(stderr, "\n");
}
D != DEnd; ++D)
AddDeclRef(*D, Record);
+ ++NumLexicalDeclContexts;
Stream.EmitRecord(pch::DECL_CONTEXT_LEXICAL, Record);
return Offset;
}
return 0;
Stream.EmitRecord(pch::DECL_CONTEXT_VISIBLE, Record);
+ ++NumVisibleDeclContexts;
return Offset;
}
PCHWriter::PCHWriter(llvm::BitstreamWriter &Stream)
: Stream(Stream), NextTypeID(pch::NUM_PREDEF_TYPE_IDS),
- NumStatements(0), NumMacros(0) { }
+ NumStatements(0), NumMacros(0), NumLexicalDeclContexts(0),
+ NumVisibleDeclContexts(0) { }
void PCHWriter::WritePCH(Sema &SemaRef) {
ASTContext &Context = SemaRef.Context;
Record.clear();
Record.push_back(NumStatements);
Record.push_back(NumMacros);
+ Record.push_back(NumLexicalDeclContexts);
+ Record.push_back(NumVisibleDeclContexts);
Stream.EmitRecord(pch::STATISTICS, Record);
Stream.ExitBlock();
}