From c3030bc285d90a139fb74629daadef5617283203 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 26 Aug 2013 20:33:21 +0000 Subject: Simplify/clean up debug info suppression in CodeGenFunction CodeGenFunction is run on only one function - a new object is made for each new function. I would add an assertion/flag to this effect, but there's an exception: ObjC properties involve emitting helper functions that are all emitted by the same CodeGenFunction object, so such a check is not possible/correct. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189277 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenFunction.cpp | 40 +++++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'lib/CodeGen/CodeGenFunction.cpp') diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index da8db172f5..20352f9f68 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -31,25 +31,23 @@ using namespace clang; using namespace CodeGen; CodeGenFunction::CodeGenFunction(CodeGenModule &cgm, bool suppressNewContext) - : CodeGenTypeCache(cgm), CGM(cgm), Target(cgm.getTarget()), - Builder(cgm.getModule().getContext()), - CapturedStmtInfo(0), - SanitizePerformTypeCheck(CGM.getSanOpts().Null | - CGM.getSanOpts().Alignment | - CGM.getSanOpts().ObjectSize | - CGM.getSanOpts().Vptr), - SanOpts(&CGM.getSanOpts()), - AutoreleaseResult(false), BlockInfo(0), BlockPointer(0), - LambdaThisCaptureField(0), NormalCleanupDest(0), NextCleanupDestIndex(1), - FirstBlockInfo(0), EHResumeBlock(0), ExceptionSlot(0), EHSelectorSlot(0), - DebugInfo(0), DisableDebugInfo(false), DidCallStackSave(false), - IndirectBranch(0), SwitchInsn(0), CaseRangeBlock(0), UnreachableBlock(0), - NumReturnExprs(0), NumSimpleReturnExprs(0), - CXXABIThisDecl(0), CXXABIThisValue(0), CXXThisValue(0), - CXXDefaultInitExprThis(0), - CXXStructorImplicitParamDecl(0), CXXStructorImplicitParamValue(0), - OutermostConditional(0), CurLexicalScope(0), TerminateLandingPad(0), - TerminateHandler(0), TrapBB(0) { + : CodeGenTypeCache(cgm), CGM(cgm), Target(cgm.getTarget()), + Builder(cgm.getModule().getContext()), CapturedStmtInfo(0), + SanitizePerformTypeCheck(CGM.getSanOpts().Null | + CGM.getSanOpts().Alignment | + CGM.getSanOpts().ObjectSize | + CGM.getSanOpts().Vptr), + SanOpts(&CGM.getSanOpts()), AutoreleaseResult(false), BlockInfo(0), + BlockPointer(0), LambdaThisCaptureField(0), NormalCleanupDest(0), + NextCleanupDestIndex(1), FirstBlockInfo(0), EHResumeBlock(0), + ExceptionSlot(0), EHSelectorSlot(0), DebugInfo(CGM.getModuleDebugInfo()), + DisableDebugInfo(false), DidCallStackSave(false), IndirectBranch(0), + SwitchInsn(0), CaseRangeBlock(0), UnreachableBlock(0), NumReturnExprs(0), + NumSimpleReturnExprs(0), CXXABIThisDecl(0), CXXABIThisValue(0), + CXXThisValue(0), CXXDefaultInitExprThis(0), + CXXStructorImplicitParamDecl(0), CXXStructorImplicitParamValue(0), + OutermostConditional(0), CurLexicalScope(0), TerminateLandingPad(0), + TerminateHandler(0), TrapBB(0) { if (!suppressNewContext) CGM.getCXXABI().getMangleContext().startNewFunction(); @@ -660,8 +658,8 @@ void CodeGenFunction::GenerateCode(GlobalDecl GD, llvm::Function *Fn, const FunctionDecl *FD = cast(GD.getDecl()); // Check if we should generate debug info for this function. - if (!FD->hasAttr()) - maybeInitializeDebugInfo(); + if (FD->hasAttr()) + DebugInfo = NULL; // disable debug info indefinitely for this function FunctionArgList Args; QualType ResTy = FD->getResultType(); -- cgit v1.2.3