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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 14 09:52:32 PDT 2021


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

LG with some nits. After fixes, please wait one day or so in case there are further comments.



================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:5500
+      SmallString<128> OutputFilename(OutputOpt->getValue());
+      llvm::sys::path::replace_extension(OutputFilename, llvm::Twine("su"));
+      CmdArgs.push_back(Args.MakeArgString(OutputFilename));
----------------
remove `llvm::Twine`


================
Comment at: clang/test/CodeGen/stack-usage.c:4
+// RUN: rm -rf %t && mkdir %t
+// RUN: %clang_cc1 -triple aarch64-unknown -stack-usage-file %t/b.su -emit-obj %s -o %t/b.o
+// RUN: FileCheck %s < %t/b.su
----------------
`%t/b.su` can be simplified to `b.su` since you have changed cwd.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1189
+void AsmPrinter::emitStackUsage(const MachineFunction &MF) {
+  auto OutputFilename = MF.getTarget().Options.StackUsageOutput;
+
----------------
const std::string &

otherwise there will be an unneeded copy.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100509



More information about the llvm-commits mailing list