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