1. Wrong usage of memset
2. Member initializer list in order of declaration
3. Add explicit to MSFileSystemHandle's single parameter constructors
This commit is contained in:
Minmin Gong 2023-09-25 23:11:25 -07:00 коммит произвёл GitHub
Родитель cb6a65415f
Коммит 755d111ccd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
10 изменённых файлов: 23 добавлений и 24 удалений

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

@ -76,7 +76,7 @@ public:
};
CompilationInfo::CompilationInfo(IMalloc *pMalloc, dxil_dia::Session *pSession)
: m_pSession(pSession), m_pMalloc(pMalloc) {
: m_pMalloc(pMalloc), m_pSession(pSession) {
auto *Module = m_pSession->DxilModuleRef().GetModule();
m_contents =
Module->getNamedMetadata(hlsl::DxilMDHelper::kDxilSourceContentsMDName);

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

@ -42,7 +42,7 @@ public:
}
EnumTables(IMalloc *pMalloc, Session *pSession)
: m_pMalloc(pMalloc), m_pSession(pSession), m_dwRef(0), m_next(0) {
: m_dwRef(0), m_pMalloc(pMalloc), m_pSession(pSession), m_next(0) {
m_tables.fill(nullptr);
}

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

@ -107,10 +107,10 @@ struct MSFileSystemHandle {
stream; // For a file or console file handle, the stream interface.
int fd; // For a file handle, its file descriptor.
MSFileSystemHandle(int knownFD)
explicit MSFileSystemHandle(int knownFD)
: kind(MSFileSystemHandleKind_FileHandle), fd(knownFD) {}
MSFileSystemHandle(IUnknown *pMapping)
explicit MSFileSystemHandle(IUnknown *pMapping)
: kind(MSFileSystemHandleKind_FileMappingHandle), storage(pMapping),
fd(0) {}
@ -118,7 +118,7 @@ struct MSFileSystemHandle {
: kind(MSFileSystemHandleKind_FileHandle), storage(pStorage),
stream(pStream), fd(0) {}
MSFileSystemHandle(IEnumSTATSTG *pEnumSTATG)
explicit MSFileSystemHandle(IEnumSTATSTG *pEnumSTATG)
: kind(MSFileSystemHandleKind_FindHandle), storage(pEnumSTATG) {}
MSFileSystemHandle(MSFileSystemHandle &&other) {

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

@ -71,7 +71,7 @@ struct ScopeNestEvent {
Type ElementType;
BlockTy *Block;
ScopeNestEvent(BlockTy *B, Type T) : Block(B), ElementType(T) {}
ScopeNestEvent(BlockTy *B, Type T) : ElementType(T), Block(B) {}
static ScopeNestEvent Invalid() {
return ScopeNestEvent(nullptr, Type::Invalid);
}

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

@ -264,9 +264,8 @@ private: // ScopeNestIterator Implementation
public:
Scope(Type scopeType, Block *startBlock, BranchKind annotation)
: m_type(scopeType), m_startBlock(startBlock),
m_startAnnotation(annotation), m_endBlock(nullptr),
m_backedge(nullptr)
: m_type(scopeType), m_startAnnotation(annotation),
m_startBlock(startBlock), m_endBlock(nullptr), m_backedge(nullptr)
{
if (m_type == Type::If) {

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

@ -104,14 +104,14 @@ __override HRESULT STDMETHODCALLTYPE DxbcConverter::ConvertInDriver(
DxbcConverter::DxbcConverter()
: m_dwRef(0), m_pPR(nullptr), m_pOP(nullptr), m_pSM(nullptr),
m_DxbcMajor(0), m_DxbcMinor(0), m_pUnusedF32(nullptr),
m_pUnusedI32(nullptr), m_NumTempRegs(0), m_pIcbGV(nullptr),
m_bDisableHashCheck(false), m_bRunDxilCleanup(true),
m_bLegacyCBufferLoad(true), m_TGSMCount(0),
m_DxbcMajor(0), m_DxbcMinor(0), m_bDisableHashCheck(false),
m_bRunDxilCleanup(true), m_bLegacyCBufferLoad(true),
m_DepthRegType(D3D10_SB_OPERAND_TYPE_NULL), m_bHasStencilRef(false),
m_bHasCoverageOut(false), m_bControlPointPhase(false),
m_bPatchConstantPhase(false), m_pInterfaceDataBuffer(nullptr),
m_pClassInstanceCBuffers(nullptr), m_pClassInstanceSamplers(nullptr),
m_bHasCoverageOut(false), m_pUnusedF32(nullptr), m_pUnusedI32(nullptr),
m_NumTempRegs(0), m_pIcbGV(nullptr), m_TGSMCount(0),
m_bControlPointPhase(false), m_bPatchConstantPhase(false),
m_pInterfaceDataBuffer(nullptr), m_pClassInstanceCBuffers(nullptr),
m_pClassInstanceSamplers(nullptr),
m_pClassInstanceComparisonSamplers(nullptr), m_NumIfaces(0),
m_FcallCount(0) {
DXASSERT(OP::CheckOpCodeTable(), "incorrect entry in OpCode property table");

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

@ -133,9 +133,9 @@ public:
DXASSERT_NOMSG(false);
}
LiveRange(LiveRange &&other)
: id(other.id), numI(other.numI), numF(other.numF), numU(other.numU),
pNewType(other.pNewType), defs(std::move(other.defs)),
bitcastMap(std::move(other.bitcastMap)) {
: id(other.id), defs(std::move(other.defs)),
bitcastMap(std::move(other.bitcastMap)), numI(other.numI),
numF(other.numF), numU(other.numU), pNewType(other.pNewType) {
DXASSERT_NOMSG(false);
}

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

@ -133,7 +133,7 @@ private:
public:
unsigned findCount;
MockDxcSystemAccess() : findCount(1), m_dwRef(0) {}
MockDxcSystemAccess() : m_dwRef(0), findCount(1) {}
static HRESULT Create(MockDxcSystemAccess **pResult) {
*pResult = new (std::nothrow) MockDxcSystemAccess();

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

@ -3445,9 +3445,9 @@ TEST_F(ExecutionTest, WaveIntrinsicsInPSTest) {
bool isTop[4];
bool isLeft[4];
PerPixelData helperData;
memset(&helperData, sizeof(helperData), 0);
memset(&helperData, 0, sizeof(helperData));
PerPixelData *layout[4]; // tl,tr,bl,br
memset(layout, sizeof(layout), 0);
memset(layout, 0, sizeof(layout));
auto fnToLayout = [&](bool top, bool left) -> PerPixelData ** {
int idx = top ? 0 : 2;
idx += left ? 0 : 1;
@ -10948,7 +10948,7 @@ void ExecutionTest::WaveSizeTest() {
VERIFY_IS_TRUE(sizeof(WaveSizeTestData) * MAX_WAVESIZE <=
Data.size());
WaveSizeTestData *pInData = (WaveSizeTestData *)Data.data();
memset(&pInData, sizeof(WaveSizeTestData) * MAX_WAVESIZE, 0);
memset(pInData, 0, sizeof(WaveSizeTestData) * MAX_WAVESIZE);
},
ShaderOpSet);

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

@ -342,4 +342,4 @@ void ParseShaderOpSetFromXml(IXmlReader *pReader, ShaderOpSet *pShaderOpSet);
} // namespace st
#endif __SHADEROPTEST_H__
#endif // __SHADEROPTEST_H__