[PATCH] D19447: Refactor bitcode writer into classes (NFC)

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 22 20:37:48 PDT 2016


joker.eph added inline comments.

================
Comment at: lib/Bitcode/Writer/BitcodeWriter.cpp:71
@@ +70,3 @@
+  /// Pointer to the buffer allocated by caller for bitcode writing.
+  SmallVectorImpl<char> *Buffer;
+
----------------
tejohnson wrote:
> joker.eph wrote:
> > Use a reference is it non-optional and does not need to be rebound.
> > 
> In other contexts I have seen the advice that const references should be avoided as class members because of dangers due to lifetime issues if a temporary were to be passed in to the constructor. It looks like this is fairly common practice in LLVM though. I will go ahead and change it since that seems to be the convention here.
Interesting, nobody ever pointed me to this "con" of using a ref before.


http://reviews.llvm.org/D19447





More information about the llvm-commits mailing list