[llvm] r247178 - Bitcode Writer: EmitRecordWith* takes an ArrayRef instead of a SmallVector (NFC)
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 13:16:21 PDT 2015
On Wed, Sep 9, 2015 at 1:08 PM, Mehdi Amini via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: mehdi_amini
> Date: Wed Sep 9 15:08:39 2015
> New Revision: 247178
>
> URL: http://llvm.org/viewvc/llvm-project?rev=247178&view=rev
> Log:
> Bitcode Writer: EmitRecordWith* takes an ArrayRef instead of a SmallVector
> (NFC)
>
> From: Mehdi Amini <mehdi.amini at apple.com>
>
> Modified:
> llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h
>
> Modified: llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h?rev=247178&r1=247177&r2=247178&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h (original)
> +++ llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h Wed Sep 9 15:08:39
> 2015
> @@ -15,6 +15,7 @@
> #ifndef LLVM_BITCODE_BITSTREAMWRITER_H
> #define LLVM_BITCODE_BITSTREAMWRITER_H
>
> +#include "llvm/ADT/ArrayRef.h"
> #include "llvm/ADT/SmallVector.h"
> #include "llvm/ADT/StringRef.h"
> #include "llvm/Bitcode/BitCodes.h"
> @@ -286,8 +287,8 @@ private:
> /// emission code. If BlobData is non-null, then it specifies an array
> of
> /// data that should be emitted as part of the Blob or Array operand
> that is
> /// known to exist at the end of the record.
> - template<typename uintty>
> - void EmitRecordWithAbbrevImpl(unsigned Abbrev, SmallVectorImpl<uintty>
> &Vals,
> + template <typename uintty>
> + void EmitRecordWithAbbrevImpl(unsigned Abbrev, const ArrayRef<uintty>
> &Vals,
>
Pass ArrayRef by value (similar feedback in several parts of this change)
> StringRef Blob) {
> const char *BlobData = Blob.data();
> unsigned BlobLen = (unsigned) Blob.size();
> @@ -398,14 +399,14 @@ public:
> // Insert the code into Vals to treat it uniformly.
> Vals.insert(Vals.begin(), Code);
>
> - EmitRecordWithAbbrev(Abbrev, Vals);
> + EmitRecordWithAbbrev(Abbrev, makeArrayRef(Vals));
>
Should Vals (whatever type it is) be impliictly convertible to ArrayRef?
> }
>
> /// EmitRecordWithAbbrev - Emit a record with the specified
> abbreviation.
> /// Unlike EmitRecord, the code for the record should be included in
> Vals as
> /// the first entry.
> - template<typename uintty>
> - void EmitRecordWithAbbrev(unsigned Abbrev, SmallVectorImpl<uintty>
> &Vals) {
> + template <typename uintty>
> + void EmitRecordWithAbbrev(unsigned Abbrev, const ArrayRef<uintty>
> &Vals) {
> EmitRecordWithAbbrevImpl(Abbrev, Vals, StringRef());
> }
>
> @@ -414,27 +415,27 @@ public:
> /// specified by the pointer and length specified at the end. In
> contrast to
> /// EmitRecord, this routine expects that the first entry in Vals is
> the code
> /// of the record.
> - template<typename uintty>
> - void EmitRecordWithBlob(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
> + template <typename uintty>
> + void EmitRecordWithBlob(unsigned Abbrev, const ArrayRef<uintty> &Vals,
> StringRef Blob) {
> EmitRecordWithAbbrevImpl(Abbrev, Vals, Blob);
> }
> - template<typename uintty>
> - void EmitRecordWithBlob(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
> + template <typename uintty>
> + void EmitRecordWithBlob(unsigned Abbrev, const ArrayRef<uintty> &Vals,
> const char *BlobData, unsigned BlobLen) {
> return EmitRecordWithAbbrevImpl(Abbrev, Vals, StringRef(BlobData,
> BlobLen));
> }
>
> /// EmitRecordWithArray - Just like EmitRecordWithBlob, works with
> records
> /// that end with an array.
> - template<typename uintty>
> - void EmitRecordWithArray(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
> - StringRef Array) {
> + template <typename uintty>
> + void EmitRecordWithArray(unsigned Abbrev, const ArrayRef<uintty> &Vals,
> + StringRef Array) {
> EmitRecordWithAbbrevImpl(Abbrev, Vals, Array);
> }
> - template<typename uintty>
> - void EmitRecordWithArray(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
> - const char *ArrayData, unsigned ArrayLen) {
> + template <typename uintty>
> + void EmitRecordWithArray(unsigned Abbrev, const ArrayRef<uintty> &Vals,
> + const char *ArrayData, unsigned ArrayLen) {
> return EmitRecordWithAbbrevImpl(Abbrev, Vals, StringRef(ArrayData,
> ArrayLen));
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150909/831d9e0a/attachment.html>
More information about the llvm-commits
mailing list