================
@@ -7344,6 +7346,28 @@ void Clang::ConstructJob(Compilation &C, const JobAction 
&JA,
     CmdArgs.push_back(Args.MakeArgString("-ftime-trace=" + Twine(Name)));
     Args.AddLastArg(CmdArgs, options::OPT_ftime_trace_granularity_EQ);
     Args.AddLastArg(CmdArgs, options::OPT_ftime_trace_verbose);
+    if (const Arg *CompressArg =
+            Args.getLastArg(options::OPT_ftime_trace_compress_EQ)) {
+      StringRef Value = CompressArg->getValue();
+      if (Value == "none") {
+        // Explicit -ftime-trace-compress=none disables compression even if the
+        // filename has a .zst/.zstd extension.
----------------
chandlerc wrote:

The main use case for `-ftime-trace-compress=none` is overriding an earlier 
`-ftime-trace-compress` (or `-ftime-trace-compress=zstd`) flag on the command 
line (e.g., from build-system default `CXXFLAGS`). Because 
`-ftime-trace-compress` is an alias for `-ftime-trace-compress=zstd`, 
`getLastArg(OPT_ftime_trace_compress_EQ)` matches both.

If someone also uses `-ftime-trace-compress=none` to override a 
build-system-hardcoded `-ftime-trace=foo.json.zst` path, emitting a warning 
would break under `-Werror` and make that override harder to use. I've updated 
the comment here to clarify that the primary purpose is overriding earlier 
flags (and added a driver test case for `-ftime-trace -ftime-trace-compress 
-ftime-trace-compress=none`).

https://github.com/llvm/llvm-project/pull/228627
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to