r266254 - [modules] Remove CXX_CTOR_INITIALIZERS_OFFSETS table. Instead of storing an ID
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 13 14:57:08 PDT 2016
Author: rsmith
Date: Wed Apr 13 16:57:08 2016
New Revision: 266254
URL: http://llvm.org/viewvc/llvm-project?rev=266254&view=rev
Log:
[modules] Remove CXX_CTOR_INITIALIZERS_OFFSETS table. Instead of storing an ID
of a table entry in the corresponding decl, store an offset from the current
record to the relevant CXX_CTOR_INITIALIZERS record. This results in fewer
indirections and a minor .pcm file size reduction.
Modified:
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/include/clang/Serialization/ASTWriter.h
cfe/trunk/include/clang/Serialization/Module.h
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
cfe/trunk/lib/Serialization/Module.cpp
Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=266254&r1=266253&r2=266254&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Wed Apr 13 16:57:08 2016
@@ -2134,8 +2134,7 @@ public:
assert(I < getNumArrayIndices() && "Out of bounds member array index");
getTrailingObjects<VarDecl *>()[I] = Index;
}
- ArrayRef<VarDecl *> getArrayIndexes() {
- assert(getNumArrayIndices() != 0 && "Getting indexes for non-array init");
+ ArrayRef<VarDecl *> getArrayIndices() {
return llvm::makeArrayRef(getTrailingObjects<VarDecl *>(),
getNumArrayIndices());
}
Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=266254&r1=266253&r2=266254&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Wed Apr 13 16:57:08 2016
@@ -839,10 +839,10 @@ bool RecursiveASTVisitor<Derived>::Trave
if (Init->isWritten() || getDerived().shouldVisitImplicitCode())
TRY_TO(TraverseStmt(Init->getInit()));
- if (Init->getNumArrayIndices() && getDerived().shouldVisitImplicitCode())
- for (VarDecl *VD : Init->getArrayIndexes()) {
+ if (getDerived().shouldVisitImplicitCode())
+ for (VarDecl *VD : Init->getArrayIndices())
TRY_TO(TraverseDecl(VD));
- }
+
return true;
}
Modified: cfe/trunk/include/clang/Serialization/ASTBitCodes.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=266254&r1=266253&r2=266254&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Wed Apr 13 16:57:08 2016
@@ -573,9 +573,7 @@ namespace clang {
/// \brief Record code for potentially unused local typedef names.
UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES = 52,
- /// \brief Record code for the table of offsets to CXXCtorInitializers
- /// lists.
- CXX_CTOR_INITIALIZERS_OFFSETS = 53,
+ // ID 53 used to be a table of constructor initializer records.
/// \brief Delete expressions that will be analyzed later.
DELETE_EXPRS_TO_ANALYZE = 54,
Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=266254&r1=266253&r2=266254&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Wed Apr 13 16:57:08 2016
@@ -1971,11 +1971,6 @@ public:
ReadCXXCtorInitializers(ModuleFile &F, const RecordData &Record,
unsigned &Idx);
- /// \brief Read a CXXCtorInitializers ID from the given record and
- /// return its global bit offset.
- uint64_t ReadCXXCtorInitializersRef(ModuleFile &M, const RecordData &Record,
- unsigned &Idx);
-
/// \brief Read the contents of a CXXCtorInitializer array.
CXXCtorInitializer **GetExternalCXXCtorInitializers(uint64_t Offset) override;
Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=266254&r1=266253&r2=266254&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTWriter.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTWriter.h Wed Apr 13 16:57:08 2016
@@ -438,33 +438,6 @@ private:
/// in the order they should be written.
SmallVector<QueuedCXXBaseSpecifiers, 2> CXXBaseSpecifiersToWrite;
- /// \brief The offset of each CXXCtorInitializer list within the AST.
- SmallVector<uint32_t, 16> CXXCtorInitializersOffsets;
-
- /// \brief The first ID number we can use for our own ctor initializers.
- serialization::CXXCtorInitializersID FirstCXXCtorInitializersID;
-
- /// \brief The ctor initializers ID that will be assigned to the next new
- /// list of C++ ctor initializers.
- serialization::CXXCtorInitializersID NextCXXCtorInitializersID;
-
- /// \brief A set of C++ ctor initializers that is queued to be written
- /// into the AST file.
- struct QueuedCXXCtorInitializers {
- QueuedCXXCtorInitializers() : ID() {}
-
- QueuedCXXCtorInitializers(serialization::CXXCtorInitializersID ID,
- ArrayRef<CXXCtorInitializer*> Inits)
- : ID(ID), Inits(Inits) {}
-
- serialization::CXXCtorInitializersID ID;
- ArrayRef<CXXCtorInitializer*> Inits;
- };
-
- /// \brief Queue of C++ ctor initializers to be written to the AST file,
- /// in the order they should be written.
- SmallVector<QueuedCXXCtorInitializers, 2> CXXCtorInitializersToWrite;
-
/// \brief A mapping from each known submodule to its ID number, which will
/// be a positive integer.
llvm::DenseMap<Module *, unsigned> SubmoduleIDs;
@@ -494,7 +467,6 @@ private:
void WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag,
bool isModule);
void WriteCXXBaseSpecifiersOffsets();
- void WriteCXXCtorInitializersOffsets();
unsigned TypeExtQualAbbrev;
unsigned TypeFunctionProtoAbbrev;
@@ -660,11 +632,6 @@ public:
/// \brief Emit a UnresolvedSet structure.
void AddUnresolvedSet(const ASTUnresolvedSet &Set, RecordDataImpl &Record);
- /// \brief Emit the ID for a CXXCtorInitializer array and register the array
- /// for later serialization.
- void AddCXXCtorInitializersRef(ArrayRef<CXXCtorInitializer *> Inits,
- RecordDataImpl &Record);
-
/// \brief Add a string to the given record.
void AddString(StringRef Str, RecordDataImpl &Record);
@@ -703,15 +670,10 @@ public:
/// via \c AddCXXBaseSpecifiersRef().
void FlushCXXBaseSpecifiers();
- /// \brief Flush all of the C++ constructor initializer lists that have been
- /// added via \c AddCXXCtorInitializersRef().
- void FlushCXXCtorInitializers();
-
/// \brief Flush all pending records that are tacked onto the end of
/// decl and decl update records.
void FlushPendingAfterDecl() {
FlushCXXBaseSpecifiers();
- FlushCXXCtorInitializers();
}
/// \brief Record an ID for the given switch-case statement.
@@ -988,15 +950,8 @@ public:
/// \brief Emit a C++ base specifier.
void AddCXXBaseSpecifier(const CXXBaseSpecifier &Base);
- /// \brief Emit the ID for a CXXCtorInitializer array and register the array
- /// for later serialization.
- void AddCXXCtorInitializersRef(ArrayRef<CXXCtorInitializer *> Inits) {
- return Writer->AddCXXCtorInitializersRef(Inits, *Record);
- }
-
/// \brief Emit a CXXCtorInitializer array.
- void AddCXXCtorInitializers(const CXXCtorInitializer *const *CtorInitializers,
- unsigned NumCtorInitializers);
+ void AddCXXCtorInitializers(ArrayRef<CXXCtorInitializer*> CtorInits);
void AddCXXDefinitionData(const CXXRecordDecl *D);
Modified: cfe/trunk/include/clang/Serialization/Module.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/Module.h?rev=266254&r1=266253&r2=266254&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/Module.h (original)
+++ cfe/trunk/include/clang/Serialization/Module.h Wed Apr 13 16:57:08 2016
@@ -406,13 +406,6 @@ public:
/// indexed by the C++ base specifier set ID (-1).
const uint32_t *CXXBaseSpecifiersOffsets;
- /// \brief The number of C++ ctor initializer lists in this AST file.
- unsigned LocalNumCXXCtorInitializers;
-
- /// \brief Offset of each C++ ctor initializer list within the bitstream,
- /// indexed by the C++ ctor initializer list ID minus 1.
- const uint32_t *CXXCtorInitializersOffsets;
-
/// \brief Array of file-level DeclIDs sorted by file.
const serialization::DeclID *FileSortedDecls;
unsigned NumFileSortedDecls;
Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=266254&r1=266253&r2=266254&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Wed Apr 13 16:57:08 2016
@@ -746,7 +746,7 @@ static void EmitMemberInitializer(CodeGe
ArrayRef<VarDecl *> ArrayIndexes;
if (MemberInit->getNumArrayIndices())
- ArrayIndexes = MemberInit->getArrayIndexes();
+ ArrayIndexes = MemberInit->getArrayIndices();
CGF.EmitInitializerForField(Field, LHS, MemberInit->getInit(), ArrayIndexes);
}
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=266254&r1=266253&r2=266254&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Wed Apr 13 16:57:08 2016
@@ -3064,17 +3064,6 @@ ASTReader::ReadASTBlock(ModuleFile &F, u
break;
}
- case CXX_CTOR_INITIALIZERS_OFFSETS: {
- if (F.LocalNumCXXCtorInitializers != 0) {
- Error("duplicate CXX_CTOR_INITIALIZERS_OFFSETS record in AST file");
- return Failure;
- }
-
- F.LocalNumCXXCtorInitializers = Record[0];
- F.CXXCtorInitializersOffsets = (const uint32_t *)Blob.data();
- break;
- }
-
case DIAG_PRAGMA_MAPPINGS:
if (F.PragmaDiagMappings.empty())
F.PragmaDiagMappings.swap(Record);
@@ -6303,18 +6292,6 @@ void ASTReader::CompleteRedeclChain(cons
}
}
-uint64_t ASTReader::ReadCXXCtorInitializersRef(ModuleFile &M,
- const RecordData &Record,
- unsigned &Idx) {
- if (Idx >= Record.size() || Record[Idx] > M.LocalNumCXXCtorInitializers) {
- Error("malformed AST file: missing C++ ctor initializers");
- return 0;
- }
-
- unsigned LocalID = Record[Idx++];
- return getGlobalBitOffset(M, M.CXXCtorInitializersOffsets[LocalID - 1]);
-}
-
CXXCtorInitializer **
ASTReader::GetExternalCXXCtorInitializers(uint64_t Offset) {
RecordLocation Loc = getLocalBitOffset(Offset);
Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=266254&r1=266253&r2=266254&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Wed Apr 13 16:57:08 2016
@@ -59,6 +59,11 @@ namespace clang {
return LocalOffset ? Offset - LocalOffset : 0;
}
+ uint64_t ReadGlobalOffset(ModuleFile &F, const RecordData &R, unsigned &I) {
+ uint64_t Local = ReadLocalOffset(R, I);
+ return Local ? Reader.getGlobalBitOffset(F, Local) : 0;
+ }
+
SourceLocation ReadSourceLocation(const RecordData &R, unsigned &I) {
return Reader.ReadSourceLocation(F, R, I);
}
@@ -472,8 +477,7 @@ void ASTDeclReader::Visit(Decl *D) {
if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
CD->NumCtorInitializers = Record[Idx++];
if (CD->NumCtorInitializers)
- CD->CtorInitializers =
- Reader.ReadCXXCtorInitializersRef(F, Record, Idx);
+ CD->CtorInitializers = ReadGlobalOffset(F, Record, Idx);
}
Reader.PendingBodies[FD] = GetCurrentCursorOffset();
HasPendingBody = true;
@@ -1137,7 +1141,7 @@ void ASTDeclReader::VisitObjCImplementat
D->setHasDestructors(Record[Idx++]);
D->NumIvarInitializers = Record[Idx++];
if (D->NumIvarInitializers)
- D->IvarInitializers = Reader.ReadCXXCtorInitializersRef(F, Record, Idx);
+ D->IvarInitializers = ReadGlobalOffset(F, Record, Idx);
}
void ASTDeclReader::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {
@@ -3745,8 +3749,7 @@ void ASTDeclReader::UpdateDecl(Decl *D,
if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
CD->NumCtorInitializers = Record[Idx++];
if (CD->NumCtorInitializers)
- CD->CtorInitializers =
- Reader.ReadCXXCtorInitializersRef(F, Record, Idx);
+ CD->CtorInitializers = ReadGlobalOffset(F, Record, Idx);
}
// Store the offset of the body so we can lazily load it later.
Reader.PendingBodies[FD] = GetCurrentCursorOffset();
Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=266254&r1=266253&r2=266254&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Wed Apr 13 16:57:08 2016
@@ -983,7 +983,6 @@ void ASTWriter::WriteBlockInfoBlock() {
RECORD(MSSTRUCT_PRAGMA_OPTIONS);
RECORD(POINTERS_TO_MEMBERS_PRAGMA_OPTIONS);
RECORD(UNUSED_LOCAL_TYPEDEF_NAME_CANDIDATES);
- RECORD(CXX_CTOR_INITIALIZERS_OFFSETS);
RECORD(DELETE_EXPRS_TO_ANALYZE);
// SourceManager Block.
@@ -2725,26 +2724,6 @@ void ASTWriter::WritePragmaDiagnosticMap
Stream.EmitRecord(DIAG_PRAGMA_MAPPINGS, Record);
}
-void ASTWriter::WriteCXXCtorInitializersOffsets() {
- if (CXXCtorInitializersOffsets.empty())
- return;
-
- // Create a blob abbreviation for the C++ ctor initializer offsets.
- using namespace llvm;
-
- auto *Abbrev = new BitCodeAbbrev();
- Abbrev->Add(BitCodeAbbrevOp(CXX_CTOR_INITIALIZERS_OFFSETS));
- Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // size
- Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
- unsigned CtorInitializersOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
-
- // Write the base specifier offsets table.
- RecordData::value_type Record[] = {CXX_CTOR_INITIALIZERS_OFFSETS,
- CXXCtorInitializersOffsets.size()};
- Stream.EmitRecordWithBlob(CtorInitializersOffsetAbbrev, Record,
- bytes(CXXCtorInitializersOffsets));
-}
-
void ASTWriter::WriteCXXBaseSpecifiersOffsets() {
if (CXXBaseSpecifiersOffsets.empty())
return;
@@ -4116,7 +4095,7 @@ ASTWriter::ASTWriter(
FirstSelectorID(NUM_PREDEF_SELECTOR_IDS), NextSelectorID(FirstSelectorID),
NumStatements(0), NumMacros(0),
NumLexicalDeclContexts(0), NumVisibleDeclContexts(0),
- NextCXXBaseSpecifiersID(1), NextCXXCtorInitializersID(1),
+ NextCXXBaseSpecifiersID(1),
TypeExtQualAbbrev(0), TypeFunctionProtoAbbrev(0), DeclParmVarAbbrev(0),
DeclContextLexicalAbbrev(0), DeclContextVisibleLookupAbbrev(0),
UpdateVisibleAbbrev(0), DeclRecordAbbrev(0), DeclTypedefAbbrev(0),
@@ -4518,7 +4497,6 @@ uint64_t ASTWriter::WriteASTCore(Sema &S
if (!DeclUpdatesOffsetsRecord.empty())
Stream.EmitRecord(DECL_UPDATE_OFFSETS, DeclUpdatesOffsetsRecord);
WriteCXXBaseSpecifiersOffsets();
- WriteCXXCtorInitializersOffsets();
WriteFileDeclIDsMap();
WriteSourceManagerBlock(Context.getSourceManager(), PP);
WriteComments();
@@ -4899,14 +4877,6 @@ void ASTWriter::AddCXXTemporary(const CX
AddDeclRef(Temp->getDestructor(), Record);
}
-void ASTWriter::AddCXXCtorInitializersRef(ArrayRef<CXXCtorInitializer *> Inits,
- RecordDataImpl &Record) {
- assert(!Inits.empty() && "Empty ctor initializer sets are not recorded");
- CXXCtorInitializersToWrite.push_back(
- QueuedCXXCtorInitializers(NextCXXCtorInitializersID, Inits));
- Record.push_back(NextCXXCtorInitializersID++);
-}
-
void ASTWriter::AddCXXBaseSpecifiersRef(CXXBaseSpecifier const *Bases,
CXXBaseSpecifier const *BasesEnd,
RecordDataImpl &Record) {
@@ -5488,69 +5458,50 @@ void ASTWriter::FlushCXXBaseSpecifiers()
}
// FIXME: Move this out of the main ASTRecordWriter interface.
-void ASTRecordWriter::AddCXXCtorInitializers(
- const CXXCtorInitializer *const *CtorInitializers,
- unsigned NumCtorInitializers) {
- Record->push_back(NumCtorInitializers);
- for (unsigned i=0; i != NumCtorInitializers; ++i) {
- const CXXCtorInitializer *Init = CtorInitializers[i];
+static uint64_t
+EmitCXXCtorInitializers(ASTWriter &W,
+ ArrayRef<CXXCtorInitializer *> CtorInits) {
+ ASTWriter::RecordData Record;
+ ASTRecordWriter Writer(W, Record);
+ Writer.push_back(CtorInits.size());
+ for (auto *Init : CtorInits) {
if (Init->isBaseInitializer()) {
- Record->push_back(CTOR_INITIALIZER_BASE);
- AddTypeSourceInfo(Init->getTypeSourceInfo());
- Record->push_back(Init->isBaseVirtual());
+ Writer.push_back(CTOR_INITIALIZER_BASE);
+ Writer.AddTypeSourceInfo(Init->getTypeSourceInfo());
+ Writer.push_back(Init->isBaseVirtual());
} else if (Init->isDelegatingInitializer()) {
- Record->push_back(CTOR_INITIALIZER_DELEGATING);
- AddTypeSourceInfo(Init->getTypeSourceInfo());
+ Writer.push_back(CTOR_INITIALIZER_DELEGATING);
+ Writer.AddTypeSourceInfo(Init->getTypeSourceInfo());
} else if (Init->isMemberInitializer()){
- Record->push_back(CTOR_INITIALIZER_MEMBER);
- AddDeclRef(Init->getMember());
+ Writer.push_back(CTOR_INITIALIZER_MEMBER);
+ Writer.AddDeclRef(Init->getMember());
} else {
- Record->push_back(CTOR_INITIALIZER_INDIRECT_MEMBER);
- AddDeclRef(Init->getIndirectMember());
+ Writer.push_back(CTOR_INITIALIZER_INDIRECT_MEMBER);
+ Writer.AddDeclRef(Init->getIndirectMember());
}
- AddSourceLocation(Init->getMemberLocation());
- AddStmt(Init->getInit());
- AddSourceLocation(Init->getLParenLoc());
- AddSourceLocation(Init->getRParenLoc());
- Record->push_back(Init->isWritten());
+ Writer.AddSourceLocation(Init->getMemberLocation());
+ Writer.AddStmt(Init->getInit());
+ Writer.AddSourceLocation(Init->getLParenLoc());
+ Writer.AddSourceLocation(Init->getRParenLoc());
+ Writer.push_back(Init->isWritten());
if (Init->isWritten()) {
- Record->push_back(Init->getSourceOrder());
+ Writer.push_back(Init->getSourceOrder());
} else {
- Record->push_back(Init->getNumArrayIndices());
- for (unsigned i=0, e=Init->getNumArrayIndices(); i != e; ++i)
- AddDeclRef(Init->getArrayIndex(i));
+ Writer.push_back(Init->getNumArrayIndices());
+ for (auto *VD : Init->getArrayIndices())
+ Writer.AddDeclRef(VD);
}
}
-}
-
-void ASTWriter::FlushCXXCtorInitializers() {
- RecordData Record;
-
- unsigned N = CXXCtorInitializersToWrite.size();
- (void)N; // Silence unused warning in non-assert builds.
- for (auto &Init : CXXCtorInitializersToWrite) {
- Record.clear();
-
- ASTRecordWriter Writer(*this, Record);
- Writer.AddCXXCtorInitializers(Init.Inits.data(), Init.Inits.size());
- uint64_t Offset = Writer.Emit(serialization::DECL_CXX_CTOR_INITIALIZERS);
- // Record the offset of this mem-initializer list.
- unsigned Index = Init.ID - 1;
- if (Index == CXXCtorInitializersOffsets.size())
- CXXCtorInitializersOffsets.push_back(Offset);
- else {
- if (Index > CXXCtorInitializersOffsets.size())
- CXXCtorInitializersOffsets.resize(Index + 1);
- CXXCtorInitializersOffsets[Index] = Offset;
- }
- }
+ return Writer.Emit(serialization::DECL_CXX_CTOR_INITIALIZERS);
+}
- assert(N == CXXCtorInitializersToWrite.size() &&
- "added more ctor initializers while writing ctor initializers");
- CXXCtorInitializersToWrite.clear();
+// FIXME: Move this out of the main ASTRecordWriter interface.
+void ASTRecordWriter::AddCXXCtorInitializers(
+ ArrayRef<CXXCtorInitializer *> CtorInits) {
+ AddOffset(EmitCXXCtorInitializers(*Writer, CtorInits));
}
void ASTRecordWriter::AddCXXDefinitionData(const CXXRecordDecl *D) {
Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=266254&r1=266253&r2=266254&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Wed Apr 13 16:57:08 2016
@@ -823,7 +823,7 @@ void ASTDeclWriter::VisitObjCImplementat
Record.push_back(D->hasDestructors());
Record.push_back(D->NumIvarInitializers);
if (D->NumIvarInitializers)
- Record.AddCXXCtorInitializersRef(
+ Record.AddCXXCtorInitializers(
llvm::makeArrayRef(D->init_begin(), D->init_end()));
Code = serialization::DECL_OBJC_IMPLEMENTATION;
}
@@ -2177,7 +2177,7 @@ void ASTRecordWriter::AddFunctionDefinit
if (auto *CD = dyn_cast<CXXConstructorDecl>(FD)) {
Record->push_back(CD->getNumCtorInitializers());
if (CD->getNumCtorInitializers())
- AddCXXCtorInitializersRef(
+ AddCXXCtorInitializers(
llvm::makeArrayRef(CD->init_begin(), CD->init_end()));
}
AddStmt(FD->getBody());
Modified: cfe/trunk/lib/Serialization/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/Module.cpp?rev=266254&r1=266253&r2=266254&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/Module.cpp (original)
+++ cfe/trunk/lib/Serialization/Module.cpp Wed Apr 13 16:57:08 2016
@@ -38,7 +38,6 @@ ModuleFile::ModuleFile(ModuleKind Kind,
SelectorLookupTableData(nullptr), SelectorLookupTable(nullptr),
LocalNumDecls(0), DeclOffsets(nullptr), BaseDeclID(0),
LocalNumCXXBaseSpecifiers(0), CXXBaseSpecifiersOffsets(nullptr),
- LocalNumCXXCtorInitializers(0), CXXCtorInitializersOffsets(nullptr),
FileSortedDecls(nullptr), NumFileSortedDecls(0),
ObjCCategoriesMap(nullptr), LocalNumObjCCategoriesInMap(0),
LocalNumTypes(0), TypeOffsets(nullptr), BaseTypeIndex(0)
More information about the cfe-commits
mailing list