From ba678a23baf4f8d33ac10258013b16acdc8d3c96 Mon Sep 17 00:00:00 2001 From: Pierre Moreau Date: Tue, 17 Apr 2018 18:13:15 +0200 Subject: Run clang-tidy without the readability-identifier-naming enabled Command used: /usr/share/clang/run-clang-tidy.py -fix -format -header-filter "(./include/SPIRV.h|./lib/SPIRV/Mangler/FunctionDescriptor.h|./lib/SPIRV/Mangler/ManglingUtils.h|./lib/SPIRV/Mangler/NameMangleAPI.h|./lib/SPIRV/Mangler/ParameterType.h|./lib/SPIRV/Mangler/Refcount.h|./lib/SPIRV/libSPIRV/libSPIRV.h|./lib/SPIRV/libSPIRV/SPIRVBasicBlock.h|./lib/SPIRV/libSPIRV/SPIRVDebug.h|./lib/SPIRV/libSPIRV/SPIRVDecorate.h|./lib/SPIRV/libSPIRV/SPIRVEntry.h|./lib/SPIRV/libSPIRV/SPIRVEnum.h|./lib/SPIRV/libSPIRV/SPIRVError.h|./lib/SPIRV/libSPIRV/SPIRVErrorEnum.h|./lib/SPIRV/libSPIRV/SPIRVExtInst.h|./lib/SPIRV/libSPIRV/SPIRVFunction.h|./lib/SPIRV/libSPIRV/SPIRVInstruction.h|./lib/SPIRV/libSPIRV/SPIRVIsValidEnum.h|./lib/SPIRV/libSPIRV/SPIRVModule.h|./lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h|./lib/SPIRV/libSPIRV/SPIRVOpCode.h|./lib/SPIRV/libSPIRV/SPIRVOpCodeEnum.h|./lib/SPIRV/libSPIRV/SPIRVStream.h|./lib/SPIRV/libSPIRV/SPIRVType.h|./lib/SPIRV/libSPIRV/SPIRVUtil.h|./lib/SPIRV/libSPIRV/SPIRVValue.h|./lib/SPIRV/runtime/OpenCL/inc/spirv.h|./lib/SPIRV/runtime/OpenCL/inc/spirv_convert.h|./lib/SPIRV/OCLUtil.h|./lib/SPIRV/OCLTypeToSPIRV.h|./lib/SPIRV/SPIRVInternal.h|./lib/SPIRV/SPIRVMDBuilder.h|./lib/SPIRV/SPIRVMDWalker.h|./lib/SPIRV/SPIRVWriterPass.h)" -checks="-*,clang-diagnostic-*,llvm-*,misc-*,-misc-unused-parameters" `find . -iname "*.cpp"` Manual edits: * lib/SPIRV/libSPIRV/SPIRVStream.h: remove parentheses around `Type` on line 178; * lib/SPIRV/libSPIRV/SPIRVStream.cpp: remove parentheses around `Type` on line 123 * lib/SPIRV/libSPIRV/SPIRVOpCodeEnum.h: remove added header guard --- include/SPIRV.h | 8 +-- lib/SPIRV/Mangler/FunctionDescriptor.h | 6 +-- lib/SPIRV/Mangler/Mangler.cpp | 4 +- lib/SPIRV/Mangler/ManglingUtils.cpp | 2 +- lib/SPIRV/Mangler/ManglingUtils.h | 6 +-- lib/SPIRV/Mangler/NameMangleAPI.h | 6 +-- lib/SPIRV/Mangler/ParameterType.h | 6 +-- lib/SPIRV/Mangler/Refcount.h | 6 +-- lib/SPIRV/OCLTypeToSPIRV.h | 6 +++ lib/SPIRV/OCLUtil.h | 6 +++ lib/SPIRV/SPIRVInternal.h | 8 +-- lib/SPIRV/SPIRVLowerOCLBlocks.cpp | 5 -- lib/SPIRV/SPIRVMDBuilder.h | 6 +-- lib/SPIRV/SPIRVMDWalker.h | 6 +-- lib/SPIRV/SPIRVReader.cpp | 2 +- lib/SPIRV/SPIRVUtil.cpp | 8 +-- lib/SPIRV/SPIRVWriter.cpp | 2 +- lib/SPIRV/SPIRVWriterPass.h | 6 +-- lib/SPIRV/libSPIRV/SPIRVBasicBlock.h | 6 +-- lib/SPIRV/libSPIRV/SPIRVDebug.h | 6 +-- lib/SPIRV/libSPIRV/SPIRVDecorate.h | 6 +-- lib/SPIRV/libSPIRV/SPIRVEntry.h | 94 ++++++++++++++++++++-------------- lib/SPIRV/libSPIRV/SPIRVEnum.h | 8 +-- lib/SPIRV/libSPIRV/SPIRVError.h | 14 ++--- lib/SPIRV/libSPIRV/SPIRVErrorEnum.h | 5 ++ lib/SPIRV/libSPIRV/SPIRVExtInst.h | 6 +-- lib/SPIRV/libSPIRV/SPIRVFunction.h | 6 +-- lib/SPIRV/libSPIRV/SPIRVInstruction.h | 8 +-- lib/SPIRV/libSPIRV/SPIRVIsValidEnum.h | 6 +-- lib/SPIRV/libSPIRV/SPIRVModule.h | 6 +-- lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h | 6 +-- lib/SPIRV/libSPIRV/SPIRVOpCode.h | 8 +-- lib/SPIRV/libSPIRV/SPIRVStream.h | 6 +-- lib/SPIRV/libSPIRV/SPIRVType.h | 14 ++--- lib/SPIRV/libSPIRV/SPIRVUtil.h | 8 +-- lib/SPIRV/libSPIRV/SPIRVValue.h | 10 ++-- lib/SPIRV/libSPIRV/libSPIRV.h | 4 +- 37 files changed, 177 insertions(+), 149 deletions(-) diff --git a/include/SPIRV.h b/include/SPIRV.h index 5b8b5a3..29c79f0 100644 --- a/include/SPIRV.h +++ b/include/SPIRV.h @@ -1,4 +1,4 @@ -//===- SPIRV.h – Read and write SPIR-V binary -------------------*- C++ -*-===// +//===- SPIRV.h - Read and write SPIR-V binary -------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // @@ -38,8 +38,8 @@ /// /// //===----------------------------------------------------------------------===// -#ifndef LLVM_SUPPORT_SPIRV_H -#define LLVM_SUPPORT_SPIRV_H +#ifndef SPIRV_H +#define SPIRV_H #include #include @@ -157,4 +157,4 @@ ModulePass *createSPIRVWriterPass(llvm::raw_ostream &Str); } // namespace llvm -#endif +#endif // SPIRV_H diff --git a/lib/SPIRV/Mangler/FunctionDescriptor.h b/lib/SPIRV/Mangler/FunctionDescriptor.h index 9e71f41..a34999e 100644 --- a/lib/SPIRV/Mangler/FunctionDescriptor.h +++ b/lib/SPIRV/Mangler/FunctionDescriptor.h @@ -10,8 +10,8 @@ * Contributed by: Intel Corporation. */ -#ifndef __FUNCTION_DESCRIPTOR_H__ -#define __FUNCTION_DESCRIPTOR_H__ +#ifndef SPIRV_MANGLER_FUNCTIONDESCRIPTOR_H +#define SPIRV_MANGLER_FUNCTIONDESCRIPTOR_H #include "ParameterType.h" #include "Refcount.h" @@ -52,4 +52,4 @@ std::ostream &operator<<(T &o, const SPIR::FunctionDescriptor &fd) { } } // namespace SPIR -#endif //__FUNCTION_DESCRIPTOR_H__ +#endif // SPIRV_MANGLER_FUNCTIONDESCRIPTOR_H diff --git a/lib/SPIRV/Mangler/Mangler.cpp b/lib/SPIRV/Mangler/Mangler.cpp index b080477..91b99e6 100644 --- a/lib/SPIRV/Mangler/Mangler.cpp +++ b/lib/SPIRV/Mangler/Mangler.cpp @@ -95,8 +95,8 @@ public: // out of all enums it makes sense to substitute only // memory_scope/memory_order since only they appear several times in the // builtin declaration. - if (mangledPrimitive.compare("12memory_scope") == 0 || - mangledPrimitive.compare("12memory_order") == 0) { + if (mangledPrimitive == "12memory_scope" || + mangledPrimitive == "12memory_order") { if (!mangleSubstitution(t, mangledPrimitiveString(t->getPrimitive()))) { size_t index = m_stream.str().size(); m_stream << mangledPrimitiveString(t->getPrimitive()); diff --git a/lib/SPIRV/Mangler/ManglingUtils.cpp b/lib/SPIRV/Mangler/ManglingUtils.cpp index 41a55af..5237ef2 100644 --- a/lib/SPIRV/Mangler/ManglingUtils.cpp +++ b/lib/SPIRV/Mangler/ManglingUtils.cpp @@ -168,7 +168,7 @@ SPIRversion getSupportedVersion(TypePrimitiveEnum t) { const char *mangledPrimitiveStringfromName(std::string type) { for (size_t i = 0; i < (sizeof(PrimitiveNames) / sizeof(PrimitiveNames[0])); i++) - if (type.compare(PrimitiveNames[i]) == 0) + if (type == PrimitiveNames[i]) return mangledTypes[i]; return NULL; } diff --git a/lib/SPIRV/Mangler/ManglingUtils.h b/lib/SPIRV/Mangler/ManglingUtils.h index a33b836..6a6b0e8 100644 --- a/lib/SPIRV/Mangler/ManglingUtils.h +++ b/lib/SPIRV/Mangler/ManglingUtils.h @@ -10,8 +10,8 @@ * Contributed by: Intel Corporation. */ -#ifndef __MANGLING_UTILS_H__ -#define __MANGLING_UTILS_H__ +#ifndef SPIRV_MANGLER_MANGLINGUTILS_H +#define SPIRV_MANGLER_MANGLINGUTILS_H #include "ParameterType.h" @@ -31,4 +31,4 @@ const char *mangledPrimitiveStringfromName(std::string type); bool isPipeBuiltin(std::string unmangledName); } // namespace SPIR -#endif //__MANGLING_UTILS_H__ +#endif // SPIRV_MANGLER_MANGLINGUTILS_H diff --git a/lib/SPIRV/Mangler/NameMangleAPI.h b/lib/SPIRV/Mangler/NameMangleAPI.h index 8650f47..56d1ec4 100644 --- a/lib/SPIRV/Mangler/NameMangleAPI.h +++ b/lib/SPIRV/Mangler/NameMangleAPI.h @@ -9,8 +9,8 @@ /* * Contributed by: Intel Corporation. */ -#ifndef __NAME_MANGLE_API_H__ -#define __NAME_MANGLE_API_H__ +#ifndef SPIRV_MANGLER_NAMEMANGLEAPI_H +#define SPIRV_MANGLER_NAMEMANGLEAPI_H #include "FunctionDescriptor.h" #include @@ -38,4 +38,4 @@ private: }; } // namespace SPIR -#endif //__NAME_MANGLE_API_H__ +#endif // SPIRV_MANGLER_NAMEMANGLEAPI_H diff --git a/lib/SPIRV/Mangler/ParameterType.h b/lib/SPIRV/Mangler/ParameterType.h index ea2e473..31d0627 100644 --- a/lib/SPIRV/Mangler/ParameterType.h +++ b/lib/SPIRV/Mangler/ParameterType.h @@ -10,8 +10,8 @@ * Contributed by: Intel Corporation. */ -#ifndef __PARAMETER_TYPE_H__ -#define __PARAMETER_TYPE_H__ +#ifndef SPIRV_MANGLER_PARAMETERTYPE_H +#define SPIRV_MANGLER_PARAMETERTYPE_H #include "Refcount.h" #include @@ -449,4 +449,4 @@ template const T *dyn_cast(const ParamType *pType) { } } // namespace SPIR -#endif //__PARAMETER_TYPE_H__ +#endif // SPIRV_MANGLER_PARAMETERTYPE_H diff --git a/lib/SPIRV/Mangler/Refcount.h b/lib/SPIRV/Mangler/Refcount.h index edaf0b7..95d2299 100644 --- a/lib/SPIRV/Mangler/Refcount.h +++ b/lib/SPIRV/Mangler/Refcount.h @@ -10,8 +10,8 @@ * Contributed by: Intel Corporation */ -#ifndef __REF_COUNT_H__ -#define __REF_COUNT_H__ +#ifndef SPIRV_MANGLER_REFCOUNT_H +#define SPIRV_MANGLER_REFCOUNT_H #include @@ -97,4 +97,4 @@ private: } // namespace SPIR -#endif //__REF_COUNT_H__ +#endif // SPIRV_MANGLER_REFCOUNT_H diff --git a/lib/SPIRV/OCLTypeToSPIRV.h b/lib/SPIRV/OCLTypeToSPIRV.h index fa4eb10..22903cd 100644 --- a/lib/SPIRV/OCLTypeToSPIRV.h +++ b/lib/SPIRV/OCLTypeToSPIRV.h @@ -38,6 +38,10 @@ // type instead of the original type. // //===----------------------------------------------------------------------===// + +#ifndef SPIRV_OCLTYPETOSPIRV_H +#define SPIRV_OCLTYPETOSPIRV_H + #include "SPIRV.h" #include "llvm/IR/Function.h" #include "llvm/IR/LLVMContext.h" @@ -84,3 +88,5 @@ private: }; } // namespace SPIRV + +#endif // SPIRV_OCLTYPETOSPIRV_H diff --git a/lib/SPIRV/OCLUtil.h b/lib/SPIRV/OCLUtil.h index 1f7896c..33d0db3 100644 --- a/lib/SPIRV/OCLUtil.h +++ b/lib/SPIRV/OCLUtil.h @@ -35,6 +35,10 @@ // This file declares OCL utility functions. // //===----------------------------------------------------------------------===// + +#ifndef SPIRV_OCLUTIL_H +#define SPIRV_OCLUTIL_H + #include "SPIRVInternal.h" #include @@ -613,3 +617,5 @@ template <> inline void SPIRVMap::init() { } } // namespace SPIRV + +#endif // SPIRV_OCLUTIL_H diff --git a/lib/SPIRV/SPIRVInternal.h b/lib/SPIRV/SPIRVInternal.h index ece2837..9e75e84 100644 --- a/lib/SPIRV/SPIRVInternal.h +++ b/lib/SPIRV/SPIRVInternal.h @@ -36,8 +36,8 @@ /// This file declares classes and functions shared by SPIR-V reader/writer. /// //===----------------------------------------------------------------------===// -#ifndef LLVMSPIRVINTERNAL_HPP_ -#define LLVMSPIRVINTERNAL_HPP_ +#ifndef SPIRV_SPIRVINTERNAL_H +#define SPIRV_SPIRVINTERNAL_H #include "NameMangleAPI.h" #include "libSPIRV/SPIRVEnum.h" @@ -264,7 +264,7 @@ typedef SPIRVMap namespace kLLVMTypeName { const static char StructPrefix[] = "struct."; -} +} // namespace kLLVMTypeName namespace kSPIRVImageSampledTypeName { const static char Float[] = "float"; @@ -893,4 +893,4 @@ template <> inline void SPIRVMap::init() { } // namespace SPIRV -#endif +#endif // SPIRV_SPIRVINTERNAL_H diff --git a/lib/SPIRV/SPIRVLowerOCLBlocks.cpp b/lib/SPIRV/SPIRVLowerOCLBlocks.cpp index f33dff3..fa9fb43 100644 --- a/lib/SPIRV/SPIRVLowerOCLBlocks.cpp +++ b/lib/SPIRV/SPIRVLowerOCLBlocks.cpp @@ -37,9 +37,6 @@ /// //===----------------------------------------------------------------------===// -#ifndef OCLLOWERBLOCKS_H_ -#define OCLLOWERBLOCKS_H_ - #include "OCLUtil.h" #include "SPIRVInternal.h" @@ -627,5 +624,3 @@ INITIALIZE_PASS_END(SPIRVLowerOCLBlocks, "spvblocks", "SPIR-V lower OCL blocks", ModulePass *llvm::createSPIRVLowerOCLBlocks() { return new SPIRVLowerOCLBlocks(); } - -#endif /* OCLLOWERBLOCKS_H_ */ diff --git a/lib/SPIRV/SPIRVMDBuilder.h b/lib/SPIRV/SPIRVMDBuilder.h index 2c4d26c..b8d4bfe 100644 --- a/lib/SPIRV/SPIRVMDBuilder.h +++ b/lib/SPIRV/SPIRVMDBuilder.h @@ -37,8 +37,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LIB_SPIRV_SPIRVMDBUILDER_H_ -#define LIB_SPIRV_SPIRVMDBUILDER_H_ +#ifndef SPIRV_SPIRVMDBUILDER_H +#define SPIRV_SPIRVMDBUILDER_H #include "SPIRVInternal.h" #include "llvm/IR/Metadata.h" @@ -128,4 +128,4 @@ private: } /* namespace SPIRV */ -#endif /* LIB_SPIRV_SPIRVMDBUILDER_H_ */ +#endif // SPIRV_SPIRVMDBUILDER_H diff --git a/lib/SPIRV/SPIRVMDWalker.h b/lib/SPIRV/SPIRVMDWalker.h index 2e3fa85..1b7febe 100644 --- a/lib/SPIRV/SPIRVMDWalker.h +++ b/lib/SPIRV/SPIRVMDWalker.h @@ -37,8 +37,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LIB_SPIRV_SPIRVMDWALKER_H_ -#define LIB_SPIRV_SPIRVMDWALKER_H_ +#ifndef SPIRV_SPIRVMDWALKER_H +#define SPIRV_SPIRVMDWALKER_H #include "SPIRVInternal.h" #include "llvm/IR/Metadata.h" @@ -174,4 +174,4 @@ private: } /* namespace SPIRV */ -#endif /* LIB_SPIRV_SPIRVMDBUILDER_H_ */ +#endif // SPIRV_SPIRVMDWALKER_H diff --git a/lib/SPIRV/SPIRVReader.cpp b/lib/SPIRV/SPIRVReader.cpp index 0e895b9..e08420a 100644 --- a/lib/SPIRV/SPIRVReader.cpp +++ b/lib/SPIRV/SPIRVReader.cpp @@ -650,7 +650,7 @@ std::string SPIRVToLLVM::transOCLImageTypeName(SPIRV::SPIRVTypeImage *ST) { rmap(ST->getDescriptor()); if (SPIRVGenImgTypeAccQualPostfix) SPIRVToLLVM::insertImageNameAccessQualifier(ST, Name); - return std::move(Name); + return Name; } std::string diff --git a/lib/SPIRV/SPIRVUtil.cpp b/lib/SPIRV/SPIRVUtil.cpp index 3fb9856..69459d4 100644 --- a/lib/SPIRV/SPIRVUtil.cpp +++ b/lib/SPIRV/SPIRVUtil.cpp @@ -839,7 +839,7 @@ std::set getNamedMDAsStringSet(Module *M, NamedMDNode *NamedMD = M->getNamedMetadata(MDName); std::set StrSet; if (!NamedMD) - return std::move(StrSet); + return StrSet; assert(NamedMD->getNumOperands() > 0 && "Invalid SPIR"); @@ -848,10 +848,10 @@ std::set getNamedMDAsStringSet(Module *M, if (!MD || MD->getNumOperands() == 0) continue; for (unsigned J = 0, N = MD->getNumOperands(); J != N; ++J) - StrSet.insert(std::move(getMDOperandAsString(MD, J))); + StrSet.insert(getMDOperandAsString(MD, J)); } - return std::move(StrSet); + return StrSet; } std::tuple getSPIRVSource(Module *M) { @@ -1296,7 +1296,7 @@ static SPIR::MangleError manglePipeBuiltin(const SPIR::FunctionDescriptor &fd, return SPIR::MANGLE_NULL_FUNC_DESCRIPTOR; } mangledName.assign("__" + fd.name); - if (fd.name.compare("write_pipe") == 0 || fd.name.compare("read_pipe") == 0) { + if (fd.name == "write_pipe" || fd.name == "read_pipe") { // add "_2" or "_4" postfix reflecting the number of explicit args. mangledName.append("_"); // subtruct 2 in order to not count size and alignment of packet. diff --git a/lib/SPIRV/SPIRVWriter.cpp b/lib/SPIRV/SPIRVWriter.cpp index d52a017..f52db31 100644 --- a/lib/SPIRV/SPIRVWriter.cpp +++ b/lib/SPIRV/SPIRVWriter.cpp @@ -95,7 +95,7 @@ using namespace OCLUtil; namespace llvm { FunctionPass *createPromoteMemoryToRegisterPass(); -} +} // namespace llvm namespace SPIRV { diff --git a/lib/SPIRV/SPIRVWriterPass.h b/lib/SPIRV/SPIRVWriterPass.h index 434b71a..5fab0a0 100644 --- a/lib/SPIRV/SPIRVWriterPass.h +++ b/lib/SPIRV/SPIRVWriterPass.h @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef LLVM_SPIRVWRITERPASS_H -#define LLVM_SPIRVWRITERPASS_H +#ifndef SPIRV_SPIRVWRITERPASS_H +#define SPIRV_SPIRVWRITERPASS_H #include "llvm/ADT/StringRef.h" @@ -48,4 +48,4 @@ public: } // namespace llvm -#endif +#endif // SPIRV_SPIRVWRITERPASS_H diff --git a/lib/SPIRV/libSPIRV/SPIRVBasicBlock.h b/lib/SPIRV/libSPIRV/SPIRVBasicBlock.h index 8b31fd9..624e369 100644 --- a/lib/SPIRV/libSPIRV/SPIRVBasicBlock.h +++ b/lib/SPIRV/libSPIRV/SPIRVBasicBlock.h @@ -37,8 +37,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef SPIRVBASICBLOCK_HPP_ -#define SPIRVBASICBLOCK_HPP_ +#ifndef SPIRV_LIBSPIRV_SPIRVBASICBLOCK_H +#define SPIRV_LIBSPIRV_SPIRVBASICBLOCK_H #include "SPIRVValue.h" #include @@ -109,4 +109,4 @@ private: typedef SPIRVBasicBlock SPIRVLabel; } // namespace SPIRV -#endif +#endif // SPIRV_LIBSPIRV_SPIRVBASICBLOCK_H diff --git a/lib/SPIRV/libSPIRV/SPIRVDebug.h b/lib/SPIRV/libSPIRV/SPIRVDebug.h index 9a12967..7dc91d8 100644 --- a/lib/SPIRV/libSPIRV/SPIRVDebug.h +++ b/lib/SPIRV/libSPIRV/SPIRVDebug.h @@ -37,8 +37,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef SPIRVDEBUG_HPP_ -#define SPIRVDEBUG_HPP_ +#ifndef SPIRV_LIBSPIRV_SPIRVDEBUG_H +#define SPIRV_LIBSPIRV_SPIRVDEBUG_H #include "SPIRVUtil.h" #ifdef _SPIRV_LLVM_API @@ -81,4 +81,4 @@ inline spv_ostream &spvdbgs() { #endif } // namespace SPIRV -#endif /* SPIRVDEBUG_HPP_ */ +#endif // SPIRV_LIBSPIRV_SPIRVDEBUG_H diff --git a/lib/SPIRV/libSPIRV/SPIRVDecorate.h b/lib/SPIRV/libSPIRV/SPIRVDecorate.h index d956299..1e49993 100644 --- a/lib/SPIRV/libSPIRV/SPIRVDecorate.h +++ b/lib/SPIRV/libSPIRV/SPIRVDecorate.h @@ -37,8 +37,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef SPIRVDECORATE_HPP_ -#define SPIRVDECORATE_HPP_ +#ifndef SPIRV_LIBSPIRV_SPIRVDECORATE_H +#define SPIRV_LIBSPIRV_SPIRVDECORATE_H #include "SPIRVEntry.h" #include "SPIRVStream.h" @@ -312,4 +312,4 @@ public: } // namespace SPIRV -#endif /* SPIRVDECORATE_HPP_ */ +#endif // SPIRV_LIBSPIRV_SPIRVDECORATE_H diff --git a/lib/SPIRV/libSPIRV/SPIRVEntry.h b/lib/SPIRV/libSPIRV/SPIRVEntry.h index 24d297b..3ff4b7d 100644 --- a/lib/SPIRV/libSPIRV/SPIRVEntry.h +++ b/lib/SPIRV/libSPIRV/SPIRVEntry.h @@ -37,8 +37,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef SPIRVENTRY_HPP_ -#define SPIRVENTRY_HPP_ +#ifndef SPIRV_LIBSPIRV_SPIRVENTRY_H +#define SPIRV_LIBSPIRV_SPIRVENTRY_H #include "SPIRVEnum.h" #include "SPIRVError.h" @@ -80,49 +80,59 @@ class SPIRVExtInst; void Ty::encode(spv_ostream &O) const {} \ void Ty::decode(std::istream &I) {} #define _SPIRV_IMP_ENCDEC1(Ty, x) \ - void Ty::encode(spv_ostream &O) const { getEncoder(O) << x; } \ - void Ty::decode(std::istream &I) { getDecoder(I) >> x; } + void Ty::encode(spv_ostream &O) const { getEncoder(O) << (x); } \ + void Ty::decode(std::istream &I) { getDecoder(I) >> (x); } #define _SPIRV_IMP_ENCDEC2(Ty, x, y) \ - void Ty::encode(spv_ostream &O) const { getEncoder(O) << x << y; } \ - void Ty::decode(std::istream &I) { getDecoder(I) >> x >> y; } + void Ty::encode(spv_ostream &O) const { getEncoder(O) << (x) << (y); } \ + void Ty::decode(std::istream &I) { getDecoder(I) >> (x) >> (y); } #define _SPIRV_IMP_ENCDEC3(Ty, x, y, z) \ - void Ty::encode(spv_ostream &O) const { getEncoder(O) << x << y << z; } \ - void Ty::decode(std::istream &I) { getDecoder(I) >> x >> y >> z; } + void Ty::encode(spv_ostream &O) const { \ + getEncoder(O) << (x) << (y) << (z); \ + } \ + void Ty::decode(std::istream &I) { getDecoder(I) >> (x) >> (y) >> (z); } #define _SPIRV_IMP_ENCDEC4(Ty, x, y, z, u) \ - void Ty::encode(spv_ostream &O) const { getEncoder(O) << x << y << z << u; } \ - void Ty::decode(std::istream &I) { getDecoder(I) >> x >> y >> z >> u; } + void Ty::encode(spv_ostream &O) const { \ + getEncoder(O) << (x) << (y) << (z) << (u); \ + } \ + void Ty::decode(std::istream &I) { \ + getDecoder(I) >> (x) >> (y) >> (z) >> (u); \ + } #define _SPIRV_IMP_ENCDEC5(Ty, x, y, z, u, v) \ void Ty::encode(spv_ostream &O) const { \ - getEncoder(O) << x << y << z << u << v; \ + getEncoder(O) << (x) << (y) << (z) << (u) << (v); \ } \ - void Ty::decode(std::istream &I) { getDecoder(I) >> x >> y >> z >> u >> v; } + void Ty::decode(std::istream &I) { \ + getDecoder(I) >> (x) >> (y) >> (z) >> (u) >> (v); \ + } #define _SPIRV_IMP_ENCDEC6(Ty, x, y, z, u, v, w) \ void Ty::encode(spv_ostream &O) const { \ - getEncoder(O) << x << y << z << u << v << w; \ + getEncoder(O) << (x) << (y) << (z) << (u) << (v) << (w); \ } \ void Ty::decode(std::istream &I) { \ - getDecoder(I) >> x >> y >> z >> u >> v >> w; \ + getDecoder(I) >> (x) >> (y) >> (z) >> (u) >> (v) >> (w); \ } #define _SPIRV_IMP_ENCDEC7(Ty, x, y, z, u, v, w, r) \ void Ty::encode(spv_ostream &O) const { \ - getEncoder(O) << x << y << z << u << v << w << r; \ + getEncoder(O) << (x) << (y) << (z) << (u) << (v) << (w) << (r); \ } \ void Ty::decode(std::istream &I) { \ - getDecoder(I) >> x >> y >> z >> u >> v >> w >> r; \ + getDecoder(I) >> (x) >> (y) >> (z) >> (u) >> (v) >> (w) >> (r); \ } #define _SPIRV_IMP_ENCDEC8(Ty, x, y, z, u, v, w, r, s) \ void Ty::encode(spv_ostream &O) const { \ - getEncoder(O) << x << y << z << u << v << w << r << s; \ + getEncoder(O) << (x) << (y) << (z) << (u) << (v) << (w) << (r) << (s); \ } \ void Ty::decode(std::istream &I) { \ - getDecoder(I) >> x >> y >> z >> u >> v >> w >> r >> s; \ + getDecoder(I) >> (x) >> (y) >> (z) >> (u) >> (v) >> (w) >> (r) >> (s); \ } #define _SPIRV_IMP_ENCDEC9(Ty, x, y, z, u, v, w, r, s, t) \ void Ty::encode(spv_ostream &O) const { \ - getEncoder(O) << x << y << z << u << v << w << r << s << t; \ + getEncoder(O) << (x) << (y) << (z) << (u) << (v) << (w) << (r) << (s) \ + << (t); \ } \ void Ty::decode(std::istream &I) { \ - getDecoder(I) >> x >> y >> z >> u >> v >> w >> r >> s >> t; \ + getDecoder(I) >> (x) >> (y) >> (z) >> (u) >> (v) >> (w) >> (r) >> (s) >> \ + (t); \ } // Add definition of encode/decode functions to a class. @@ -131,53 +141,59 @@ class SPIRVExtInst; void encode(spv_ostream &O) const override {} \ void decode(std::istream &I) override {} #define _SPIRV_DEF_ENCDEC1(x) \ - void encode(spv_ostream &O) const override { getEncoder(O) << x; } \ - void decode(std::istream &I) override { getDecoder(I) >> x; } + void encode(spv_ostream &O) const override { getEncoder(O) << (x); } \ + void decode(std::istream &I) override { getDecoder(I) >> (x); } #define _SPIRV_DEF_ENCDEC2(x, y) \ - void encode(spv_ostream &O) const override { getEncoder(O) << x << y; } \ - void decode(std::istream &I) override { getDecoder(I) >> x >> y; } + void encode(spv_ostream &O) const override { getEncoder(O) << (x) << (y); } \ + void decode(std::istream &I) override { getDecoder(I) >> (x) >> (y); } #define _SPIRV_DEF_ENCDEC3(x, y, z) \ - void encode(spv_ostream &O) const override { getEncoder(O) << x << y << z; } \ - void decode(std::istream &I) override { getDecoder(I) >> x >> y >> z; } + void encode(spv_ostream &O) const override { \ + getEncoder(O) << (x) << (y) << (z); \ + } \ + void decode(std::istream &I) override { getDecoder(I) >> (x) >> (y) >> (z); } #define _SPIRV_DEF_ENCDEC4(x, y, z, u) \ void encode(spv_ostream &O) const override { \ - getEncoder(O) << x << y << z << u; \ + getEncoder(O) << (x) << (y) << (z) << (u); \ } \ - void decode(std::istream &I) override { getDecoder(I) >> x >> y >> z >> u; } + void decode(std::istream &I) override { \ + getDecoder(I) >> (x) >> (y) >> (z) >> (u); \ + } #define _SPIRV_DEF_ENCDEC5(x, y, z, u, v) \ void encode(spv_ostream &O) const override { \ - getEncoder(O) << x << y << z << u << v; \ + getEncoder(O) << (x) << (y) << (z) << (u) << (v); \ } \ void decode(std::istream &I) override { \ - getDecoder(I) >> x >> y >> z >> u >> v; \ + getDecoder(I) >> (x) >> (y) >> (z) >> (u) >> (v); \ } #define _SPIRV_DEF_ENCDEC6(x, y, z, u, v, w) \ void encode(spv_ostream &O) const override { \ - getEncoder(O) << x << y << z << u << v << w; \ + getEncoder(O) << (x) << (y) << (z) << (u) << (v) << (w); \ } \ void decode(std::istream &I) override { \ - getDecoder(I) >> x >> y >> z >> u >> v >> w; \ + getDecoder(I) >> (x) >> (y) >> (z) >> (u) >> (v) >> (w); \ } #define _SPIRV_DEF_ENCDEC7(x, y, z, u, v, w, r) \ void encode(spv_ostream &O) const override { \ - getEncoder(O) << x << y << z << u << v << w << r; \ + getEncoder(O) << (x) << (y) << (z) << (u) << (v) << (w) << (r); \ } \ void decode(std::istream &I) override { \ - getDecoder(I) >> x >> y >> z >> u >> v >> w >> r; \ + getDecoder(I) >> (x) >> (y) >> (z) >> (u) >> (v) >> (w) >> (r); \ } #define _SPIRV_DEF_ENCDEC8(x, y, z, u, v, w, r, s) \ void encode(spv_ostream &O) const override { \ - getEncoder(O) << x << y << z << u << v << w << r << s; \ + getEncoder(O) << (x) << (y) << (z) << (u) << (v) << (w) << (r) << (s); \ } \ void decode(std::istream &I) override { \ - getDecoder(I) >> x >> y >> z >> u >> v >> w >> r >> s; \ + getDecoder(I) >> (x) >> (y) >> (z) >> (u) >> (v) >> (w) >> (r) >> (s); \ } #define _SPIRV_DEF_ENCDEC9(x, y, z, u, v, w, r, s, t) \ void encode(spv_ostream &O) const override { \ - getEncoder(O) << x << y << z << u << v << w << r << s << t; \ + getEncoder(O) << (x) << (y) << (z) << (u) << (v) << (w) << (r) << (s) \ + << (t); \ } \ void decode(std::istream &I) override { \ - getDecoder(I) >> x >> y >> z >> u >> v >> w >> r >> s >> t; \ + getDecoder(I) >> (x) >> (y) >> (z) >> (u) >> (v) >> (w) >> (r) >> (s) >> \ + (t); \ } /// All SPIR-V in-memory-representation entities inherits from SPIRVEntry. @@ -786,4 +802,4 @@ _SPIRV_OP(SizeOf) #undef _SPIRV_OP } // namespace SPIRV -#endif /* SPIRVENTRY_HPP_ */ +#endif // SPIRV_LIBSPIRV_SPIRVENTRY_H diff --git a/lib/SPIRV/libSPIRV/SPIRVEnum.h b/lib/SPIRV/libSPIRV/SPIRVEnum.h index 9f4729c..0572e54 100644 --- a/lib/SPIRV/libSPIRV/SPIRVEnum.h +++ b/lib/SPIRV/libSPIRV/SPIRVEnum.h @@ -37,8 +37,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef SPIRVENUM_HPP_ -#define SPIRVENUM_HPP_ +#ifndef SPIRV_LIBSPIRV_SPIRVENUM_H +#define SPIRV_LIBSPIRV_SPIRVENUM_H #include "SPIRVOpCode.h" #include "spirv.hpp" @@ -120,7 +120,7 @@ typedef SPIRVMap SPIRVBuiltinSetNameMap; template SPIRVCapVec getCapability(K Key) { SPIRVCapVec V; SPIRVMap::find(Key, &V); - return std::move(V); + return V; } #define ADD_VEC_INIT(Cap, ...) \ @@ -408,4 +408,4 @@ inline unsigned extractSPIRVMemOrderSemantic(unsigned Sema) { } // namespace SPIRV -#endif /* SPIRVENUM_HPP_ */ +#endif // SPIRV_LIBSPIRV_SPIRVENUM_H diff --git a/lib/SPIRV/libSPIRV/SPIRVError.h b/lib/SPIRV/libSPIRV/SPIRVError.h index 076808f..9c4ce47 100644 --- a/lib/SPIRV/libSPIRV/SPIRVError.h +++ b/lib/SPIRV/libSPIRV/SPIRVError.h @@ -36,8 +36,8 @@ // //===----------------------------------------------------------------------===// -#ifndef SPIRVERROR_HPP_ -#define SPIRVERROR_HPP_ +#ifndef SPIRV_LIBSPIRV_SPIRVERROR_H +#define SPIRV_LIBSPIRV_SPIRVERROR_H #include "SPIRVDebug.h" #include "SPIRVUtil.h" @@ -50,14 +50,14 @@ namespace SPIRV { // To use this macro, function checkError must be defined in the scope. #define SPIRVCK(Condition, ErrCode, ErrMsg) \ getErrorLog().checkError(Condition, SPIRVEC_##ErrCode, \ - std::string() + ErrMsg, #Condition, __FILE__, \ + std::string() + (ErrMsg), #Condition, __FILE__, \ __LINE__) // Check condition and set error code and error msg. If fail returns false. #define SPIRVCKRT(Condition, ErrCode, ErrMsg) \ if (!getErrorLog().checkError(Condition, SPIRVEC_##ErrCode, \ - std::string() + ErrMsg, #Condition, __FILE__, \ - __LINE__)) \ + std::string() + (ErrMsg), #Condition, \ + __FILE__, __LINE__)) \ return false; // Defines error code enum type SPIRVErrorCode. @@ -69,7 +69,7 @@ enum SPIRVErrorCode { // Defines OpErorMap which maps error code to a string describing the error. template <> inline void SPIRVMap::init() { -#define _SPIRV_OP(x, y) add(SPIRVEC_##x, std::string(#x) + ": " + y); +#define _SPIRV_OP(x, y) add(SPIRVEC_##x, std::string(#x) + ": " + (y)); #include "SPIRVErrorEnum.h" #undef _SPIRV_OP } @@ -123,4 +123,4 @@ inline bool SPIRVErrorLog::checkError(bool Cond, SPIRVErrorCode ErrCode, } // namespace SPIRV -#endif /* SPIRVERROR_HPP_ */ +#endif // SPIRV_LIBSPIRV_SPIRVERROR_H diff --git a/lib/SPIRV/libSPIRV/SPIRVErrorEnum.h b/lib/SPIRV/libSPIRV/SPIRVErrorEnum.h index 423d171..6df2fb2 100644 --- a/lib/SPIRV/libSPIRV/SPIRVErrorEnum.h +++ b/lib/SPIRV/libSPIRV/SPIRVErrorEnum.h @@ -1,3 +1,6 @@ +#ifndef SPIRV_LIBSPIRV_SPIRVERRORENUM_H +#define SPIRV_LIBSPIRV_SPIRVERRORENUM_H + /* The error code name should be meaningful since it is part of error message */ _SPIRV_OP(Success, "") _SPIRV_OP(InvalidTargetTriple, @@ -7,3 +10,5 @@ _SPIRV_OP(InvalidMemoryModel, "Expects 0-3.") _SPIRV_OP(InvalidFunctionControlMask, "") _SPIRV_OP(InvalidBuiltinSetName, "Expects OpenCL.std.") _SPIRV_OP(InvalidFunctionCall, "Unexpected llvm intrinsic:") + +#endif diff --git a/lib/SPIRV/libSPIRV/SPIRVExtInst.h b/lib/SPIRV/libSPIRV/SPIRVExtInst.h index 1982692..94fd8f9 100644 --- a/lib/SPIRV/libSPIRV/SPIRVExtInst.h +++ b/lib/SPIRV/libSPIRV/SPIRVExtInst.h @@ -37,8 +37,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef SPIRVBUILTIN_HPP_ -#define SPIRVBUILTIN_HPP_ +#ifndef SPIRV_LIBSPIRV_SPIRVEXTINST_H +#define SPIRV_LIBSPIRV_SPIRVEXTINST_H #include "OpenCL.std.h" #include "SPIRVEnum.h" @@ -267,4 +267,4 @@ inline bool isReadOrWriteImage(SPIRVWord EntryPoint) { } // namespace SPIRV -#endif +#endif // SPIRV_LIBSPIRV_SPIRVEXTINST_H diff --git a/lib/SPIRV/libSPIRV/SPIRVFunction.h b/lib/SPIRV/libSPIRV/SPIRVFunction.h index d5506d4..11c71df 100644 --- a/lib/SPIRV/libSPIRV/SPIRVFunction.h +++ b/lib/SPIRV/libSPIRV/SPIRVFunction.h @@ -36,8 +36,8 @@ // //===----------------------------------------------------------------------===// -#ifndef SPIRVFUNCTION_HPP_ -#define SPIRVFUNCTION_HPP_ +#ifndef SPIRV_LIBSPIRV_SPIRVFUNCTION_H +#define SPIRV_LIBSPIRV_SPIRVFUNCTION_H #include "SPIRVBasicBlock.h" #include "SPIRVValue.h" #include @@ -162,4 +162,4 @@ typedef SPIRVEntryOpCodeOnly SPIRVFunctionEnd; } // namespace SPIRV -#endif /* SPIRVFUNCTION_HPP_ */ +#endif // SPIRV_LIBSPIRV_SPIRVFUNCTION_H diff --git a/lib/SPIRV/libSPIRV/SPIRVInstruction.h b/lib/SPIRV/libSPIRV/SPIRVInstruction.h index c183f44..7ee2c29 100644 --- a/lib/SPIRV/libSPIRV/SPIRVInstruction.h +++ b/lib/SPIRV/libSPIRV/SPIRVInstruction.h @@ -37,8 +37,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef SPIRVINSTRUCTION_HPP_ -#define SPIRVINSTRUCTION_HPP_ +#ifndef SPIRV_LIBSPIRV_SPIRVINSTRUCTION_H +#define SPIRV_LIBSPIRV_SPIRVINSTRUCTION_H #include "SPIRVBasicBlock.h" #include "SPIRVEnum.h" @@ -1462,7 +1462,7 @@ protected: case OpTypeStruct: break; default: - assert("Invalid type"); + static_assert("Invalid type", ""); } } std::vector Constituents; @@ -2164,4 +2164,4 @@ SPIRVSpecConstantOp *createSpecConstantOpInst(SPIRVInstruction *Inst); SPIRVInstruction *createInstFromSpecConstantOp(SPIRVSpecConstantOp *C); } // namespace SPIRV -#endif // SPIRVINSTRUCTION_HPP_ +#endif // SPIRV_LIBSPIRV_SPIRVINSTRUCTION_H diff --git a/lib/SPIRV/libSPIRV/SPIRVIsValidEnum.h b/lib/SPIRV/libSPIRV/SPIRVIsValidEnum.h index 9833a4c..d95cafc 100644 --- a/lib/SPIRV/libSPIRV/SPIRVIsValidEnum.h +++ b/lib/SPIRV/libSPIRV/SPIRVIsValidEnum.h @@ -43,8 +43,8 @@ // script and any other source file instead, before re-generating this file. //===----------------------------------------------------------------------===// -#ifndef SPIRVISVALIDENUM_H_ -#define SPIRVISVALIDENUM_H_ +#ifndef SPIRV_LIBSPIRV_SPIRVISVALIDENUM_H +#define SPIRV_LIBSPIRV_SPIRVISVALIDENUM_H #include "SPIRVEnum.h" #include "spirv.hpp" @@ -962,4 +962,4 @@ inline bool isValidKernelProfilingInfoMask(SPIRVWord Mask) { } /* namespace SPIRV */ -#endif /* SPIRVISVALIDENUM_H_ */ +#endif // SPIRV_LIBSPIRV_SPIRVISVALIDENUM_H diff --git a/lib/SPIRV/libSPIRV/SPIRVModule.h b/lib/SPIRV/libSPIRV/SPIRVModule.h index 160d91f..fbad3b8 100644 --- a/lib/SPIRV/libSPIRV/SPIRVModule.h +++ b/lib/SPIRV/libSPIRV/SPIRVModule.h @@ -37,8 +37,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef SPIRVMODULE_HPP_ -#define SPIRVMODULE_HPP_ +#ifndef SPIRV_LIBSPIRV_SPIRVMODULE_H +#define SPIRV_LIBSPIRV_SPIRVMODULE_H #include "SPIRVEntry.h" @@ -401,4 +401,4 @@ bool ConvertSPIRV(std::string &Input, std::string &Out, std::string &ErrMsg, #endif } // namespace SPIRV -#endif /* SPIRVMODULE_HPP_ */ +#endif // SPIRV_LIBSPIRV_SPIRVMODULE_H diff --git a/lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h b/lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h index 80e1d9a..91871e3 100644 --- a/lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h +++ b/lib/SPIRV/libSPIRV/SPIRVNameMapEnum.h @@ -43,8 +43,8 @@ // script and any other source file instead, before re-generating this file. //===----------------------------------------------------------------------===// -#ifndef SPIRVNAMEMAPENUM_H_ -#define SPIRVNAMEMAPENUM_H_ +#ifndef SPIRV_LIBSPIRV_SPIRVNAMEMAPENUM_H +#define SPIRV_LIBSPIRV_SPIRVNAMEMAPENUM_H #include "SPIRVEnum.h" #include "spirv.hpp" @@ -471,4 +471,4 @@ SPIRV_DEF_NAMEMAP(Capability, SPIRVCapabilityNameMap) } /* namespace SPIRV */ -#endif /* SPIRVNAMEMAPENUM_H_ */ +#endif // SPIRV_LIBSPIRV_SPIRVNAMEMAPENUM_H diff --git a/lib/SPIRV/libSPIRV/SPIRVOpCode.h b/lib/SPIRV/libSPIRV/SPIRVOpCode.h index 0e701a0..612ab94 100644 --- a/lib/SPIRV/libSPIRV/SPIRVOpCode.h +++ b/lib/SPIRV/libSPIRV/SPIRVOpCode.h @@ -37,8 +37,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef SPIRVOPCODE_HPP_ -#define SPIRVOPCODE_HPP_ +#ifndef SPIRV_LIBSPIRV_SPIRVOPCODE_H +#define SPIRV_LIBSPIRV_SPIRVOPCODE_H #include "SPIRVUtil.h" #include "spirv.hpp" @@ -55,7 +55,7 @@ template <> inline void SPIRVMap::init() { SPIRV_DEF_NAMEMAP(Op, OpCodeNameMap) inline bool isAtomicOpCode(Op OpCode) { - assert(OpAtomicLoad < OpAtomicXor); + static_assert(OpAtomicLoad < OpAtomicXor, ""); return ((unsigned)OpCode >= OpAtomicLoad && (unsigned)OpCode <= OpAtomicXor) || OpCode == OpAtomicFlagTestAndSet || OpCode == OpAtomicFlagClear; @@ -159,4 +159,4 @@ inline bool isIntelSubgroupOpCode(Op OpCode) { } } // namespace SPIRV -#endif /* SPIRVOPCODE_HPP_ */ +#endif // SPIRV_LIBSPIRV_SPIRVOPCODE_H diff --git a/lib/SPIRV/libSPIRV/SPIRVStream.h b/lib/SPIRV/libSPIRV/SPIRVStream.h index b87cd43..9498f1c 100644 --- a/lib/SPIRV/libSPIRV/SPIRVStream.h +++ b/lib/SPIRV/libSPIRV/SPIRVStream.h @@ -37,8 +37,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef SPIRVSTREAM_H -#define SPIRVSTREAM_H +#ifndef SPIRV_LIBSPIRV_SPIRVSTREAM_H +#define SPIRV_LIBSPIRV_SPIRVSTREAM_H #include "SPIRVDebug.h" #include "SPIRVExtInst.h" @@ -187,4 +187,4 @@ const SPIRVEncoder &operator<<(const SPIRVEncoder &O, const std::string &Str); const SPIRVDecoder &operator>>(const SPIRVDecoder &I, std::string &Str); } // namespace SPIRV -#endif +#endif // SPIRV_LIBSPIRV_SPIRVSTREAM_H diff --git a/lib/SPIRV/libSPIRV/SPIRVType.h b/lib/SPIRV/libSPIRV/SPIRVType.h index 1b99c9e..2a9e4c7 100644 --- a/lib/SPIRV/libSPIRV/SPIRVType.h +++ b/lib/SPIRV/libSPIRV/SPIRVType.h @@ -41,8 +41,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef SPIRVTYPE_HPP_ -#define SPIRVTYPE_HPP_ +#ifndef SPIRV_LIBSPIRV_SPIRVTYPE_H +#define SPIRV_LIBSPIRV_SPIRVTYPE_H #include "SPIRVEntry.h" #include "SPIRVStream.h" @@ -156,7 +156,7 @@ public: default: break; } - return std::move(CV); + return CV; } protected: @@ -192,7 +192,7 @@ public: CV.push_back(CapabilityFloat16); } else if (isTypeFloat(64)) CV.push_back(CapabilityFloat64); - return std::move(CV); + return CV; } protected: @@ -287,7 +287,7 @@ public: // usage of 8-component or 16-component vectors. if (CompCount >= 8) V.push_back(CapabilityVector16); - return std::move(V); + return V; } std::vector getNonLiteralOperands() const override { @@ -321,7 +321,7 @@ public: SPIRVType *getElementType() const { return ElemType; } SPIRVConstant *getLength() const; SPIRVCapVec getRequiredCapability() const override { - return std::move(getElementType()->getRequiredCapability()); + return getElementType()->getRequiredCapability(); } std::vector getNonLiteralOperands() const override { std::vector Operands(2, ElemType); @@ -754,4 +754,4 @@ bool isType(const T1 *Ty, unsigned Bits = 0) { } } // namespace SPIRV -#endif // SPIRVTYPE_HPP_ +#endif // SPIRV_LIBSPIRV_SPIRVTYPE_H diff --git a/lib/SPIRV/libSPIRV/SPIRVUtil.h b/lib/SPIRV/libSPIRV/SPIRVUtil.h index 9861475..fc0bcdc 100644 --- a/lib/SPIRV/libSPIRV/SPIRVUtil.h +++ b/lib/SPIRV/libSPIRV/SPIRVUtil.h @@ -37,8 +37,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef SPIRVUTIL_H_ -#define SPIRVUTIL_H_ +#ifndef SPIRV_LIBSPIRV_SPIRVUTIL_H +#define SPIRV_LIBSPIRV_SPIRVUTIL_H #ifdef _SPIRV_LLVM_API #include "llvm/Support/raw_ostream.h" @@ -74,7 +74,7 @@ static llvm::sys::Mutex MapLock; #endif // LLVM_MSC_PREREQ(1900) #define SPIRV_DEF_NAMEMAP(Type, MapType) \ - typedef SPIRVMap MapType; \ + typedef SPIRVMap(MapType); \ inline MapType getNameMap(Type) { \ MapType MT; \ return MT; \ @@ -409,4 +409,4 @@ getOrInsert(MapTy &Map, typename MapTy::key_type Key, FuncTy Func) { } // namespace SPIRV -#endif /* SPIRVUTIL_HPP_ */ +#endif // SPIRV_LIBSPIRV_SPIRVUTIL_H diff --git a/lib/SPIRV/libSPIRV/SPIRVValue.h b/lib/SPIRV/libSPIRV/SPIRVValue.h index 2ee386c..eea5f21 100644 --- a/lib/SPIRV/libSPIRV/SPIRVValue.h +++ b/lib/SPIRV/libSPIRV/SPIRVValue.h @@ -40,8 +40,8 @@ // //===----------------------------------------------------------------------===// -#ifndef SPIRVVALUE_HPP_ -#define SPIRVVALUE_HPP_ +#ifndef SPIRV_LIBSPIRV_SPIRVVALUE_H +#define SPIRV_LIBSPIRV_SPIRVVALUE_H #include "SPIRVDecorate.h" #include "SPIRVEntry.h" @@ -112,8 +112,8 @@ public: SPIRVCapVec getRequiredCapability() const override { SPIRVCapVec CV; if (!hasType()) - return std::move(CV); - return std::move(Type->getRequiredCapability()); + return CV; + return Type->getRequiredCapability(); } protected: @@ -387,4 +387,4 @@ protected: } // namespace SPIRV -#endif /* SPIRVVALUE_HPP_ */ +#endif // SPIRV_LIBSPIRV_SPIRVVALUE_H diff --git a/lib/SPIRV/libSPIRV/libSPIRV.h b/lib/SPIRV/libSPIRV/libSPIRV.h index e8695e7..fe11064 100644 --- a/lib/SPIRV/libSPIRV/libSPIRV.h +++ b/lib/SPIRV/libSPIRV/libSPIRV.h @@ -1,4 +1,4 @@ -//===- libSPIRV.h – SPIR-V Header files -------------------------*- C++ -*-===// +//===- libSPIRV.h - SPIR-V Header files -------------------------*- C++ -*-===// // // The LLVM/SPIRV Translator // @@ -49,4 +49,4 @@ #include "SPIRVType.h" #include "SPIRVValue.h" -#endif +#endif // LIBSPIRV_H_ -- cgit v1.2.3