[clang] [Clang] Add "extend lifetime" flags and release note (PR #110000)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 8 15:46:42 PST 2025


================
@@ -412,6 +412,20 @@ New Compiler Flags
   only for thread-local variables, and none (which corresponds to the
   existing ``-fno-c++-static-destructors`` flag) skips all static
   destructors registration.
+- The ``-fextend-variable-liveness`` flag has been added to allow for improved
+  debugging of optimized code. Using ``-fextend-variable-liveness`` will cause
+  Clang to generate code that tries to preserve the liveness of source variables
+  through optimizations, meaning that variables will typically be visible in a
+  debugger more often. The flag has two levels: ``-fextend-variable-liveness``,
+  or ``-fextend-variable-liveness=all``, extendes the liveness of all user
+  variables and the ``this`` pointer. Alternatively ``-fextend-this-ptr``, or
----------------
zygoloid wrote:

Looks like the flag name supported is `-fextend-this-ptr-liveness`, not `-fextend-this-ptr`.

I also wonder whether the `-fextend-this-ptr-liveness` flag carries its weight -- we've historically removed these special-case flags in favor of the more general things, as we did with `-fsanitize=` for example. I understand that this is being upstreamed from some existing deployment; does the alias help there? Having it around for a shorter time period with an intent to eventually remove it might be reasonable.

https://github.com/llvm/llvm-project/pull/110000


More information about the cfe-commits mailing list