summaryrefslogtreecommitdiffstats
path: root/include/clang/Serialization
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-07-26 06:37:51 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-07-26 06:37:51 +0000
commit82ab1c51c0cfeca6081667771771439a227919fe (patch)
treed9160b6137d1ba37390a45e475c140299f8f5512 /include/clang/Serialization
parent9bca33e072f375f88ad54b0884b3a0674c6a0236 (diff)
[modules] Improve abbreviations for C++:
* Add abbreviation for CXXMethodDecl and for FunctionProtoType. These come up a *lot* in C++ modules. * Allow typedef declarations to use the abbreviation if they're class members, or if they're used. In passing, add more record name records for Clang AST node kinds. The downside is that we had already used up our allotment of 12 abbreviations, so this pushes us to an extra bit on each record to support the extra abbrev kinds, which increases file size by ~1%. This patch *barely* pays for that through the other improvements, but we've got room for another 18 abbrevs, so we should be able to make it much more profitable with future changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214024 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Serialization')
-rw-r--r--include/clang/Serialization/ASTBitCodes.h3
-rw-r--r--include/clang/Serialization/ASTWriter.h16
2 files changed, 15 insertions, 4 deletions
diff --git a/include/clang/Serialization/ASTBitCodes.h b/include/clang/Serialization/ASTBitCodes.h
index 7541f24ce5..2b18380cc9 100644
--- a/include/clang/Serialization/ASTBitCodes.h
+++ b/include/clang/Serialization/ASTBitCodes.h
@@ -759,9 +759,6 @@ namespace clang {
/// NUM_PREDEF_TYPE_IDs.
const unsigned NUM_PREDEF_TYPE_IDS = 100;
- /// \brief The number of allowed abbreviations in bits
- const unsigned NUM_ALLOWED_ABBREVS_SIZE = 4;
-
/// \brief Record codes for each kind of type.
///
/// These constants describe the type records that can occur within a
diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h
index ad6ecdd351..8ecdda40a8 100644
--- a/include/clang/Serialization/ASTWriter.h
+++ b/include/clang/Serialization/ASTWriter.h
@@ -466,7 +466,12 @@ private:
void WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag,
bool isModule);
void WriteCXXBaseSpecifiersOffsets();
+
+ unsigned TypeExtQualAbbrev;
+ unsigned TypeFunctionProtoAbbrev;
+ void WriteTypeAbbrevs();
void WriteType(QualType T);
+
uint32_t GenerateNameLookupTable(const DeclContext *DC,
llvm::SmallVectorImpl<char> &LookupTable);
uint64_t WriteDeclContextLexicalBlock(ASTContext &Context, DeclContext *DC);
@@ -503,8 +508,9 @@ private:
unsigned DeclFieldAbbrev;
unsigned DeclEnumAbbrev;
unsigned DeclObjCIvarAbbrev;
+ unsigned DeclCXXMethodAbbrev;
- void WriteDeclsBlockAbbrevs();
+ void WriteDeclAbbrevs();
void WriteDecl(ASTContext &Context, Decl *D);
void AddFunctionDefinition(const FunctionDecl *FD, RecordData &Record);
@@ -731,6 +737,13 @@ public:
void ClearSwitchCaseIDs();
+ unsigned getTypeExtQualAbbrev() const {
+ return TypeExtQualAbbrev;
+ }
+ unsigned getTypeFunctionProtoAbbrev() const {
+ return TypeFunctionProtoAbbrev;
+ }
+
unsigned getDeclParmVarAbbrev() const { return DeclParmVarAbbrev; }
unsigned getDeclRefExprAbbrev() const { return DeclRefExprAbbrev; }
unsigned getCharacterLiteralAbbrev() const { return CharacterLiteralAbbrev; }
@@ -741,6 +754,7 @@ public:
unsigned getDeclFieldAbbrev() const { return DeclFieldAbbrev; }
unsigned getDeclEnumAbbrev() const { return DeclEnumAbbrev; }
unsigned getDeclObjCIvarAbbrev() const { return DeclObjCIvarAbbrev; }
+ unsigned getDeclCXXMethodAbbrev() const { return DeclCXXMethodAbbrev; }
bool hasChain() const { return Chain; }