aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorOrlando Cazalet-Hyams <orlando.hyams@sony.com>2025-05-28 11:25:41 +0100
committerGitHub <noreply@github.com>2025-05-28 11:25:41 +0100
commitc4d0d95a4fb92d65594f3575814a027815b5182f (patch)
tree7b8bbf55524cd1ec5260999dc960405a1f0858a2 /clang/lib/CodeGen/CodeGenFunction.cpp
parent63de20c0de05ce7b8b3968a9d210aa0f3d01acd4 (diff)
downloadllvm-c4d0d95a4fb92d65594f3575814a027815b5182f.zip
llvm-c4d0d95a4fb92d65594f3575814a027815b5182f.tar.gz
llvm-c4d0d95a4fb92d65594f3575814a027815b5182f.tar.bz2
[KeyInstr][Clang] Reset atomGroup number for each function (#141607)
CGDebugInfo::completeFunction was added previously but mistakenly not called (dropped through the cracks while putting together the patch stack). Moved out of #134652 and #134654. 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.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index e235756..4193f0a 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -36,6 +36,7 @@
#include "clang/CodeGen/CGFunctionInfo.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/ScopeExit.h"
#include "llvm/Frontend/OpenMP/OMPIRBuilder.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Dominators.h"
@@ -1507,6 +1508,11 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn,
// Disable debug info indefinitely for this function
DebugInfo = nullptr;
}
+ // Finalize function debug info on exit.
+ auto Cleanup = llvm::make_scope_exit([this] {
+ if (CGDebugInfo *DI = getDebugInfo())
+ DI->completeFunction();
+ });
// The function might not have a body if we're generating thunks for a
// function declaration.