[PATCH] D71853: [MLIR][NFC] Insert const_cast to avoid warning

Hideto Ueno via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 24 23:01:51 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG1497a4350e26: [MLIR][NFC] Insert const_cast to avoid warning (authored by uenoku).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71853/new/

https://reviews.llvm.org/D71853

Files:
  mlir/include/mlir/IR/Value.h
  mlir/include/mlir/Pass/PassOptions.h


Index: mlir/include/mlir/Pass/PassOptions.h
===================================================================
--- mlir/include/mlir/Pass/PassOptions.h
+++ mlir/include/mlir/Pass/PassOptions.h
@@ -176,7 +176,8 @@
 
     /// Copy the value from the given option into this one.
     void copyValueFrom(const OptionBase &other) final {
-      (*this) = ArrayRef<DataType>((ListOption<DataType> &)other);
+      (*this) = ArrayRef<DataType>(
+          (ListOption<DataType> &)(const_cast<OptionBase &>(other)));
     }
   };
 
Index: mlir/include/mlir/IR/Value.h
===================================================================
--- mlir/include/mlir/IR/Value.h
+++ mlir/include/mlir/IR/Value.h
@@ -109,7 +109,7 @@
   /// value-type.
   /// TODO(riverriddle) Remove these when all usages have been removed.
   Value operator*() const { return *this; }
-  Value *operator->() const { return (Value *)this; }
+  Value *operator->() const { return const_cast<Value *>(this); }
 
   operator bool() const { return impl; }
   bool operator==(const Value &other) const { return impl == other.impl; }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71853.235259.patch
Type: text/x-patch
Size: 1094 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191225/efd913d0/attachment.bin>


More information about the llvm-commits mailing list