From 9459c8309c6768cf6aa7956885b2540e16582a93 Mon Sep 17 00:00:00 2001 From: Orlando Cazalet-Hyams Date: Wed, 21 May 2025 17:40:45 +0100 Subject: [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. --- clang/lib/CodeGen/CodeGenFunction.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp') 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); +} -- cgit v1.1