Fix code to avoid various compiler warnings. am: a4eb334c79 am: b7af82162d
am: e853bd540f
Change-Id: I71527955f5680c1503e4eb8390e6079297b7a817
diff --git a/lib/SPIRV/Mangler/ManglingUtils.cpp b/lib/SPIRV/Mangler/ManglingUtils.cpp
index 645d31a..166f2e1 100644
--- a/lib/SPIRV/Mangler/ManglingUtils.cpp
+++ b/lib/SPIRV/Mangler/ManglingUtils.cpp
@@ -171,7 +171,7 @@
return readableAttribute[attribute];
}
- const SPIRversion getSupportedVersion(TypePrimitiveEnum t) {
+ SPIRversion getSupportedVersion(TypePrimitiveEnum t) {
return primitiveSupportedVersions[t];
}
diff --git a/lib/SPIRV/Mangler/ManglingUtils.h b/lib/SPIRV/Mangler/ManglingUtils.h
index 6fc5572..5b39a41 100644
--- a/lib/SPIRV/Mangler/ManglingUtils.h
+++ b/lib/SPIRV/Mangler/ManglingUtils.h
@@ -23,7 +23,7 @@
const char* getMangledAttribute(TypeAttributeEnum attribute);
const char* getReadableAttribute(TypeAttributeEnum attribute);
- const SPIRversion getSupportedVersion(TypePrimitiveEnum t);
+ SPIRversion getSupportedVersion(TypePrimitiveEnum t);
const char* getSPIRVersionAsString(SPIRversion version);
const char* mangledPrimitiveStringfromName(std::string type);
diff --git a/lib/SPIRV/Mangler/ParameterType.h b/lib/SPIRV/Mangler/ParameterType.h
index 8089e8e..34e2548 100644
--- a/lib/SPIRV/Mangler/ParameterType.h
+++ b/lib/SPIRV/Mangler/ParameterType.h
@@ -435,6 +435,11 @@
struct TypeVisitor{
SPIRversion spirVer;
TypeVisitor(SPIRversion ver) : spirVer(ver) {};
+
+ /// should usually have virtual destructor if there are any
+ /// virtual functions
+ virtual ~TypeVisitor() { }
+
virtual MangleError visit(const PrimitiveType*) = 0;
virtual MangleError visit(const VectorType*) = 0;
virtual MangleError visit(const PointerType*) = 0;
diff --git a/lib/SPIRV/OCL20ToSPIRV.cpp b/lib/SPIRV/OCL20ToSPIRV.cpp
index d232402..a5b1210 100644
--- a/lib/SPIRV/OCL20ToSPIRV.cpp
+++ b/lib/SPIRV/OCL20ToSPIRV.cpp
@@ -1081,6 +1081,7 @@
StringRef TyName;
SmallVector<StringRef, 4> SubStrs;
auto IsImg = isOCLImageType(CI->getArgOperand(0)->getType(), &TyName);
+ (void)IsImg; // prevent warning about unused variable in NDEBUG build
assert(IsImg);
std::string ImageTyName = TyName.str();
if (hasAccessQualifiedName(TyName))
diff --git a/lib/SPIRV/OCLTypeToSPIRV.cpp b/lib/SPIRV/OCLTypeToSPIRV.cpp
index 588cd83..9e4c888 100644
--- a/lib/SPIRV/OCLTypeToSPIRV.cpp
+++ b/lib/SPIRV/OCLTypeToSPIRV.cpp
@@ -61,7 +61,7 @@
char OCLTypeToSPIRV::ID = 0;
OCLTypeToSPIRV::OCLTypeToSPIRV()
- :ModulePass(ID), M(nullptr), Ctx(nullptr), CLVer(0) {
+ :ModulePass(ID), M(nullptr), Ctx(nullptr) {
initializeOCLTypeToSPIRVPass(*PassRegistry::getPassRegistry());
}
diff --git a/lib/SPIRV/OCLTypeToSPIRV.h b/lib/SPIRV/OCLTypeToSPIRV.h
index 20eafae..8c5b31f 100644
--- a/lib/SPIRV/OCLTypeToSPIRV.h
+++ b/lib/SPIRV/OCLTypeToSPIRV.h
@@ -66,7 +66,6 @@
private:
Module *M;
LLVMContext *Ctx;
- unsigned CLVer;
std::map<Value*, Type*> AdaptedTy; // Adapted types for values
std::set<Function *> WorkSet; // Functions to be adapted
@@ -82,5 +81,3 @@
};
}
-
-
diff --git a/lib/SPIRV/SPIRVReader.cpp b/lib/SPIRV/SPIRVReader.cpp
index 03a74d8..65c93ce 100644
--- a/lib/SPIRV/SPIRVReader.cpp
+++ b/lib/SPIRV/SPIRVReader.cpp
@@ -139,6 +139,8 @@
return MDNode::get(*Context, ValueVec);
}
+#if 0
+// this function is currently unneeded
static MDNode*
getMDString(LLVMContext *Context, const std::string& Str) {
std::vector<Metadata*> ValueVec;
@@ -146,6 +148,7 @@
ValueVec.push_back(MDString::get(*Context, Str));
return MDNode::get(*Context, ValueVec);
}
+#endif
static void
addOCLVersionMetadata(LLVMContext *Context, Module *M,
@@ -1108,7 +1111,7 @@
if (!T->isArrayTy())
continue;
auto Alloca = new AllocaInst(T, "", static_cast<Instruction*>(FBegin));
- auto Store = new StoreInst(I, Alloca, false, CI);
+ new StoreInst(I, Alloca, false, CI);
auto Zero = ConstantInt::getNullValue(Type::getInt32Ty(T->getContext()));
Value *Index[] = {Zero, Zero};
I = GetElementPtrInst::CreateInBounds(Alloca, Index, "", CI);
diff --git a/lib/SPIRV/SPIRVWriter.cpp b/lib/SPIRV/SPIRVWriter.cpp
index 748f6ef..fc3d9c3 100644
--- a/lib/SPIRV/SPIRVWriter.cpp
+++ b/lib/SPIRV/SPIRVWriter.cpp
@@ -587,6 +587,7 @@
auto ET = T->getPointerElementType();
auto ST = cast<StructType>(ET);
auto AddrSpc = T->getPointerAddressSpace();
+ (void)AddrSpc; // prevent warning about unused variable in NDEBUG build
auto STName = ST->getStructName();
assert (STName.startswith(kSPIRVTypeName::PrefixAndDelim) &&
"Invalid SPIR-V opaque type name");
@@ -1735,4 +1736,3 @@
PassMgr.run(*M);
return true;
}
-
diff --git a/lib/SPIRV/libSPIRV/SPIRVModule.cpp b/lib/SPIRV/libSPIRV/SPIRVModule.cpp
index 0b70e76..e0c512e 100644
--- a/lib/SPIRV/libSPIRV/SPIRVModule.cpp
+++ b/lib/SPIRV/libSPIRV/SPIRVModule.cpp
@@ -61,7 +61,7 @@
class SPIRVModuleImpl : public SPIRVModule {
public:
- SPIRVModuleImpl():SPIRVModule(), NextId(1), BoolType(NULL),
+ SPIRVModuleImpl():SPIRVModule(), NextId(1),
SPIRVVersion(SPIRV_1_0),
GeneratorId(SPIRVGEN_KhronosLLVMSPIRVTranslator),
GeneratorVer(0),
@@ -302,7 +302,6 @@
private:
SPIRVErrorLog ErrLog;
SPIRVId NextId;
- SPIRVTypeInt *BoolType;
SPIRVWord SPIRVVersion;
unsigned short GeneratorId;
unsigned short GeneratorVer;
@@ -1588,4 +1587,3 @@
#endif // _SPIRV_SUPPORT_TEXT_FMT
}
-