emission.Address = DeclPtr;
// Emit debug info for local var declaration.
- if (CGDebugInfo *DI = getDebugInfo()) {
- assert(HaveInsertPoint() && "Unexpected unreachable point!");
-
- DI->setLocation(D.getLocation());
- if (Target.useGlobalsForAutomaticVariables()) {
- DI->EmitGlobalVariable(static_cast<llvm::GlobalVariable *>(DeclPtr), &D);
- } else
- DI->EmitDeclareOfAutoVariable(&D, DeclPtr, Builder);
- }
+ if (HaveInsertPoint())
+ if (CGDebugInfo *DI = getDebugInfo()) {
+ DI->setLocation(D.getLocation());
+ DI->UpdateLineDirectiveRegion(Builder);
+ DI->EmitStopPoint(Builder);
+ if (Target.useGlobalsForAutomaticVariables()) {
+ DI->EmitGlobalVariable(static_cast<llvm::GlobalVariable *>(DeclPtr), &D);
+ } else
+ DI->EmitDeclareOfAutoVariable(&D, DeclPtr, Builder);
+ }
return emission;
}
}
void CodeGenFunction::EmitDeclStmt(const DeclStmt &S) {
- // As long as debug info is modeled with instructions, we have to ensure we
- // have a place to insert here and write the stop point here.
- if (getDebugInfo()) {
- EnsureInsertPoint();
- EmitStopPoint(&S);
- }
-
for (DeclStmt::const_decl_iterator I = S.decl_begin(), E = S.decl_end();
I != E; ++I)
EmitDecl(**I);