<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Sep 10, 2015 at 9:13 AM, David Blaikie 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"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Thu, Sep 10, 2015 at 9:07 AM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><div><div><blockquote type="cite"><div>On Sep 10, 2015, at 9:02 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:</div><br><div><br><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"><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 Thu, Sep 10, 2015 at 9:00 AM, Mehdi Amini<span> </span><span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span><span> </span>wrote:<br><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"><div style="word-wrap:break-word"><br><div><span><blockquote type="cite"><div>On Sep 9, 2015, at 7:06 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:</div><br><div><br><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"><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 6:46 PM, Mehdi Amini via cfe-commits<span> </span><span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span><span> </span>wrote:<br><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>Date: Wed Sep  9 20:46:39 2015<br>New Revision: 247233<br><br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project?rev=247233&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=247233&view=rev</a><br>Log:<br>EmitRecord* API change: accepts ArrayRef instead of a SmallVector (NFC)<br><br>This reapply a variant commit r247179 after post-commit review from<br>D.Blaikie.<br>Hopefully I got it right this time: lifetime of initializer list ends<br>as with any expression, which make invalid the pattern:<br><br>ArrayRef<int> Arr = { 1, 2, 3, 4};<br><br>Just like StringRef, ArrayRef shouldn't be used to initialize local<br>variable but only as function argument.<br></blockquote><div><br></div><div>Looks pretty reasonable - I'll mention it again, just in case: removing the named variables and just putting the init lists directly in the call might be as (or more) readable - might be worth giving it a go & running it through clang-format to see what you think.<br></div></div></div></blockquote><div><br></div></span><div>Here is an example, let me know what do you think:</div><div><br></div><div><div style="margin:0px;font-size:11px;font-family:Menlo">  {</div><span><div style="margin:0px;font-size:11px;font-family:Menlo">   <span> </span>RecordData::value_type Record[] = {METADATA, VERSION_MAJOR, VERSION_MINOR,</div></span><div style="margin:0px;font-size:11px;font-family:Menlo">                                      <span> </span><span style="color:rgb(4,51,255)">CLANG_VERSION_MAJOR</span>,<span> </span><span style="color:rgb(4,51,255)">CLANG_VERSION_MINOR</span>,</div><div style="margin:0px;font-size:11px;font-family:Menlo">                                      <span> </span>!isysroot.empty(), IncludeTimestamps,</div><div style="margin:0px;font-size:11px;font-family:Menlo">                                      <span> </span>ASTHasCompilerErrors};</div><div style="margin:0px;font-size:11px;font-family:Menlo">   <span> </span>Stream.EmitRecordWithBlob(MetadataAbbrevCode, Record,</div><div style="margin:0px;font-size:11px;font-family:Menlo">                             <span> </span>getClangFullRepositoryVersion());</div><div style="margin:0px;font-size:11px;font-family:Menlo"> <span> </span>}</div><div style="margin:0px;font-size:11px;font-family:Menlo"> <span> </span>Stream.EmitRecordWithBlob(</div><div style="margin:0px;font-size:11px;font-family:Menlo">     <span> </span>MetadataAbbrevCode,</div><div style="margin:0px;font-size:11px;font-family:Menlo">     <span> </span>(uint64_t[]){METADATA, VERSION_MAJOR, VERSION_MINOR,<span> </span><span style="color:rgb(4,51,255)">CLANG_VERSION_MAJOR</span>,</div></div></div></div></blockquote><div><br>Why the cast (uint64_t[])? I'm vaguely surprised that even compiles... ?</div></div></div></blockquote></div></div></div></div></blockquote></div></div></div></div></div></blockquote><div>This is a GNU extension (C99 compound literals in C++). It won't compile on MSVC.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div><blockquote type="cite"><div><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>I would imagine it'd be passed as an init list, then turned into an ArrayRef from there... but I guess not?<br></div></div></div></blockquote><div><br></div><div><br></div></div></div><div>Might be more clear with the callee:</div><div><br></div><div><div style="margin:0px;font-size:11px;font-family:Menlo;color:rgb(4,51,255)"><span style="color:#000000">  </span>template<span style="color:#000000"> <</span>typename<span style="color:#000000"> Container></span></div><div style="margin:0px;font-size:11px;font-family:Menlo">  <span style="color:#0433ff">void</span> EmitRecordWithBlob(<span style="color:#0433ff">unsigned</span> Abbrev, <span style="color:#0433ff">const</span> Container &Vals,</div><div style="margin:0px;font-size:11px;font-family:Menlo">                          <span style="color:#3495af">StringRef</span> Blob) {</div><div style="margin:0px;font-size:11px;font-family:Menlo">    EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), Blob, <span style="color:#3495af">None</span>);</div><div style="margin:0px;font-size:11px;font-family:Menlo">  }</div><div><br></div><div>The template can’t be deduced without the cast.</div></div></div></div></blockquote></div></div><div><br>Yeah, curious though. Another hole in perfect forwarding I suppose (not that this ^ is perfect forwarding, but even with perfect forwarding it doesn't cope well)<br><br>Yeah, the cast is rather unfortunate. Hrm.<br><br>Ah well - probably just as good to leave it as-is for now. If someone has a flash of inspiration later & figures out a way to make it better, so be it.<br></div></div></div></div></blockquote><div><br></div><div>The way to handle this is to add another EmitRecord overload that takes a std::initializer_list<uint64_t>.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><div><br></div><div>— </div><span><font color="#888888"><div>Mehdi</div><div><br></div><div><br></div></font></span></div><div><div><div><br></div><div><br></div><div><br></div><br><blockquote type="cite"><div><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> </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"><div style="word-wrap:break-word"><div><div><div style="margin:0px;font-size:11px;font-family:Menlo">                  <span> </span><span style="color:rgb(4,51,255)">CLANG_VERSION_MINOR</span>, !isysroot.empty(), IncludeTimestamps,</div><div style="margin:0px;font-size:11px;font-family:Menlo">                  <span> </span>ASTHasCompilerErrors},</div><div style="margin:0px;font-size:11px;font-family:Menlo">     <span> </span>getClangFullRepositoryVersion());</div><div><br></div><div>Thanks,</div><div><br></div><div>— </div><span><font color="#888888"><div>Mehdi</div><div><br></div></font></span></div><div><div><div><br></div><div><br></div><div><br></div><div><br></div><br><blockquote type="cite"><div><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><br>- Dave</div><div> </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>From: Mehdi Amini <<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>><br><br>Modified:<br>   <span> </span>cfe/trunk/include/clang/Serialization/ASTWriter.h<br>   <span> </span>cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp<br>   <span> </span>cfe/trunk/lib/Serialization/ASTWriter.cpp<br>   <span> </span>cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp<br><br>Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h<br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=247233&r1=247232&r2=247233&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=247233&r1=247232&r2=247233&view=diff</a><br>==============================================================================<br>--- cfe/trunk/include/clang/Serialization/ASTWriter.h (original)<br>+++ cfe/trunk/include/clang/Serialization/ASTWriter.h Wed Sep  9 20:46:39 2015<br>@@ -84,6 +84,7 @@ class ASTWriter : public ASTDeserializat<br> public:<br>   typedef SmallVector<uint64_t, 64> RecordData;<br>   typedef SmallVectorImpl<uint64_t> RecordDataImpl;<br>+  typedef ArrayRef<uint64_t> RecordDataRef;<br><br>   friend class ASTDeclWriter;<br>   friend class ASTStmtWriter;<br>@@ -756,7 +757,7 @@ public:<br>   void AddPath(StringRef Path, RecordDataImpl &Record);<br><br>   /// \brief Emit the current record with the given path as a blob.<br>-  void EmitRecordWithPath(unsigned Abbrev, RecordDataImpl &Record,<br>+  void EmitRecordWithPath(unsigned Abbrev, RecordDataRef Record,<br>                           StringRef Path);<br><br>   /// \brief Add a version tuple to the given record<br><br>Modified: cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp<br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp?rev=247233&r1=247232&r2=247233&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp?rev=247233&r1=247232&r2=247233&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp (original)<br>+++ cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp Wed Sep  9 20:46:39 2015<br>@@ -51,6 +51,7 @@ public:<br><br> typedef SmallVector<uint64_t, 64> RecordData;<br> typedef SmallVectorImpl<uint64_t> RecordDataImpl;<br>+typedef ArrayRef<uint64_t> RecordDataRef;<br><br> class SDiagsWriter;<br><br>@@ -393,13 +394,9 @@ unsigned SDiagsWriter::getEmitFile(const<br><br>   // Lazily generate the record for the file.<br>   entry = State->Files.size();<br>-  RecordData Record;<br>-  Record.push_back(RECORD_FILENAME);<br>-  Record.push_back(entry);<br>-  Record.push_back(0); // For legacy.<br>-  Record.push_back(0); // For legacy.<br>   StringRef Name(FileName);<br>-  Record.push_back(Name.size());<br>+  RecordData::value_type Record[] = {RECORD_FILENAME, entry, 0 /* For legacy */,<br>+                                     0 /* For legacy */, Name.size()};<br>   State->Stream.EmitRecordWithBlob(State->Abbrevs.get(RECORD_FILENAME), Record,<br>                                   <span> </span>Name);<br><br>@@ -531,14 +528,11 @@ void SDiagsWriter::EmitBlockInfoBlock()<br><br> void SDiagsWriter::EmitMetaBlock() {<br>   llvm::BitstreamWriter &Stream = State->Stream;<br>-  RecordData &Record = State->Record;<br>   AbbreviationMap &Abbrevs = State->Abbrevs;<br><br>   Stream.EnterSubblock(BLOCK_META, 3);<br>-  Record.clear();<br>-  Record.push_back(RECORD_VERSION);<br>-  Record.push_back(VersionNumber);<br>-  Stream.EmitRecordWithAbbrev(Abbrevs.get(RECORD_VERSION), Record);<br>+  RecordData::value_type Record[] = {RECORD_VERSION, VersionNumber};<br>+  Stream.EmitRecordWithAbbrev(Abbrevs.get(RECORD_VERSION), Record);<br>   Stream.ExitBlock();<br> }<br><br>@@ -548,11 +542,8 @@ unsigned SDiagsWriter::getEmitCategory(u<br><br>   // We use a local version of 'Record' so that we can be generating<br>   // another record when we lazily generate one for the category entry.<br>-  RecordData Record;<br>-  Record.push_back(RECORD_CATEGORY);<br>-  Record.push_back(category);<br>   StringRef catName = DiagnosticIDs::getCategoryNameFromID(category);<br>-  Record.push_back(catName.size());<br>+  RecordData::value_type Record[] = {RECORD_CATEGORY, category, catName.size()};<br>   State->Stream.EmitRecordWithBlob(State->Abbrevs.get(RECORD_CATEGORY), Record,<br>                                   <span> </span>catName);<br><br>@@ -581,10 +572,8 @@ unsigned SDiagsWriter::getEmitDiagnostic<br>     entry.second = FlagName;<br><br>     // Lazily emit the string in a separate record.<br>-    RecordData Record;<br>-    Record.push_back(RECORD_DIAG_FLAG);<br>-    Record.push_back(entry.first);<br>-    Record.push_back(FlagName.size());<br>+    RecordData::value_type Record[] = {RECORD_DIAG_FLAG, entry.first,<br>+                                       FlagName.size()};<br>     State->Stream.EmitRecordWithBlob(State->Abbrevs.get(RECORD_DIAG_FLAG),<br>                                     <span> </span>Record, FlagName);<br>   }<br>@@ -844,17 +833,9 @@ std::error_code SDiagsMerger::visitEndOf<br> std::error_code<br> SDiagsMerger::visitSourceRangeRecord(const serialized_diags::Location &Start,<br>                                     <span> </span>const serialized_diags::Location &End) {<br>-  RecordData Record;<br>-  Record.push_back(RECORD_SOURCE_RANGE);<br>-  Record.push_back(FileLookup[Start.FileID]);<br>-  Record.push_back(Start.Line);<br>-  Record.push_back(Start.Col);<br>-  Record.push_back(Start.Offset);<br>-  Record.push_back(FileLookup[End.FileID]);<br>-  Record.push_back(End.Line);<br>-  Record.push_back(End.Col);<br>-  Record.push_back(End.Offset);<br>-<br>+  RecordData::value_type Record[] = {<br>+      RECORD_SOURCE_RANGE, FileLookup[Start.FileID], Start.Line, Start.Col,<br>+      Start.Offset, FileLookup[End.FileID], End.Line, End.Col, End.Offset};<br>   Writer.State->Stream.EmitRecordWithAbbrev(<br>       Writer.State->Abbrevs.get(RECORD_SOURCE_RANGE), Record);<br>   return std::error_code();<br>@@ -863,19 +844,13 @@ SDiagsMerger::visitSourceRangeRecord(con<br> std::error_code SDiagsMerger::visitDiagnosticRecord(<br>     unsigned Severity, const serialized_diags::Location &Location,<br>     unsigned Category, unsigned Flag, StringRef Message) {<br>-  RecordData MergedRecord;<br>-  MergedRecord.push_back(RECORD_DIAG);<br>-  MergedRecord.push_back(Severity);<br>-  MergedRecord.push_back(FileLookup[Location.FileID]);<br>-  MergedRecord.push_back(Location.Line);<br>-  MergedRecord.push_back(Location.Col);<br>-  MergedRecord.push_back(Location.Offset);<br>-  MergedRecord.push_back(CategoryLookup[Category]);<br>-  MergedRecord.push_back(Flag ? DiagFlagLookup[Flag] : 0);<br>-  MergedRecord.push_back(Message.size());<br>+  RecordData::value_type Record[] = {<br>+      RECORD_DIAG, Severity, FileLookup[Location.FileID], Location.Line,<br>+      Location.Col, Location.Offset, CategoryLookup[Category],<br>+      Flag ? DiagFlagLookup[Flag] : 0, Message.size()};<br><br>   Writer.State->Stream.EmitRecordWithBlob(<br>-      Writer.State->Abbrevs.get(RECORD_DIAG), MergedRecord, Message);<br>+      Writer.State->Abbrevs.get(RECORD_DIAG), Record, Message);<br>   return std::error_code();<br> }<br><br>@@ -883,17 +858,10 @@ std::error_code<br> SDiagsMerger::visitFixitRecord(const serialized_diags::Location &Start,<br>                               <span> </span>const serialized_diags::Location &End,<br>                               <span> </span>StringRef Text) {<br>-  RecordData Record;<br>-  Record.push_back(RECORD_FIXIT);<br>-  Record.push_back(FileLookup[Start.FileID]);<br>-  Record.push_back(Start.Line);<br>-  Record.push_back(Start.Col);<br>-  Record.push_back(Start.Offset);<br>-  Record.push_back(FileLookup[End.FileID]);<br>-  Record.push_back(End.Line);<br>-  Record.push_back(End.Col);<br>-  Record.push_back(End.Offset);<br>-  Record.push_back(Text.size());<br>+  RecordData::value_type Record[] = {RECORD_FIXIT, FileLookup[Start.FileID],<br>+                                     Start.Line, Start.Col, Start.Offset,<br>+                                     FileLookup[End.FileID], End.Line, End.Col,<br>+                                     End.Offset, Text.size()};<br><br>   Writer.State->Stream.EmitRecordWithBlob(<br>       Writer.State->Abbrevs.get(RECORD_FIXIT), Record, Text);<br><br>Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp<br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=247233&r1=247232&r2=247233&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=247233&r1=247232&r2=247233&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)<br>+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Wed Sep  9 20:46:39 2015<br>@@ -1185,27 +1185,23 @@ void ASTWriter::WriteControlBlock(Prepro<br>   MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Errors<br>   MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // SVN branch/tag<br>   unsigned MetadataAbbrevCode = Stream.EmitAbbrev(MetadataAbbrev);<br>-  Record.push_back(METADATA);<br>-  Record.push_back(VERSION_MAJOR);<br>-  Record.push_back(VERSION_MINOR);<br>-  Record.push_back(CLANG_VERSION_MAJOR);<br>-  Record.push_back(CLANG_VERSION_MINOR);<br>   assert((!WritingModule || isysroot.empty()) &&<br>         <span> </span>"writing module as a relocatable PCH?");<br>-  Record.push_back(!isysroot.empty());<br>-  Record.push_back(IncludeTimestamps);<br>-  Record.push_back(ASTHasCompilerErrors);<br>-  Stream.EmitRecordWithBlob(MetadataAbbrevCode, Record,<br>-                            getClangFullRepositoryVersion());<br>-<br>+  {<br>+    RecordData::value_type Record[] = {METADATA, VERSION_MAJOR, VERSION_MINOR,<br>+                                       CLANG_VERSION_MAJOR, CLANG_VERSION_MINOR,<br>+                                       !isysroot.empty(), IncludeTimestamps,<br>+                                       ASTHasCompilerErrors};<br>+    Stream.EmitRecordWithBlob(MetadataAbbrevCode, Record,<br>+                              getClangFullRepositoryVersion());<br>+  }<br>   if (WritingModule) {<br>     // For implicit modules we output a signature that we can use to ensure<br>     // duplicate module builds don't collide in the cache as their output order<br>     // is non-deterministic.<br>     // FIXME: Remove this when output is deterministic.<br>     if (Context.getLangOpts().ImplicitModules) {<br>-      Record.clear();<br>-      Record.push_back(getSignature());<br>+      RecordData::value_type Record[] = {getSignature()};<br>       Stream.EmitRecord(SIGNATURE, Record);<br>     }<br><br>@@ -1214,8 +1210,7 @@ void ASTWriter::WriteControlBlock(Prepro<br>     Abbrev->Add(BitCodeAbbrevOp(MODULE_NAME));<br>     Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Name<br>     unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev);<br>-    RecordData Record;<br>-    Record.push_back(MODULE_NAME);<br>+    RecordData::value_type Record[] = {MODULE_NAME};<br>     Stream.EmitRecordWithBlob(AbbrevCode, Record, WritingModule->Name);<br>   }<br><br>@@ -1236,8 +1231,7 @@ void ASTWriter::WriteControlBlock(Prepro<br>       Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Directory<br>       unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev);<br><br>-      RecordData Record;<br>-      Record.push_back(MODULE_DIRECTORY);<br>+      RecordData::value_type Record[] = {MODULE_DIRECTORY};<br>       Stream.EmitRecordWithBlob(AbbrevCode, Record, BaseDir);<br>     }<br><br>@@ -1466,8 +1460,7 @@ void ASTWriter::WriteControlBlock(Prepro<br>     SM.getFileManager().makeAbsolutePath(OutputPath);<br>     StringRef origDir = llvm::sys::path::parent_path(OutputPath);<br><br>-    RecordData Record;<br>-    Record.push_back(ORIGINAL_PCH_DIR);<br>+    RecordData::value_type Record[] = {ORIGINAL_PCH_DIR};<br>     Stream.EmitRecordWithBlob(AbbrevCode, Record, origDir);<br>   }<br><br>@@ -1491,8 +1484,7 @@ void ASTWriter::WriteInputFiles(SourceMa<br>                                 bool Modules) {<br>   using namespace llvm;<br>   Stream.EnterSubblock(INPUT_FILES_BLOCK_ID, 4);<br>-  RecordData Record;<br>-<br>+<br>   // Create input-file abbreviation.<br>   BitCodeAbbrev *IFAbbrev = new BitCodeAbbrev();<br>   IFAbbrev->Add(BitCodeAbbrevOp(INPUT_FILE));<br>@@ -1547,16 +1539,11 @@ void ASTWriter::WriteInputFiles(SourceMa<br>     if (!Entry.IsSystemFile)<br>       ++UserFilesNum;<br><br>-    Record.clear();<br>-    Record.push_back(INPUT_FILE);<br>-    Record.push_back(InputFileOffsets.size());<br>-<br>     // Emit size/modification time for this file.<br>-    Record.push_back(Entry.File->getSize());<br>-    Record.push_back(getTimestampForOutput(Entry.File));<br>-<br>-    // Whether this file was overridden.<br>-    Record.push_back(Entry.BufferOverridden);<br>+    // And whether this file was overridden.<br>+    RecordData::value_type Record[] = {<br>+        INPUT_FILE, InputFileOffsets.size(), (uint64_t)Entry.File->getSize(),<br>+        (uint64_t)getTimestampForOutput(Entry.File), Entry.BufferOverridden};<br><br>     EmitRecordWithPath(IFAbbrevCode, Record, Entry.File->getName());<br>   }<br>@@ -1573,10 +1560,8 @@ void ASTWriter::WriteInputFiles(SourceMa<br>   unsigned OffsetsAbbrevCode = Stream.EmitAbbrev(OffsetsAbbrev);<br><br>   // Write input file offsets.<br>-  Record.clear();<br>-  Record.push_back(INPUT_FILE_OFFSETS);<br>-  Record.push_back(InputFileOffsets.size());<br>-  Record.push_back(UserFilesNum);<br>+  RecordData::value_type Record[] = {INPUT_FILE_OFFSETS,<br>+                                     InputFileOffsets.size(), UserFilesNum};<br>   Stream.EmitRecordWithBlob(OffsetsAbbrevCode, Record, bytes(InputFileOffsets));<br> }<br><br>@@ -1818,11 +1803,8 @@ void ASTWriter::WriteHeaderSearch(const<br>   unsigned TableAbbrev = Stream.EmitAbbrev(Abbrev);<br><br>   // Write the header search table<br>-  RecordData Record;<br>-  Record.push_back(HEADER_SEARCH_TABLE);<br>-  Record.push_back(BucketOffset);<br>-  Record.push_back(NumHeaderSearchEntries);<br>-  Record.push_back(TableData.size());<br>+  RecordData::value_type Record[] = {HEADER_SEARCH_TABLE, BucketOffset,<br>+                                     NumHeaderSearchEntries, TableData.size()};<br>   TableData.append(GeneratorTrait.strings_begin(),GeneratorTrait.strings_end());<br>   Stream.EmitRecordWithBlob(TableAbbrev, Record, TableData);<br><br>@@ -1911,8 +1893,7 @@ void ASTWriter::WriteSourceManagerBlock(<br>         Stream.EmitRecordWithAbbrev(SLocFileAbbrv, Record);<br><br>         if (Content->BufferOverridden) {<br>-          Record.clear();<br>-          Record.push_back(SM_SLOC_BUFFER_BLOB);<br>+          RecordData::value_type Record[] = {SM_SLOC_BUFFER_BLOB};<br>           const llvm::MemoryBuffer *Buffer<br>             = Content->getBuffer(PP.getDiagnostics(), PP.getSourceManager());<br>           Stream.EmitRecordWithBlob(SLocBufferBlobAbbrv, Record,<br>@@ -1931,8 +1912,7 @@ void ASTWriter::WriteSourceManagerBlock(<br>         const char *Name = Buffer->getBufferIdentifier();<br>         Stream.EmitRecordWithBlob(SLocBufferAbbrv, Record,<br>                                   StringRef(Name, strlen(Name) + 1));<br>-        Record.clear();<br>-        Record.push_back(SM_SLOC_BUFFER_BLOB);<br>+        RecordData::value_type Record[] = {SM_SLOC_BUFFER_BLOB};<br>         Stream.EmitRecordWithBlob(SLocBufferBlobAbbrv, Record,<br>                                   StringRef(Buffer->getBufferStart(),<br>                                                   Buffer->getBufferSize() + 1));<br>@@ -1972,13 +1952,13 @@ void ASTWriter::WriteSourceManagerBlock(<br>   Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 16)); // total size<br>   Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // offsets<br>   unsigned SLocOffsetsAbbrev = Stream.EmitAbbrev(Abbrev);<br>-<br>-  Record.clear();<br>-  Record.push_back(SOURCE_LOCATION_OFFSETS);<br>-  Record.push_back(SLocEntryOffsets.size());<br>-  Record.push_back(SourceMgr.getNextLocalOffset() - 1); // skip dummy<br>-  Stream.EmitRecordWithBlob(SLocOffsetsAbbrev, Record, bytes(SLocEntryOffsets));<br>-<br>+  {<br>+    RecordData::value_type Record[] = {<br>+        SOURCE_LOCATION_OFFSETS, SLocEntryOffsets.size(),<br>+        SourceMgr.getNextLocalOffset() - 1 /* skip dummy */};<br>+    Stream.EmitRecordWithBlob(SLocOffsetsAbbrev, Record,<br>+                              bytes(SLocEntryOffsets));<br>+  }<br>   // Write the source location entry preloads array, telling the AST<br>   // reader which source locations entries it should load eagerly.<br>   Stream.EmitRecord(SOURCE_LOCATION_PRELOADS, PreloadSLocs);<br>@@ -2064,9 +2044,8 @@ void ASTWriter::WritePreprocessor(const<br><br>   // If the preprocessor __COUNTER__ value has been bumped, remember it.<br>   if (PP.getCounterValue() != 0) {<br>-    Record.push_back(PP.getCounterValue());<br>+    RecordData::value_type Record[] = {PP.getCounterValue()};<br>     Stream.EmitRecord(PP_COUNTER_VALUE, Record);<br>-    Record.clear();<br>   }<br><br>   // Enter the preprocessor block.<br>@@ -2232,12 +2211,11 @@ void ASTWriter::WritePreprocessor(const<br>   Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));<br><br>   unsigned MacroOffsetAbbrev = Stream.EmitAbbrev(Abbrev);<br>-  Record.clear();<br>-  Record.push_back(MACRO_OFFSET);<br>-  Record.push_back(MacroOffsets.size());<br>-  Record.push_back(FirstMacroID - NUM_PREDEF_MACRO_IDS);<br>-  Stream.EmitRecordWithBlob(MacroOffsetAbbrev, Record,<br>-                            bytes(MacroOffsets));<br>+  {<br>+    RecordData::value_type Record[] = {MACRO_OFFSET, MacroOffsets.size(),<br>+                                       FirstMacroID - NUM_PREDEF_MACRO_IDS};<br>+    Stream.EmitRecordWithBlob(MacroOffsetAbbrev, Record, bytes(MacroOffsets));<br>+  }<br> }<br><br> void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) {<br>@@ -2331,9 +2309,9 @@ void ASTWriter::WritePreprocessorDetail(<br>     Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));<br>     unsigned PPEOffsetAbbrev = Stream.EmitAbbrev(Abbrev);<br><br>-    Record.clear();<br>-    Record.push_back(PPD_ENTITIES_OFFSETS);<br>-    Record.push_back(FirstPreprocessorEntityID - NUM_PREDEF_PP_ENTITY_IDS);<br>+    RecordData::value_type Record[] = {PPD_ENTITIES_OFFSETS,<br>+                                       FirstPreprocessorEntityID -<br>+                                           NUM_PREDEF_PP_ENTITY_IDS};<br>     Stream.EmitRecordWithBlob(PPEOffsetAbbrev, Record,<br>                               bytes(PreprocessedEntityOffsets));<br>   }<br>@@ -2460,9 +2438,9 @@ void ASTWriter::WriteSubmodules(Module *<br>   unsigned ConflictAbbrev = Stream.EmitAbbrev(Abbrev);<br><br>   // Write the submodule metadata block.<br>-  RecordData Record;<br>-  Record.push_back(getNumberOfModules(WritingModule));<br>-  Record.push_back(FirstSubmoduleID - NUM_PREDEF_SUBMODULE_IDS);<br>+  RecordData::value_type Record[] = {getNumberOfModules(WritingModule),<br>+                                     FirstSubmoduleID -<br>+                                         NUM_PREDEF_SUBMODULE_IDS};<br>   Stream.EmitRecord(SUBMODULE_METADATA, Record);<br><br>   // Write all of the submodules.<br>@@ -2472,45 +2450,37 @@ void ASTWriter::WriteSubmodules(Module *<br>     Module *Mod = Q.front();<br>     Q.pop();<br>     unsigned ID = getSubmoduleID(Mod);<br>-<br>-    // Emit the definition of the block.<br>-    Record.clear();<br>-    Record.push_back(SUBMODULE_DEFINITION);<br>-    Record.push_back(ID);<br>+<br>+    uint64_t ParentID = 0;<br>     if (Mod->Parent) {<br>       assert(SubmoduleIDs[Mod->Parent] && "Submodule parent not written?");<br>-      Record.push_back(SubmoduleIDs[Mod->Parent]);<br>-    } else {<br>-      Record.push_back(0);<br>+      ParentID = SubmoduleIDs[Mod->Parent];<br>     }<br>-    Record.push_back(Mod->IsFramework);<br>-    Record.push_back(Mod->IsExplicit);<br>-    Record.push_back(Mod->IsSystem);<br>-    Record.push_back(Mod->IsExternC);<br>-    Record.push_back(Mod->InferSubmodules);<br>-    Record.push_back(Mod->InferExplicitSubmodules);<br>-    Record.push_back(Mod->InferExportWildcard);<br>-    Record.push_back(Mod->ConfigMacrosExhaustive);<br>-    Stream.EmitRecordWithBlob(DefinitionAbbrev, Record, Mod->Name);<br>-<br>+<br>+    // Emit the definition of the block.<br>+    {<br>+      RecordData::value_type Record[] = {<br>+          SUBMODULE_DEFINITION, ID, ParentID, Mod->IsFramework, Mod->IsExplicit,<br>+          Mod->IsSystem, Mod->IsExternC, Mod->InferSubmodules,<br>+          Mod->InferExplicitSubmodules, Mod->InferExportWildcard,<br>+          Mod->ConfigMacrosExhaustive};<br>+      Stream.EmitRecordWithBlob(DefinitionAbbrev, Record, Mod->Name);<br>+    }<br>+<br>     // Emit the requirements.<br>     for (const auto &R : Mod->Requirements) {<br>-      Record.clear();<br>-      Record.push_back(SUBMODULE_REQUIRES);<br>-      Record.push_back(R.second);<br>+      RecordData::value_type Record[] = {SUBMODULE_REQUIRES, R.second};<br>       Stream.EmitRecordWithBlob(RequiresAbbrev, Record, R.first);<br>     }<br><br>     // Emit the umbrella header, if there is one.<br>     if (auto UmbrellaHeader = Mod->getUmbrellaHeader()) {<br>-      Record.clear();<br>-      Record.push_back(SUBMODULE_UMBRELLA_HEADER);<br>+      RecordData::value_type Record[] = {SUBMODULE_UMBRELLA_HEADER};<br>       Stream.EmitRecordWithBlob(UmbrellaAbbrev, Record,<br>                                 UmbrellaHeader.NameAsWritten);<br>     } else if (auto UmbrellaDir = Mod->getUmbrellaDir()) {<br>-      Record.clear();<br>-      Record.push_back(SUBMODULE_UMBRELLA_DIR);<br>-      Stream.EmitRecordWithBlob(UmbrellaDirAbbrev, Record,<br>+      RecordData::value_type Record[] = {SUBMODULE_UMBRELLA_DIR};<br>+      Stream.EmitRecordWithBlob(UmbrellaDirAbbrev, Record,<br>                                 UmbrellaDir.NameAsWritten);<br>     }<br><br>@@ -2528,8 +2498,7 @@ void ASTWriter::WriteSubmodules(Module *<br>       {SUBMODULE_EXCLUDED_HEADER, ExcludedHeaderAbbrev, Module::HK_Excluded}<br>     };<br>     for (auto &HL : HeaderLists) {<br>-      Record.clear();<br>-      Record.push_back(HL.RecordKind);<br>+      RecordData::value_type Record[] = {HL.RecordKind};<br>       for (auto &H : Mod->Headers[HL.HeaderKind])<br>         Stream.EmitRecordWithBlob(HL.Abbrev, Record, H.NameAsWritten);<br>     }<br>@@ -2537,15 +2506,14 @@ void ASTWriter::WriteSubmodules(Module *<br>     // Emit the top headers.<br>     {<br>       auto TopHeaders = Mod->getTopHeaders(PP->getFileManager());<br>-      Record.clear();<br>-      Record.push_back(SUBMODULE_TOPHEADER);<br>+      RecordData::value_type Record[] = {SUBMODULE_TOPHEADER};<br>       for (auto *H : TopHeaders)<br>         Stream.EmitRecordWithBlob(TopHeaderAbbrev, Record, H->getName());<br>     }<br><br>     // Emit the imports.<br>     if (!Mod->Imports.empty()) {<br>-      Record.clear();<br>+      RecordData Record;<br>       for (auto *I : Mod->Imports)<br>         Record.push_back(getSubmoduleID(I));<br>       Stream.EmitRecord(SUBMODULE_IMPORTS, Record);<br>@@ -2553,7 +2521,7 @@ void ASTWriter::WriteSubmodules(Module *<br><br>     // Emit the exports.<br>     if (!Mod->Exports.empty()) {<br>-      Record.clear();<br>+      RecordData Record;<br>       for (const auto &E : Mod->Exports) {<br>         // FIXME: This may fail; we don't require that all exported modules<br>         // are local or imported.<br>@@ -2569,26 +2537,23 @@ void ASTWriter::WriteSubmodules(Module *<br><br>     // Emit the link libraries.<br>     for (const auto &LL : Mod->LinkLibraries) {<br>-      Record.clear();<br>-      Record.push_back(SUBMODULE_LINK_LIBRARY);<br>-      Record.push_back(LL.IsFramework);<br>+      RecordData::value_type Record[] = {SUBMODULE_LINK_LIBRARY,<br>+                                         LL.IsFramework};<br>       Stream.EmitRecordWithBlob(LinkLibraryAbbrev, Record, LL.Library);<br>     }<br><br>     // Emit the conflicts.<br>     for (const auto &C : Mod->Conflicts) {<br>-      Record.clear();<br>-      Record.push_back(SUBMODULE_CONFLICT);<br>       // FIXME: This may fail; we don't require that all conflicting modules<br>       // are local or imported.<br>-      Record.push_back(getSubmoduleID(C.Other));<br>+      RecordData::value_type Record[] = {SUBMODULE_CONFLICT,<br>+                                         getSubmoduleID(C.Other)};<br>       Stream.EmitRecordWithBlob(ConflictAbbrev, Record, C.Message);<br>     }<br><br>     // Emit the configuration macros.<br>     for (const auto &CM : Mod->ConfigMacros) {<br>-      Record.clear();<br>-      Record.push_back(SUBMODULE_CONFIG_MACRO);<br>+      RecordData::value_type Record[] = {SUBMODULE_CONFIG_MACRO};<br>       Stream.EmitRecordWithBlob(ConfigMacroAbbrev, Record, CM);<br>     }<br><br>@@ -2670,8 +2635,6 @@ void ASTWriter::WriteCXXCtorInitializers<br>   if (CXXCtorInitializersOffsets.empty())<br>     return;<br><br>-  RecordData Record;<br>-<br>   // Create a blob abbreviation for the C++ ctor initializer offsets.<br>   using namespace llvm;<br><br>@@ -2682,9 +2645,8 @@ void ASTWriter::WriteCXXCtorInitializers<br>   unsigned CtorInitializersOffsetAbbrev = Stream.EmitAbbrev(Abbrev);<br><br>   // Write the base specifier offsets table.<br>-  Record.clear();<br>-  Record.push_back(CXX_CTOR_INITIALIZERS_OFFSETS);<br>-  Record.push_back(CXXCtorInitializersOffsets.size());<br>+  RecordData::value_type Record[] = {CXX_CTOR_INITIALIZERS_OFFSETS,<br>+                                     CXXCtorInitializersOffsets.size()};<br>   Stream.EmitRecordWithBlob(CtorInitializersOffsetAbbrev, Record,<br>                             bytes(CXXCtorInitializersOffsets));<br> }<br>@@ -2693,8 +2655,6 @@ void ASTWriter::WriteCXXBaseSpecifiersOf<br>   if (CXXBaseSpecifiersOffsets.empty())<br>     return;<br><br>-  RecordData Record;<br>-<br>   // Create a blob abbreviation for the C++ base specifiers offsets.<br>   using namespace llvm;<br><br>@@ -2705,9 +2665,8 @@ void ASTWriter::WriteCXXBaseSpecifiersOf<br>   unsigned BaseSpecifierOffsetAbbrev = Stream.EmitAbbrev(Abbrev);<br><br>   // Write the base specifier offsets table.<br>-  Record.clear();<br>-  Record.push_back(CXX_BASE_SPECIFIER_OFFSETS);<br>-  Record.push_back(CXXBaseSpecifiersOffsets.size());<br>+  RecordData::value_type Record[] = {CXX_BASE_SPECIFIER_OFFSETS,<br>+                                     CXXBaseSpecifiersOffsets.size()};<br>   Stream.EmitRecordWithBlob(BaseSpecifierOffsetAbbrev, Record,<br>                             bytes(CXXBaseSpecifiersOffsets));<br> }<br>@@ -2778,8 +2737,6 @@ uint64_t ASTWriter::WriteDeclContextLexi<br>     return 0;<br><br>   uint64_t Offset = Stream.GetCurrentBitNo();<br>-  RecordData Record;<br>-  Record.push_back(DECL_CONTEXT_LEXICAL);<br>   SmallVector<uint32_t, 128> KindDeclPairs;<br>   for (const auto *D : DC->decls()) {<br>     KindDeclPairs.push_back(D->getKind());<br>@@ -2787,6 +2744,7 @@ uint64_t ASTWriter::WriteDeclContextLexi<br>   }<br><br>   ++NumLexicalDeclContexts;<br>+  RecordData::value_type Record[] = {DECL_CONTEXT_LEXICAL};<br>   Stream.EmitRecordWithBlob(DeclContextLexicalAbbrev, Record,<br>                             bytes(KindDeclPairs));<br>   return Offset;<br>@@ -2794,7 +2752,6 @@ uint64_t ASTWriter::WriteDeclContextLexi<br><br> void ASTWriter::WriteTypeDeclOffsets() {<br>   using namespace llvm;<br>-  RecordData Record;<br><br>   // Write the type offsets array<br>   BitCodeAbbrev *Abbrev = new BitCodeAbbrev();<br>@@ -2803,11 +2760,11 @@ void ASTWriter::WriteTypeDeclOffsets() {<br>   Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // base type index<br>   Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // types block<br>   unsigned TypeOffsetAbbrev = Stream.EmitAbbrev(Abbrev);<br>-  Record.clear();<br>-  Record.push_back(TYPE_OFFSET);<br>-  Record.push_back(TypeOffsets.size());<br>-  Record.push_back(FirstTypeID - NUM_PREDEF_TYPE_IDS);<br>-  Stream.EmitRecordWithBlob(TypeOffsetAbbrev, Record, bytes(TypeOffsets));<br>+  {<br>+    RecordData::value_type Record[] = {TYPE_OFFSET, TypeOffsets.size(),<br>+                                       FirstTypeID - NUM_PREDEF_TYPE_IDS};<br>+    Stream.EmitRecordWithBlob(TypeOffsetAbbrev, Record, bytes(TypeOffsets));<br>+  }<br><br>   // Write the declaration offsets array<br>   Abbrev = new BitCodeAbbrev();<br>@@ -2816,16 +2773,15 @@ void ASTWriter::WriteTypeDeclOffsets() {<br>   Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // base decl ID<br>   Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // declarations block<br>   unsigned DeclOffsetAbbrev = Stream.EmitAbbrev(Abbrev);<br>-  Record.clear();<br>-  Record.push_back(DECL_OFFSET);<br>-  Record.push_back(DeclOffsets.size());<br>-  Record.push_back(FirstDeclID - NUM_PREDEF_DECL_IDS);<br>-  Stream.EmitRecordWithBlob(DeclOffsetAbbrev, Record, bytes(DeclOffsets));<br>+  {<br>+    RecordData::value_type Record[] = {DECL_OFFSET, DeclOffsets.size(),<br>+                                       FirstDeclID - NUM_PREDEF_DECL_IDS};<br>+    Stream.EmitRecordWithBlob(DeclOffsetAbbrev, Record, bytes(DeclOffsets));<br>+  }<br> }<br><br> void ASTWriter::WriteFileDeclIDsMap() {<br>   using namespace llvm;<br>-  RecordData Record;<br><br>   SmallVector<std::pair<FileID, DeclIDInFileInfo *>, 64> SortedFileDeclIDs(<br>       FileDeclIDs.begin(), FileDeclIDs.end());<br>@@ -2846,8 +2802,8 @@ void ASTWriter::WriteFileDeclIDsMap() {<br>   Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));<br>   Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));<br>   unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev);<br>-  Record.push_back(FILE_SORTED_DECLS);<br>-  Record.push_back(FileGroupedDeclIDs.size());<br>+  RecordData::value_type Record[] = {FILE_SORTED_DECLS,<br>+                                     FileGroupedDeclIDs.size()};<br>   Stream.EmitRecordWithBlob(AbbrevCode, Record, bytes(FileGroupedDeclIDs));<br> }<br><br>@@ -3057,11 +3013,11 @@ void ASTWriter::WriteSelectors(Sema &Sem<br>     unsigned MethodPoolAbbrev = Stream.EmitAbbrev(Abbrev);<br><br>     // Write the method pool<br>-    RecordData Record;<br>-    Record.push_back(METHOD_POOL);<br>-    Record.push_back(BucketOffset);<br>-    Record.push_back(NumTableEntries);<br>-    Stream.EmitRecordWithBlob(MethodPoolAbbrev, Record, MethodPool);<br>+    {<br>+      RecordData::value_type Record[] = {METHOD_POOL, BucketOffset,<br>+                                         NumTableEntries};<br>+      Stream.EmitRecordWithBlob(MethodPoolAbbrev, Record, MethodPool);<br>+    }<br><br>     // Create a blob abbreviation for the selector table offsets.<br>     Abbrev = new BitCodeAbbrev();<br>@@ -3072,12 +3028,13 @@ void ASTWriter::WriteSelectors(Sema &Sem<br>     unsigned SelectorOffsetAbbrev = Stream.EmitAbbrev(Abbrev);<br><br>     // Write the selector offsets table.<br>-    Record.clear();<br>-    Record.push_back(SELECTOR_OFFSETS);<br>-    Record.push_back(SelectorOffsets.size());<br>-    Record.push_back(FirstSelectorID - NUM_PREDEF_SELECTOR_IDS);<br>-    Stream.EmitRecordWithBlob(SelectorOffsetAbbrev, Record,<br>-                              bytes(SelectorOffsets));<br>+    {<br>+      RecordData::value_type Record[] = {<br>+          SELECTOR_OFFSETS, SelectorOffsets.size(),<br>+          FirstSelectorID - NUM_PREDEF_SELECTOR_IDS};<br>+      Stream.EmitRecordWithBlob(SelectorOffsetAbbrev, Record,<br>+                                bytes(SelectorOffsets));<br>+    }<br>   }<br> }<br><br>@@ -3347,9 +3304,7 @@ void ASTWriter::WriteIdentifierTable(Pre<br>     unsigned IDTableAbbrev = Stream.EmitAbbrev(Abbrev);<br><br>     // Write the identifier table<br>-    RecordData Record;<br>-    Record.push_back(IDENTIFIER_TABLE);<br>-    Record.push_back(BucketOffset);<br>+    RecordData::value_type Record[] = {IDENTIFIER_TABLE, BucketOffset};<br>     Stream.EmitRecordWithBlob(IDTableAbbrev, Record, IdentifierTable);<br>   }<br><br>@@ -3365,11 +3320,10 @@ void ASTWriter::WriteIdentifierTable(Pre<br>   for (unsigned I = 0, N = IdentifierOffsets.size(); I != N; ++I)<br>     assert(IdentifierOffsets[I] && "Missing identifier offset?");<br> #endif<br>-<br>-  RecordData Record;<br>-  Record.push_back(IDENTIFIER_OFFSET);<br>-  Record.push_back(IdentifierOffsets.size());<br>-  Record.push_back(FirstIdentID - NUM_PREDEF_IDENT_IDS);<br>+<br>+  RecordData::value_type Record[] = {IDENTIFIER_OFFSET,<br>+                                     IdentifierOffsets.size(),<br>+                                     FirstIdentID - NUM_PREDEF_IDENT_IDS};<br>   Stream.EmitRecordWithBlob(IdentifierOffsetAbbrev, Record,<br>                             bytes(IdentifierOffsets));<br><br>@@ -3785,8 +3739,7 @@ uint64_t ASTWriter::WriteDeclContextVisi<br>   GenerateNameLookupTable(DC, LookupTable);<br><br>   // Write the lookup table<br>-  RecordData Record;<br>-  Record.push_back(DECL_CONTEXT_VISIBLE);<br>+  RecordData::value_type Record[] = {DECL_CONTEXT_VISIBLE};<br>   Stream.EmitRecordWithBlob(DeclContextVisibleLookupAbbrev, Record,<br>                             LookupTable);<br>   ++NumVisibleDeclContexts;<br>@@ -3817,16 +3770,13 @@ void ASTWriter::WriteDeclContextVisibleU<br>     DC = cast<DeclContext>(Chain->getKeyDeclaration(cast<Decl>(DC)));<br><br>   // Write the lookup table<br>-  RecordData Record;<br>-  Record.push_back(UPDATE_VISIBLE);<br>-  Record.push_back(getDeclID(cast<Decl>(DC)));<br>+  RecordData::value_type Record[] = {UPDATE_VISIBLE, getDeclID(cast<Decl>(DC))};<br>   Stream.EmitRecordWithBlob(UpdateVisibleAbbrev, Record, LookupTable);<br> }<br><br> /// \brief Write an FP_PRAGMA_OPTIONS block for the given FPOptions.<br> void ASTWriter::WriteFPPragmaOptions(const FPOptions &Opts) {<br>-  RecordData Record;<br>-  Record.push_back(Opts.fp_contract);<br>+  RecordData::value_type Record[] = {Opts.fp_contract};<br>   Stream.EmitRecord(FP_PRAGMA_OPTIONS, Record);<br> }<br><br>@@ -3883,14 +3833,12 @@ void ASTWriter::WriteObjCCategories() {<br>   Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // # of entries<br>   Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));<br>   unsigned AbbrevID = Stream.EmitAbbrev(Abbrev);<br>-<br>-  RecordData Record;<br>-  Record.push_back(OBJC_CATEGORIES_MAP);<br>-  Record.push_back(CategoriesMap.size());<br>-  Stream.EmitRecordWithBlob(AbbrevID, Record,<br>-                            reinterpret_cast<char*>(CategoriesMap.data()),<br>+<br>+  RecordData::value_type Record[] = {OBJC_CATEGORIES_MAP, CategoriesMap.size()};<br>+  Stream.EmitRecordWithBlob(AbbrevID, Record,<br>+                            reinterpret_cast<char *>(CategoriesMap.data()),<br>                             CategoriesMap.size() * sizeof(ObjCCategoriesInfo));<br>-<br>+<br>   // Emit the category lists.<br>   Stream.EmitRecord(OBJC_CATEGORIES, Categories);<br> }<br>@@ -3987,7 +3935,7 @@ void ASTWriter::AddPath(StringRef Path,<br>   AddString(FilePath, Record);<br> }<br><br>-void ASTWriter::EmitRecordWithPath(unsigned Abbrev, RecordDataImpl &Record,<br>+void ASTWriter::EmitRecordWithPath(unsigned Abbrev, RecordDataRef Record,<br>                                   <span> </span>StringRef Path) {<br>   SmallString<128> FilePath(Path);<br>   PreparePathForOutput(FilePath);<br>@@ -4250,14 +4198,14 @@ void ASTWriter::WriteASTCore(Sema &SemaR<br>   WriteControlBlock(PP, Context, isysroot, OutputFile);<br><br>   // Write the remaining AST contents.<br>-  RecordData Record;<br>   Stream.EnterSubblock(AST_BLOCK_ID, 5);<br><br>   // This is so that older clang versions, before the introduction<br>   // of the control block, can read and reject the newer PCH format.<br>-  Record.clear();<br>-  Record.push_back(VERSION_MAJOR);<br>-  Stream.EmitRecord(METADATA_OLD_FORMAT, Record);<br>+  {<br>+    RecordData Record = {VERSION_MAJOR};<br>+    Stream.EmitRecord(METADATA_OLD_FORMAT, Record);<br>+  }<br><br>   // Create a lexical update block containing all of the declarations in the<br>   // translation unit that do not come from other AST files.<br>@@ -4274,11 +4222,12 @@ void ASTWriter::WriteASTCore(Sema &SemaR<br>   Abv->Add(llvm::BitCodeAbbrevOp(TU_UPDATE_LEXICAL));<br>   Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));<br>   unsigned TuUpdateLexicalAbbrev = Stream.EmitAbbrev(Abv);<br>-  Record.clear();<br>-  Record.push_back(TU_UPDATE_LEXICAL);<br>-  Stream.EmitRecordWithBlob(TuUpdateLexicalAbbrev, Record,<br>-                            bytes(NewGlobalKindDeclPairs));<br>-<br>+  {<br>+    RecordData::value_type Record[] = {TU_UPDATE_LEXICAL};<br>+    Stream.EmitRecordWithBlob(TuUpdateLexicalAbbrev, Record,<br>+                              bytes(NewGlobalKindDeclPairs));<br>+  }<br>+<br>   // And a visible updates block for the translation unit.<br>   Abv = new llvm::BitCodeAbbrev();<br>   Abv->Add(llvm::BitCodeAbbrevOp(UPDATE_VISIBLE));<br>@@ -4408,8 +4357,7 @@ void ASTWriter::WriteASTCore(Sema &SemaR<br>         writeBaseIDOrNone(M->BaseTypeIndex, M->LocalNumTypes);<br>       }<br>     }<br>-    Record.clear();<br>-    Record.push_back(MODULE_OFFSET_MAP);<br>+    RecordData::value_type Record[] = {MODULE_OFFSET_MAP};<br>     Stream.EmitRecordWithBlob(ModuleOffsetMapAbbrev, Record,<br>                               Buffer.data(), Buffer.size());<br>   }<br>@@ -4573,11 +4521,8 @@ void ASTWriter::WriteASTCore(Sema &SemaR<br>     WriteOptimizePragmaOptions(SemaRef);<br><br>   // Some simple statistics<br>-  Record.clear();<br>-  Record.push_back(NumStatements);<br>-  Record.push_back(NumMacros);<br>-  Record.push_back(NumLexicalDeclContexts);<br>-  Record.push_back(NumVisibleDeclContexts);<br>+  RecordData::value_type Record[] = {<br>+      NumStatements, NumMacros, NumLexicalDeclContexts, NumVisibleDeclContexts};<br>   Stream.EmitRecord(STATISTICS, Record);<br>   Stream.ExitBlock();<br> }<br><br>Modified: cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp<br>URL:<span> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp?rev=247233&r1=247232&r2=247233&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp?rev=247233&r1=247232&r2=247233&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp (original)<br>+++ cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp Wed Sep  9 20:46:39 2015<br>@@ -757,9 +757,7 @@ void GlobalModuleIndexBuilder::writeInde<br>     unsigned IDTableAbbrev = Stream.EmitAbbrev(Abbrev);<br><br>     // Write the identifier table<br>-    Record.clear();<br>-    Record.push_back(IDENTIFIER_INDEX);<br>-    Record.push_back(BucketOffset);<br>+    uint64_t Record[] = {IDENTIFIER_INDEX, BucketOffset};<br>     Stream.EmitRecordWithBlob(IDTableAbbrev, Record, IdentifierTable);<br>   }<br><br><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@lists.llvm.org" target="_blank">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></blockquote></div></div></blockquote></div></div></div></div></blockquote></div></div></blockquote></div></div></div><br></div></blockquote></div></div></div><br></div></div>
<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>
<br></blockquote></div><br></div></div>