<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Sep 9, 2015, at 1:35 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Wed, Sep 9, 2015 at 1:28 PM, Mehdi Amini <span dir="ltr" class=""><<a href="mailto:mehdi.amini@apple.com" target="_blank" class="">mehdi.amini@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hi David,<div class=""><br class=""></div><div class="">Thanks for the review.</div><div class=""><br class=""></div><div class=""><br class=""><div class=""><div class=""><div class=""><div class="h5"><blockquote type="cite" class=""><div class="">On Sep 9, 2015, at 1:14 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank" class="">dblaikie@gmail.com</a>> wrote:</div><br class=""><div class=""><br class=""><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" class=""><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">On Wed, Sep 9, 2015 at 1:08 PM, Mehdi Amini via cfe-commits<span class=""> </span><span dir="ltr" class=""><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a>></span><span class=""> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: mehdi_amini<br class="">Date: Wed Sep 9 15:08:51 2015<br class="">New Revision: 247179<br class=""><br class="">URL:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project?rev=247179&view=rev" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=247179&view=rev</a><br class="">Log:<br class="">EmitRecordWith* API change: takes an ArrayRef instead of a SmallVector (NFC)<br class=""><br class="">From: Mehdi Amini <<a href="mailto:mehdi.amini@apple.com" target="_blank" class="">mehdi.amini@apple.com</a>><br class=""><br class="">Modified:<br class=""> <span class=""> </span>cfe/trunk/include/clang/Serialization/ASTWriter.h<br class=""> <span class=""> </span>cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp<br class=""> <span class=""> </span>cfe/trunk/lib/Serialization/ASTWriter.cpp<br class=""> <span class=""> </span>cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp<br class=""><br class="">Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h<br class="">URL:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=247179&r1=247178&r2=247179&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=247179&r1=247178&r2=247179&view=diff</a><br class="">==============================================================================<br class="">--- cfe/trunk/include/clang/Serialization/ASTWriter.h (original)<br class="">+++ cfe/trunk/include/clang/Serialization/ASTWriter.h Wed Sep 9 15:08:51 2015<br class="">@@ -84,6 +84,7 @@ class ASTWriter : public ASTDeserializat<br class=""> public:<br class=""> typedef SmallVector<uint64_t, 64> RecordData;<br class=""> typedef SmallVectorImpl<uint64_t> RecordDataImpl;<br class="">+ typedef ArrayRef<uint64_t> RecordDataRef;<br class=""><br class=""> friend class ASTDeclWriter;<br class=""> friend class ASTStmtWriter;<br class="">@@ -756,7 +757,7 @@ public:<br class=""> void AddPath(StringRef Path, RecordDataImpl &Record);<br class=""><br class=""> /// \brief Emit the current record with the given path as a blob.<br class="">- void EmitRecordWithPath(unsigned Abbrev, RecordDataImpl &Record,<br class="">+ void EmitRecordWithPath(unsigned Abbrev, const RecordDataRef &Record,<br class=""></blockquote><div class=""><br class=""></div><div class="">ArrayRefs are generally passed by value, like StringRefs.</div></div></div></blockquote><div class=""><br class=""></div></div></div><div class="">Good point, will update.</div><div class=""><div class="h5"><div class=""><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> StringRef Path);<br class=""><br class=""> /// \brief Add a version tuple to the given record<br class=""><br class="">Modified: cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp<br class="">URL:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp?rev=247179&r1=247178&r2=247179&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp?rev=247179&r1=247178&r2=247179&view=diff</a><br class="">==============================================================================<br class="">--- cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp (original)<br class="">+++ cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp Wed Sep 9 15:08:51 2015<br class="">@@ -51,6 +51,7 @@ public:<br class=""><br class=""> typedef SmallVector<uint64_t, 64> RecordData;<br class=""> typedef SmallVectorImpl<uint64_t> RecordDataImpl;<br class="">+typedef ArrayRef<uint64_t> RecordDataRef;<br class=""><br class=""> class SDiagsWriter;<br class=""><br class="">@@ -393,13 +394,9 @@ unsigned SDiagsWriter::getEmitFile(const<br class=""><br class=""> // Lazily generate the record for the file.<br class=""> entry = State->Files.size();<br class="">- RecordData Record;<br class="">- Record.push_back(RECORD_FILENAME);<br class="">- Record.push_back(entry);<br class="">- Record.push_back(0); // For legacy.<br class="">- Record.push_back(0); // For legacy.<br class=""> StringRef Name(FileName);<br class="">- Record.push_back(Name.size());<br class="">+ RecordDataRef Record = {RECORD_FILENAME, entry, 0 /* For legacy */,<br class="">+ 0 /* For legacy */, Name.size()};<br class=""></blockquote><div class=""><br class=""></div><div class="">I imagine this would produce a dangling reference, maybe? (the temporary initializer_list would go out-of-scope at the end of the full expression?) But I don't fully understand initializer_lists, to be fair.</div></div></div></blockquote><div class=""><br class=""></div></div></div><div class="">It is possible, my initial patch was initializing a raw array, but it requires the makeArrayRef().</div><div class="">I’ll try to look into the details here.</div></div></div></div></div></blockquote></div></div></div></div></blockquote><div><br class=""></div><div>Double checked the doc for initializer_list and you’re right about lifetime (I didn’t have much hope anyway). </div><div>I hope it is the reason the linux bots were broken...</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class=""><span class=""><div class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> State->Stream.EmitRecordWithBlob(State->Abbrevs.get(RECORD_FILENAME), Record,<br class=""> <span class=""> </span>Name);<br class=""><br class="">@@ -412,7 +409,7 @@ void SDiagsWriter::EmitCharSourceRange(C<br class=""> State->Record.push_back(RECORD_SOURCE_RANGE);<br class=""> AddCharSourceRangeToRecord(R, State->Record, SM);<br class=""> State->Stream.EmitRecordWithAbbrev(State->Abbrevs.get(RECORD_SOURCE_RANGE),<br class="">- State->Record);<br class="">+ makeArrayRef(State->Record));<br class=""></blockquote><div class=""><br class=""></div><div class="">What type is State->Record & why isn't it implicitly convertible to ArrayRef?</div></div></div></blockquote><div class=""><br class=""></div></span><div class="">It is a SmallVector, and the explicit conversion is needed because EmitRecordWithAbbrev is templated, and the template can’t be deduced if you don’t supply an ArrayRef:</div><div class=""><br class=""></div><div class=""><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(4,51,255)" class=""><span style="" class=""> </span>template<span style="" class=""> <</span>typename<span style="" class=""> uintty></span></div><div style="margin:0px;font-size:11px;font-family:Menlo" class=""> <span style="color:#0433ff" class="">void</span> EmitRecordWithAbbrev(<span style="color:#0433ff" class="">unsigned</span> Abbrev, <span style="color:#0433ff" class="">const</span> <span style="color:#3495af" class="">ArrayRef</span><uintty> &Vals)</div><div class=""><br class=""></div><div class="">An alternative would be to provide an overload for SmallVector, I’ll try to do:</div><div class=""><br class=""></div></div><div class=""><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(4,51,255)" class=""><span style="" class=""> </span>template<span style="" class=""> <</span>typename<span style="" class=""> uintty></span></div><div style="margin:0px;font-size:11px;font-family:Menlo" class=""> <span style="color:rgb(4,51,255)" class="">void</span> EmitRecordWithAbbrev(<span style="color:rgb(4,51,255)" class="">unsigned</span> Abbrev, <span style="color:rgb(4,51,255)" class="">const</span> <span style="color:rgb(52,149,175)" class="">SmallVectorImpl</span><uintty> &Vals)</div><div class=""><br class=""></div></div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">Based on your comments and Teresa's I see what you mean.<br class=""><br class="">So there are a few options... <br class=""><br class="">The simplest/heavy-handiest would be to change the template parameter for all these functions from "ArrayRef<uintty>" to "const RandomAccessSequence&" (where RandomAccessSequence is the template parameter, instead of uintty).<br class="">Then it can be used with any container that provides random access ([], size, begin/end, etc).<br class=""><br class="">I'm not sure if that's necessary/worthwhile. In theory I guess all the wrapper utility functions could be changed to use this sort of broad template and the final implementation function could stay the same way (or could, itself, have a single wrapper: template<typename Container> void EmitRecordWith*Impl(..., const Container& C) { EmitRecordWith*Impl(..., makeArrayRef(C)); }, etc… <br class=""></div></div></div></div></div></blockquote><div><br class=""></div><div>I like the idea of going with: template<typename Container> and using makeArrayRef() instead of template<typename uintty>.</div><div><br class=""></div><div>— </div><div>Mehdi</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">(the problem is that given SmallVector<int>, the call to the function template cannot deduce the template parameter seen in ArrayRef<T>, SmallVector<int> doesn't 'match' ArrayRef<T> (because SmallVector isn't ArrayRef) - it doesn't use user-defined conversions to reach ArrayRef<int> and then deduce T == int)</div></div></div></div></div></blockquote><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class=""><div class=""><div class=""></div></div><span class=""><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> }<br class=""><br class=""> /// \brief Emits the preamble of the diagnostics file.<br class="">@@ -531,14 +528,11 @@ void SDiagsWriter::EmitBlockInfoBlock()<br class=""><br class=""> void SDiagsWriter::EmitMetaBlock() {<br class=""> llvm::BitstreamWriter &Stream = State->Stream;<br class="">- RecordData &Record = State->Record;<br class=""> AbbreviationMap &Abbrevs = State->Abbrevs;<br class=""><br class=""> Stream.EnterSubblock(BLOCK_META, 3);<br class="">- Record.clear();<br class="">- Record.push_back(RECORD_VERSION);<br class="">- Record.push_back(VersionNumber);<br class="">- Stream.EmitRecordWithAbbrev(Abbrevs.get(RECORD_VERSION), Record);<br class="">+ RecordDataRef Record = {RECORD_VERSION, VersionNumber};<br class=""></blockquote><div class=""><br class=""></div><div class="">Same (possible) lifetime issue here. (and several other cases through this change).<br class=""><br class="">Even if there isn't a lifetime issue, I'd probably just pass these directly, rather than creating a named variable anyway. Probably.</div></div></div></blockquote><div class=""><br class=""></div></span><div class="">I was not sure about readability of doing this, some of the call sites have ~10 elements in the array.</div><div class=""><br class=""></div><div class="">— </div><span class="HOEnZb"><font color="#888888" class=""><div class="">Mehdi</div></font></span><div class=""><div class="h5"><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div class=""> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">+ Stream.EmitRecordWithAbbrev(Abbrevs.get(RECORD_VERSION), Record);<br class=""> Stream.ExitBlock();<br class=""> }<br class=""><br class="">@@ -548,11 +542,8 @@ unsigned SDiagsWriter::getEmitCategory(u<br class=""><br class=""> // We use a local version of 'Record' so that we can be generating<br class=""> // another record when we lazily generate one for the category entry.<br class="">- RecordData Record;<br class="">- Record.push_back(RECORD_CATEGORY);<br class="">- Record.push_back(category);<br class=""> StringRef catName = DiagnosticIDs::getCategoryNameFromID(category);<br class="">- Record.push_back(catName.size());<br class="">+ RecordDataRef Record = {RECORD_CATEGORY, category, catName.size()};<br class=""> State->Stream.EmitRecordWithBlob(State->Abbrevs.get(RECORD_CATEGORY), Record,<br class=""> <span class=""> </span>catName);<br class=""><br class="">@@ -581,10 +572,7 @@ unsigned SDiagsWriter::getEmitDiagnostic<br class=""> entry.second = FlagName;<br class=""><br class=""> // Lazily emit the string in a separate record.<br class="">- RecordData Record;<br class="">- Record.push_back(RECORD_DIAG_FLAG);<br class="">- Record.push_back(entry.first);<br class="">- Record.push_back(FlagName.size());<br class="">+ RecordDataRef Record = {RECORD_DIAG_FLAG, entry.first, FlagName.size()};<br class=""> State->Stream.EmitRecordWithBlob(State->Abbrevs.get(RECORD_DIAG_FLAG),<br class=""> <span class=""> </span>Record, FlagName);<br class=""> }<br class="">@@ -682,7 +670,8 @@ void SDiagsWriter::EmitDiagnosticMessage<br class=""> }<br class=""><br class=""> Record.push_back(Message.size());<br class="">- Stream.EmitRecordWithBlob(Abbrevs.get(RECORD_DIAG), Record, Message);<br class="">+ Stream.EmitRecordWithBlob(Abbrevs.get(RECORD_DIAG), makeArrayRef(Record),<br class="">+ Message);<br class=""> }<br class=""><br class=""> void<br class="">@@ -741,7 +730,7 @@ void SDiagsWriter::EmitCodeContext(Small<br class=""> Record.push_back(RECORD_FIXIT);<br class=""> AddCharSourceRangeToRecord(Fix.RemoveRange, Record, SM);<br class=""> Record.push_back(Fix.CodeToInsert.size());<br class="">- Stream.EmitRecordWithBlob(Abbrevs.get(RECORD_FIXIT), Record,<br class="">+ Stream.EmitRecordWithBlob(Abbrevs.get(RECORD_FIXIT), makeArrayRef(Record),<br class=""> Fix.CodeToInsert);<br class=""> }<br class=""> }<br class="">@@ -844,17 +833,9 @@ std::error_code SDiagsMerger::visitEndOf<br class=""> std::error_code<br class=""> SDiagsMerger::visitSourceRangeRecord(const serialized_diags::Location &Start,<br class=""> <span class=""> </span>const serialized_diags::Location &End) {<br class="">- RecordData Record;<br class="">- Record.push_back(RECORD_SOURCE_RANGE);<br class="">- Record.push_back(FileLookup[Start.FileID]);<br class="">- Record.push_back(Start.Line);<br class="">- Record.push_back(Start.Col);<br class="">- Record.push_back(Start.Offset);<br class="">- Record.push_back(FileLookup[End.FileID]);<br class="">- Record.push_back(End.Line);<br class="">- Record.push_back(End.Col);<br class="">- Record.push_back(End.Offset);<br class="">-<br class="">+ RecordDataRef Record = {<br class="">+ RECORD_SOURCE_RANGE, FileLookup[Start.FileID], Start.Line, Start.Col,<br class="">+ Start.Offset, FileLookup[End.FileID], End.Line, End.Col, End.Offset};<br class=""> Writer.State->Stream.EmitRecordWithAbbrev(<br class=""> Writer.State->Abbrevs.get(RECORD_SOURCE_RANGE), Record);<br class=""> return std::error_code();<br class="">@@ -863,19 +844,13 @@ SDiagsMerger::visitSourceRangeRecord(con<br class=""> std::error_code SDiagsMerger::visitDiagnosticRecord(<br class=""> unsigned Severity, const serialized_diags::Location &Location,<br class=""> unsigned Category, unsigned Flag, StringRef Message) {<br class="">- RecordData MergedRecord;<br class="">- MergedRecord.push_back(RECORD_DIAG);<br class="">- MergedRecord.push_back(Severity);<br class="">- MergedRecord.push_back(FileLookup[Location.FileID]);<br class="">- MergedRecord.push_back(Location.Line);<br class="">- MergedRecord.push_back(Location.Col);<br class="">- MergedRecord.push_back(Location.Offset);<br class="">- MergedRecord.push_back(CategoryLookup[Category]);<br class="">- MergedRecord.push_back(Flag ? DiagFlagLookup[Flag] : 0);<br class="">- MergedRecord.push_back(Message.size());<br class="">+ RecordDataRef Record = {RECORD_DIAG, Severity, FileLookup[Location.FileID],<br class="">+ Location.Line, Location.Col, Location.Offset,<br class="">+ CategoryLookup[Category],<br class="">+ Flag ? DiagFlagLookup[Flag] : 0, Message.size()};<br class=""><br class=""> Writer.State->Stream.EmitRecordWithBlob(<br class="">- Writer.State->Abbrevs.get(RECORD_DIAG), MergedRecord, Message);<br class="">+ Writer.State->Abbrevs.get(RECORD_DIAG), Record, Message);<br class=""> return std::error_code();<br class=""> }<br class=""><br class="">@@ -883,17 +858,9 @@ std::error_code<br class=""> SDiagsMerger::visitFixitRecord(const serialized_diags::Location &Start,<br class=""> <span class=""> </span>const serialized_diags::Location &End,<br class=""> <span class=""> </span>StringRef Text) {<br class="">- RecordData Record;<br class="">- Record.push_back(RECORD_FIXIT);<br class="">- Record.push_back(FileLookup[Start.FileID]);<br class="">- Record.push_back(Start.Line);<br class="">- Record.push_back(Start.Col);<br class="">- Record.push_back(Start.Offset);<br class="">- Record.push_back(FileLookup[End.FileID]);<br class="">- Record.push_back(End.Line);<br class="">- Record.push_back(End.Col);<br class="">- Record.push_back(End.Offset);<br class="">- Record.push_back(Text.size());<br class="">+ RecordDataRef Record = {RECORD_FIXIT, FileLookup[Start.FileID], Start.Line,<br class="">+ Start.Col, Start.Offset, FileLookup[End.FileID],<br class="">+ End.Line, End.Col, End.Offset, Text.size()};<br class=""><br class=""> Writer.State->Stream.EmitRecordWithBlob(<br class=""> Writer.State->Abbrevs.get(RECORD_FIXIT), Record, Text);<br class=""><br class="">Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp<br class="">URL:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=247179&r1=247178&r2=247179&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=247179&r1=247178&r2=247179&view=diff</a><br class="">==============================================================================<br class="">--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)<br class="">+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Wed Sep 9 15:08:51 2015<br class="">@@ -1171,8 +1171,7 @@ void ASTWriter::WriteControlBlock(Prepro<br class=""> const std::string &OutputFile) {<br class=""> using namespace llvm;<br class=""> Stream.EnterSubblock(CONTROL_BLOCK_ID, 5);<br class="">- RecordData Record;<br class="">-<br class="">+<br class=""> // Metadata<br class=""> BitCodeAbbrev *MetadataAbbrev = new BitCodeAbbrev();<br class=""> MetadataAbbrev->Add(BitCodeAbbrevOp(METADATA));<br class="">@@ -1185,27 +1184,23 @@ void ASTWriter::WriteControlBlock(Prepro<br class=""> MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Errors<br class=""> MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // SVN branch/tag<br class=""> unsigned MetadataAbbrevCode = Stream.EmitAbbrev(MetadataAbbrev);<br class="">- Record.push_back(METADATA);<br class="">- Record.push_back(VERSION_MAJOR);<br class="">- Record.push_back(VERSION_MINOR);<br class="">- Record.push_back(CLANG_VERSION_MAJOR);<br class="">- Record.push_back(CLANG_VERSION_MINOR);<br class=""> assert((!WritingModule || isysroot.empty()) &&<br class=""> <span class=""> </span>"writing module as a relocatable PCH?");<br class="">- Record.push_back(!isysroot.empty());<br class="">- Record.push_back(IncludeTimestamps);<br class="">- Record.push_back(ASTHasCompilerErrors);<br class="">- Stream.EmitRecordWithBlob(MetadataAbbrevCode, Record,<br class="">- getClangFullRepositoryVersion());<br class="">-<br class="">+ {<br class="">+ RecordDataRef Record = {METADATA, VERSION_MAJOR, VERSION_MINOR,<br class="">+ CLANG_VERSION_MAJOR, CLANG_VERSION_MINOR,<br class="">+ !isysroot.empty(), IncludeTimestamps,<br class="">+ ASTHasCompilerErrors};<br class="">+ Stream.EmitRecordWithBlob(MetadataAbbrevCode, Record,<br class="">+ getClangFullRepositoryVersion());<br class="">+ }<br class=""> if (WritingModule) {<br class=""> // For implicit modules we output a signature that we can use to ensure<br class=""> // duplicate module builds don't collide in the cache as their output order<br class=""> // is non-deterministic.<br class=""> // FIXME: Remove this when output is deterministic.<br class=""> if (Context.getLangOpts().ImplicitModules) {<br class="">- Record.clear();<br class="">- Record.push_back(getSignature());<br class="">+ RecordData Record = {getSignature()};<br class=""> Stream.EmitRecord(SIGNATURE, Record);<br class=""> }<br class=""><br class="">@@ -1214,8 +1209,7 @@ void ASTWriter::WriteControlBlock(Prepro<br class=""> Abbrev->Add(BitCodeAbbrevOp(MODULE_NAME));<br class=""> Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Name<br class=""> unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev);<br class="">- RecordData Record;<br class="">- Record.push_back(MODULE_NAME);<br class="">+ RecordDataRef Record = {MODULE_NAME};<br class=""> Stream.EmitRecordWithBlob(AbbrevCode, Record, WritingModule->Name);<br class=""> }<br class=""><br class="">@@ -1236,8 +1230,7 @@ void ASTWriter::WriteControlBlock(Prepro<br class=""> Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Directory<br class=""> unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev);<br class=""><br class="">- RecordData Record;<br class="">- Record.push_back(MODULE_DIRECTORY);<br class="">+ RecordDataRef Record = {MODULE_DIRECTORY};<br class=""> Stream.EmitRecordWithBlob(AbbrevCode, Record, BaseDir);<br class=""> }<br class=""><br class="">@@ -1250,7 +1243,7 @@ void ASTWriter::WriteControlBlock(Prepro<br class=""><br class=""> // Module map file<br class=""> if (WritingModule) {<br class="">- Record.clear();<br class="">+ RecordData Record;<br class=""><br class=""> auto &Map = PP.getHeaderSearchInfo().getModuleMap();<br class=""><br class="">@@ -1273,7 +1266,7 @@ void ASTWriter::WriteControlBlock(Prepro<br class=""> // Imports<br class=""> if (Chain) {<br class=""> serialization::ModuleManager &Mgr = Chain->getModuleManager();<br class="">- Record.clear();<br class="">+ RecordData Record;<br class=""><br class=""> for (auto *M : Mgr) {<br class=""> // Skip modules that weren't directly imported.<br class="">@@ -1294,7 +1287,7 @@ void ASTWriter::WriteControlBlock(Prepro<br class=""> Stream.EnterSubblock(OPTIONS_BLOCK_ID, 4);<br class=""><br class=""> // Language options.<br class="">- Record.clear();<br class="">+ RecordData Record;<br class=""> const LangOptions &LangOpts = Context.getLangOpts();<br class=""> #define LANGOPT(Name, Bits, Default, Description) \<br class=""> Record.push_back(LangOpts.Name);<br class="">@@ -1466,8 +1459,7 @@ void ASTWriter::WriteControlBlock(Prepro<br class=""> SM.getFileManager().makeAbsolutePath(OutputPath);<br class=""> StringRef origDir = llvm::sys::path::parent_path(OutputPath);<br class=""><br class="">- RecordData Record;<br class="">- Record.push_back(ORIGINAL_PCH_DIR);<br class="">+ RecordDataRef Record = {ORIGINAL_PCH_DIR};<br class=""> Stream.EmitRecordWithBlob(AbbrevCode, Record, origDir);<br class=""> }<br class=""><br class="">@@ -1491,8 +1483,7 @@ void ASTWriter::WriteInputFiles(SourceMa<br class=""> bool Modules) {<br class=""> using namespace llvm;<br class=""> Stream.EnterSubblock(INPUT_FILES_BLOCK_ID, 4);<br class="">- RecordData Record;<br class="">-<br class="">+<br class=""> // Create input-file abbreviation.<br class=""> BitCodeAbbrev *IFAbbrev = new BitCodeAbbrev();<br class=""> IFAbbrev->Add(BitCodeAbbrevOp(INPUT_FILE));<br class="">@@ -1547,16 +1538,11 @@ void ASTWriter::WriteInputFiles(SourceMa<br class=""> if (!Entry.IsSystemFile)<br class=""> ++UserFilesNum;<br class=""><br class="">- Record.clear();<br class="">- Record.push_back(INPUT_FILE);<br class="">- Record.push_back(InputFileOffsets.size());<br class="">-<br class=""> // Emit size/modification time for this file.<br class="">- Record.push_back(Entry.File->getSize());<br class="">- Record.push_back(getTimestampForOutput(Entry.File));<br class="">-<br class="">- // Whether this file was overridden.<br class="">- Record.push_back(Entry.BufferOverridden);<br class="">+ // And whether this file was overridden.<br class="">+ RecordDataRef Record = {<br class="">+ INPUT_FILE, InputFileOffsets.size(), (uint64_t)Entry.File->getSize(),<br class="">+ (uint64_t)getTimestampForOutput(Entry.File), Entry.BufferOverridden};<br class=""><br class=""> EmitRecordWithPath(IFAbbrevCode, Record, Entry.File->getName());<br class=""> }<br class="">@@ -1573,10 +1559,8 @@ void ASTWriter::WriteInputFiles(SourceMa<br class=""> unsigned OffsetsAbbrevCode = Stream.EmitAbbrev(OffsetsAbbrev);<br class=""><br class=""> // Write input file offsets.<br class="">- Record.clear();<br class="">- Record.push_back(INPUT_FILE_OFFSETS);<br class="">- Record.push_back(InputFileOffsets.size());<br class="">- Record.push_back(UserFilesNum);<br class="">+ RecordDataRef Record = {INPUT_FILE_OFFSETS, InputFileOffsets.size(),<br class="">+ UserFilesNum};<br class=""> Stream.EmitRecordWithBlob(OffsetsAbbrevCode, Record, bytes(InputFileOffsets));<br class=""> }<br class=""><br class="">@@ -1818,11 +1802,8 @@ void ASTWriter::WriteHeaderSearch(const<br class=""> unsigned TableAbbrev = Stream.EmitAbbrev(Abbrev);<br class=""><br class=""> // Write the header search table<br class="">- RecordData Record;<br class="">- Record.push_back(HEADER_SEARCH_TABLE);<br class="">- Record.push_back(BucketOffset);<br class="">- Record.push_back(NumHeaderSearchEntries);<br class="">- Record.push_back(TableData.size());<br class="">+ RecordDataRef Record = {HEADER_SEARCH_TABLE, BucketOffset,<br class="">+ NumHeaderSearchEntries, TableData.size()};<br class=""> TableData.append(GeneratorTrait.strings_begin(),GeneratorTrait.strings_end());<br class=""> Stream.EmitRecordWithBlob(TableAbbrev, Record, TableData);<br class=""><br class="">@@ -1907,12 +1888,11 @@ void ASTWriter::WriteSourceManagerBlock(<br class=""> Record.push_back(0);<br class=""> Record.push_back(0);<br class=""> }<br class="">-<br class="">- Stream.EmitRecordWithAbbrev(SLocFileAbbrv, Record);<br class="">-<br class="">+<br class="">+ Stream.EmitRecordWithAbbrev(SLocFileAbbrv, makeArrayRef(Record));<br class="">+<br class=""> if (Content->BufferOverridden) {<br class="">- Record.clear();<br class="">- Record.push_back(SM_SLOC_BUFFER_BLOB);<br class="">+ RecordDataRef Record = {SM_SLOC_BUFFER_BLOB};<br class=""> const llvm::MemoryBuffer *Buffer<br class=""> = Content->getBuffer(PP.getDiagnostics(), PP.getSourceManager());<br class=""> Stream.EmitRecordWithBlob(SLocBufferBlobAbbrv, Record,<br class="">@@ -1929,10 +1909,9 @@ void ASTWriter::WriteSourceManagerBlock(<br class=""> const llvm::MemoryBuffer *Buffer<br class=""> = Content->getBuffer(PP.getDiagnostics(), PP.getSourceManager());<br class=""> const char *Name = Buffer->getBufferIdentifier();<br class="">- Stream.EmitRecordWithBlob(SLocBufferAbbrv, Record,<br class="">+ Stream.EmitRecordWithBlob(SLocBufferAbbrv, makeArrayRef(Record),<br class=""> StringRef(Name, strlen(Name) + 1));<br class="">- Record.clear();<br class="">- Record.push_back(SM_SLOC_BUFFER_BLOB);<br class="">+ RecordDataRef Record = {SM_SLOC_BUFFER_BLOB};<br class=""> Stream.EmitRecordWithBlob(SLocBufferBlobAbbrv, Record,<br class=""> StringRef(Buffer->getBufferStart(),<br class=""> Buffer->getBufferSize() + 1));<br class="">@@ -1954,7 +1933,7 @@ void ASTWriter::WriteSourceManagerBlock(<br class=""> if (I + 1 != N)<br class=""> NextOffset = SourceMgr.getLocalSLocEntry(I + 1).getOffset();<br class=""> Record.push_back(NextOffset - SLoc->getOffset() - 1);<br class="">- Stream.EmitRecordWithAbbrev(SLocExpansionAbbrv, Record);<br class="">+ Stream.EmitRecordWithAbbrev(SLocExpansionAbbrv, makeArrayRef(Record));<br class=""> }<br class=""> }<br class=""><br class="">@@ -1972,13 +1951,13 @@ void ASTWriter::WriteSourceManagerBlock(<br class=""> Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 16)); // total size<br class=""> Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // offsets<br class=""> unsigned SLocOffsetsAbbrev = Stream.EmitAbbrev(Abbrev);<br class="">-<br class="">- Record.clear();<br class="">- Record.push_back(SOURCE_LOCATION_OFFSETS);<br class="">- Record.push_back(SLocEntryOffsets.size());<br class="">- Record.push_back(SourceMgr.getNextLocalOffset() - 1); // skip dummy<br class="">- Stream.EmitRecordWithBlob(SLocOffsetsAbbrev, Record, bytes(SLocEntryOffsets));<br class="">-<br class="">+ {<br class="">+ RecordDataRef Record = {SOURCE_LOCATION_OFFSETS, SLocEntryOffsets.size(),<br class="">+ SourceMgr.getNextLocalOffset() -<br class="">+ 1 /* skip dummy */};<br class="">+ Stream.EmitRecordWithBlob(SLocOffsetsAbbrev, Record,<br class="">+ bytes(SLocEntryOffsets));<br class="">+ }<br class=""> // Write the source location entry preloads array, telling the AST<br class=""> // reader which source locations entries it should load eagerly.<br class=""> Stream.EmitRecord(SOURCE_LOCATION_PRELOADS, PreloadSLocs);<br class="">@@ -2232,12 +2211,11 @@ void ASTWriter::WritePreprocessor(const<br class=""> Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));<br class=""><br class=""> unsigned MacroOffsetAbbrev = Stream.EmitAbbrev(Abbrev);<br class="">- Record.clear();<br class="">- Record.push_back(MACRO_OFFSET);<br class="">- Record.push_back(MacroOffsets.size());<br class="">- Record.push_back(FirstMacroID - NUM_PREDEF_MACRO_IDS);<br class="">- Stream.EmitRecordWithBlob(MacroOffsetAbbrev, Record,<br class="">- bytes(MacroOffsets));<br class="">+ {<br class="">+ RecordDataRef Record = {MACRO_OFFSET, MacroOffsets.size(),<br class="">+ FirstMacroID - NUM_PREDEF_MACRO_IDS};<br class="">+ Stream.EmitRecordWithBlob(MacroOffsetAbbrev, Record, bytes(MacroOffsets));<br class="">+ }<br class=""> }<br class=""><br class=""> void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) {<br class="">@@ -2311,7 +2289,7 @@ void ASTWriter::WritePreprocessorDetail(<br class=""> // we create a PCH even with compiler errors.<br class=""> if (ID->getFile())<br class=""> Buffer += ID->getFile()->getName();<br class="">- Stream.EmitRecordWithBlob(InclusionAbbrev, Record, Buffer);<br class="">+ Stream.EmitRecordWithBlob(InclusionAbbrev, makeArrayRef(Record), Buffer);<br class=""> continue;<br class=""> }<br class=""><br class="">@@ -2331,9 +2309,8 @@ void ASTWriter::WritePreprocessorDetail(<br class=""> Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));<br class=""> unsigned PPEOffsetAbbrev = Stream.EmitAbbrev(Abbrev);<br class=""><br class="">- Record.clear();<br class="">- Record.push_back(PPD_ENTITIES_OFFSETS);<br class="">- Record.push_back(FirstPreprocessorEntityID - NUM_PREDEF_PP_ENTITY_IDS);<br class="">+ RecordDataRef Record = {PPD_ENTITIES_OFFSETS, FirstPreprocessorEntityID -<br class="">+ NUM_PREDEF_PP_ENTITY_IDS};<br class=""> Stream.EmitRecordWithBlob(PPEOffsetAbbrev, Record,<br class=""> bytes(PreprocessedEntityOffsets));<br class=""> }<br class="">@@ -2472,45 +2449,37 @@ void ASTWriter::WriteSubmodules(Module *<br class=""> Module *Mod = Q.front();<br class=""> Q.pop();<br class=""> unsigned ID = getSubmoduleID(Mod);<br class="">-<br class="">- // Emit the definition of the block.<br class="">- Record.clear();<br class="">- Record.push_back(SUBMODULE_DEFINITION);<br class="">- Record.push_back(ID);<br class="">+<br class="">+ uint64_t ParentID = 0;<br class=""> if (Mod->Parent) {<br class=""> assert(SubmoduleIDs[Mod->Parent] && "Submodule parent not written?");<br class="">- Record.push_back(SubmoduleIDs[Mod->Parent]);<br class="">- } else {<br class="">- Record.push_back(0);<br class="">+ ParentID = SubmoduleIDs[Mod->Parent];<br class=""> }<br class="">- Record.push_back(Mod->IsFramework);<br class="">- Record.push_back(Mod->IsExplicit);<br class="">- Record.push_back(Mod->IsSystem);<br class="">- Record.push_back(Mod->IsExternC);<br class="">- Record.push_back(Mod->InferSubmodules);<br class="">- Record.push_back(Mod->InferExplicitSubmodules);<br class="">- Record.push_back(Mod->InferExportWildcard);<br class="">- Record.push_back(Mod->ConfigMacrosExhaustive);<br class="">- Stream.EmitRecordWithBlob(DefinitionAbbrev, Record, Mod->Name);<br class="">-<br class="">+<br class="">+ // Emit the definition of the block.<br class="">+ {<br class="">+ RecordDataRef Record = {<br class="">+ SUBMODULE_DEFINITION, ID, ParentID, Mod->IsFramework, Mod->IsExplicit,<br class="">+ Mod->IsSystem, Mod->IsExternC, Mod->InferSubmodules,<br class="">+ Mod->InferExplicitSubmodules, Mod->InferExportWildcard,<br class="">+ Mod->ConfigMacrosExhaustive};<br class="">+ Stream.EmitRecordWithBlob(DefinitionAbbrev, Record, Mod->Name);<br class="">+ }<br class="">+<br class=""> // Emit the requirements.<br class=""> for (const auto &R : Mod->Requirements) {<br class="">- Record.clear();<br class="">- Record.push_back(SUBMODULE_REQUIRES);<br class="">- Record.push_back(R.second);<br class="">+ RecordDataRef Record = {SUBMODULE_REQUIRES, R.second};<br class=""> Stream.EmitRecordWithBlob(RequiresAbbrev, Record, R.first);<br class=""> }<br class=""><br class=""> // Emit the umbrella header, if there is one.<br class=""> if (auto UmbrellaHeader = Mod->getUmbrellaHeader()) {<br class="">- Record.clear();<br class="">- Record.push_back(SUBMODULE_UMBRELLA_HEADER);<br class="">+ RecordDataRef Record = {SUBMODULE_UMBRELLA_HEADER};<br class=""> Stream.EmitRecordWithBlob(UmbrellaAbbrev, Record,<br class=""> UmbrellaHeader.NameAsWritten);<br class=""> } else if (auto UmbrellaDir = Mod->getUmbrellaDir()) {<br class="">- Record.clear();<br class="">- Record.push_back(SUBMODULE_UMBRELLA_DIR);<br class="">- Stream.EmitRecordWithBlob(UmbrellaDirAbbrev, Record,<br class="">+ RecordDataRef Record = {SUBMODULE_UMBRELLA_DIR};<br class="">+ Stream.EmitRecordWithBlob(UmbrellaDirAbbrev, Record,<br class=""> UmbrellaDir.NameAsWritten);<br class=""> }<br class=""><br class="">@@ -2528,8 +2497,7 @@ void ASTWriter::WriteSubmodules(Module *<br class=""> {SUBMODULE_EXCLUDED_HEADER, ExcludedHeaderAbbrev, Module::HK_Excluded}<br class=""> };<br class=""> for (auto &HL : HeaderLists) {<br class="">- Record.clear();<br class="">- Record.push_back(HL.RecordKind);<br class="">+ RecordDataRef Record = {HL.RecordKind};<br class=""> for (auto &H : Mod->Headers[HL.HeaderKind])<br class=""> Stream.EmitRecordWithBlob(HL.Abbrev, Record, H.NameAsWritten);<br class=""> }<br class="">@@ -2537,15 +2505,14 @@ void ASTWriter::WriteSubmodules(Module *<br class=""> // Emit the top headers.<br class=""> {<br class=""> auto TopHeaders = Mod->getTopHeaders(PP->getFileManager());<br class="">- Record.clear();<br class="">- Record.push_back(SUBMODULE_TOPHEADER);<br class="">+ RecordDataRef Record = {SUBMODULE_TOPHEADER};<br class=""> for (auto *H : TopHeaders)<br class=""> Stream.EmitRecordWithBlob(TopHeaderAbbrev, Record, H->getName());<br class=""> }<br class=""><br class=""> // Emit the imports.<br class=""> if (!Mod->Imports.empty()) {<br class="">- Record.clear();<br class="">+ RecordData Record;<br class=""> for (auto *I : Mod->Imports)<br class=""> Record.push_back(getSubmoduleID(I));<br class=""> Stream.EmitRecord(SUBMODULE_IMPORTS, Record);<br class="">@@ -2553,7 +2520,7 @@ void ASTWriter::WriteSubmodules(Module *<br class=""><br class=""> // Emit the exports.<br class=""> if (!Mod->Exports.empty()) {<br class="">- Record.clear();<br class="">+ RecordData Record;<br class=""> for (const auto &E : Mod->Exports) {<br class=""> // FIXME: This may fail; we don't require that all exported modules<br class=""> // are local or imported.<br class="">@@ -2569,26 +2536,21 @@ void ASTWriter::WriteSubmodules(Module *<br class=""><br class=""> // Emit the link libraries.<br class=""> for (const auto &LL : Mod->LinkLibraries) {<br class="">- Record.clear();<br class="">- Record.push_back(SUBMODULE_LINK_LIBRARY);<br class="">- Record.push_back(LL.IsFramework);<br class="">+ RecordDataRef Record = {SUBMODULE_LINK_LIBRARY, LL.IsFramework};<br class=""> Stream.EmitRecordWithBlob(LinkLibraryAbbrev, Record, LL.Library);<br class=""> }<br class=""><br class=""> // Emit the conflicts.<br class=""> for (const auto &C : Mod->Conflicts) {<br class="">- Record.clear();<br class="">- Record.push_back(SUBMODULE_CONFLICT);<br class=""> // FIXME: This may fail; we don't require that all conflicting modules<br class=""> // are local or imported.<br class="">- Record.push_back(getSubmoduleID(C.Other));<br class="">+ RecordDataRef Record = {SUBMODULE_CONFLICT, getSubmoduleID(C.Other)};<br class=""> Stream.EmitRecordWithBlob(ConflictAbbrev, Record, C.Message);<br class=""> }<br class=""><br class=""> // Emit the configuration macros.<br class=""> for (const auto &CM : Mod->ConfigMacros) {<br class="">- Record.clear();<br class="">- Record.push_back(SUBMODULE_CONFIG_MACRO);<br class="">+ RecordDataRef Record = {SUBMODULE_CONFIG_MACRO};<br class=""> Stream.EmitRecordWithBlob(ConfigMacroAbbrev, Record, CM);<br class=""> }<br class=""><br class="">@@ -2670,8 +2632,6 @@ void ASTWriter::WriteCXXCtorInitializers<br class=""> if (CXXCtorInitializersOffsets.empty())<br class=""> return;<br class=""><br class="">- RecordData Record;<br class="">-<br class=""> // Create a blob abbreviation for the C++ ctor initializer offsets.<br class=""> using namespace llvm;<br class=""><br class="">@@ -2682,9 +2642,8 @@ void ASTWriter::WriteCXXCtorInitializers<br class=""> unsigned CtorInitializersOffsetAbbrev = Stream.EmitAbbrev(Abbrev);<br class=""><br class=""> // Write the base specifier offsets table.<br class="">- Record.clear();<br class="">- Record.push_back(CXX_CTOR_INITIALIZERS_OFFSETS);<br class="">- Record.push_back(CXXCtorInitializersOffsets.size());<br class="">+ RecordDataRef Record = {CXX_CTOR_INITIALIZERS_OFFSETS,<br class="">+ CXXCtorInitializersOffsets.size()};<br class=""> Stream.EmitRecordWithBlob(CtorInitializersOffsetAbbrev, Record,<br class=""> bytes(CXXCtorInitializersOffsets));<br class=""> }<br class="">@@ -2693,8 +2652,6 @@ void ASTWriter::WriteCXXBaseSpecifiersOf<br class=""> if (CXXBaseSpecifiersOffsets.empty())<br class=""> return;<br class=""><br class="">- RecordData Record;<br class="">-<br class=""> // Create a blob abbreviation for the C++ base specifiers offsets.<br class=""> using namespace llvm;<br class=""><br class="">@@ -2705,9 +2662,8 @@ void ASTWriter::WriteCXXBaseSpecifiersOf<br class=""> unsigned BaseSpecifierOffsetAbbrev = Stream.EmitAbbrev(Abbrev);<br class=""><br class=""> // Write the base specifier offsets table.<br class="">- Record.clear();<br class="">- Record.push_back(CXX_BASE_SPECIFIER_OFFSETS);<br class="">- Record.push_back(CXXBaseSpecifiersOffsets.size());<br class="">+ RecordDataRef Record = {CXX_BASE_SPECIFIER_OFFSETS,<br class="">+ CXXBaseSpecifiersOffsets.size()};<br class=""> Stream.EmitRecordWithBlob(BaseSpecifierOffsetAbbrev, Record,<br class=""> bytes(CXXBaseSpecifiersOffsets));<br class=""> }<br class="">@@ -2778,8 +2734,6 @@ uint64_t ASTWriter::WriteDeclContextLexi<br class=""> return 0;<br class=""><br class=""> uint64_t Offset = Stream.GetCurrentBitNo();<br class="">- RecordData Record;<br class="">- Record.push_back(DECL_CONTEXT_LEXICAL);<br class=""> SmallVector<uint32_t, 128> KindDeclPairs;<br class=""> for (const auto *D : DC->decls()) {<br class=""> KindDeclPairs.push_back(D->getKind());<br class="">@@ -2787,6 +2741,7 @@ uint64_t ASTWriter::WriteDeclContextLexi<br class=""> }<br class=""><br class=""> ++NumLexicalDeclContexts;<br class="">+ RecordDataRef Record = {DECL_CONTEXT_LEXICAL};<br class=""> Stream.EmitRecordWithBlob(DeclContextLexicalAbbrev, Record,<br class=""> bytes(KindDeclPairs));<br class=""> return Offset;<br class="">@@ -2794,7 +2749,6 @@ uint64_t ASTWriter::WriteDeclContextLexi<br class=""><br class=""> void ASTWriter::WriteTypeDeclOffsets() {<br class=""> using namespace llvm;<br class="">- RecordData Record;<br class=""><br class=""> // Write the type offsets array<br class=""> BitCodeAbbrev *Abbrev = new BitCodeAbbrev();<br class="">@@ -2803,11 +2757,11 @@ void ASTWriter::WriteTypeDeclOffsets() {<br class=""> Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // base type index<br class=""> Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // types block<br class=""> unsigned TypeOffsetAbbrev = Stream.EmitAbbrev(Abbrev);<br class="">- Record.clear();<br class="">- Record.push_back(TYPE_OFFSET);<br class="">- Record.push_back(TypeOffsets.size());<br class="">- Record.push_back(FirstTypeID - NUM_PREDEF_TYPE_IDS);<br class="">- Stream.EmitRecordWithBlob(TypeOffsetAbbrev, Record, bytes(TypeOffsets));<br class="">+ {<br class="">+ RecordDataRef Record = {TYPE_OFFSET, TypeOffsets.size(),<br class="">+ FirstTypeID - NUM_PREDEF_TYPE_IDS};<br class="">+ Stream.EmitRecordWithBlob(TypeOffsetAbbrev, Record, bytes(TypeOffsets));<br class="">+ }<br class=""><br class=""> // Write the declaration offsets array<br class=""> Abbrev = new BitCodeAbbrev();<br class="">@@ -2816,16 +2770,15 @@ void ASTWriter::WriteTypeDeclOffsets() {<br class=""> Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // base decl ID<br class=""> Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // declarations block<br class=""> unsigned DeclOffsetAbbrev = Stream.EmitAbbrev(Abbrev);<br class="">- Record.clear();<br class="">- Record.push_back(DECL_OFFSET);<br class="">- Record.push_back(DeclOffsets.size());<br class="">- Record.push_back(FirstDeclID - NUM_PREDEF_DECL_IDS);<br class="">- Stream.EmitRecordWithBlob(DeclOffsetAbbrev, Record, bytes(DeclOffsets));<br class="">+ {<br class="">+ RecordDataRef Record = {DECL_OFFSET, DeclOffsets.size(),<br class="">+ FirstDeclID - NUM_PREDEF_DECL_IDS};<br class="">+ Stream.EmitRecordWithBlob(DeclOffsetAbbrev, Record, bytes(DeclOffsets));<br class="">+ }<br class=""> }<br class=""><br class=""> void ASTWriter::WriteFileDeclIDsMap() {<br class=""> using namespace llvm;<br class="">- RecordData Record;<br class=""><br class=""> SmallVector<std::pair<FileID, DeclIDInFileInfo *>, 64> SortedFileDeclIDs(<br class=""> FileDeclIDs.begin(), FileDeclIDs.end());<br class="">@@ -2846,8 +2799,7 @@ void ASTWriter::WriteFileDeclIDsMap() {<br class=""> Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));<br class=""> Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));<br class=""> unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev);<br class="">- Record.push_back(FILE_SORTED_DECLS);<br class="">- Record.push_back(FileGroupedDeclIDs.size());<br class="">+ RecordDataRef Record = {FILE_SORTED_DECLS, FileGroupedDeclIDs.size()};<br class=""> Stream.EmitRecordWithBlob(AbbrevCode, Record, bytes(FileGroupedDeclIDs));<br class=""> }<br class=""><br class="">@@ -3057,11 +3009,10 @@ void ASTWriter::WriteSelectors(Sema &Sem<br class=""> unsigned MethodPoolAbbrev = Stream.EmitAbbrev(Abbrev);<br class=""><br class=""> // Write the method pool<br class="">- RecordData Record;<br class="">- Record.push_back(METHOD_POOL);<br class="">- Record.push_back(BucketOffset);<br class="">- Record.push_back(NumTableEntries);<br class="">- Stream.EmitRecordWithBlob(MethodPoolAbbrev, Record, MethodPool);<br class="">+ {<br class="">+ RecordDataRef Record = {METHOD_POOL, BucketOffset, NumTableEntries};<br class="">+ Stream.EmitRecordWithBlob(MethodPoolAbbrev, Record, MethodPool);<br class="">+ }<br class=""><br class=""> // Create a blob abbreviation for the selector table offsets.<br class=""> Abbrev = new BitCodeAbbrev();<br class="">@@ -3072,12 +3023,12 @@ void ASTWriter::WriteSelectors(Sema &Sem<br class=""> unsigned SelectorOffsetAbbrev = Stream.EmitAbbrev(Abbrev);<br class=""><br class=""> // Write the selector offsets table.<br class="">- Record.clear();<br class="">- Record.push_back(SELECTOR_OFFSETS);<br class="">- Record.push_back(SelectorOffsets.size());<br class="">- Record.push_back(FirstSelectorID - NUM_PREDEF_SELECTOR_IDS);<br class="">- Stream.EmitRecordWithBlob(SelectorOffsetAbbrev, Record,<br class="">- bytes(SelectorOffsets));<br class="">+ {<br class="">+ RecordDataRef Record = {SELECTOR_OFFSETS, SelectorOffsets.size(),<br class="">+ FirstSelectorID - NUM_PREDEF_SELECTOR_IDS};<br class="">+ Stream.EmitRecordWithBlob(SelectorOffsetAbbrev, Record,<br class="">+ bytes(SelectorOffsets));<br class="">+ }<br class=""> }<br class=""> }<br class=""><br class="">@@ -3347,9 +3298,7 @@ void ASTWriter::WriteIdentifierTable(Pre<br class=""> unsigned IDTableAbbrev = Stream.EmitAbbrev(Abbrev);<br class=""><br class=""> // Write the identifier table<br class="">- RecordData Record;<br class="">- Record.push_back(IDENTIFIER_TABLE);<br class="">- Record.push_back(BucketOffset);<br class="">+ RecordDataRef Record = {IDENTIFIER_TABLE, BucketOffset};<br class=""> Stream.EmitRecordWithBlob(IDTableAbbrev, Record, IdentifierTable);<br class=""> }<br class=""><br class="">@@ -3365,11 +3314,9 @@ void ASTWriter::WriteIdentifierTable(Pre<br class=""> for (unsigned I = 0, N = IdentifierOffsets.size(); I != N; ++I)<br class=""> assert(IdentifierOffsets[I] && "Missing identifier offset?");<br class=""> #endif<br class="">-<br class="">- RecordData Record;<br class="">- Record.push_back(IDENTIFIER_OFFSET);<br class="">- Record.push_back(IdentifierOffsets.size());<br class="">- Record.push_back(FirstIdentID - NUM_PREDEF_IDENT_IDS);<br class="">+<br class="">+ RecordDataRef Record = {IDENTIFIER_OFFSET, IdentifierOffsets.size(),<br class="">+ FirstIdentID - NUM_PREDEF_IDENT_IDS};<br class=""> Stream.EmitRecordWithBlob(IdentifierOffsetAbbrev, Record,<br class=""> bytes(IdentifierOffsets));<br class=""><br class="">@@ -3785,8 +3732,7 @@ uint64_t ASTWriter::WriteDeclContextVisi<br class=""> GenerateNameLookupTable(DC, LookupTable);<br class=""><br class=""> // Write the lookup table<br class="">- RecordData Record;<br class="">- Record.push_back(DECL_CONTEXT_VISIBLE);<br class="">+ RecordDataRef Record = {DECL_CONTEXT_VISIBLE};<br class=""> Stream.EmitRecordWithBlob(DeclContextVisibleLookupAbbrev, Record,<br class=""> LookupTable);<br class=""> ++NumVisibleDeclContexts;<br class="">@@ -3817,9 +3763,7 @@ void ASTWriter::WriteDeclContextVisibleU<br class=""> DC = cast<DeclContext>(Chain->getKeyDeclaration(cast<Decl>(DC)));<br class=""><br class=""> // Write the lookup table<br class="">- RecordData Record;<br class="">- Record.push_back(UPDATE_VISIBLE);<br class="">- Record.push_back(getDeclID(cast<Decl>(DC)));<br class="">+ RecordDataRef Record = {UPDATE_VISIBLE, getDeclID(cast<Decl>(DC))};<br class=""> Stream.EmitRecordWithBlob(UpdateVisibleAbbrev, Record, LookupTable);<br class=""> }<br class=""><br class="">@@ -3883,14 +3827,12 @@ void ASTWriter::WriteObjCCategories() {<br class=""> Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // # of entries<br class=""> Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));<br class=""> unsigned AbbrevID = Stream.EmitAbbrev(Abbrev);<br class="">-<br class="">- RecordData Record;<br class="">- Record.push_back(OBJC_CATEGORIES_MAP);<br class="">- Record.push_back(CategoriesMap.size());<br class="">- Stream.EmitRecordWithBlob(AbbrevID, Record,<br class="">- reinterpret_cast<char*>(CategoriesMap.data()),<br class="">+<br class="">+ RecordDataRef Record = {OBJC_CATEGORIES_MAP, CategoriesMap.size()};<br class="">+ Stream.EmitRecordWithBlob(AbbrevID, Record,<br class="">+ reinterpret_cast<char *>(CategoriesMap.data()),<br class=""> CategoriesMap.size() * sizeof(ObjCCategoriesInfo));<br class="">-<br class="">+<br class=""> // Emit the category lists.<br class=""> Stream.EmitRecord(OBJC_CATEGORIES, Categories);<br class=""> }<br class="">@@ -3987,7 +3929,7 @@ void ASTWriter::AddPath(StringRef Path,<br class=""> AddString(FilePath, Record);<br class=""> }<br class=""><br class="">-void ASTWriter::EmitRecordWithPath(unsigned Abbrev, RecordDataImpl &Record,<br class="">+void ASTWriter::EmitRecordWithPath(unsigned Abbrev, const RecordDataRef &Record,<br class=""> <span class=""> </span>StringRef Path) {<br class=""> SmallString<128> FilePath(Path);<br class=""> PreparePathForOutput(FilePath);<br class="">@@ -4250,14 +4192,14 @@ void ASTWriter::WriteASTCore(Sema &SemaR<br class=""> WriteControlBlock(PP, Context, isysroot, OutputFile);<br class=""><br class=""> // Write the remaining AST contents.<br class="">- RecordData Record;<br class=""> Stream.EnterSubblock(AST_BLOCK_ID, 5);<br class=""><br class=""> // This is so that older clang versions, before the introduction<br class=""> // of the control block, can read and reject the newer PCH format.<br class="">- Record.clear();<br class="">- Record.push_back(VERSION_MAJOR);<br class="">- Stream.EmitRecord(METADATA_OLD_FORMAT, Record);<br class="">+ {<br class="">+ RecordData Record = {VERSION_MAJOR};<br class="">+ Stream.EmitRecord(METADATA_OLD_FORMAT, Record);<br class="">+ }<br class=""><br class=""> // Create a lexical update block containing all of the declarations in the<br class=""> // translation unit that do not come from other AST files.<br class="">@@ -4274,11 +4216,12 @@ void ASTWriter::WriteASTCore(Sema &SemaR<br class=""> Abv->Add(llvm::BitCodeAbbrevOp(TU_UPDATE_LEXICAL));<br class=""> Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));<br class=""> unsigned TuUpdateLexicalAbbrev = Stream.EmitAbbrev(Abv);<br class="">- Record.clear();<br class="">- Record.push_back(TU_UPDATE_LEXICAL);<br class="">- Stream.EmitRecordWithBlob(TuUpdateLexicalAbbrev, Record,<br class="">- bytes(NewGlobalKindDeclPairs));<br class="">-<br class="">+ {<br class="">+ RecordDataRef Record = {TU_UPDATE_LEXICAL};<br class="">+ Stream.EmitRecordWithBlob(TuUpdateLexicalAbbrev, Record,<br class="">+ bytes(NewGlobalKindDeclPairs));<br class="">+ }<br class="">+<br class=""> // And a visible updates block for the translation unit.<br class=""> Abv = new llvm::BitCodeAbbrev();<br class=""> Abv->Add(llvm::BitCodeAbbrevOp(UPDATE_VISIBLE));<br class="">@@ -4408,8 +4351,7 @@ void ASTWriter::WriteASTCore(Sema &SemaR<br class=""> writeBaseIDOrNone(M->BaseTypeIndex, M->LocalNumTypes);<br class=""> }<br class=""> }<br class="">- Record.clear();<br class="">- Record.push_back(MODULE_OFFSET_MAP);<br class="">+ RecordDataRef Record = {MODULE_OFFSET_MAP};<br class=""> Stream.EmitRecordWithBlob(ModuleOffsetMapAbbrev, Record,<br class=""> Buffer.data(), Buffer.size());<br class=""> }<br class="">@@ -4573,7 +4515,7 @@ void ASTWriter::WriteASTCore(Sema &SemaR<br class=""> WriteOptimizePragmaOptions(SemaRef);<br class=""><br class=""> // Some simple statistics<br class="">- Record.clear();<br class="">+ RecordData Record;<br class=""> Record.push_back(NumStatements);<br class=""> Record.push_back(NumMacros);<br class=""> Record.push_back(NumLexicalDeclContexts);<br class=""><br class="">Modified: cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp<br class="">URL:<span class=""> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp?rev=247179&r1=247178&r2=247179&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp?rev=247179&r1=247178&r2=247179&view=diff</a><br class="">==============================================================================<br class="">--- cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp (original)<br class="">+++ cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp Wed Sep 9 15:08:51 2015<br class="">@@ -757,9 +757,7 @@ void GlobalModuleIndexBuilder::writeInde<br class=""> unsigned IDTableAbbrev = Stream.EmitAbbrev(Abbrev);<br class=""><br class=""> // Write the identifier table<br class="">- Record.clear();<br class="">- Record.push_back(IDENTIFIER_INDEX);<br class="">- Record.push_back(BucketOffset);<br class="">+ ArrayRef<uint64_t> Record = {IDENTIFIER_INDEX, BucketOffset};<br class=""> Stream.EmitRecordWithBlob(IDTableAbbrev, Record, IdentifierTable);<br class=""> }<br class=""><br class=""><br class=""><br class="">_______________________________________________<br class="">cfe-commits mailing list<br class=""><a href="mailto:cfe-commits@lists.llvm.org" target="_blank" class="">cfe-commits@lists.llvm.org</a><br class=""><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a></blockquote></div></div></blockquote></div></div></div><br class=""></div></div></div></blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></body></html>