[PATCH] D150282: [Driver] -ftime-trace: derive trace file names from -o and -dumpdir
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu May 11 13:33:02 PDT 2023
MaskRay added a comment.
In D150282#4335568 <https://reviews.llvm.org/D150282#4335568>, @scott.linder wrote:
> Does GCC have the same `-ftime-trace=` option? It seems like it doesn't, as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92396 is still open?
You found it!
I am trying to collect other auxiliary output file features in Clang and add them to https://maskray.me/blog/2023-04-25-compiler-output-files
> If so, I am happy with unifying more of the dump/aux handling, and I imagine when/if GCC adds the option it will behave similarly.
Thanks.
================
Comment at: clang/include/clang/Driver/Compilation.h:279
+ void addTimeTraceFile(const char *Name, const JobAction *JA) {
+ TimeTraceFiles[JA] = Name;
+ }
----------------
scott.linder wrote:
> If this is overriding previous paths should it be called `setTimeTraceFile`?
The naming is to match `add*File` above.
Do you want an assert that the entry hasn't been inserted before?
================
Comment at: clang/lib/Driver/Driver.cpp:5253
+ Path = DumpDir->getValue();
+ Path += llvm::sys::path::filename(BaseInput);
+ } else {
----------------
scott.linder wrote:
> Why `+=` instead of `append`? Do we just know the value of `dumpdir` is terminated with the path separator?
`-dumpdir ` is a bit misnomer that it may or may not end with a path separator.
`clang -c -ftime-trace d/a.c -o e/xa.o -dumpdir f/` is intended to create `fa.json`
I updated a test and the description to give an example.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150282/new/
https://reviews.llvm.org/D150282
More information about the cfe-commits
mailing list