llvm.org GIT mirror llvm / 3db59a7
Bitcode: ArrayRef-ize EmitRecordWithAbbrev(), NFC Change `EmitRecordWithAbbrev()` and friends to take an `ArrayRef<T>` instead of requiring a `SmallVectorImpl<T>`. No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247107 91177308-0d34-0410-b5e6-96231b3b80d8 Duncan P. N. Exon Smith 5 years ago
1 changed file(s) with 16 addition(s) and 15 deletion(s). Raw diff Collapse all Expand all
1414 #ifndef LLVM_BITCODE_BITSTREAMWRITER_H
1515 #define LLVM_BITCODE_BITSTREAMWRITER_H
1616
17 #include "llvm/ADT/ArrayRef.h"
1718 #include "llvm/ADT/SmallVector.h"
1819 #include "llvm/ADT/StringRef.h"
1920 #include "llvm/Bitcode/BitCodes.h"
285286 /// emission code. If BlobData is non-null, then it specifies an array of
286287 /// data that should be emitted as part of the Blob or Array operand that is
287288 /// known to exist at the end of the record.
288 template
289 void EmitRecordWithAbbrevImpl(unsigned Abbrev, SmallVectorImpl &Vals,
289 template
290 void EmitRecordWithAbbrevImpl(unsigned Abbrev, ArrayRef Vals,
290291 StringRef Blob) {
291292 const char *BlobData = Blob.data();
292293 unsigned BlobLen = (unsigned) Blob.size();
397398 // Insert the code into Vals to treat it uniformly.
398399 Vals.insert(Vals.begin(), Code);
399400
400 EmitRecordWithAbbrev(Abbrev, Vals);
401 EmitRecordWithAbbrev(Abbrev, makeArrayRef(Vals));
401402 }
402403
403404 /// EmitRecordWithAbbrev - Emit a record with the specified abbreviation.
404405 /// Unlike EmitRecord, the code for the record should be included in Vals as
405406 /// the first entry.
406 template
407 void EmitRecordWithAbbrev(unsigned Abbrev, SmallVectorImpl &Vals) {
407 template
408 void EmitRecordWithAbbrev(unsigned Abbrev, ArrayRef Vals) {
408409 EmitRecordWithAbbrevImpl(Abbrev, Vals, StringRef());
409410 }
410411
413414 /// specified by the pointer and length specified at the end. In contrast to
414415 /// EmitRecord, this routine expects that the first entry in Vals is the code
415416 /// of the record.
416 template
417 void EmitRecordWithBlob(unsigned Abbrev, SmallVectorImpl &Vals,
417 template
418 void EmitRecordWithBlob(unsigned Abbrev, ArrayRef Vals,
418419 StringRef Blob) {
419420 EmitRecordWithAbbrevImpl(Abbrev, Vals, Blob);
420421 }
421 template
422 void EmitRecordWithBlob(unsigned Abbrev, SmallVectorImpl &Vals,
422 template
423 void EmitRecordWithBlob(unsigned Abbrev, ArrayRef Vals,
423424 const char *BlobData, unsigned BlobLen) {
424425 return EmitRecordWithAbbrevImpl(Abbrev, Vals, StringRef(BlobData, BlobLen));
425426 }
426427
427428 /// EmitRecordWithArray - Just like EmitRecordWithBlob, works with records
428429 /// that end with an array.
429 template
430 void EmitRecordWithArray(unsigned Abbrev, SmallVectorImpl &Vals,
431 StringRef Array) {
430 template
431 void EmitRecordWithArray(unsigned Abbrev, ArrayRef Vals,
432 StringRef Array) {
432433 EmitRecordWithAbbrevImpl(Abbrev, Vals, Array);
433434 }
434 template
435 void EmitRecordWithArray(unsigned Abbrev, SmallVectorImpl &Vals,
436 const char *ArrayData, unsigned ArrayLen) {
435 template
436 void EmitRecordWithArray(unsigned Abbrev, ArrayRef Vals,
437 const char *ArrayData, unsigned ArrayLen) {
437438 return EmitRecordWithAbbrevImpl(Abbrev, Vals, StringRef(ArrayData,
438439 ArrayLen));
439440 }