mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
Add StringRef based APIs to BitstreamWriter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79904 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
#ifndef BITSTREAM_WRITER_H
|
#ifndef BITSTREAM_WRITER_H
|
||||||
#define BITSTREAM_WRITER_H
|
#define BITSTREAM_WRITER_H
|
||||||
|
|
||||||
|
#include "llvm/ADT/StringRef.h"
|
||||||
#include "llvm/Bitcode/BitCodes.h"
|
#include "llvm/Bitcode/BitCodes.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -293,7 +294,9 @@ private:
|
|||||||
/// known to exist at the end of the the record.
|
/// known to exist at the end of the the record.
|
||||||
template<typename uintty>
|
template<typename uintty>
|
||||||
void EmitRecordWithAbbrevImpl(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
|
void EmitRecordWithAbbrevImpl(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
|
||||||
const char *BlobData, unsigned BlobLen) {
|
const StringRef &Blob) {
|
||||||
|
const char *BlobData = Blob.data();
|
||||||
|
unsigned BlobLen = (unsigned) Blob.size();
|
||||||
unsigned AbbrevNo = Abbrev-bitc::FIRST_APPLICATION_ABBREV;
|
unsigned AbbrevNo = Abbrev-bitc::FIRST_APPLICATION_ABBREV;
|
||||||
assert(AbbrevNo < CurAbbrevs.size() && "Invalid abbrev #!");
|
assert(AbbrevNo < CurAbbrevs.size() && "Invalid abbrev #!");
|
||||||
BitCodeAbbrev *Abbv = CurAbbrevs[AbbrevNo];
|
BitCodeAbbrev *Abbv = CurAbbrevs[AbbrevNo];
|
||||||
@@ -409,7 +412,7 @@ public:
|
|||||||
/// the first entry.
|
/// the first entry.
|
||||||
template<typename uintty>
|
template<typename uintty>
|
||||||
void EmitRecordWithAbbrev(unsigned Abbrev, SmallVectorImpl<uintty> &Vals) {
|
void EmitRecordWithAbbrev(unsigned Abbrev, SmallVectorImpl<uintty> &Vals) {
|
||||||
EmitRecordWithAbbrevImpl(Abbrev, Vals, 0, 0);
|
EmitRecordWithAbbrevImpl(Abbrev, Vals, StringRef());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EmitRecordWithBlob - Emit the specified record to the stream, using an
|
/// EmitRecordWithBlob - Emit the specified record to the stream, using an
|
||||||
@@ -418,17 +421,28 @@ public:
|
|||||||
/// EmitRecord, this routine expects that the first entry in Vals is the code
|
/// EmitRecord, this routine expects that the first entry in Vals is the code
|
||||||
/// of the record.
|
/// of the record.
|
||||||
template<typename uintty>
|
template<typename uintty>
|
||||||
|
void EmitRecordWithBlob(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
|
||||||
|
const StringRef &Blob) {
|
||||||
|
EmitRecordWithAbbrevImpl(Abbrev, Vals, Blob);
|
||||||
|
}
|
||||||
|
template<typename uintty>
|
||||||
void EmitRecordWithBlob(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
|
void EmitRecordWithBlob(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
|
||||||
const char *BlobData, unsigned BlobLen) {
|
const char *BlobData, unsigned BlobLen) {
|
||||||
EmitRecordWithAbbrevImpl(Abbrev, Vals, BlobData, BlobLen);
|
return EmitRecordWithAbbrevImpl(Abbrev, Vals, StringRef(BlobData, BlobLen));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EmitRecordWithArray - Just like EmitRecordWithBlob, works with records
|
/// EmitRecordWithArray - Just like EmitRecordWithBlob, works with records
|
||||||
/// that end with an array.
|
/// that end with an array.
|
||||||
template<typename uintty>
|
template<typename uintty>
|
||||||
|
void EmitRecordWithArray(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
|
||||||
|
const StringRef &Array) {
|
||||||
|
EmitRecordWithAbbrevImpl(Abbrev, Vals, Array);
|
||||||
|
}
|
||||||
|
template<typename uintty>
|
||||||
void EmitRecordWithArray(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
|
void EmitRecordWithArray(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
|
||||||
const char *ArrayData, unsigned ArrayLen) {
|
const char *ArrayData, unsigned ArrayLen) {
|
||||||
EmitRecordWithAbbrevImpl(Abbrev, Vals, ArrayData, ArrayLen);
|
return EmitRecordWithAbbrevImpl(Abbrev, Vals, StringRef(ArrayData,
|
||||||
|
ArrayLen));
|
||||||
}
|
}
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
|
Reference in New Issue
Block a user