Fixed some debug locations with line 0 (#3784)
This commit is contained in:
Родитель
64fdd16ee0
Коммит
37e802cd07
|
@ -106,7 +106,13 @@ public:
|
|||
}
|
||||
|
||||
/// \brief Set location information used by debugging information.
|
||||
void SetCurrentDebugLocation(DebugLoc L) { CurDbgLocation = std::move(L); }
|
||||
void SetCurrentDebugLocation(DebugLoc L) { CurDbgLocation = std::move(L);
|
||||
// HLSL Change - begin
|
||||
// Don't propagate debug locations at line 0
|
||||
if (CurDbgLocation && CurDbgLocation.getLine() == 0)
|
||||
CurDbgLocation = nullptr;
|
||||
// HLSL Change - end
|
||||
}
|
||||
|
||||
/// \brief Get location information used by debugging information.
|
||||
const DebugLoc &getCurrentDebugLocation() const { return CurDbgLocation; }
|
||||
|
|
|
@ -6087,7 +6087,7 @@ void PatchDebugInfo(DebugInfoFinder &DbgFinder, Function *F, GlobalVariable *GV,
|
|||
DITypeIdentifierMap EmptyMap;
|
||||
DIBuilder DIB(*GV->getParent());
|
||||
DIScope *Scope = Subprogram;
|
||||
DebugLoc Loc = DebugLoc::get(0, 0, Scope);
|
||||
DebugLoc Loc = DebugLoc::get(DGV->getLine(), 0, Scope);
|
||||
|
||||
// If the variable is a member of another variable, find the offset and size
|
||||
bool IsFragment = false;
|
||||
|
|
|
@ -885,7 +885,8 @@ static void fixupLineNumbers(Function *Fn, Function::iterator FI,
|
|||
if (!getDebugMetadataVersionFromModule(*Fn->getParent()))
|
||||
return;
|
||||
if (DISubprogram *Subprogram = getDISubprogram(Fn)) {
|
||||
TheCallDL = DebugLoc(llvm::DILocation::get(Fn->getContext(), 0, 0, Subprogram));
|
||||
// Just give it the submodule's line, so it doesn't have line number 0
|
||||
TheCallDL = DebugLoc(llvm::DILocation::get(Fn->getContext(), Subprogram->getLine(), 0, Subprogram));
|
||||
TheCall->setDebugLoc(TheCallDL);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
// RUN: %dxc -Zi -E main -T ps_6_0 /Zi /O0 %s | FileCheck %s
|
||||
|
||||
// CHECK-NOT: !{{[0-9]+}} = !DILocation(line: 0,
|
||||
|
||||
// Regression test to make sure debug locations with 0
|
||||
// as line number don't show up.
|
||||
|
||||
struct My_Struct {
|
||||
float m_foo;
|
||||
float m_bar;
|
||||
void set_foo(float foo) {
|
||||
m_foo = foo;
|
||||
m_foo *= 2;
|
||||
}
|
||||
void test() {
|
||||
m_bar = m_bar * 2;
|
||||
}
|
||||
};
|
||||
|
||||
static My_Struct s = { 0.0, 0.0 };
|
||||
|
||||
[RootSignature("")]
|
||||
float main(float foo : FOO) : SV_Target {
|
||||
s.set_foo(foo);
|
||||
s.test();
|
||||
return s.m_bar;
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче