summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gross <dgross@google.com>2016-11-23 18:58:49 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-11-23 18:58:49 +0000
commit31ce82c3db81fa5cbf9f41388b660b971329e3b9 (patch)
tree737b1cccc66a9f156612aa6f83120e35e6b12ae6
parent5e86d5717e17f81e8adf909a42dea5034784e859 (diff)
parente853bd540f57319380433dbf355c7ad91487da7f (diff)
downloadspirv-llvm-31ce82c3db81fa5cbf9f41388b660b971329e3b9.tar.gz
Fix code to avoid various compiler warnings. am: a4eb334c79 am: b7af82162d
am: e853bd540f Change-Id: I71527955f5680c1503e4eb8390e6079297b7a817
-rw-r--r--lib/SPIRV/Mangler/ManglingUtils.cpp2
-rw-r--r--lib/SPIRV/Mangler/ManglingUtils.h2
-rw-r--r--lib/SPIRV/Mangler/ParameterType.h5
-rw-r--r--lib/SPIRV/OCL20ToSPIRV.cpp1
-rw-r--r--lib/SPIRV/OCLTypeToSPIRV.cpp2
-rw-r--r--lib/SPIRV/OCLTypeToSPIRV.h3
-rw-r--r--lib/SPIRV/SPIRVReader.cpp5
-rw-r--r--lib/SPIRV/SPIRVWriter.cpp2
-rw-r--r--lib/SPIRV/libSPIRV/SPIRVModule.cpp4
9 files changed, 15 insertions, 11 deletions
diff --git a/lib/SPIRV/Mangler/ManglingUtils.cpp b/lib/SPIRV/Mangler/ManglingUtils.cpp
index 645d31ab..166f2e17 100644
--- a/lib/SPIRV/Mangler/ManglingUtils.cpp
+++ b/lib/SPIRV/Mangler/ManglingUtils.cpp
@@ -171,7 +171,7 @@ namespace SPIR {
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 6fc5572b..5b39a410 100644
--- a/lib/SPIRV/Mangler/ManglingUtils.h
+++ b/lib/SPIRV/Mangler/ManglingUtils.h
@@ -23,7 +23,7 @@ namespace SPIR {
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 8089e8e0..34e2548e 100644
--- a/lib/SPIRV/Mangler/ParameterType.h
+++ b/lib/SPIRV/Mangler/ParameterType.h
@@ -435,6 +435,11 @@ namespace SPIR {
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 d232402f..a5b12107 100644
--- a/lib/SPIRV/OCL20ToSPIRV.cpp
+++ b/lib/SPIRV/OCL20ToSPIRV.cpp
@@ -1081,6 +1081,7 @@ OCL20ToSPIRV::visitCallGetImageSize(CallInst* CI,
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 588cd83d..9e4c8888 100644
--- a/lib/SPIRV/OCLTypeToSPIRV.cpp
+++ b/lib/SPIRV/OCLTypeToSPIRV.cpp
@@ -61,7 +61,7 @@ namespace SPIRV {
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 20eafaef..8c5b31f7 100644
--- a/lib/SPIRV/OCLTypeToSPIRV.h
+++ b/lib/SPIRV/OCLTypeToSPIRV.h
@@ -66,7 +66,6 @@ public:
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 @@ private:
};
}
-
-
diff --git a/lib/SPIRV/SPIRVReader.cpp b/lib/SPIRV/SPIRVReader.cpp
index 03a74d85..65c93cee 100644
--- a/lib/SPIRV/SPIRVReader.cpp
+++ b/lib/SPIRV/SPIRVReader.cpp
@@ -139,6 +139,8 @@ getMDTwoInt(LLVMContext *Context, unsigned Int1, unsigned Int2) {
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 @@ getMDString(LLVMContext *Context, const std::string& Str) {
ValueVec.push_back(MDString::get(*Context, Str));
return MDNode::get(*Context, ValueVec);
}
+#endif
static void
addOCLVersionMetadata(LLVMContext *Context, Module *M,
@@ -1108,7 +1111,7 @@ SPIRVToLLVM::postProcessOCLBuiltinWithArrayArguments(Function* F,
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 748f6ef9..fc3d9c39 100644
--- a/lib/SPIRV/SPIRVWriter.cpp
+++ b/lib/SPIRV/SPIRVWriter.cpp
@@ -587,6 +587,7 @@ LLVMToSPIRV::transSPIRVOpaqueType(Type *T) {
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 @@ llvm::RegularizeLLVMForSPIRV(Module *M, std::string &ErrMsg) {
PassMgr.run(*M);
return true;
}
-
diff --git a/lib/SPIRV/libSPIRV/SPIRVModule.cpp b/lib/SPIRV/libSPIRV/SPIRVModule.cpp
index 0b70e76b..e0c512e6 100644
--- a/lib/SPIRV/libSPIRV/SPIRVModule.cpp
+++ b/lib/SPIRV/libSPIRV/SPIRVModule.cpp
@@ -61,7 +61,7 @@ SPIRVModule::~SPIRVModule()
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 @@ public:
private:
SPIRVErrorLog ErrLog;
SPIRVId NextId;
- SPIRVTypeInt *BoolType;
SPIRVWord SPIRVVersion;
unsigned short GeneratorId;
unsigned short GeneratorVer;
@@ -1588,4 +1587,3 @@ bool ConvertSPIRV(std::string &Input, std::string &Out,
#endif // _SPIRV_SUPPORT_TEXT_FMT
}
-