Makes EmitRecord() accepting ArrayRef and raw array (NFC)
authorMehdi Amini <mehdi.amini@apple.com>
Thu, 10 Sep 2015 01:45:55 +0000 (01:45 +0000)
committerMehdi Amini <mehdi.amini@apple.com>
Thu, 10 Sep 2015 01:45:55 +0000 (01:45 +0000)
After r247186, a vector is no longer needed as the push_front for
the code is removed.

From: Mehdi Amini <mehdi.amini@apple.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247232 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Bitcode/BitstreamWriter.h

index 1fded87..490911f 100644 (file)
@@ -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;
     }