[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:06:30 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).
----------------
aganea wrote:
> 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.
Frankly a better fix would be to change the API of `ExecuteCC1Tool` to take an `ArrayRef` and not rely on internal behavior of `SmallVector`. Maybe we should do that.


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