Code Cleanup for syncing with Windows (#651)

This commit is contained in:
Young Kim 2017-09-26 09:45:43 -07:00 коммит произвёл Marcelo Lopez Ruiz
Родитель f227c5f9d6
Коммит 028a08a6a9
9 изменённых файлов: 25 добавлений и 23 удалений

Просмотреть файл

@ -11,6 +11,12 @@
#pragma once
#include "Global.h"
#ifndef _ATL_DECLSPEC_ALLOCATOR
#define _ATL_DECLSPEC_ALLOCATOR
#endif
// Forward declarations.
struct IDxcBlob;
struct IDxcBlobEncoding;

Просмотреть файл

@ -10412,7 +10412,7 @@ HLSLBufferDecl::Create(ASTContext &C, DeclContext *lexicalParent, bool cbuffer,
const char *HLSLBufferDecl::getDeclKindName() const {
static const char *HLSLBufferNames[] = {"tbuffer", "cbuffer", "TextureBuffer",
"ConstantBuffer"};
unsigned index = isCBuffer() | (isConstantBufferView()) << 1;
unsigned index = (unsigned ) isCBuffer() | (isConstantBufferView()) << 1;
return HLSLBufferNames[index];
}

Просмотреть файл

@ -23,20 +23,20 @@ namespace hlsl { HRESULT SetupRegistryPassForHLSL(); }
#pragma warning( disable : 4290 )
// operator new and friends.
void *operator new(std::size_t size) throw(std::bad_alloc) {
void * __CRTDECL operator new(std::size_t size) throw(std::bad_alloc) {
void * ptr = DxcGetThreadMallocNoRef()->Alloc(size);
if (ptr == nullptr)
throw std::bad_alloc();
return ptr;
}
void *operator new(std::size_t size,
void * __CRTDECL operator new(std::size_t size,
const std::nothrow_t &nothrow_value) throw() {
return DxcGetThreadMallocNoRef()->Alloc(size);
}
void operator delete (void* ptr) throw() {
void __CRTDECL operator delete (void* ptr) throw() {
DxcGetThreadMallocNoRef()->Free(ptr);
}
void operator delete (void* ptr, const std::nothrow_t& nothrow_constant) throw() {
void __CRTDECL operator delete (void* ptr, const std::nothrow_t& nothrow_constant) throw() {
DxcGetThreadMallocNoRef()->Free(ptr);
}

Просмотреть файл

@ -2053,7 +2053,7 @@ __override STDMETHODIMP DxcDiaSession::findInjectedSource(
IDiaTable *pTable;
IFT(CreateDxcDiaTable(this, DiaTableKind::InjectedSource, &pTable));
DxcDiaTableInjectedSource *pInjectedSource =
dynamic_cast<DxcDiaTableInjectedSource *>(pTable);
reinterpret_cast<DxcDiaTableInjectedSource *>(pTable);
pInjectedSource->Init(pUtf8FileName.m_psz);
*ppResult = pInjectedSource;
return S_OK;

Просмотреть файл

@ -262,12 +262,11 @@ HRESULT STDMETHODCALLTYPE DxcLinker::Link(
HRESULT CreateDxcLinker(_In_ REFIID riid, _Out_ LPVOID *ppv) {
*ppv = nullptr;
CComPtr<DxcLinker> result;
try {
result = DxcLinker::Alloc(DxcGetThreadMallocNoRef());
CComPtr<DxcLinker> result(DxcLinker::Alloc(DxcGetThreadMallocNoRef()));
IFROOM(result.p);
result->Initialize();
return result.p->QueryInterface(riid, ppv);
}
CATCH_CPP_RETURN_HRESULT();
return result.p->QueryInterface(riid, ppv);
}

Просмотреть файл

@ -880,11 +880,10 @@ public:
HRESULT CreateDxcCompiler(_In_ REFIID riid, _Out_ LPVOID* ppv) {
*ppv = nullptr;
CComPtr<DxcCompiler> result;
try {
result = DxcCompiler::Alloc(DxcGetThreadMallocNoRef());
CComPtr<DxcCompiler> result(DxcCompiler::Alloc(DxcGetThreadMallocNoRef()));
IFROOM(result.p);
return result.p->QueryInterface(riid, ppv);
}
CATCH_CPP_RETURN_HRESULT();
return result.p->QueryInterface(riid, ppv);
}

Просмотреть файл

@ -154,7 +154,6 @@ HRESULT STDMETHODCALLTYPE DxcContainerBuilder::SerializeContainer(_Out_ IDxcOper
HRESULT valHR = S_OK;
if (m_RequireValidation) {
CComPtr<IDxcValidator> pValidator;
CComPtr<IDxcLibrary> pLibrary;
IFT(CreateDxcValidator(IID_PPV_ARGS(&pValidator)));
CComPtr<IDxcOperationResult> pValidationResult;
IFT(pValidator->Validate(pResult, DxcValidatorFlags_RootSignatureOnly, &pValidationResult));

Просмотреть файл

@ -260,11 +260,10 @@ HRESULT RunInternalValidator(_In_ IDxcValidator *pValidator,
}
HRESULT CreateDxcValidator(_In_ REFIID riid, _Out_ LPVOID* ppv) {
CComPtr<DxcValidator> result = DxcValidator::Alloc(DxcGetThreadMallocNoRef());
if (result == nullptr) {
*ppv = nullptr;
return E_OUTOFMEMORY;
try {
CComPtr<DxcValidator> result(DxcValidator::Alloc(DxcGetThreadMallocNoRef()));
IFROOM(result.p);
return result.p->QueryInterface(riid, ppv);
}
return result.p->QueryInterface(riid, ppv);
CATCH_CPP_RETURN_HRESULT();
}

Просмотреть файл

@ -21,20 +21,20 @@ using namespace hlsl;
#pragma warning( disable : 4290 )
// operator new and friends.
void *operator new(std::size_t size) throw(std::bad_alloc) {
void * __CRTDECL operator new(std::size_t size) throw(std::bad_alloc) {
void * ptr = DxcGetThreadMallocNoRef()->Alloc(size);
if (ptr == nullptr)
throw std::bad_alloc();
return ptr;
}
void *operator new(std::size_t size,
void * __CRTDECL operator new(std::size_t size,
const std::nothrow_t &nothrow_value) throw() {
return DxcGetThreadMallocNoRef()->Alloc(size);
}
void operator delete (void* ptr) throw() {
void __CRTDECL operator delete (void* ptr) throw() {
DxcGetThreadMallocNoRef()->Free(ptr);
}
void operator delete (void* ptr, const std::nothrow_t& nothrow_constant) throw() {
void __CRTDECL operator delete (void* ptr, const std::nothrow_t& nothrow_constant) throw() {
DxcGetThreadMallocNoRef()->Free(ptr);
}
// Finish of new delete.