Debug Info: Set the debug location for the function prologue to the decl of the function.

rdar://problem/14536357

Swift SVN r6576
This commit is contained in:
Adrian Prantl
2013-07-25 01:03:46 +00:00
parent b85ba363a8
commit 511ddc46fd
3 changed files with 7 additions and 4 deletions

View File

@@ -32,13 +32,14 @@ using namespace irgen;
IRGenFunction::IRGenFunction(IRGenModule &IGM,
ExplosionKind explosionLevel,
llvm::Function *Fn,
SILDebugScope *DS)
SILDebugScope *DbgScope,
SILLocation DbgLoc)
: IGM(IGM), Builder(IGM.getLLVMContext()),
CurFn(Fn), CurExplosionLevel(explosionLevel),
ContextPtr(nullptr) {
// Make sure the instructions in this function are attached its debug scope.
if (IGM.DebugInfo)
IGM.DebugInfo->setCurrentLoc(Builder, DS);
IGM.DebugInfo->setCurrentLoc(Builder, DbgScope, DbgLoc);
emitPrologue();
}

View File

@@ -20,6 +20,7 @@
#include "swift/Basic/LLVM.h"
#include "swift/AST/Type.h"
#include "swift/SIL/SILLocation.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/IR/CallingConv.h"
#include "IRBuilder.h"
@@ -91,7 +92,8 @@ public:
IRGenFunction(IRGenModule &IGM,
Mangle::ExplosionKind explosion,
llvm::Function *fn,
SILDebugScope* DS = nullptr);
SILDebugScope* DbgScope = nullptr,
SILLocation DbgLoc = SILLocation());
~IRGenFunction();
void unimplemented(SourceLoc Loc, StringRef Message);

View File

@@ -645,7 +645,7 @@ IRGenSILFunction::IRGenSILFunction(IRGenModule &IGM,
ExplosionKind explosionLevel)
: IRGenFunction(IGM, explosionLevel,
IGM.getAddrOfSILFunction(f, explosionLevel),
f->getDebugScope()),
f->getDebugScope(), f->getLocation()),
CurSILFn(f)
{}