From e896d98548b02223c7740d807a0aa6e20fba7079 Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Fri, 13 Feb 2009 08:11:52 +0000 Subject: Add CodeGen support for the nodebug attribute. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64445 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenFunction.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/CodeGen/CodeGenFunction.cpp') diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 322f8bf565..a699317f63 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -23,8 +23,8 @@ using namespace clang; using namespace CodeGen; CodeGenFunction::CodeGenFunction(CodeGenModule &cgm) - : CGM(cgm), Target(CGM.getContext().Target), SwitchInsn(NULL), - CaseRangeBlock(NULL) { + : CGM(cgm), Target(CGM.getContext().Target), DebugInfo(0), SwitchInsn(0), + CaseRangeBlock(0) { LLVMIntTy = ConvertType(getContext().IntTy); LLVMPointerWidth = Target.getPointerWidth(0); } @@ -128,7 +128,7 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) { EmitReturnBlock(); // Emit debug descriptor for function end. - if (CGDebugInfo *DI = CGM.getDebugInfo()) { + if (CGDebugInfo *DI = getDebugInfo()) { DI->setLocation(EndLoc); DI->EmitRegionEnd(CurFn, Builder); } @@ -168,7 +168,7 @@ void CodeGenFunction::StartFunction(const Decl *D, QualType RetTy, // Emit subprogram debug descriptor. // FIXME: The cast here is a huge hack. - if (CGDebugInfo *DI = CGM.getDebugInfo()) { + if (CGDebugInfo *DI = getDebugInfo()) { DI->setLocation(StartLoc); if (const FunctionDecl *FD = dyn_cast(D)) { DI->EmitFunctionStart(CGM.getMangledName(FD)->getName(), @@ -197,6 +197,10 @@ void CodeGenFunction::StartFunction(const Decl *D, QualType RetTy, void CodeGenFunction::GenerateCode(const FunctionDecl *FD, llvm::Function *Fn) { + // Check if we should generate debug info for this function. + if (CGM.getDebugInfo() && !FD->getAttr()) + DebugInfo = CGM.getDebugInfo(); + FunctionArgList Args; if (FD->getNumParams()) { const FunctionTypeProto* FProto = FD->getType()->getAsFunctionTypeProto(); -- cgit v1.2.3-18-g5258