getOrCreateType(FnType, Unit),
Fn->hasInternalLinkage(), true/*definition*/);
-#ifndef ATTACH_DEBUG_INFO_TO_AN_INSN
- DebugFactory.InsertSubprogramStart(SP, Builder.GetInsertBlock());
-#endif
-
// Push function on region stack.
RegionStack.push_back(SP);
}
llvm::DICompileUnit Unit = getOrCreateCompileUnit(CurLoc);
PresumedLoc PLoc = SM.getPresumedLoc(CurLoc);
-#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
llvm::DIDescriptor DR = RegionStack.back();
llvm::DIScope DS = llvm::DIScope(DR.getNode());
llvm::DILocation DO(NULL);
DebugFactory.CreateLocation(PLoc.getLine(), PLoc.getColumn(),
DS, DO);
Builder.SetCurrentDebugLocation(DL.getNode());
-#else
- DebugFactory.InsertStopPoint(Unit, PLoc.getLine(), PLoc.getColumn(),
- Builder.GetInsertBlock());
-#endif
}
/// EmitRegionStart- Constructs the debug code for entering a declarative
D = RegionStack.back();
D = DebugFactory.CreateLexicalBlock(D);
RegionStack.push_back(D);
-#ifndef ATTACH_DEBUG_INFO_TO_AN_INSN
- DebugFactory.InsertRegionStart(D, Builder.GetInsertBlock());
-#endif
}
/// EmitRegionEnd - Constructs the debug code for exiting a declarative
// Provide an region stop point.
EmitStopPoint(Fn, Builder);
-#ifndef ATTACH_DEBUG_INFO_TO_AN_INSN
- DebugFactory.InsertRegionEnd(RegionStack.back(), Builder.GetInsertBlock());
-#endif
RegionStack.pop_back();
}
// Insert an llvm.dbg.declare into the current block.
llvm::Instruction *Call =
DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertBlock());
-#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
- llvm::DIDescriptor DR = RegionStack.back();
- llvm::DIScope DS = llvm::DIScope(DR.getNode());
- llvm::DILocation DO(NULL);
- llvm::DILocation DL =
- DebugFactory.CreateLocation(Line, PLoc.getColumn(), DS, DO);
- Builder.SetDebugLocation(Call, DL.getNode());
-#endif
+
+ llvm::DIDescriptor DR = RegionStack.back();
+ llvm::DIScope DS = llvm::DIScope(DR.getNode());
+ llvm::DILocation DO(NULL);
+ llvm::DILocation DL =
+ DebugFactory.CreateLocation(Line, PLoc.getColumn(), DS, DO);
+ Builder.SetDebugLocation(Call, DL.getNode());
}
/// EmitDeclare - Emit local variable declaration debug info.
// Insert an llvm.dbg.declare into the current block.
llvm::Instruction *Call =
DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertPoint());
-#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
- llvm::DIDescriptor DR = RegionStack.back();
- llvm::DIScope DS = llvm::DIScope(DR.getNode());
- llvm::DILocation DO(NULL);
- llvm::DILocation DL =
- DebugFactory.CreateLocation(Line, PLoc.getColumn(), DS, DO);
- Builder.SetDebugLocation(Call, DL.getNode());
-#endif
+
+ llvm::DIDescriptor DR = RegionStack.back();
+ llvm::DIScope DS = llvm::DIScope(DR.getNode());
+ llvm::DILocation DO(NULL);
+ llvm::DILocation DL =
+ DebugFactory.CreateLocation(Line, PLoc.getColumn(), DS, DO);
+ Builder.SetDebugLocation(Call, DL.getNode());
}
void CGDebugInfo::EmitDeclareOfAutoVariable(const VarDecl *Decl,
CGDebugInfo *DI = getDebugInfo();
if (DI) {
-#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
DI->setLocation(S.getLBracLoc());
DI->EmitRegionStart(CurFn, Builder);
-#else
- EnsureInsertPoint();
- DI->setLocation(S.getLBracLoc());
-#endif
}
// Keep track of the current cleanup stack depth.
EmitStmt(*I);
if (DI) {
-#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
DI->setLocation(S.getLBracLoc());
DI->EmitRegionEnd(CurFn, Builder);
-#else
- EnsureInsertPoint();
- DI->setLocation(S.getLBracLoc());
-#endif
}
RValue RV;
BreakContinueStack.push_back(BreakContinue(AfterFor, ContinueBlock));
// If the condition is true, execute the body of the for stmt.
-#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
CGDebugInfo *DI = getDebugInfo();
if (DI) {
DI->setLocation(S.getSourceRange().getBegin());
DI->EmitRegionStart(CurFn, Builder);
}
-#endif
EmitStmt(S.getBody());
BreakContinueStack.pop_back();
// Finally, branch back up to the condition for the next iteration.
EmitBranch(CondBlock);
-#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN
if (DI) {
DI->setLocation(S.getSourceRange().getEnd());
DI->EmitRegionEnd(CurFn, Builder);
}
-#endif
// Emit the fall-through block.
EmitBlock(AfterFor, true);