[cfe-commits] [PATCH] Clean up CXX Base Specifiers in AST reader
Douglas Gregor
dgregor at apple.com
Thu Jul 21 12:20:00 PDT 2011
On Jul 21, 2011, at 11:51 AM, Jonathan Turner wrote:
> Cleaning up more of the ID situation in the AST reader. This patch relaxes and generalizes how CXX base specifiers are identified and loaded by using a ContinuousRangeMap.
+ typedef ContinuousRangeMap<serialization::CXXBaseSpecifiersID,
+ std::pair<PerFileData *,
+ std::pair<uint64_t, int32_t> >, 4>
+ GlobalCXXBaseSpecifiersMapType;
Usually, once we hit nested pairs, it's better just to introduce a named structure… however, I have a different comment that addresses the problem.
@@ -787,6 +797,9 @@
/// \brief The total number of method pool entries in the selector table.
unsigned TotalNumMethodPoolEntries;
+ /// Number of CXX base specifiers currently loaded
+ unsigned TotalCXXBaseSizeInBits;
+
/// Number of lexical decl contexts read/total.
unsigned NumLexicalDeclContextsRead, TotalLexicalDeclContexts;
The comment here is incorrect, and I think this should be a uint64_t.
More importantly, the idea of keeping track of the # of bits loaded applies more generally. For example, note how ASTReader::LoadMacroDefinition() does a global -> local mapping on a bit offset.
So, I suggest making two ContinuousRangeMaps: one for actually mapping the base specifier IDs (for indexing purposes) and another for mapping from global bit numbers (a uint64_t) to local bit numbers. Loading a CXXBaseSpecifier will look in both maps (which is fine), and the second map will be useful in other places as well.
- Doug
More information about the cfe-commits
mailing list