aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorOrlando Cazalet-Hyams <orlando.hyams@sony.com>2025-05-21 17:40:45 +0100
committerGitHub <noreply@github.com>2025-05-21 17:40:45 +0100
commit9459c8309c6768cf6aa7956885b2540e16582a93 (patch)
tree81388d1d4dddfcb4fcb62e0bb1cd6391495217ca /clang/lib/CodeGen/CodeGenFunction.cpp
parent878c976c7e0a7f00b4175def9f1f90c88dfe9f96 (diff)
downloadllvm-9459c8309c6768cf6aa7956885b2540e16582a93.zip
llvm-9459c8309c6768cf6aa7956885b2540e16582a93.tar.gz
llvm-9459c8309c6768cf6aa7956885b2540e16582a93.tar.bz2
[KeyInstr][Clang] Add ApplyAtomGroup (#134632)
This is a scoped helper similar to ApplyDebugLocation that creates a new source location atom group which instructions can be added to. A source atom is a source construct that is "interesting" for debug stepping purposes. We use an atom group number to track the instruction(s) that implement the functionality for the atom, plus backup instructions/source locations. 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/CodeGenFunction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 4e79cdf..2256cc0 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -3326,3 +3326,15 @@ CodeGenFunction::EmitPointerAuthAuth(const CGPointerAuthInfo &PointerAuth,
return EmitPointerAuthCommon(*this, PointerAuth, Pointer,
llvm::Intrinsic::ptrauth_auth);
}
+
+void CodeGenFunction::addInstToCurrentSourceAtom(
+ llvm::Instruction *KeyInstruction, llvm::Value *Backup) {
+ if (CGDebugInfo *DI = getDebugInfo())
+ DI->addInstToCurrentSourceAtom(KeyInstruction, Backup);
+}
+
+void CodeGenFunction::addInstToSpecificSourceAtom(
+ llvm::Instruction *KeyInstruction, llvm::Value *Backup, uint64_t Atom) {
+ if (CGDebugInfo *DI = getDebugInfo())
+ DI->addInstToSpecificSourceAtom(KeyInstruction, Backup, Atom);
+}