[PATCH] D100509: Support GCC's -fstack-usage flag

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 15 04:46:36 PDT 2021


jansvoboda11 added a comment.

I left a couple of comments inline on the command-line parsing aspect of the patch. For more info, check https://clang.llvm.org/docs/InternalsManual.html#adding-new-command-line-option.



================
Comment at: clang/include/clang/Driver/Options.td:2658
+  Flags<[CC1Option, NoDriverOption]>,
+  MarshallingInfoString<CodeGenOpts<"StackUsageOutput">, [{""}]>;
 
----------------
This argument is not necessary, `MarshallingInfoString` defaults to an empty string by default.


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1926
 
+  if (Args.hasArg(OPT_fstack_usage))
+    NeedLocTracking = true;
----------------
Since `OPT_fstack_usage` has already been parsed into `Opts.StackUsage` at this point, it would make more sense to check that instead.


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1930
+  if (Arg *A = Args.getLastArg(OPT_fstack_usage_EQ))
+    Opts.StackUsageOutput = std::string(A->getValue());
+
----------------
This has already been parsed through `MarshallingInfoString<CodeGenOpts<"StackUsageOutput">>`, no need to duplicate it here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100509



More information about the cfe-commits mailing list