Fix a ton of comment typos found by codespell. Patch by
[oota-llvm.git] / include / llvm / Bitcode / BitstreamWriter.h
index e48a1908336554955c644e43f06eb9635b49628a..bfb3a4e49c512180b9cbcef945601be36f8aafed 100644 (file)
@@ -88,7 +88,7 @@ public:
   //===--------------------------------------------------------------------===//
 
   void Emit(uint32_t Val, unsigned NumBits) {
-    assert(NumBits <= 32 && "Invalid value size!");
+    assert(NumBits && NumBits <= 32 && "Invalid value size!");
     assert((Val & ~(~0U >> (32-NumBits))) == 0 && "High bits set!");
     CurValue |= Val << CurBit;
     if (CurBit + NumBits < 32) {
@@ -277,10 +277,12 @@ private:
     switch (Op.getEncoding()) {
     default: assert(0 && "Unknown encoding!");
     case BitCodeAbbrevOp::Fixed:
-      Emit((unsigned)V, (unsigned)Op.getEncodingData());
+      if (Op.getEncodingData())
+        Emit((unsigned)V, (unsigned)Op.getEncodingData());
       break;
     case BitCodeAbbrevOp::VBR:
-      EmitVBR64(V, (unsigned)Op.getEncodingData());
+      if (Op.getEncodingData())
+        EmitVBR64(V, (unsigned)Op.getEncodingData());
       break;
     case BitCodeAbbrevOp::Char6:
       Emit(BitCodeAbbrevOp::EncodeChar6((char)V), 6);
@@ -291,10 +293,10 @@ private:
   /// EmitRecordWithAbbrevImpl - This is the core implementation of the record
   /// 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 the record.
+  /// known to exist at the end of the record.
   template<typename uintty>
   void EmitRecordWithAbbrevImpl(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
-                                const StringRef &Blob) {
+                                StringRef Blob) {
     const char *BlobData = Blob.data();
     unsigned BlobLen = (unsigned) Blob.size();
     unsigned AbbrevNo = Abbrev-bitc::FIRST_APPLICATION_ABBREV;
@@ -422,7 +424,7 @@ public:
   /// of the record.
   template<typename uintty>
   void EmitRecordWithBlob(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
-                          const StringRef &Blob) {
+                          StringRef Blob) {
     EmitRecordWithAbbrevImpl(Abbrev, Vals, Blob);
   }
   template<typename uintty>
@@ -435,7 +437,7 @@ public:
   /// that end with an array.
   template<typename uintty>
   void EmitRecordWithArray(unsigned Abbrev, SmallVectorImpl<uintty> &Vals,
-                          const StringRef &Array) {
+                          StringRef Array) {
     EmitRecordWithAbbrevImpl(Abbrev, Vals, Array);
   }
   template<typename uintty>