[PATCH] D89087: [MemProf] Pass down memory profile name with optional path from clang

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 31 17:00:52 PDT 2020


MaskRay added inline comments.


================
Comment at: clang/include/clang/Driver/Options.td:1021
+def fmemory_profile_EQ : Joined<["-"], "fmemory-profile=">,
+    Group<f_Group>, Flags<[CC1Option, DriverOption]>, MetaVarName<"<directory>">,
+    HelpText<"Enable heap memory profiling and dump results into <directory>">;
----------------
DriverOption has been renamed to NoXarchOption (which is just used to provide a diagnostic for -Xarch, which may be removed in the future). Please remove the flag


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:4316
+  if (MemProfArg) {
+    if (MemProfArg->getOption().matches(options::OPT_fmemory_profile))
+      Args.AddLastArg(CmdArgs, options::OPT_fmemory_profile);
----------------
if not match  options::OPT_fno_memory_profile, `render(Args, CmdArgs)`


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1042
+  // The memory profile runtime appends the pid to make this name more unique.
+  std::string MemProfileBasename = "memprof.profraw";
+  if (Args.hasArg(OPT_fmemory_profile_EQ)) {
----------------
const StringLiteral


================
Comment at: clang/lib/Frontend/CompilerInvocation.cpp:1049
+  } else if (Args.hasArg(OPT_fmemory_profile))
+    Opts.MemoryProfileOutput = MemProfileBasename;
 
----------------
std::string(MemProfileBasename)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89087



More information about the cfe-commits mailing list