[PATCH] D17392: Embed bitcode in object file (clang cc1 part)

Vedant Kumar via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 21 16:57:07 PDT 2016


vsk added a subscriber: vsk.
vsk added a comment.

Just a few nitpicks.


================
Comment at: lib/CodeGen/BackendUtil.cpp:785
@@ +784,3 @@
+      llvm::WriteBitcodeToFile(M, OS, /* ShouldPreserveUseListOrder */ true);
+      ModuleData = ArrayRef<uint8_t>((uint8_t*)OS.str().data(),
+                                     OS.str().size());
----------------
You might see a 'drops const qualifier' warning on this line.

Also, calling OS.str() twice calls raw_ostream::flush() twice. Maybe it could be: `OS.flush(); ArrayRef(Data.data(), Data.size())`.

================
Comment at: lib/CodeGen/BackendUtil.cpp:814
@@ +813,3 @@
+  // Embed command-line options.
+  ArrayRef<uint8_t> CmdData((uint8_t*)CGOpts.CmdArgs.data(),
+                            CGOpts.CmdArgs.size());
----------------
You might see a 'drops const qualifier' warning on this line.

================
Comment at: lib/Frontend/CompilerInvocation.cpp:670
@@ +669,3 @@
+      (*A)->render(Args, ASL);
+      for (ArgStringList::iterator it = ASL.begin(), ie = ASL.end();
+          it != ie; ++ it) {
----------------
nit, can you use a range loop here?


http://reviews.llvm.org/D17392





More information about the cfe-commits mailing list