Skip to content

Commit 49b89ae

Browse files
committed
Make dxcompiler target build with Clang 19.1.1 (ClangCL toolset, shipped with VS)
1 parent b2e7582 commit 49b89ae

File tree

5 files changed

+21
-23
lines changed

5 files changed

+21
-23
lines changed

include/dxc/Support/dxcapi.use.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class DxcDllSupport {
3434
m_dll = LoadLibraryA(dllName);
3535
if (m_dll == nullptr)
3636
return HRESULT_FROM_WIN32(GetLastError());
37-
m_createFn = (DxcCreateInstanceProc)GetProcAddress(m_dll, fnName);
37+
m_createFn = reinterpret_cast<DxcCreateInstanceProc>(reinterpret_cast<void *>(GetProcAddress(m_dll, fnName)));
3838

3939
if (m_createFn == nullptr) {
4040
HRESULT hr = HRESULT_FROM_WIN32(GetLastError());
@@ -64,7 +64,7 @@ class DxcDllSupport {
6464
fnName2[s] = '2';
6565
fnName2[s + 1] = '\0';
6666
#ifdef _WIN32
67-
m_createFn2 = (DxcCreateInstance2Proc)GetProcAddress(m_dll, fnName2);
67+
m_createFn2 = reinterpret_cast<DxcCreateInstance2Proc>(reinterpret_cast<void *>(GetProcAddress(m_dll, fnName2)));
6868
#else
6969
m_createFn2 = (DxcCreateInstance2Proc)::dlsym(m_dll, fnName2);
7070
#endif

include/llvm/CodeGen/SchedulerRegistry.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class RegisterScheduler : public MachinePassRegistryNode {
4040
static MachinePassRegistry Registry;
4141

4242
RegisterScheduler(const char *N, const char *D, FunctionPassCtor C)
43-
: MachinePassRegistryNode(N, D, (MachinePassCtor)C)
43+
: MachinePassRegistryNode(N, D, reinterpret_cast<MachinePassCtor>(reinterpret_cast<void *>(C)))
4444
{ Registry.Add(this); }
4545
~RegisterScheduler() { Registry.Remove(this); }
4646

@@ -54,10 +54,10 @@ class RegisterScheduler : public MachinePassRegistryNode {
5454
return (RegisterScheduler *)Registry.getList();
5555
}
5656
static FunctionPassCtor getDefault() {
57-
return (FunctionPassCtor)Registry.getDefault();
57+
return reinterpret_cast<FunctionPassCtor>(reinterpret_cast<void *>(Registry.getDefault()));
5858
}
5959
static void setDefault(FunctionPassCtor C) {
60-
Registry.setDefault((MachinePassCtor)C);
60+
Registry.setDefault(reinterpret_cast<MachinePassCtor>(reinterpret_cast<void *>(C)));
6161
}
6262
static void setListener(MachinePassRegistryListener *L) {
6363
Registry.setListener(L);

lib/IR/Core.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ void LLVMContextSetDiagnosticHandler(LLVMContextRef C,
9090
LLVMDiagnosticHandler Handler,
9191
void *DiagnosticContext) {
9292
unwrap(C)->setDiagnosticHandler(
93-
LLVM_EXTENSION reinterpret_cast<LLVMContext::DiagnosticHandlerTy>(Handler),
93+
reinterpret_cast<LLVMContext::DiagnosticHandlerTy>(
94+
reinterpret_cast<void *>(Handler)),
9495
DiagnosticContext);
9596
}
9697

lib/MSSupport/MSFileSystemImpl.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,9 @@ typedef BOOLEAN(WINAPI *PtrCreateSymbolicLinkW)(
322322
/*__in*/ DWORD dwFlags);
323323

324324
PtrCreateSymbolicLinkW create_symbolic_link_api =
325-
PtrCreateSymbolicLinkW(::GetProcAddress(::GetModuleHandleW(L"Kernel32.dll"),
326-
"CreateSymbolicLinkW"));
325+
PtrCreateSymbolicLinkW(reinterpret_cast<void *>(::GetProcAddress(
326+
::GetModuleHandleW(L"Kernel32.dll"),
327+
"CreateSymbolicLinkW")));
327328
} // namespace
328329
#endif
329330

lib/Support/Windows/RWMutex.inc

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,16 @@ static bool loadSRW() {
4949
sChecked = true;
5050

5151
if (HMODULE hLib = ::GetModuleHandleW(L"Kernel32.dll")) {
52-
fpInitializeSRWLock =
53-
(VOID (WINAPI *)(PSRWLOCK))::GetProcAddress(hLib,
54-
"InitializeSRWLock");
55-
fpAcquireSRWLockExclusive =
56-
(VOID (WINAPI *)(PSRWLOCK))::GetProcAddress(hLib,
57-
"AcquireSRWLockExclusive");
58-
fpAcquireSRWLockShared =
59-
(VOID (WINAPI *)(PSRWLOCK))::GetProcAddress(hLib,
60-
"AcquireSRWLockShared");
61-
fpReleaseSRWLockExclusive =
62-
(VOID (WINAPI *)(PSRWLOCK))::GetProcAddress(hLib,
63-
"ReleaseSRWLockExclusive");
64-
fpReleaseSRWLockShared =
65-
(VOID (WINAPI *)(PSRWLOCK))::GetProcAddress(hLib,
66-
"ReleaseSRWLockShared");
52+
fpInitializeSRWLock = reinterpret_cast<VOID (WINAPI *)(PSRWLOCK)>(
53+
reinterpret_cast<void *>(::GetProcAddress(hLib, "InitializeSRWLock")));
54+
fpAcquireSRWLockExclusive = reinterpret_cast<VOID (WINAPI *)(PSRWLOCK)>(
55+
reinterpret_cast<void *>(::GetProcAddress(hLib, "AcquireSRWLockExclusive")));
56+
fpAcquireSRWLockShared = reinterpret_cast<VOID (WINAPI *)(PSRWLOCK)>(
57+
reinterpret_cast<void *>(::GetProcAddress(hLib, "AcquireSRWLockShared")));
58+
fpReleaseSRWLockExclusive = reinterpret_cast<VOID (WINAPI *)(PSRWLOCK)>(
59+
reinterpret_cast<void *>(::GetProcAddress(hLib, "ReleaseSRWLockExclusive")));
60+
fpReleaseSRWLockShared = reinterpret_cast<VOID (WINAPI *)(PSRWLOCK)>(
61+
reinterpret_cast<void *>(::GetProcAddress(hLib, "ReleaseSRWLockShared")));
6762

6863
if (fpInitializeSRWLock != NULL) {
6964
sHasSRW = true;
@@ -73,6 +68,7 @@ static bool loadSRW() {
7368
return sHasSRW;
7469
}
7570

71+
7672
RWMutexImpl::RWMutexImpl() {
7773
// TODO: harden to allocation failures - HLSL Change
7874
if (loadSRW()) {

0 commit comments

Comments
 (0)