Skip to content

Commit

Permalink
Defer
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffnn committed Jan 23, 2024
1 parent 79f55f2 commit 2779d8c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions lib/DxilDia/DxilDiaSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,15 @@ void dxil_dia::Session::Init(std::shared_ptr<llvm::LLVMContext> context,
DXASSERT(m_rvaMap[It->second] == It->first,
"instruction mapped to wrong rva");
}
}

// Initialize symbols
const dxil_dia::SymbolManager &dxil_dia::Session::SymMgr() {
try {
m_symsMgr.Init(this);
} catch (const hlsl::Exception &) {
m_symsMgr = dxil_dia::SymbolManager();
}
return m_symsMgr;
}

HRESULT dxil_dia::Session::getSourceFileIdByName(llvm::StringRef fileName,
Expand Down Expand Up @@ -138,7 +140,7 @@ STDMETHODIMP dxil_dia::Session::get_globalScope(
*pRetVal = nullptr;

Symbol *ret;
IFR(m_symsMgr.GetGlobalScope(&ret));
IFR(SymMgr().GetGlobalScope(&ret));
*pRetVal = ret;
return S_OK;
}
Expand Down Expand Up @@ -378,7 +380,7 @@ STDMETHODIMP dxil_dia::Session::findInlineFramesByAddr(

HRESULT hr;
SymbolChildrenEnumerator *ChildrenEnum;
IFR(hr = m_symsMgr.DbgScopeOf(It->second, &ChildrenEnum));
IFR(hr = SymMgr().DbgScopeOf(It->second, &ChildrenEnum));

*ppResult = ChildrenEnum;
return hr;
Expand Down
2 changes: 1 addition & 1 deletion lib/DxilDia/DxilDiaSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Session : public IDiaSession, public IDxcPixDxilDebugInfoFactory {
hlsl::DxilModule &DxilModuleRef() { return *m_dxilModule.get(); }
llvm::Module &ModuleRef() { return *m_module.get(); }
llvm::DebugInfoFinder &InfoRef() { return *m_finder.get(); }
const SymbolManager &SymMgr() const { return m_symsMgr; }
const SymbolManager &SymMgr();
const RVAMap &InstructionsRef() const { return m_instructions; }
const std::vector<const llvm::Instruction *> &InstructionLinesRef() const {
return m_instructionLines;
Expand Down
3 changes: 2 additions & 1 deletion lib/DxilDia/DxilDiaSymbolManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2343,7 +2343,8 @@ dxil_dia::SymbolManager::SymbolManager() = default;
dxil_dia::SymbolManager::~SymbolManager() { m_pSession = nullptr; }

void dxil_dia::SymbolManager::Init(Session *pSes) {
DXASSERT(m_pSession == nullptr, "SymbolManager already initialized");
if (m_pSession != nullptr)
return; // Already initialized
m_pSession = pSes;
m_symbolCtors.clear();
m_parentToChildren.clear();
Expand Down

0 comments on commit 2779d8c

Please sign in to comment.