Skip to content

Commit 2383541

Browse files
committed
rename to IDllLoader, rename to OverrideDll, remove defaulted functions, remove initialize
1 parent ed23ada commit 2383541

File tree

9 files changed

+18
-27
lines changed

9 files changed

+18
-27
lines changed

include/dxc/Support/dxcapi.extval.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#include <string>
33

44
namespace dxc {
5-
class DxcDllExtValidationLoader : public DllLoader {
5+
class DxcDllExtValidationLoader : public IDllLoader {
66
// DxCompilerSupport manages the
77
// lifetime of dxcompiler.dll, while DxilExtValSupport
88
// manages the lifetime of dxil.dll
@@ -26,7 +26,7 @@ class DxcDllExtValidationLoader : public DllLoader {
2626
IUnknown **pResult);
2727

2828
HRESULT Initialize() { return InitializeInternal("DxcCreateInstance"); }
29-
HRESULT InitializeForDll(LPCSTR dll, LPCSTR entryPoint) {
29+
HRESULT OverrideDll(LPCSTR dll, LPCSTR entryPoint) {
3030
return InitializeInternal(dll);
3131
}
3232

include/dxc/Support/dxcapi.use.h

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,9 @@ extern const char *kDxCompilerLib;
2020
extern const char *kDxilLib;
2121

2222
// Interface for common dll operations
23-
class DllLoader {
23+
class IDllLoader {
2424
public:
25-
DllLoader() = default;
26-
27-
DllLoader(DllLoader &&other) = default;
28-
29-
virtual ~DllLoader() = default;
30-
31-
virtual HRESULT Initialize() = 0;
32-
33-
virtual HRESULT InitializeForDll(LPCSTR dll, LPCSTR entryPoint) = 0;
25+
virtual HRESULT OverrideDll(LPCSTR dll, LPCSTR entryPoint) = 0;
3426

3527
template <typename TInterface>
3628
HRESULT CreateInstance(REFCLSID clsid, TInterface **pResult) {
@@ -63,7 +55,7 @@ class DllLoader {
6355
};
6456

6557
// Helper class to dynamically load the dxcompiler or a compatible libraries.
66-
class SpecificDllLoader : public DllLoader {
58+
class SpecificDllLoader : public IDllLoader {
6759

6860
HMODULE m_dll;
6961
DxcCreateInstanceProc m_createFn;
@@ -135,13 +127,13 @@ class SpecificDllLoader : public DllLoader {
135127
return InitializeInternal(kDxCompilerLib, "DxcCreateInstance");
136128
}
137129

138-
HRESULT InitializeForDll(LPCSTR dll, LPCSTR entryPoint) {
130+
HRESULT OverrideDll(LPCSTR dll, LPCSTR entryPoint) {
139131
return InitializeInternal(dll, entryPoint);
140132
}
141133

142134
// Also bring visibility into the interface definition of this function
143135
// which takes 2 args
144-
using DllLoader::CreateInstance;
136+
using IDllLoader::CreateInstance;
145137
HRESULT CreateInstance(REFCLSID clsid, REFIID riid, IUnknown **pResult) {
146138
if (pResult == nullptr)
147139
return E_POINTER;
@@ -153,7 +145,7 @@ class SpecificDllLoader : public DllLoader {
153145

154146
// Also bring visibility into the interface definition of this function
155147
// which takes 3 args
156-
using DllLoader::CreateInstance2;
148+
using IDllLoader::CreateInstance2;
157149
HRESULT CreateInstance2(IMalloc *pMalloc, REFCLSID clsid, REFIID riid,
158150
IUnknown **pResult) {
159151
if (pResult == nullptr)

lib/DxcSupport/HLSLOptions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,8 +1389,8 @@ int SetupSpecificDllLoader(const DxcOpts &opts,
13891389
llvm::raw_ostream &errors) {
13901390
if (!opts.ExternalLib.empty()) {
13911391
DXASSERT(!opts.ExternalFn.empty(), "else ReadDxcOpts should have failed");
1392-
HRESULT hrLoad = dxcSupport.InitializeForDll(opts.ExternalLib.data(),
1393-
opts.ExternalFn.data());
1392+
HRESULT hrLoad =
1393+
dxcSupport.OverrideDll(opts.ExternalLib.data(), opts.ExternalFn.data());
13941394
if (DXC_FAILED(hrLoad)) {
13951395
errors << "Unable to load support for external DLL " << opts.ExternalLib
13961396
<< " with function " << opts.ExternalFn << " - error 0x";

lib/DxcSupport/dxcapi.extval.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ HRESULT DxcDllExtValidationLoader::CreateInstance2(IMalloc *pMalloc,
2525

2626
HRESULT DxcDllExtValidationLoader::InitializeInternal(LPCSTR fnName) {
2727
// Load dxcompiler.dll
28-
HRESULT Result = DxCompilerSupport.InitializeForDll(kDxCompilerLib, fnName);
28+
HRESULT Result = DxCompilerSupport.OverrideDll(kDxCompilerLib, fnName);
2929
// if dxcompiler.dll fails to load, return the failed HRESULT
3030
if (DXC_FAILED(Result)) {
3131
return Result;
@@ -45,7 +45,7 @@ HRESULT DxcDllExtValidationLoader::InitializeInternal(LPCSTR fnName) {
4545
return E_INVALIDARG;
4646
}
4747

48-
return DxilExtValSupport.InitializeForDll(DxilDllPath.c_str(), fnName);
48+
return DxilExtValSupport.OverrideDll(DxilDllPath.c_str(), fnName);
4949
}
5050

5151
bool DxcDllExtValidationLoader::GetCreateInstanceProcs(

projects/dxilconv/unittests/DxilConvTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class DxilConvTest {
170170
bool DxilConvTest::InitSupport() {
171171
if (!m_dllSupport.IsEnabled()) {
172172
VERIFY_SUCCEEDED(
173-
m_dllSupport.InitializeForDll("dxilconv.dll", "DxcCreateInstance"));
173+
m_dllSupport.OverrideDll("dxilconv.dll", "DxcCreateInstance"));
174174
}
175175

176176
if (!FindToolInBinDir("%dxbc2dxil", "dxbc2dxil.exe")) {

tools/clang/tools/dxclib/dxc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1327,7 +1327,7 @@ void DxcContext::GetCompilerVersionInfo(llvm::raw_string_ostream &OS) {
13271327

13281328
// Print validator if exists
13291329
SpecificDllLoader DxilSupport;
1330-
DxilSupport.InitializeForDll(kDxilLib, "DxcCreateInstance");
1330+
DxilSupport.OverrideDll(kDxilLib, "DxcCreateInstance");
13311331
WriteDXILVersionInfo(OS, DxilSupport);
13321332
}
13331333

tools/clang/tools/dxopt/dxopt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ int main(int argc, const char **argv) {
317317
if (externalLib) {
318318
CW2A externalFnA(externalFn);
319319
CW2A externalLibA(externalLib);
320-
IFT(g_DxcSupport.InitializeForDll(externalLibA, externalFnA));
320+
IFT(g_DxcSupport.OverrideDll(externalLibA, externalFnA));
321321
} else {
322322
IFT(g_DxcSupport.Initialize());
323323
}

tools/clang/tools/dxrfallbackcompiler/dxillib.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ bool DxilLibIsEnabled() {
4646
EnterCriticalSection(&cs);
4747
if (SUCCEEDED(g_DllLibResult)) {
4848
if (!g_DllSupport.IsEnabled()) {
49-
g_DllLibResult =
50-
g_DllSupport.InitializeForDll(kDxilLib, "DxcCreateInstance");
49+
g_DllLibResult = g_DllSupport.OverrideDll(kDxilLib, "DxcCreateInstance");
5150
}
5251
}
5352
LeaveCriticalSection(&cs);

tools/clang/unittests/DxrFallback/test_DxrFallback.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ class Tester {
140140
Tester(const std::string &deviceName, const std::string &path)
141141
: m_deviceName(s2ws(deviceName)), m_path(path) {
142142
dxc::EnsureEnabled(m_dxcSupport);
143-
m_dxrFallbackSupport.InitializeForDll("DxrFallbackCompiler.dll",
144-
"DxcCreateDxrFallbackCompiler");
143+
m_dxrFallbackSupport.OverrideDll("DxrFallbackCompiler.dll",
144+
"DxcCreateDxrFallbackCompiler");
145145
}
146146

147147
void setFiles(const std::vector<std::string> &files) {

0 commit comments

Comments
 (0)