summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLifeng Pan <lifeng.pan@amd.com>2017-08-16 18:28:35 +0800
committerbader <alexey.bader@intel.com>2017-08-16 13:28:35 +0300
commit1bd038ed05657f4eda724786c2e7b65d4ebff827 (patch)
treea80cbe5dd3ce33fd8c8336f0132e035ac747e191
parent5dd5096dfac2fa5adceae6bfee6d27671fec2eef (diff)
Fix typo in an assert message (#220)
* Fix typo in an assert message and get rid of build warnings. Value of size_t type is always >= 0; Use explicit conversion from uint64_t to unsigned.
-rw-r--r--lib/SPIRV/libSPIRV/SPIRVDecorate.cpp2
-rw-r--r--lib/SPIRV/libSPIRV/SPIRVModule.cpp2
-rw-r--r--lib/SPIRV/libSPIRV/SPIRVType.cpp4
3 files changed, 4 insertions, 4 deletions
diff --git a/lib/SPIRV/libSPIRV/SPIRVDecorate.cpp b/lib/SPIRV/libSPIRV/SPIRVDecorate.cpp
index 92a8461..9790b18 100644
--- a/lib/SPIRV/libSPIRV/SPIRVDecorate.cpp
+++ b/lib/SPIRV/libSPIRV/SPIRVDecorate.cpp
@@ -84,7 +84,7 @@ SPIRVDecorateGeneric::getDecorateKind()const {
SPIRVWord
SPIRVDecorateGeneric::getLiteral(size_t i) const {
- assert(0 <= i && i <= Literals.size() && "Out of bounds");
+ assert(i <= Literals.size() && "Out of bounds");
return Literals[i];
}
diff --git a/lib/SPIRV/libSPIRV/SPIRVModule.cpp b/lib/SPIRV/libSPIRV/SPIRVModule.cpp
index d24db9b..308c7da 100644
--- a/lib/SPIRV/libSPIRV/SPIRVModule.cpp
+++ b/lib/SPIRV/libSPIRV/SPIRVModule.cpp
@@ -924,7 +924,7 @@ SPIRVModuleImpl::addConstant(SPIRVType *Ty, uint64_t V) {
SPIRVValue *
SPIRVModuleImpl::addIntegerConstant(SPIRVTypeInt *Ty, uint64_t V) {
if (Ty->getBitWidth() == 32) {
- unsigned I32 = V;
+ unsigned I32 = static_cast<unsigned>(V);
assert(I32 == V && "Integer value truncated");
return getLiteralAsConstant(I32);
}
diff --git a/lib/SPIRV/libSPIRV/SPIRVType.cpp b/lib/SPIRV/libSPIRV/SPIRVType.cpp
index a8277f5..82cf0e0 100644
--- a/lib/SPIRV/libSPIRV/SPIRVType.cpp
+++ b/lib/SPIRV/libSPIRV/SPIRVType.cpp
@@ -1,4 +1,4 @@
-//===- SPIRVtype.cpp – Class to represent a SPIR-V type ----------*- C++ -*-===//
+//===- SPIRVtype.cpp – Class to represent a SPIR-V type ----------*- C++ -*-===//
//
// The LLVM/SPIRV Translator
//
@@ -70,7 +70,7 @@ SPIRVType::getBitWidth() const {
SPIRVWord
SPIRVType::getFloatBitWidth()const {
- assert(OpCode == OpTypeFloat && "Not an integer type");
+ assert(OpCode == OpTypeFloat && "Not a float type");
return static_cast<const SPIRVTypeFloat *const>(this)->getBitWidth();
}