r247179 - EmitRecordWith* API change: takes an ArrayRef instead of a SmallVector (NFC)
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 9 13:35:50 PDT 2015
On Wed, Sep 9, 2015 at 1:28 PM, Mehdi Amini <mehdi.amini at apple.com> wrote:
> Hi David,
>
> Thanks for the review.
>
>
> On Sep 9, 2015, at 1:14 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>
>
> On Wed, Sep 9, 2015 at 1:08 PM, Mehdi Amini via cfe-commits <
> cfe-commits at lists.llvm.org> wrote:
>
>> Author: mehdi_amini
>> Date: Wed Sep 9 15:08:51 2015
>> New Revision: 247179
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=247179&view=rev
>> Log:
>> EmitRecordWith* API change: takes an ArrayRef instead of a SmallVector
>> (NFC)
>>
>> From: Mehdi Amini <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=247179&r1=247178&r2=247179&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/include/clang/Serialization/ASTWriter.h (original)
>> +++ cfe/trunk/include/clang/Serialization/ASTWriter.h Wed Sep 9 15:08:51
>> 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, const RecordDataRef &Record,
>>
>
> ArrayRefs are generally passed by value, like StringRefs.
>
>
> Good point, will update.
>
>
>
>
>> 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=247179&r1=247178&r2=247179&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp (original)
>> +++ cfe/trunk/lib/Frontend/SerializedDiagnosticPrinter.cpp Wed Sep 9
>> 15:08:51 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());
>> + RecordDataRef Record = {RECORD_FILENAME, entry, 0 /* For legacy */,
>> + 0 /* For legacy */, Name.size()};
>>
>
> I imagine this would produce a dangling reference, maybe? (the temporary
> initializer_list would go out-of-scope at the end of the full expression?)
> But I don't fully understand initializer_lists, to be fair.
>
>
> It is possible, my initial patch was initializing a raw array, but it
> requires the makeArrayRef().
> I’ll try to look into the details here.
>
>
>
>> State->Stream.EmitRecordWithBlob(State->Abbrevs.get(RECORD_FILENAME),
>> Record,
>> Name);
>>
>> @@ -412,7 +409,7 @@ void SDiagsWriter::EmitCharSourceRange(C
>> State->Record.push_back(RECORD_SOURCE_RANGE);
>> AddCharSourceRangeToRecord(R, State->Record, SM);
>>
>> State->Stream.EmitRecordWithAbbrev(State->Abbrevs.get(RECORD_SOURCE_RANGE),
>> - State->Record);
>> + makeArrayRef(State->Record));
>>
>
> What type is State->Record & why isn't it implicitly convertible to
> ArrayRef?
>
>
> It is a SmallVector, and the explicit conversion is needed because
> EmitRecordWithAbbrev is templated, and the template can’t be deduced if you
> don’t supply an ArrayRef:
>
> template <typename uintty>
> void EmitRecordWithAbbrev(unsigned Abbrev, const ArrayRef<uintty> &Vals)
>
> An alternative would be to provide an overload for SmallVector, I’ll try
> to do:
>
> template <typename uintty>
> void EmitRecordWithAbbrev(unsigned Abbrev, const SmallVectorImpl<uintty>
> &Vals)
>
>
Based on your comments and Teresa's I see what you mean.
So there are a few options...
The simplest/heavy-handiest would be to change the template parameter for
all these functions from "ArrayRef<uintty>" to "const
RandomAccessSequence&" (where RandomAccessSequence is the template
parameter, instead of uintty).
Then it can be used with any container that provides random access ([],
size, begin/end, etc).
I'm not sure if that's necessary/worthwhile. In theory I guess all the
wrapper utility functions could be changed to use this sort of broad
template and the final implementation function could stay the same way (or
could, itself, have a single wrapper: template<typename Container> void
EmitRecordWith*Impl(..., const Container& C) { EmitRecordWith*Impl(...,
makeArrayRef(C)); }, etc...
(the problem is that given SmallVector<int>, the call to the function
template cannot deduce the template parameter seen in ArrayRef<T>,
SmallVector<int> doesn't 'match' ArrayRef<T> (because SmallVector isn't
ArrayRef) - it doesn't use user-defined conversions to reach ArrayRef<int>
and then deduce T == int)
>
>
>
>> }
>>
>> /// \brief Emits the preamble of the diagnostics file.
>> @@ -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);
>> + RecordDataRef Record = {RECORD_VERSION, VersionNumber};
>>
>
> Same (possible) lifetime issue here. (and several other cases through this
> change).
>
> Even if there isn't a lifetime issue, I'd probably just pass these
> directly, rather than creating a named variable anyway. Probably.
>
>
> I was not sure about readability of doing this, some of the call sites
> have ~10 elements in the array.
>
> —
> Mehdi
>
>
>
>
>
>
>> + 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());
>> + RecordDataRef Record = {RECORD_CATEGORY, category, catName.size()};
>> State->Stream.EmitRecordWithBlob(State->Abbrevs.get(RECORD_CATEGORY),
>> Record,
>> catName);
>>
>> @@ -581,10 +572,7 @@ 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());
>> + RecordDataRef Record = {RECORD_DIAG_FLAG, entry.first,
>> FlagName.size()};
>>
>> State->Stream.EmitRecordWithBlob(State->Abbrevs.get(RECORD_DIAG_FLAG),
>> Record, FlagName);
>> }
>> @@ -682,7 +670,8 @@ void SDiagsWriter::EmitDiagnosticMessage
>> }
>>
>> Record.push_back(Message.size());
>> - Stream.EmitRecordWithBlob(Abbrevs.get(RECORD_DIAG), Record, Message);
>> + Stream.EmitRecordWithBlob(Abbrevs.get(RECORD_DIAG),
>> makeArrayRef(Record),
>> + Message);
>> }
>>
>> void
>> @@ -741,7 +730,7 @@ void SDiagsWriter::EmitCodeContext(Small
>> Record.push_back(RECORD_FIXIT);
>> AddCharSourceRangeToRecord(Fix.RemoveRange, Record, SM);
>> Record.push_back(Fix.CodeToInsert.size());
>> - Stream.EmitRecordWithBlob(Abbrevs.get(RECORD_FIXIT), Record,
>> + Stream.EmitRecordWithBlob(Abbrevs.get(RECORD_FIXIT),
>> makeArrayRef(Record),
>> Fix.CodeToInsert);
>> }
>> }
>> @@ -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);
>> -
>> + RecordDataRef 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());
>> + RecordDataRef 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,9 @@ 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());
>> + RecordDataRef 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=247179&r1=247178&r2=247179&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
>> +++ cfe/trunk/lib/Serialization/ASTWriter.cpp Wed Sep 9 15:08:51 2015
>> @@ -1171,8 +1171,7 @@ void ASTWriter::WriteControlBlock(Prepro
>> const std::string &OutputFile) {
>> using namespace llvm;
>> Stream.EnterSubblock(CONTROL_BLOCK_ID, 5);
>> - RecordData Record;
>> -
>> +
>> // Metadata
>> BitCodeAbbrev *MetadataAbbrev = new BitCodeAbbrev();
>> MetadataAbbrev->Add(BitCodeAbbrevOp(METADATA));
>> @@ -1185,27 +1184,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());
>> -
>> + {
>> + RecordDataRef 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 Record = {getSignature()};
>> Stream.EmitRecord(SIGNATURE, Record);
>> }
>>
>> @@ -1214,8 +1209,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);
>> + RecordDataRef Record = {MODULE_NAME};
>> Stream.EmitRecordWithBlob(AbbrevCode, Record, WritingModule->Name);
>> }
>>
>> @@ -1236,8 +1230,7 @@ void ASTWriter::WriteControlBlock(Prepro
>> Abbrev->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Blob)); // Directory
>> unsigned AbbrevCode = Stream.EmitAbbrev(Abbrev);
>>
>> - RecordData Record;
>> - Record.push_back(MODULE_DIRECTORY);
>> + RecordDataRef Record = {MODULE_DIRECTORY};
>> Stream.EmitRecordWithBlob(AbbrevCode, Record, BaseDir);
>> }
>>
>> @@ -1250,7 +1243,7 @@ void ASTWriter::WriteControlBlock(Prepro
>>
>> // Module map file
>> if (WritingModule) {
>> - Record.clear();
>> + RecordData Record;
>>
>> auto &Map = PP.getHeaderSearchInfo().getModuleMap();
>>
>> @@ -1273,7 +1266,7 @@ void ASTWriter::WriteControlBlock(Prepro
>> // Imports
>> if (Chain) {
>> serialization::ModuleManager &Mgr = Chain->getModuleManager();
>> - Record.clear();
>> + RecordData Record;
>>
>> for (auto *M : Mgr) {
>> // Skip modules that weren't directly imported.
>> @@ -1294,7 +1287,7 @@ void ASTWriter::WriteControlBlock(Prepro
>> Stream.EnterSubblock(OPTIONS_BLOCK_ID, 4);
>>
>> // Language options.
>> - Record.clear();
>> + RecordData Record;
>> const LangOptions &LangOpts = Context.getLangOpts();
>> #define LANGOPT(Name, Bits, Default, Description) \
>> Record.push_back(LangOpts.Name);
>> @@ -1466,8 +1459,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);
>> + RecordDataRef Record = {ORIGINAL_PCH_DIR};
>> Stream.EmitRecordWithBlob(AbbrevCode, Record, origDir);
>> }
>>
>> @@ -1491,8 +1483,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 +1538,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.
>> + RecordDataRef 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 +1559,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);
>> + RecordDataRef Record = {INPUT_FILE_OFFSETS, InputFileOffsets.size(),
>> + UserFilesNum};
>> Stream.EmitRecordWithBlob(OffsetsAbbrevCode, Record,
>> bytes(InputFileOffsets));
>> }
>>
>> @@ -1818,11 +1802,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());
>> + RecordDataRef Record = {HEADER_SEARCH_TABLE, BucketOffset,
>> + NumHeaderSearchEntries, TableData.size()};
>>
>> TableData.append(GeneratorTrait.strings_begin(),GeneratorTrait.strings_end());
>> Stream.EmitRecordWithBlob(TableAbbrev, Record, TableData);
>>
>> @@ -1907,12 +1888,11 @@ void ASTWriter::WriteSourceManagerBlock(
>> Record.push_back(0);
>> Record.push_back(0);
>> }
>> -
>> - Stream.EmitRecordWithAbbrev(SLocFileAbbrv, Record);
>> -
>> +
>> + Stream.EmitRecordWithAbbrev(SLocFileAbbrv, makeArrayRef(Record));
>> +
>> if (Content->BufferOverridden) {
>> - Record.clear();
>> - Record.push_back(SM_SLOC_BUFFER_BLOB);
>> + RecordDataRef Record = {SM_SLOC_BUFFER_BLOB};
>> const llvm::MemoryBuffer *Buffer
>> = Content->getBuffer(PP.getDiagnostics(),
>> PP.getSourceManager());
>> Stream.EmitRecordWithBlob(SLocBufferBlobAbbrv, Record,
>> @@ -1929,10 +1909,9 @@ void ASTWriter::WriteSourceManagerBlock(
>> const llvm::MemoryBuffer *Buffer
>> = Content->getBuffer(PP.getDiagnostics(),
>> PP.getSourceManager());
>> const char *Name = Buffer->getBufferIdentifier();
>> - Stream.EmitRecordWithBlob(SLocBufferAbbrv, Record,
>> + Stream.EmitRecordWithBlob(SLocBufferAbbrv, makeArrayRef(Record),
>> StringRef(Name, strlen(Name) + 1));
>> - Record.clear();
>> - Record.push_back(SM_SLOC_BUFFER_BLOB);
>> + RecordDataRef Record = {SM_SLOC_BUFFER_BLOB};
>> Stream.EmitRecordWithBlob(SLocBufferBlobAbbrv, Record,
>> StringRef(Buffer->getBufferStart(),
>>
>> Buffer->getBufferSize() + 1));
>> @@ -1954,7 +1933,7 @@ void ASTWriter::WriteSourceManagerBlock(
>> if (I + 1 != N)
>> NextOffset = SourceMgr.getLocalSLocEntry(I + 1).getOffset();
>> Record.push_back(NextOffset - SLoc->getOffset() - 1);
>> - Stream.EmitRecordWithAbbrev(SLocExpansionAbbrv, Record);
>> + Stream.EmitRecordWithAbbrev(SLocExpansionAbbrv,
>> makeArrayRef(Record));
>> }
>> }
>>
>> @@ -1972,13 +1951,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));
>> -
>> + {
>> + RecordDataRef 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);
>> @@ -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));
>> + {
>> + RecordDataRef Record = {MACRO_OFFSET, MacroOffsets.size(),
>> + FirstMacroID - NUM_PREDEF_MACRO_IDS};
>> + Stream.EmitRecordWithBlob(MacroOffsetAbbrev, Record,
>> bytes(MacroOffsets));
>> + }
>> }
>>
>> void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) {
>> @@ -2311,7 +2289,7 @@ void ASTWriter::WritePreprocessorDetail(
>> // we create a PCH even with compiler errors.
>> if (ID->getFile())
>> Buffer += ID->getFile()->getName();
>> - Stream.EmitRecordWithBlob(InclusionAbbrev, Record, Buffer);
>> + Stream.EmitRecordWithBlob(InclusionAbbrev, makeArrayRef(Record),
>> Buffer);
>> continue;
>> }
>>
>> @@ -2331,9 +2309,8 @@ 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);
>> + RecordDataRef Record = {PPD_ENTITIES_OFFSETS,
>> FirstPreprocessorEntityID -
>> +
>> NUM_PREDEF_PP_ENTITY_IDS};
>> Stream.EmitRecordWithBlob(PPEOffsetAbbrev, Record,
>> bytes(PreprocessedEntityOffsets));
>> }
>> @@ -2472,45 +2449,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.
>> + {
>> + RecordDataRef 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);
>> + RecordDataRef 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);
>> + RecordDataRef 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,
>> + RecordDataRef Record = {SUBMODULE_UMBRELLA_DIR};
>> + Stream.EmitRecordWithBlob(UmbrellaDirAbbrev, Record,
>> UmbrellaDir.NameAsWritten);
>> }
>>
>> @@ -2528,8 +2497,7 @@ void ASTWriter::WriteSubmodules(Module *
>> {SUBMODULE_EXCLUDED_HEADER, ExcludedHeaderAbbrev,
>> Module::HK_Excluded}
>> };
>> for (auto &HL : HeaderLists) {
>> - Record.clear();
>> - Record.push_back(HL.RecordKind);
>> + RecordDataRef Record = {HL.RecordKind};
>> for (auto &H : Mod->Headers[HL.HeaderKind])
>> Stream.EmitRecordWithBlob(HL.Abbrev, Record, H.NameAsWritten);
>> }
>> @@ -2537,15 +2505,14 @@ void ASTWriter::WriteSubmodules(Module *
>> // Emit the top headers.
>> {
>> auto TopHeaders = Mod->getTopHeaders(PP->getFileManager());
>> - Record.clear();
>> - Record.push_back(SUBMODULE_TOPHEADER);
>> + RecordDataRef 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 +2520,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 +2536,21 @@ 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);
>> + RecordDataRef 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));
>> + RecordDataRef 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);
>> + RecordDataRef Record = {SUBMODULE_CONFIG_MACRO};
>> Stream.EmitRecordWithBlob(ConfigMacroAbbrev, Record, CM);
>> }
>>
>> @@ -2670,8 +2632,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 +2642,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());
>> + RecordDataRef Record = {CXX_CTOR_INITIALIZERS_OFFSETS,
>> + CXXCtorInitializersOffsets.size()};
>> Stream.EmitRecordWithBlob(CtorInitializersOffsetAbbrev, Record,
>> bytes(CXXCtorInitializersOffsets));
>> }
>> @@ -2693,8 +2652,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 +2662,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());
>> + RecordDataRef Record = {CXX_BASE_SPECIFIER_OFFSETS,
>> + CXXBaseSpecifiersOffsets.size()};
>> Stream.EmitRecordWithBlob(BaseSpecifierOffsetAbbrev, Record,
>> bytes(CXXBaseSpecifiersOffsets));
>> }
>> @@ -2778,8 +2734,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 +2741,7 @@ uint64_t ASTWriter::WriteDeclContextLexi
>> }
>>
>> ++NumLexicalDeclContexts;
>> + RecordDataRef Record = {DECL_CONTEXT_LEXICAL};
>> Stream.EmitRecordWithBlob(DeclContextLexicalAbbrev, Record,
>> bytes(KindDeclPairs));
>> return Offset;
>> @@ -2794,7 +2749,6 @@ uint64_t ASTWriter::WriteDeclContextLexi
>>
>> void ASTWriter::WriteTypeDeclOffsets() {
>> using namespace llvm;
>> - RecordData Record;
>>
>> // Write the type offsets array
>> BitCodeAbbrev *Abbrev = new BitCodeAbbrev();
>> @@ -2803,11 +2757,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));
>> + {
>> + RecordDataRef 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 +2770,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));
>> + {
>> + RecordDataRef 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 +2799,7 @@ 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());
>> + RecordDataRef Record = {FILE_SORTED_DECLS, FileGroupedDeclIDs.size()};
>> Stream.EmitRecordWithBlob(AbbrevCode, Record,
>> bytes(FileGroupedDeclIDs));
>> }
>>
>> @@ -3057,11 +3009,10 @@ 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);
>> + {
>> + RecordDataRef Record = {METHOD_POOL, BucketOffset,
>> NumTableEntries};
>> + Stream.EmitRecordWithBlob(MethodPoolAbbrev, Record, MethodPool);
>> + }
>>
>> // Create a blob abbreviation for the selector table offsets.
>> Abbrev = new BitCodeAbbrev();
>> @@ -3072,12 +3023,12 @@ 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));
>> + {
>> + RecordDataRef Record = {SELECTOR_OFFSETS, SelectorOffsets.size(),
>> + FirstSelectorID - NUM_PREDEF_SELECTOR_IDS};
>> + Stream.EmitRecordWithBlob(SelectorOffsetAbbrev, Record,
>> + bytes(SelectorOffsets));
>> + }
>> }
>> }
>>
>> @@ -3347,9 +3298,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);
>> + RecordDataRef Record = {IDENTIFIER_TABLE, BucketOffset};
>> Stream.EmitRecordWithBlob(IDTableAbbrev, Record, IdentifierTable);
>> }
>>
>> @@ -3365,11 +3314,9 @@ 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);
>> +
>> + RecordDataRef Record = {IDENTIFIER_OFFSET, IdentifierOffsets.size(),
>> + FirstIdentID - NUM_PREDEF_IDENT_IDS};
>> Stream.EmitRecordWithBlob(IdentifierOffsetAbbrev, Record,
>> bytes(IdentifierOffsets));
>>
>> @@ -3785,8 +3732,7 @@ uint64_t ASTWriter::WriteDeclContextVisi
>> GenerateNameLookupTable(DC, LookupTable);
>>
>> // Write the lookup table
>> - RecordData Record;
>> - Record.push_back(DECL_CONTEXT_VISIBLE);
>> + RecordDataRef Record = {DECL_CONTEXT_VISIBLE};
>> Stream.EmitRecordWithBlob(DeclContextVisibleLookupAbbrev, Record,
>> LookupTable);
>> ++NumVisibleDeclContexts;
>> @@ -3817,9 +3763,7 @@ 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)));
>> + RecordDataRef Record = {UPDATE_VISIBLE, getDeclID(cast<Decl>(DC))};
>> Stream.EmitRecordWithBlob(UpdateVisibleAbbrev, Record, LookupTable);
>> }
>>
>> @@ -3883,14 +3827,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()),
>> +
>> + RecordDataRef 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 +3929,7 @@ void ASTWriter::AddPath(StringRef Path,
>> AddString(FilePath, Record);
>> }
>>
>> -void ASTWriter::EmitRecordWithPath(unsigned Abbrev, RecordDataImpl
>> &Record,
>> +void ASTWriter::EmitRecordWithPath(unsigned Abbrev, const RecordDataRef
>> &Record,
>> StringRef Path) {
>> SmallString<128> FilePath(Path);
>> PreparePathForOutput(FilePath);
>> @@ -4250,14 +4192,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 +4216,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));
>> -
>> + {
>> + RecordDataRef 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 +4351,7 @@ void ASTWriter::WriteASTCore(Sema &SemaR
>> writeBaseIDOrNone(M->BaseTypeIndex, M->LocalNumTypes);
>> }
>> }
>> - Record.clear();
>> - Record.push_back(MODULE_OFFSET_MAP);
>> + RecordDataRef Record = {MODULE_OFFSET_MAP};
>> Stream.EmitRecordWithBlob(ModuleOffsetMapAbbrev, Record,
>> Buffer.data(), Buffer.size());
>> }
>> @@ -4573,7 +4515,7 @@ void ASTWriter::WriteASTCore(Sema &SemaR
>> WriteOptimizePragmaOptions(SemaRef);
>>
>> // Some simple statistics
>> - Record.clear();
>> + RecordData Record;
>> Record.push_back(NumStatements);
>> Record.push_back(NumMacros);
>> Record.push_back(NumLexicalDeclContexts);
>>
>> Modified: cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp?rev=247179&r1=247178&r2=247179&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp (original)
>> +++ cfe/trunk/lib/Serialization/GlobalModuleIndex.cpp Wed Sep 9 15:08:51
>> 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);
>> + ArrayRef<uint64_t> Record = {IDENTIFIER_INDEX, BucketOffset};
>> Stream.EmitRecordWithBlob(IDTableAbbrev, Record, IdentifierTable);
>> }
>>
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at lists.llvm.org
>> 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/20150909/6013d339/attachment-0001.html>
More information about the cfe-commits
mailing list