[PATCH] D116011: [Clang] Own the CommandLineArgs in CodeGenOptions

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 21 15:03:34 PST 2021


aganea marked an inline comment as done.
aganea added inline comments.


================
Comment at: clang/lib/Driver/Job.cpp:390-392
   Argv.push_back(nullptr);
+  Argv.pop_back(); // The terminating null element shall not be part of the
+                   // slice (main() behavior).
----------------
aheejin wrote:
> If we push `nullptr` and then pop it right after that, why do we push it in the first place?
Simply to guarantee that we will have a `nullptr` element after the end of the container. `.pop_back()` only decrements the size, the `nullptr` value will remain there.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116011/new/

https://reviews.llvm.org/D116011



More information about the llvm-commits mailing list