[llvm] r247232 - Makes EmitRecord() accepting ArrayRef and raw array (NFC)
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 18:45:55 PDT 2015
Author: mehdi_amini
Date: Wed Sep 9 20:45:55 2015
New Revision: 247232
URL: http://llvm.org/viewvc/llvm-project?rev=247232&view=rev
Log:
Makes EmitRecord() accepting ArrayRef and raw array (NFC)
After r247186, a vector is no longer needed as the push_front for
the code is removed.
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=247232&r1=247231&r2=247232&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h (original)
+++ llvm/trunk/include/llvm/Bitcode/BitstreamWriter.h Wed Sep 9 20:45:55 2015
@@ -399,16 +399,16 @@ public:
/// EmitRecord - Emit the specified record to the stream, using an abbrev if
/// we have one to compress the output.
- template<typename uintty>
- void EmitRecord(unsigned Code, SmallVectorImpl<uintty> &Vals,
- unsigned Abbrev = 0) {
+ template <typename Container>
+ void EmitRecord(unsigned Code, const Container &Vals, unsigned Abbrev = 0) {
if (!Abbrev) {
// If we don't have an abbrev to use, emit this in its fully unabbreviated
// form.
+ auto Count = static_cast<uint32_t>(makeArrayRef(Vals).size());
EmitCode(bitc::UNABBREV_RECORD);
EmitVBR(Code, 6);
- EmitVBR(static_cast<uint32_t>(Vals.size()), 6);
- for (unsigned i = 0, e = static_cast<unsigned>(Vals.size()); i != e; ++i)
+ EmitVBR(Count, 6);
+ for (unsigned i = 0, e = Count; i != e; ++i)
EmitVBR64(Vals[i], 6);
return;
}
More information about the llvm-commits
mailing list