aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenFunction.h
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2025-04-03 14:04:19 +0800
committerGitHub <noreply@github.com>2025-04-03 08:04:19 +0200
commitb384d6d6ccc8f4452cd7086061c657ce76b41224 (patch)
treed3a77452114d617b07054ab04b123492c127955e /clang/lib/CodeGen/CodeGenFunction.h
parenta19c018379a1d08eceb5db533a19a6bf37423975 (diff)
downloadllvm-b384d6d6ccc8f4452cd7086061c657ce76b41224.zip
llvm-b384d6d6ccc8f4452cd7086061c657ce76b41224.tar.gz
llvm-b384d6d6ccc8f4452cd7086061c657ce76b41224.tar.bz2
[CodeGen] Don't include CGDebugInfo.h in CodeGenFunction.h (NFC) (#134100)
This is an expensive header, only include it where needed. Move some functions out of line to achieve that. This reduces time to build clang by ~0.5% in terms of instructions retired.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.h32
1 files changed, 4 insertions, 28 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h
index dd73d3b..af9798b 100644
--- a/clang/lib/CodeGen/CodeGenFunction.h
+++ b/clang/lib/CodeGen/CodeGenFunction.h
@@ -14,7 +14,6 @@
#define LLVM_CLANG_LIB_CODEGEN_CODEGENFUNCTION_H
#include "CGBuilder.h"
-#include "CGDebugInfo.h"
#include "CGLoopInfo.h"
#include "CGValue.h"
#include "CodeGenModule.h"
@@ -48,6 +47,7 @@
namespace llvm {
class BasicBlock;
+class ConvergenceControlInst;
class LLVMContext;
class MDNode;
class SwitchInst;
@@ -1105,13 +1105,7 @@ public:
public:
/// Enter a new cleanup scope.
- explicit LexicalScope(CodeGenFunction &CGF, SourceRange Range)
- : RunCleanupsScope(CGF), Range(Range),
- ParentScope(CGF.CurLexicalScope) {
- CGF.CurLexicalScope = this;
- if (CGDebugInfo *DI = CGF.getDebugInfo())
- DI->EmitLexicalBlockStart(CGF.Builder, Range.getBegin());
- }
+ explicit LexicalScope(CodeGenFunction &CGF, SourceRange Range);
void addLabel(const LabelDecl *label) {
assert(PerformCleanup && "adding label to dead scope?");
@@ -1120,17 +1114,7 @@ public:
/// Exit this cleanup scope, emitting any accumulated
/// cleanups.
- ~LexicalScope() {
- if (CGDebugInfo *DI = CGF.getDebugInfo())
- DI->EmitLexicalBlockEnd(CGF.Builder, Range.getEnd());
-
- // If we should perform a cleanup, force them now. Note that
- // this ends the cleanup scope before rescoping any labels.
- if (PerformCleanup) {
- ApplyDebugLocation DL(CGF, Range.getEnd());
- ForceCleanup();
- }
- }
+ ~LexicalScope();
/// Force the emission of cleanups now, instead of waiting
/// until this object is destroyed.
@@ -1691,15 +1675,7 @@ public:
/// Increment the profiler's counter for the given statement by \p StepV.
/// If \p StepV is null, the default increment is 1.
- void incrementProfileCounter(const Stmt *S, llvm::Value *StepV = nullptr) {
- if (CGM.getCodeGenOpts().hasProfileClangInstr() &&
- !CurFn->hasFnAttribute(llvm::Attribute::NoProfile) &&
- !CurFn->hasFnAttribute(llvm::Attribute::SkipProfile)) {
- auto AL = ApplyDebugLocation::CreateArtificial(*this);
- PGO.emitCounterSetOrIncrement(Builder, S, StepV);
- }
- PGO.setCurrentStmt(S);
- }
+ void incrementProfileCounter(const Stmt *S, llvm::Value *StepV = nullptr);
bool isMCDCCoverageEnabled() const {
return (CGM.getCodeGenOpts().hasProfileClangInstr() &&