aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenFunction.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-02-13 08:11:52 +0000
committerAnders Carlsson <andersca@mac.com>2009-02-13 08:11:52 +0000
commite896d98548b02223c7740d807a0aa6e20fba7079 (patch)
tree3cd6ed57b2f97b2dea47294eeef95ae68dbde28f /lib/CodeGen/CodeGenFunction.cpp
parentd87df37e0adaba0d5e33da7b1a14d7f1d94c5eef (diff)
Add CodeGen support for the nodebug attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64445 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r--lib/CodeGen/CodeGenFunction.cpp12
1 files changed, 8 insertions, 4 deletions
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<FunctionDecl>(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<NodebugAttr>())
+ DebugInfo = CGM.getDebugInfo();
+
FunctionArgList Args;
if (FD->getNumParams()) {
const FunctionTypeProto* FProto = FD->getType()->getAsFunctionTypeProto();