r247233 - EmitRecord* API change: accepts ArrayRef instead of a SmallVector (NFC)

Mehdi Amini via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 10 09:07:13 PDT 2015


> On Sep 10, 2015, at 9:02 AM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> 
> 
> On Thu, Sep 10, 2015 at 9:00 AM, Mehdi Amini <mehdi.amini at apple.com <mailto:mehdi.amini at apple.com>> wrote:
> 
>> On Sep 9, 2015, at 7:06 PM, David Blaikie <dblaikie at gmail.com <mailto:dblaikie at gmail.com>> wrote:
>> 
>> 
>> 
>> On Wed, Sep 9, 2015 at 6:46 PM, Mehdi Amini via cfe-commits <cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>> wrote:
>> Author: mehdi_amini
>> Date: Wed Sep  9 20:46:39 2015
>> New Revision: 247233
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=247233&view=rev <http://llvm.org/viewvc/llvm-project?rev=247233&view=rev>
>> Log:
>> EmitRecord* API change: accepts ArrayRef instead of a SmallVector (NFC)
>> 
>> This reapply a variant commit r247179 after post-commit review from
>> D.Blaikie.
>> Hopefully I got it right this time: lifetime of initializer list ends
>> as with any expression, which make invalid the pattern:
>> 
>> ArrayRef<int> Arr = { 1, 2, 3, 4};
>> 
>> Just like StringRef, ArrayRef shouldn't be used to initialize local
>> variable but only as function argument.
>> 
>> 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.
> 
> Here is an example, let me know what do you think:
> 
>   {
>     RecordData::value_type Record[] = {METADATA, VERSION_MAJOR, VERSION_MINOR,
>                                        CLANG_VERSION_MAJOR, CLANG_VERSION_MINOR,
>                                        !isysroot.empty(), IncludeTimestamps,
>                                        ASTHasCompilerErrors};
>     Stream.EmitRecordWithBlob(MetadataAbbrevCode, Record,
>                               getClangFullRepositoryVersion());
>   }
>   Stream.EmitRecordWithBlob(
>       MetadataAbbrevCode,
>       (uint64_t[]){METADATA, VERSION_MAJOR, VERSION_MINOR, CLANG_VERSION_MAJOR,
> 
> Why the cast (uint64_t[])? I'm vaguely surprised that even compiles... ?
> 
> I would imagine it'd be passed as an init list, then turned into an ArrayRef from there... but I guess not?


Might be more clear with the callee:

  template <typename Container>
  void EmitRecordWithBlob(unsigned Abbrev, const Container &Vals,
                          StringRef Blob) {
    EmitRecordWithAbbrevImpl(Abbrev, makeArrayRef(Vals), Blob, None);
  }

The template can’t be deduced without the cast.

— 
Mehdi






>  
>                    CLANG_VERSION_MINOR, !isysroot.empty(), IncludeTimestamps,
>                    ASTHasCompilerErrors},
>       getClangFullRepositoryVersion());
> 
> Thanks,
> 
>> Mehdi
> 
> 
> 
> 
> 
> 
>> 
>> - Dave
>>  
>> 
>> From: Mehdi Amini <mehdi.amini at apple.com <mailto:mehdi.amini at apple.com>>
>> 
>> Modified:
>>     cfe/trunk/include/clang/Serialization/ASTWriter.h
>>     cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp
>>     cfe/trunk/lib/Serialization/ASTWriter.cpp
>>     cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp
>> 
>> Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=247233&r1=247232&r2=247233&view=diff <http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=247233&r1=247232&r2=247233&view=diff>
>> ==============================================================================
>> --- cfe/trunk/include/clang/Serialization/ASTWriter.h (original)
>> +++ cfe/trunk/include/clang/Serialization/ASTWriter.h Wed Sep  9 20:46:39 2015
>> @@ -84,6 +84,7 @@ class ASTWriter : public ASTDeserializat
>>  public:
>>    typedef SmallVector<uint64_t, 64> RecordData;
>>    typedef SmallVectorImpl<uint64_t> RecordDataImpl;
>> +  typedef ArrayRef<uint64_t> RecordDataRef;
>> 
>>    friend class ASTDeclWriter;
>>    friend class ASTStmtWriter;
>> @@ -756,7 +757,7 @@ public:
>>    void AddPath(StringRef Path, RecordDataImpl &Record);
>> 
>>    /// \brief Emit the current record with the given path as a blob.
>> -  void EmitRecordWithPath(unsigned Abbrev, RecordDataImpl &Record,
>> +  void EmitRecordWithPath(unsigned Abbrev, RecordDataRef Record,
>>                            StringRef Path);
>> 
>>    /// \brief Add a version tuple to the given record
>> 
>> Modified: cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp?rev=247233&r1=247232&r2=247233&view=diff <http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp?rev=247233&r1=247232&r2=247233&view=diff>
>> ==============================================================================
>> --- cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp (original)
>> +++ cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp Wed Sep  9 20:46:39 2015
>> @@ -51,6 +51,7 @@ public:
>> 
>>  typedef SmallVector<uint64_t, 64> RecordData;
>>  typedef SmallVectorImpl<uint64_t> RecordDataImpl;
>> +typedef ArrayRef<uint64_t> RecordDataRef;
>> 
>>  class SDiagsWriter;
>> 
>> @@ -393,13 +394,9 @@ unsigned SDiagsWriter::getEmitFile(const
>> 
>>    // Lazily generate the record for the file.
>>    entry = State->Files.size();
>> -  RecordData Record;
>> -  Record.push_back(RECORD_FILENAME);
>> -  Record.push_back(entry);
>> -  Record.push_back(0); // For legacy.
>> -  Record.push_back(0); // For legacy.
>>    StringRef Name(FileName);
>> -  Record.push_back(Name.size());
>> +  RecordData::value_type Record[] = {RECORD_FILENAME, entry, 0 /* For legacy */,
>> +                                     0 /* For legacy */, Name.size()};
>>    State->Stream.EmitRecordWithBlob(State->Abbrevs.get(RECORD_FILENAME), Record,
>>                                     Name);
>> 
>> @@ -531,14 +528,11 @@ void SDiagsWriter::EmitBlockInfoBlock()
>> 
>>  void SDiagsWriter::EmitMetaBlock() {
>>    llvm::BitstreamWriter &Stream = State->Stream;
>> -  RecordData &Record = State->Record;
>>    AbbreviationMap &Abbrevs = State->Abbrevs;
>> 
>>    Stream.EnterSubblock(BLOCK_META, 3);
>> -  Record.clear();
>> -  Record.push_back(RECORD_VERSION);
>> -  Record.push_back(VersionNumber);
>> -  Stream.EmitRecordWithAbbrev(Abbrevs.get(RECORD_VERSION), Record);
>> +  RecordData::value_type Record[] = {RECORD_VERSION, VersionNumber};
>> +  Stream.EmitRecordWithAbbrev(Abbrevs.get(RECORD_VERSION), Record);
>>    Stream.ExitBlock();
>>  }
>> 
>> @@ -548,11 +542,8 @@ unsigned SDiagsWriter::getEmitCategory(u
>> 
>>    // We use a local version of 'Record' so that we can be generating
>>    // another record when we lazily generate one for the category entry.
>> -  RecordData Record;
>> -  Record.push_back(RECORD_CATEGORY);
>> -  Record.push_back(category);
>>    StringRef catName = DiagnosticIDs::getCategoryNameFromID(category);
>> -  Record.push_back(catName.size());
>> +  RecordData::value_type Record[] = {RECORD_CATEGORY, category, catName.size()};
>>    State->Stream.EmitRecordWithBlob(State->Abbrevs.get(RECORD_CATEGORY), Record,
>>                                     catName);
>> 
>> @@ -581,10 +572,8 @@ unsigned SDiagsWriter::getEmitDiagnostic
>>      entry.second = FlagName;
>> 
>>      // Lazily emit the string in a separate record.
>> -    RecordData Record;
>> -    Record.push_back(RECORD_DIAG_FLAG);
>> -    Record.push_back(entry.first);
>> -    Record.push_back(FlagName.size());
>> +    RecordData::value_type Record[] = {RECORD_DIAG_FLAG, entry.first,
>> +                                       FlagName.size()};
>>      State->Stream.EmitRecordWithBlob(State->Abbrevs.get(RECORD_DIAG_FLAG),
>>                                       Record, FlagName);
>>    }
>> @@ -844,17 +833,9 @@ std::error_code SDiagsMerger::visitEndOf
>>  std::error_code
>>  SDiagsMerger::visitSourceRangeRecord(const serialized_diags::Location &Start,
>>                                       const serialized_diags::Location &End) {
>> -  RecordData Record;
>> -  Record.push_back(RECORD_SOURCE_RANGE);
>> -  Record.push_back(FileLookup[Start.FileID]);
>> -  Record.push_back(Start.Line);
>> -  Record.push_back(Start.Col);
>> -  Record.push_back(Start.Offset);
>> -  Record.push_back(FileLookup[End.FileID]);
>> -  Record.push_back(End.Line);
>> -  Record.push_back(End.Col);
>> -  Record.push_back(End.Offset);
>> -
>> +  RecordData::value_type Record[] = {
>> +      RECORD_SOURCE_RANGE, FileLookup[Start.FileID], Start.Line, Start.Col,
>> +      Start.Offset, FileLookup[End.FileID], End.Line, End.Col, End.Offset};
>>    Writer.State->Stream.EmitRecordWithAbbrev(
>>        Writer.State->Abbrevs.get(RECORD_SOURCE_RANGE), Record);
>>    return std::error_code();
>> @@ -863,19 +844,13 @@ SDiagsMerger::visitSourceRangeRecord(con
>>  std::error_code SDiagsMerger::visitDiagnosticRecord(
>>      unsigned Severity, const serialized_diags::Location &Location,
>>      unsigned Category, unsigned Flag, StringRef Message) {
>> -  RecordData MergedRecord;
>> -  MergedRecord.push_back(RECORD_DIAG);
>> -  MergedRecord.push_back(Severity);
>> -  MergedRecord.push_back(FileLookup[Location.FileID]);
>> -  MergedRecord.push_back(Location.Line);
>> -  MergedRecord.push_back(Location.Col);
>> -  MergedRecord.push_back(Location.Offset);
>> -  MergedRecord.push_back(CategoryLookup[Category]);
>> -  MergedRecord.push_back(Flag ? DiagFlagLookup[Flag] : 0);
>> -  MergedRecord.push_back(Message.size());
>> +  RecordData::value_type Record[] = {
>> +      RECORD_DIAG, Severity, FileLookup[Location.FileID], Location.Line,
>> +      Location.Col, Location.Offset, CategoryLookup[Category],
>> +      Flag ? DiagFlagLookup[Flag] : 0, Message.size()};
>> 
>>    Writer.State->Stream.EmitRecordWithBlob(
>> -      Writer.State->Abbrevs.get(RECORD_DIAG), MergedRecord, Message);
>> +      Writer.State->Abbrevs.get(RECORD_DIAG), Record, Message);
>>    return std::error_code();
>>  }
>> 
>> @@ -883,17 +858,10 @@ std::error_code
>>  SDiagsMerger::visitFixitRecord(const serialized_diags::Location &Start,
>>                                 const serialized_diags::Location &End,
>>                                 StringRef Text) {
>> -  RecordData Record;
>> -  Record.push_back(RECORD_FIXIT);
>> -  Record.push_back(FileLookup[Start.FileID]);
>> -  Record.push_back(Start.Line);
>> -  Record.push_back(Start.Col);
>> -  Record.push_back(Start.Offset);
>> -  Record.push_back(FileLookup[End.FileID]);
>> -  Record.push_back(End.Line);
>> -  Record.push_back(End.Col);
>> -  Record.push_back(End.Offset);
>> -  Record.push_back(Text.size());
>> +  RecordData::value_type Record[] = {RECORD_FIXIT, FileLookup[Start.FileID],
>> +                                     Start.Line, Start.Col, Start.Offset,
>> +                                     FileLookup[End.FileID], End.Line, End.Col,
>> +                                     End.Offset, Text.size()};
>> 
>>    Writer.State->Stream.EmitRecordWithBlob(
>>        Writer.State->Abbrevs.get(RECORD_FIXIT), Record, Text);
>> 
>> Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=247233&r1=247232&r2=247233&view=diff <http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=247233&r1=247232&r2=247233&view=diff>
>> ==============================================================================
>> --- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
>> +++ cfe/trunk/lib/Serialization/ASTWriter.cpp Wed Sep  9 20:46:39 2015
>> @@ -1185,27 +1185,23 @@ void ASTWriter::WriteControlBlock(Prepro
>>    MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // Errors
>>    MetadataAbbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // SVN branch/tag
>>    unsigned MetadataAbbrevCode = Stream.EmitAbbrev(MetadataAbbrev);
>> -  Record.push_back(METADATA);
>> -  Record.push_back(VERSION_MAJOR);
>> -  Record.push_back(VERSION_MINOR);
>> -  Record.push_back(CLANG_VERSION_MAJOR);
>> -  Record.push_back(CLANG_VERSION_MINOR);
>>    assert((!WritingModule || isysroot.empty()) &&
>>           "writing module as a relocatable PCH?");
>> -  Record.push_back(!isysroot.empty());
>> -  Record.push_back(IncludeTimestamps);
>> -  Record.push_back(ASTHasCompilerErrors);
>> -  Stream.EmitRecordWithBlob(MetadataAbbrevCode, Record,
>> -                            getClangFullRepositoryVersion());
>> -
>> +  {
>> +    RecordData::value_type Record[] = {METADATA, VERSION_MAJOR, VERSION_MINOR,
>> +                                       CLANG_VERSION_MAJOR, CLANG_VERSION_MINOR,
>> +                                       !isysroot.empty(), IncludeTimestamps,
>> +                                       ASTHasCompilerErrors};
>> +    Stream.EmitRecordWithBlob(MetadataAbbrevCode, Record,
>> +                              getClangFullRepositoryVersion());
>> +  }
>>    if (WritingModule) {
>>      // For implicit modules we output a signature that we can use to ensure
>>      // duplicate module builds don't collide in the cache as their output order
>>      // is non-deterministic.
>>      // FIXME: Remove this when output is deterministic.
>>      if (Context.getLangOpts().ImplicitModules) {
>> -      Record.clear();
>> -      Record.push_back(getSignature());
>> +      RecordData::value_type Record[] = {getSignature()};
>>        Stream.EmitRecord(SIGNATURE, Record);
>>      }
>> 
>> @@ -1214,8 +1210,7 @@ void ASTWriter::WriteControlBlock(Prepro
>>      Abbrev->Add(BitCodeAbbrevOp(MODULE_NAME));
>>      Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Name
>>      unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev);
>> -    RecordData Record;
>> -    Record.push_back(MODULE_NAME);
>> +    RecordData::value_type Record[] = {MODULE_NAME};
>>      Stream.EmitRecordWithBlob(AbbrevCode, Record, WritingModule->Name);
>>    }
>> 
>> @@ -1236,8 +1231,7 @@ void ASTWriter::WriteControlBlock(Prepro
>>        Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Directory
>>        unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev);
>> 
>> -      RecordData Record;
>> -      Record.push_back(MODULE_DIRECTORY);
>> +      RecordData::value_type Record[] = {MODULE_DIRECTORY};
>>        Stream.EmitRecordWithBlob(AbbrevCode, Record, BaseDir);
>>      }
>> 
>> @@ -1466,8 +1460,7 @@ void ASTWriter::WriteControlBlock(Prepro
>>      SM.getFileManager().makeAbsolutePath(OutputPath);
>>      StringRef origDir = llvm::sys::path::parent_path(OutputPath);
>> 
>> -    RecordData Record;
>> -    Record.push_back(ORIGINAL_PCH_DIR);
>> +    RecordData::value_type Record[] = {ORIGINAL_PCH_DIR};
>>      Stream.EmitRecordWithBlob(AbbrevCode, Record, origDir);
>>    }
>> 
>> @@ -1491,8 +1484,7 @@ void ASTWriter::WriteInputFiles(SourceMa
>>                                  bool Modules) {
>>    using namespace llvm;
>>    Stream.EnterSubblock(INPUT_FILES_BLOCK_ID, 4);
>> -  RecordData Record;
>> -
>> +
>>    // Create input-file abbreviation.
>>    BitCodeAbbrev *IFAbbrev = new BitCodeAbbrev();
>>    IFAbbrev->Add(BitCodeAbbrevOp(INPUT_FILE));
>> @@ -1547,16 +1539,11 @@ void ASTWriter::WriteInputFiles(SourceMa
>>      if (!Entry.IsSystemFile)
>>        ++UserFilesNum;
>> 
>> -    Record.clear();
>> -    Record.push_back(INPUT_FILE);
>> -    Record.push_back(InputFileOffsets.size());
>> -
>>      // Emit size/modification time for this file.
>> -    Record.push_back(Entry.File->getSize());
>> -    Record.push_back(getTimestampForOutput(Entry.File));
>> -
>> -    // Whether this file was overridden.
>> -    Record.push_back(Entry.BufferOverridden);
>> +    // And whether this file was overridden.
>> +    RecordData::value_type Record[] = {
>> +        INPUT_FILE, InputFileOffsets.size(), (uint64_t)Entry.File->getSize(),
>> +        (uint64_t)getTimestampForOutput(Entry.File), Entry.BufferOverridden};
>> 
>>      EmitRecordWithPath(IFAbbrevCode, Record, Entry.File->getName());
>>    }
>> @@ -1573,10 +1560,8 @@ void ASTWriter::WriteInputFiles(SourceMa
>>    unsigned OffsetsAbbrevCode = Stream.EmitAbbrev(OffsetsAbbrev);
>> 
>>    // Write input file offsets.
>> -  Record.clear();
>> -  Record.push_back(INPUT_FILE_OFFSETS);
>> -  Record.push_back(InputFileOffsets.size());
>> -  Record.push_back(UserFilesNum);
>> +  RecordData::value_type Record[] = {INPUT_FILE_OFFSETS,
>> +                                     InputFileOffsets.size(), UserFilesNum};
>>    Stream.EmitRecordWithBlob(OffsetsAbbrevCode, Record, bytes(InputFileOffsets));
>>  }
>> 
>> @@ -1818,11 +1803,8 @@ void ASTWriter::WriteHeaderSearch(const
>>    unsigned TableAbbrev = Stream.EmitAbbrev(Abbrev);
>> 
>>    // Write the header search table
>> -  RecordData Record;
>> -  Record.push_back(HEADER_SEARCH_TABLE);
>> -  Record.push_back(BucketOffset);
>> -  Record.push_back(NumHeaderSearchEntries);
>> -  Record.push_back(TableData.size());
>> +  RecordData::value_type Record[] = {HEADER_SEARCH_TABLE, BucketOffset,
>> +                                     NumHeaderSearchEntries, TableData.size()};
>>    TableData.append(GeneratorTrait.strings_begin(),GeneratorTrait.strings_end());
>>    Stream.EmitRecordWithBlob(TableAbbrev, Record, TableData);
>> 
>> @@ -1911,8 +1893,7 @@ void ASTWriter::WriteSourceManagerBlock(
>>          Stream.EmitRecordWithAbbrev(SLocFileAbbrv, Record);
>> 
>>          if (Content->BufferOverridden) {
>> -          Record.clear();
>> -          Record.push_back(SM_SLOC_BUFFER_BLOB);
>> +          RecordData::value_type Record[] = {SM_SLOC_BUFFER_BLOB};
>>            const llvm::MemoryBuffer *Buffer
>>              = Content->getBuffer(PP.getDiagnostics(), PP.getSourceManager());
>>            Stream.EmitRecordWithBlob(SLocBufferBlobAbbrv, Record,
>> @@ -1931,8 +1912,7 @@ void ASTWriter::WriteSourceManagerBlock(
>>          const char *Name = Buffer->getBufferIdentifier();
>>          Stream.EmitRecordWithBlob(SLocBufferAbbrv, Record,
>>                                    StringRef(Name, strlen(Name) + 1));
>> -        Record.clear();
>> -        Record.push_back(SM_SLOC_BUFFER_BLOB);
>> +        RecordData::value_type Record[] = {SM_SLOC_BUFFER_BLOB};
>>          Stream.EmitRecordWithBlob(SLocBufferBlobAbbrv, Record,
>>                                    StringRef(Buffer->getBufferStart(),
>>                                                    Buffer->getBufferSize() + 1));
>> @@ -1972,13 +1952,13 @@ void ASTWriter::WriteSourceManagerBlock(
>>    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 16)); // total size
>>    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // offsets
>>    unsigned SLocOffsetsAbbrev = Stream.EmitAbbrev(Abbrev);
>> -
>> -  Record.clear();
>> -  Record.push_back(SOURCE_LOCATION_OFFSETS);
>> -  Record.push_back(SLocEntryOffsets.size());
>> -  Record.push_back(SourceMgr.getNextLocalOffset() - 1); // skip dummy
>> -  Stream.EmitRecordWithBlob(SLocOffsetsAbbrev, Record, bytes(SLocEntryOffsets));
>> -
>> +  {
>> +    RecordData::value_type Record[] = {
>> +        SOURCE_LOCATION_OFFSETS, SLocEntryOffsets.size(),
>> +        SourceMgr.getNextLocalOffset() - 1 /* skip dummy */};
>> +    Stream.EmitRecordWithBlob(SLocOffsetsAbbrev, Record,
>> +                              bytes(SLocEntryOffsets));
>> +  }
>>    // Write the source location entry preloads array, telling the AST
>>    // reader which source locations entries it should load eagerly.
>>    Stream.EmitRecord(SOURCE_LOCATION_PRELOADS, PreloadSLocs);
>> @@ -2064,9 +2044,8 @@ void ASTWriter::WritePreprocessor(const
>> 
>>    // If the preprocessor __COUNTER__ value has been bumped, remember it.
>>    if (PP.getCounterValue() != 0) {
>> -    Record.push_back(PP.getCounterValue());
>> +    RecordData::value_type Record[] = {PP.getCounterValue()};
>>      Stream.EmitRecord(PP_COUNTER_VALUE, Record);
>> -    Record.clear();
>>    }
>> 
>>    // Enter the preprocessor block.
>> @@ -2232,12 +2211,11 @@ void ASTWriter::WritePreprocessor(const
>>    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
>> 
>>    unsigned MacroOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
>> -  Record.clear();
>> -  Record.push_back(MACRO_OFFSET);
>> -  Record.push_back(MacroOffsets.size());
>> -  Record.push_back(FirstMacroID - NUM_PREDEF_MACRO_IDS);
>> -  Stream.EmitRecordWithBlob(MacroOffsetAbbrev, Record,
>> -                            bytes(MacroOffsets));
>> +  {
>> +    RecordData::value_type Record[] = {MACRO_OFFSET, MacroOffsets.size(),
>> +                                       FirstMacroID - NUM_PREDEF_MACRO_IDS};
>> +    Stream.EmitRecordWithBlob(MacroOffsetAbbrev, Record, bytes(MacroOffsets));
>> +  }
>>  }
>> 
>>  void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) {
>> @@ -2331,9 +2309,9 @@ void ASTWriter::WritePreprocessorDetail(
>>      Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
>>      unsigned PPEOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
>> 
>> -    Record.clear();
>> -    Record.push_back(PPD_ENTITIES_OFFSETS);
>> -    Record.push_back(FirstPreprocessorEntityID - NUM_PREDEF_PP_ENTITY_IDS);
>> +    RecordData::value_type Record[] = {PPD_ENTITIES_OFFSETS,
>> +                                       FirstPreprocessorEntityID -
>> +                                           NUM_PREDEF_PP_ENTITY_IDS};
>>      Stream.EmitRecordWithBlob(PPEOffsetAbbrev, Record,
>>                                bytes(PreprocessedEntityOffsets));
>>    }
>> @@ -2460,9 +2438,9 @@ void ASTWriter::WriteSubmodules(Module *
>>    unsigned ConflictAbbrev = Stream.EmitAbbrev(Abbrev);
>> 
>>    // Write the submodule metadata block.
>> -  RecordData Record;
>> -  Record.push_back(getNumberOfModules(WritingModule));
>> -  Record.push_back(FirstSubmoduleID - NUM_PREDEF_SUBMODULE_IDS);
>> +  RecordData::value_type Record[] = {getNumberOfModules(WritingModule),
>> +                                     FirstSubmoduleID -
>> +                                         NUM_PREDEF_SUBMODULE_IDS};
>>    Stream.EmitRecord(SUBMODULE_METADATA, Record);
>> 
>>    // Write all of the submodules.
>> @@ -2472,45 +2450,37 @@ void ASTWriter::WriteSubmodules(Module *
>>      Module *Mod = Q.front();
>>      Q.pop();
>>      unsigned ID = getSubmoduleID(Mod);
>> -
>> -    // Emit the definition of the block.
>> -    Record.clear();
>> -    Record.push_back(SUBMODULE_DEFINITION);
>> -    Record.push_back(ID);
>> +
>> +    uint64_t ParentID = 0;
>>      if (Mod->Parent) {
>>        assert(SubmoduleIDs[Mod->Parent] && "Submodule parent not written?");
>> -      Record.push_back(SubmoduleIDs[Mod->Parent]);
>> -    } else {
>> -      Record.push_back(0);
>> +      ParentID = SubmoduleIDs[Mod->Parent];
>>      }
>> -    Record.push_back(Mod->IsFramework);
>> -    Record.push_back(Mod->IsExplicit);
>> -    Record.push_back(Mod->IsSystem);
>> -    Record.push_back(Mod->IsExternC);
>> -    Record.push_back(Mod->InferSubmodules);
>> -    Record.push_back(Mod->InferExplicitSubmodules);
>> -    Record.push_back(Mod->InferExportWildcard);
>> -    Record.push_back(Mod->ConfigMacrosExhaustive);
>> -    Stream.EmitRecordWithBlob(DefinitionAbbrev, Record, Mod->Name);
>> -
>> +
>> +    // Emit the definition of the block.
>> +    {
>> +      RecordData::value_type Record[] = {
>> +          SUBMODULE_DEFINITION, ID, ParentID, Mod->IsFramework, Mod->IsExplicit,
>> +          Mod->IsSystem, Mod->IsExternC, Mod->InferSubmodules,
>> +          Mod->InferExplicitSubmodules, Mod->InferExportWildcard,
>> +          Mod->ConfigMacrosExhaustive};
>> +      Stream.EmitRecordWithBlob(DefinitionAbbrev, Record, Mod->Name);
>> +    }
>> +
>>      // Emit the requirements.
>>      for (const auto &R : Mod->Requirements) {
>> -      Record.clear();
>> -      Record.push_back(SUBMODULE_REQUIRES);
>> -      Record.push_back(R.second);
>> +      RecordData::value_type Record[] = {SUBMODULE_REQUIRES, R.second};
>>        Stream.EmitRecordWithBlob(RequiresAbbrev, Record, R.first);
>>      }
>> 
>>      // Emit the umbrella header, if there is one.
>>      if (auto UmbrellaHeader = Mod->getUmbrellaHeader()) {
>> -      Record.clear();
>> -      Record.push_back(SUBMODULE_UMBRELLA_HEADER);
>> +      RecordData::value_type Record[] = {SUBMODULE_UMBRELLA_HEADER};
>>        Stream.EmitRecordWithBlob(UmbrellaAbbrev, Record,
>>                                  UmbrellaHeader.NameAsWritten);
>>      } else if (auto UmbrellaDir = Mod->getUmbrellaDir()) {
>> -      Record.clear();
>> -      Record.push_back(SUBMODULE_UMBRELLA_DIR);
>> -      Stream.EmitRecordWithBlob(UmbrellaDirAbbrev, Record,
>> +      RecordData::value_type Record[] = {SUBMODULE_UMBRELLA_DIR};
>> +      Stream.EmitRecordWithBlob(UmbrellaDirAbbrev, Record,
>>                                  UmbrellaDir.NameAsWritten);
>>      }
>> 
>> @@ -2528,8 +2498,7 @@ void ASTWriter::WriteSubmodules(Module *
>>        {SUBMODULE_EXCLUDED_HEADER, ExcludedHeaderAbbrev, Module::HK_Excluded}
>>      };
>>      for (auto &HL : HeaderLists) {
>> -      Record.clear();
>> -      Record.push_back(HL.RecordKind);
>> +      RecordData::value_type Record[] = {HL.RecordKind};
>>        for (auto &H : Mod->Headers[HL.HeaderKind])
>>          Stream.EmitRecordWithBlob(HL.Abbrev, Record, H.NameAsWritten);
>>      }
>> @@ -2537,15 +2506,14 @@ void ASTWriter::WriteSubmodules(Module *
>>      // Emit the top headers.
>>      {
>>        auto TopHeaders = Mod->getTopHeaders(PP->getFileManager());
>> -      Record.clear();
>> -      Record.push_back(SUBMODULE_TOPHEADER);
>> +      RecordData::value_type Record[] = {SUBMODULE_TOPHEADER};
>>        for (auto *H : TopHeaders)
>>          Stream.EmitRecordWithBlob(TopHeaderAbbrev, Record, H->getName());
>>      }
>> 
>>      // Emit the imports.
>>      if (!Mod->Imports.empty()) {
>> -      Record.clear();
>> +      RecordData Record;
>>        for (auto *I : Mod->Imports)
>>          Record.push_back(getSubmoduleID(I));
>>        Stream.EmitRecord(SUBMODULE_IMPORTS, Record);
>> @@ -2553,7 +2521,7 @@ void ASTWriter::WriteSubmodules(Module *
>> 
>>      // Emit the exports.
>>      if (!Mod->Exports.empty()) {
>> -      Record.clear();
>> +      RecordData Record;
>>        for (const auto &E : Mod->Exports) {
>>          // FIXME: This may fail; we don't require that all exported modules
>>          // are local or imported.
>> @@ -2569,26 +2537,23 @@ void ASTWriter::WriteSubmodules(Module *
>> 
>>      // Emit the link libraries.
>>      for (const auto &LL : Mod->LinkLibraries) {
>> -      Record.clear();
>> -      Record.push_back(SUBMODULE_LINK_LIBRARY);
>> -      Record.push_back(LL.IsFramework);
>> +      RecordData::value_type Record[] = {SUBMODULE_LINK_LIBRARY,
>> +                                         LL.IsFramework};
>>        Stream.EmitRecordWithBlob(LinkLibraryAbbrev, Record, LL.Library);
>>      }
>> 
>>      // Emit the conflicts.
>>      for (const auto &C : Mod->Conflicts) {
>> -      Record.clear();
>> -      Record.push_back(SUBMODULE_CONFLICT);
>>        // FIXME: This may fail; we don't require that all conflicting modules
>>        // are local or imported.
>> -      Record.push_back(getSubmoduleID(C.Other));
>> +      RecordData::value_type Record[] = {SUBMODULE_CONFLICT,
>> +                                         getSubmoduleID(C.Other)};
>>        Stream.EmitRecordWithBlob(ConflictAbbrev, Record, C.Message);
>>      }
>> 
>>      // Emit the configuration macros.
>>      for (const auto &CM : Mod->ConfigMacros) {
>> -      Record.clear();
>> -      Record.push_back(SUBMODULE_CONFIG_MACRO);
>> +      RecordData::value_type Record[] = {SUBMODULE_CONFIG_MACRO};
>>        Stream.EmitRecordWithBlob(ConfigMacroAbbrev, Record, CM);
>>      }
>> 
>> @@ -2670,8 +2635,6 @@ void ASTWriter::WriteCXXCtorInitializers
>>    if (CXXCtorInitializersOffsets.empty())
>>      return;
>> 
>> -  RecordData Record;
>> -
>>    // Create a blob abbreviation for the C++ ctor initializer offsets.
>>    using namespace llvm;
>> 
>> @@ -2682,9 +2645,8 @@ void ASTWriter::WriteCXXCtorInitializers
>>    unsigned CtorInitializersOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
>> 
>>    // Write the base specifier offsets table.
>> -  Record.clear();
>> -  Record.push_back(CXX_CTOR_INITIALIZERS_OFFSETS);
>> -  Record.push_back(CXXCtorInitializersOffsets.size());
>> +  RecordData::value_type Record[] = {CXX_CTOR_INITIALIZERS_OFFSETS,
>> +                                     CXXCtorInitializersOffsets.size()};
>>    Stream.EmitRecordWithBlob(CtorInitializersOffsetAbbrev, Record,
>>                              bytes(CXXCtorInitializersOffsets));
>>  }
>> @@ -2693,8 +2655,6 @@ void ASTWriter::WriteCXXBaseSpecifiersOf
>>    if (CXXBaseSpecifiersOffsets.empty())
>>      return;
>> 
>> -  RecordData Record;
>> -
>>    // Create a blob abbreviation for the C++ base specifiers offsets.
>>    using namespace llvm;
>> 
>> @@ -2705,9 +2665,8 @@ void ASTWriter::WriteCXXBaseSpecifiersOf
>>    unsigned BaseSpecifierOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
>> 
>>    // Write the base specifier offsets table.
>> -  Record.clear();
>> -  Record.push_back(CXX_BASE_SPECIFIER_OFFSETS);
>> -  Record.push_back(CXXBaseSpecifiersOffsets.size());
>> +  RecordData::value_type Record[] = {CXX_BASE_SPECIFIER_OFFSETS,
>> +                                     CXXBaseSpecifiersOffsets.size()};
>>    Stream.EmitRecordWithBlob(BaseSpecifierOffsetAbbrev, Record,
>>                              bytes(CXXBaseSpecifiersOffsets));
>>  }
>> @@ -2778,8 +2737,6 @@ uint64_t ASTWriter::WriteDeclContextLexi
>>      return 0;
>> 
>>    uint64_t Offset = Stream.GetCurrentBitNo();
>> -  RecordData Record;
>> -  Record.push_back(DECL_CONTEXT_LEXICAL);
>>    SmallVector<uint32_t, 128> KindDeclPairs;
>>    for (const auto *D : DC->decls()) {
>>      KindDeclPairs.push_back(D->getKind());
>> @@ -2787,6 +2744,7 @@ uint64_t ASTWriter::WriteDeclContextLexi
>>    }
>> 
>>    ++NumLexicalDeclContexts;
>> +  RecordData::value_type Record[] = {DECL_CONTEXT_LEXICAL};
>>    Stream.EmitRecordWithBlob(DeclContextLexicalAbbrev, Record,
>>                              bytes(KindDeclPairs));
>>    return Offset;
>> @@ -2794,7 +2752,6 @@ uint64_t ASTWriter::WriteDeclContextLexi
>> 
>>  void ASTWriter::WriteTypeDeclOffsets() {
>>    using namespace llvm;
>> -  RecordData Record;
>> 
>>    // Write the type offsets array
>>    BitCodeAbbrev *Abbrev = new BitCodeAbbrev();
>> @@ -2803,11 +2760,11 @@ void ASTWriter::WriteTypeDeclOffsets() {
>>    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // base type index
>>    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // types block
>>    unsigned TypeOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
>> -  Record.clear();
>> -  Record.push_back(TYPE_OFFSET);
>> -  Record.push_back(TypeOffsets.size());
>> -  Record.push_back(FirstTypeID - NUM_PREDEF_TYPE_IDS);
>> -  Stream.EmitRecordWithBlob(TypeOffsetAbbrev, Record, bytes(TypeOffsets));
>> +  {
>> +    RecordData::value_type Record[] = {TYPE_OFFSET, TypeOffsets.size(),
>> +                                       FirstTypeID - NUM_PREDEF_TYPE_IDS};
>> +    Stream.EmitRecordWithBlob(TypeOffsetAbbrev, Record, bytes(TypeOffsets));
>> +  }
>> 
>>    // Write the declaration offsets array
>>    Abbrev = new BitCodeAbbrev();
>> @@ -2816,16 +2773,15 @@ void ASTWriter::WriteTypeDeclOffsets() {
>>    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32)); // base decl ID
>>    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // declarations block
>>    unsigned DeclOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
>> -  Record.clear();
>> -  Record.push_back(DECL_OFFSET);
>> -  Record.push_back(DeclOffsets.size());
>> -  Record.push_back(FirstDeclID - NUM_PREDEF_DECL_IDS);
>> -  Stream.EmitRecordWithBlob(DeclOffsetAbbrev, Record, bytes(DeclOffsets));
>> +  {
>> +    RecordData::value_type Record[] = {DECL_OFFSET, DeclOffsets.size(),
>> +                                       FirstDeclID - NUM_PREDEF_DECL_IDS};
>> +    Stream.EmitRecordWithBlob(DeclOffsetAbbrev, Record, bytes(DeclOffsets));
>> +  }
>>  }
>> 
>>  void ASTWriter::WriteFileDeclIDsMap() {
>>    using namespace llvm;
>> -  RecordData Record;
>> 
>>    SmallVector<std::pair<FileID, DeclIDInFileInfo *>, 64> SortedFileDeclIDs(
>>        FileDeclIDs.begin(), FileDeclIDs.end());
>> @@ -2846,8 +2802,8 @@ void ASTWriter::WriteFileDeclIDsMap() {
>>    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
>>    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
>>    unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev);
>> -  Record.push_back(FILE_SORTED_DECLS);
>> -  Record.push_back(FileGroupedDeclIDs.size());
>> +  RecordData::value_type Record[] = {FILE_SORTED_DECLS,
>> +                                     FileGroupedDeclIDs.size()};
>>    Stream.EmitRecordWithBlob(AbbrevCode, Record, bytes(FileGroupedDeclIDs));
>>  }
>> 
>> @@ -3057,11 +3013,11 @@ void ASTWriter::WriteSelectors(Sema &Sem
>>      unsigned MethodPoolAbbrev = Stream.EmitAbbrev(Abbrev);
>> 
>>      // Write the method pool
>> -    RecordData Record;
>> -    Record.push_back(METHOD_POOL);
>> -    Record.push_back(BucketOffset);
>> -    Record.push_back(NumTableEntries);
>> -    Stream.EmitRecordWithBlob(MethodPoolAbbrev, Record, MethodPool);
>> +    {
>> +      RecordData::value_type Record[] = {METHOD_POOL, BucketOffset,
>> +                                         NumTableEntries};
>> +      Stream.EmitRecordWithBlob(MethodPoolAbbrev, Record, MethodPool);
>> +    }
>> 
>>      // Create a blob abbreviation for the selector table offsets.
>>      Abbrev = new BitCodeAbbrev();
>> @@ -3072,12 +3028,13 @@ void ASTWriter::WriteSelectors(Sema &Sem
>>      unsigned SelectorOffsetAbbrev = Stream.EmitAbbrev(Abbrev);
>> 
>>      // Write the selector offsets table.
>> -    Record.clear();
>> -    Record.push_back(SELECTOR_OFFSETS);
>> -    Record.push_back(SelectorOffsets.size());
>> -    Record.push_back(FirstSelectorID - NUM_PREDEF_SELECTOR_IDS);
>> -    Stream.EmitRecordWithBlob(SelectorOffsetAbbrev, Record,
>> -                              bytes(SelectorOffsets));
>> +    {
>> +      RecordData::value_type Record[] = {
>> +          SELECTOR_OFFSETS, SelectorOffsets.size(),
>> +          FirstSelectorID - NUM_PREDEF_SELECTOR_IDS};
>> +      Stream.EmitRecordWithBlob(SelectorOffsetAbbrev, Record,
>> +                                bytes(SelectorOffsets));
>> +    }
>>    }
>>  }
>> 
>> @@ -3347,9 +3304,7 @@ void ASTWriter::WriteIdentifierTable(Pre
>>      unsigned IDTableAbbrev = Stream.EmitAbbrev(Abbrev);
>> 
>>      // Write the identifier table
>> -    RecordData Record;
>> -    Record.push_back(IDENTIFIER_TABLE);
>> -    Record.push_back(BucketOffset);
>> +    RecordData::value_type Record[] = {IDENTIFIER_TABLE, BucketOffset};
>>      Stream.EmitRecordWithBlob(IDTableAbbrev, Record, IdentifierTable);
>>    }
>> 
>> @@ -3365,11 +3320,10 @@ void ASTWriter::WriteIdentifierTable(Pre
>>    for (unsigned I = 0, N = IdentifierOffsets.size(); I != N; ++I)
>>      assert(IdentifierOffsets[I] && "Missing identifier offset?");
>>  #endif
>> -
>> -  RecordData Record;
>> -  Record.push_back(IDENTIFIER_OFFSET);
>> -  Record.push_back(IdentifierOffsets.size());
>> -  Record.push_back(FirstIdentID - NUM_PREDEF_IDENT_IDS);
>> +
>> +  RecordData::value_type Record[] = {IDENTIFIER_OFFSET,
>> +                                     IdentifierOffsets.size(),
>> +                                     FirstIdentID - NUM_PREDEF_IDENT_IDS};
>>    Stream.EmitRecordWithBlob(IdentifierOffsetAbbrev, Record,
>>                              bytes(IdentifierOffsets));
>> 
>> @@ -3785,8 +3739,7 @@ uint64_t ASTWriter::WriteDeclContextVisi
>>    GenerateNameLookupTable(DC, LookupTable);
>> 
>>    // Write the lookup table
>> -  RecordData Record;
>> -  Record.push_back(DECL_CONTEXT_VISIBLE);
>> +  RecordData::value_type Record[] = {DECL_CONTEXT_VISIBLE};
>>    Stream.EmitRecordWithBlob(DeclContextVisibleLookupAbbrev, Record,
>>                              LookupTable);
>>    ++NumVisibleDeclContexts;
>> @@ -3817,16 +3770,13 @@ void ASTWriter::WriteDeclContextVisibleU
>>      DC = cast<DeclContext>(Chain->getKeyDeclaration(cast<Decl>(DC)));
>> 
>>    // Write the lookup table
>> -  RecordData Record;
>> -  Record.push_back(UPDATE_VISIBLE);
>> -  Record.push_back(getDeclID(cast<Decl>(DC)));
>> +  RecordData::value_type Record[] = {UPDATE_VISIBLE, getDeclID(cast<Decl>(DC))};
>>    Stream.EmitRecordWithBlob(UpdateVisibleAbbrev, Record, LookupTable);
>>  }
>> 
>>  /// \brief Write an FP_PRAGMA_OPTIONS block for the given FPOptions.
>>  void ASTWriter::WriteFPPragmaOptions(const FPOptions &Opts) {
>> -  RecordData Record;
>> -  Record.push_back(Opts.fp_contract);
>> +  RecordData::value_type Record[] = {Opts.fp_contract};
>>    Stream.EmitRecord(FP_PRAGMA_OPTIONS, Record);
>>  }
>> 
>> @@ -3883,14 +3833,12 @@ void ASTWriter::WriteObjCCategories() {
>>    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // # of entries
>>    Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob));
>>    unsigned AbbrevID = Stream.EmitAbbrev(Abbrev);
>> -
>> -  RecordData Record;
>> -  Record.push_back(OBJC_CATEGORIES_MAP);
>> -  Record.push_back(CategoriesMap.size());
>> -  Stream.EmitRecordWithBlob(AbbrevID, Record,
>> -                            reinterpret_cast<char*>(CategoriesMap.data()),
>> +
>> +  RecordData::value_type Record[] = {OBJC_CATEGORIES_MAP, CategoriesMap.size()};
>> +  Stream.EmitRecordWithBlob(AbbrevID, Record,
>> +                            reinterpret_cast<char *>(CategoriesMap.data()),
>>                              CategoriesMap.size() * sizeof(ObjCCategoriesInfo));
>> -
>> +
>>    // Emit the category lists.
>>    Stream.EmitRecord(OBJC_CATEGORIES, Categories);
>>  }
>> @@ -3987,7 +3935,7 @@ void ASTWriter::AddPath(StringRef Path,
>>    AddString(FilePath, Record);
>>  }
>> 
>> -void ASTWriter::EmitRecordWithPath(unsigned Abbrev, RecordDataImpl &Record,
>> +void ASTWriter::EmitRecordWithPath(unsigned Abbrev, RecordDataRef Record,
>>                                     StringRef Path) {
>>    SmallString<128> FilePath(Path);
>>    PreparePathForOutput(FilePath);
>> @@ -4250,14 +4198,14 @@ void ASTWriter::WriteASTCore(Sema &SemaR
>>    WriteControlBlock(PP, Context, isysroot, OutputFile);
>> 
>>    // Write the remaining AST contents.
>> -  RecordData Record;
>>    Stream.EnterSubblock(AST_BLOCK_ID, 5);
>> 
>>    // This is so that older clang versions, before the introduction
>>    // of the control block, can read and reject the newer PCH format.
>> -  Record.clear();
>> -  Record.push_back(VERSION_MAJOR);
>> -  Stream.EmitRecord(METADATA_OLD_FORMAT, Record);
>> +  {
>> +    RecordData Record = {VERSION_MAJOR};
>> +    Stream.EmitRecord(METADATA_OLD_FORMAT, Record);
>> +  }
>> 
>>    // Create a lexical update block containing all of the declarations in the
>>    // translation unit that do not come from other AST files.
>> @@ -4274,11 +4222,12 @@ void ASTWriter::WriteASTCore(Sema &SemaR
>>    Abv->Add(llvm::BitCodeAbbrevOp(TU_UPDATE_LEXICAL));
>>    Abv->Add(llvm::BitCodeAbbrevOp(llvm::BitCodeAbbrevOp::Blob));
>>    unsigned TuUpdateLexicalAbbrev = Stream.EmitAbbrev(Abv);
>> -  Record.clear();
>> -  Record.push_back(TU_UPDATE_LEXICAL);
>> -  Stream.EmitRecordWithBlob(TuUpdateLexicalAbbrev, Record,
>> -                            bytes(NewGlobalKindDeclPairs));
>> -
>> +  {
>> +    RecordData::value_type Record[] = {TU_UPDATE_LEXICAL};
>> +    Stream.EmitRecordWithBlob(TuUpdateLexicalAbbrev, Record,
>> +                              bytes(NewGlobalKindDeclPairs));
>> +  }
>> +
>>    // And a visible updates block for the translation unit.
>>    Abv = new llvm::BitCodeAbbrev();
>>    Abv->Add(llvm::BitCodeAbbrevOp(UPDATE_VISIBLE));
>> @@ -4408,8 +4357,7 @@ void ASTWriter::WriteASTCore(Sema &SemaR
>>          writeBaseIDOrNone(M->BaseTypeIndex, M->LocalNumTypes);
>>        }
>>      }
>> -    Record.clear();
>> -    Record.push_back(MODULE_OFFSET_MAP);
>> +    RecordData::value_type Record[] = {MODULE_OFFSET_MAP};
>>      Stream.EmitRecordWithBlob(ModuleOffsetMapAbbrev, Record,
>>                                Buffer.data(), Buffer.size());
>>    }
>> @@ -4573,11 +4521,8 @@ void ASTWriter::WriteASTCore(Sema &SemaR
>>      WriteOptimizePragmaOptions(SemaRef);
>> 
>>    // Some simple statistics
>> -  Record.clear();
>> -  Record.push_back(NumStatements);
>> -  Record.push_back(NumMacros);
>> -  Record.push_back(NumLexicalDeclContexts);
>> -  Record.push_back(NumVisibleDeclContexts);
>> +  RecordData::value_type Record[] = {
>> +      NumStatements, NumMacros, NumLexicalDeclContexts, NumVisibleDeclContexts};
>>    Stream.EmitRecord(STATISTICS, Record);
>>    Stream.ExitBlock();
>>  }
>> 
>> Modified: cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp?rev=247233&r1=247232&r2=247233&view=diff <http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp?rev=247233&r1=247232&r2=247233&view=diff>
>> ==============================================================================
>> --- cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp (original)
>> +++ cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp Wed Sep  9 20:46:39 2015
>> @@ -757,9 +757,7 @@ void GlobalModuleIndexBuilder::writeInde
>>      unsigned IDTableAbbrev = Stream.EmitAbbrev(Abbrev);
>> 
>>      // Write the identifier table
>> -    Record.clear();
>> -    Record.push_back(IDENTIFIER_INDEX);
>> -    Record.push_back(BucketOffset);
>> +    uint64_t Record[] = {IDENTIFIER_INDEX, BucketOffset};
>>      Stream.EmitRecordWithBlob(IDTableAbbrev, Record, IdentifierTable);
>>    }
>> 
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150910/68ec7593/attachment-0001.html>


More information about the cfe-commits mailing list