Sprinkle some constexpr on default ctors so the compiler can diagnose unused instance...
authorBenjamin Kramer <benny.kra@googlemail.com>
Fri, 10 Jan 2020 13:58:07 +0000 (14:58 +0100)
committerBenjamin Kramer <benny.kra@googlemail.com>
Fri, 10 Jan 2020 13:59:24 +0000 (14:59 +0100)
mlir/include/mlir/IR/Attributes.h
mlir/include/mlir/IR/Types.h
mlir/include/mlir/IR/Value.h
mlir/lib/Dialect/SPIRV/SPIRVOps.cpp
mlir/lib/Dialect/VectorOps/VectorOps.cpp

index 64b8063..49f42af 100644 (file)
@@ -69,7 +69,7 @@ public:
   using ImplType = AttributeStorage;
   using ValueType = void;
 
-  Attribute() : impl(nullptr) {}
+  constexpr Attribute() : impl(nullptr) {}
   /* implicit */ Attribute(const ImplType *impl)
       : impl(const_cast<ImplType *>(impl)) {}
 
index 6246e9b..21d6493 100644 (file)
@@ -108,7 +108,7 @@ public:
 
   using ImplType = TypeStorage;
 
-  Type() : impl(nullptr) {}
+  constexpr Type() : impl(nullptr) {}
   /* implicit */ Type(const ImplType *impl)
       : impl(const_cast<ImplType *>(impl)) {}
 
index d4869f2..3fb5a91 100644 (file)
@@ -70,7 +70,7 @@ public:
   using ImplType = llvm::PointerIntPair<void *, 2, Kind, ImplTypeTraits>;
 
 public:
-  Value(std::nullptr_t) : ownerAndKind() {}
+  constexpr Value(std::nullptr_t) : ownerAndKind() {}
   Value(ImplType ownerAndKind = {}) : ownerAndKind(ownerAndKind) {}
   Value(const Value &) = default;
   Value &operator=(const Value &) = default;
index 1de7bce..ff20e09 100644 (file)
@@ -1470,7 +1470,6 @@ spirv::ConstantOp spirv::ConstantOp::getZero(Type type, Location loc,
                                              OpBuilder *builder) {
   if (auto intType = type.dyn_cast<IntegerType>()) {
     unsigned width = intType.getWidth();
-    Attribute val;
     if (width == 1)
       return builder->create<spirv::ConstantOp>(loc, type,
                                                 builder->getBoolAttr(false));
index 4afd057..92a230e 100644 (file)
@@ -1650,7 +1650,6 @@ static ParseResult parseTupleGetOp(OpAsmParser &parser,
   StringRef indexAttrName = TupleGetOp::getIndexAttrName();
   Type indexType = parser.getBuilder().getIndexType();
   TupleType tupleType;
-  VectorType resultVectorType;
   if (parser.parseOperand(operandInfo) || parser.parseComma() ||
       parser.parseAttribute(indexAttr, indexType, indexAttrName,
                             result.attributes) ||