summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorOrlando Cazalet-Hyams <orlando.hyams@sony.com>2025-05-23 09:40:09 +0100
committerGitHub <noreply@github.com>2025-05-23 09:40:09 +0100
commit8f1d1dde8a9b4eb317bd515fcb4838f97adbf5f2 (patch)
tree29661a7ddc180a25713fb215db9d249383627716 /clang/lib/CodeGen/CGExpr.cpp
parent4f844e7881d86971cd31401d02a418235d18f456 (diff)
[KeyInstr][Clang] Assignment atom group (#134637)
This patch is part of a stack that teaches Clang to generate Key Instructions metadata for C and C++. RFC: https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668 The feature is only functional in LLVM if LLVM is built with CMake flag LLVM_EXPERIMENTAL_KEY_INSTRUCTIONs. Eventually that flag will be removed.
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 7cb7ee20fcf6..2c0edd69d96e 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -5981,6 +5981,15 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const BinaryOperator *E) {
assert(E->getOpcode() == BO_Assign && "unexpected binary l-value");
+ // Create a Key Instructions source location atom group that covers both
+ // LHS and RHS expressions. Nested RHS expressions may get subsequently
+ // separately grouped (1 below):
+ //
+ // 1. `a = b = c` -> Two atoms.
+ // 2. `x = new(1)` -> One atom (for both addr store and value store).
+ // 3. Complex and agg assignment -> One atom.
+ ApplyAtomGroup Grp(getDebugInfo());
+
// Note that in all of these cases, __block variables need the RHS
// evaluated first just in case the variable gets moved by the RHS.