This is an automated email from the ASF dual-hosted git repository.

tqchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tvm.git


The following commit(s) were added to refs/heads/master by this push:
     new 84e3c19  [Fix] avoid unexpected throw in AttrInitEntry (#6128)
84e3c19 is described below

commit 84e3c1970c0def8f8615f23b75e2a4563059f3d5
Author: qiuhan <hanzz2...@hotmail.com>
AuthorDate: Tue Aug 4 03:29:55 2020 +0800

    [Fix] avoid unexpected throw in AttrInitEntry (#6128)
---
 include/tvm/ir/attrs.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/tvm/ir/attrs.h b/include/tvm/ir/attrs.h
index 4cdf8c5..d20ba4f 100644
--- a/include/tvm/ir/attrs.h
+++ b/include/tvm/ir/attrs.h
@@ -337,6 +337,18 @@ struct AttrInitEntry {
   T* value_;
   // whether the value is missing.
   bool value_missing_{true};
+
+  AttrInitEntry() = default;
+
+  AttrInitEntry(AttrInitEntry&& other) {
+    type_key_ = other.type_key_;
+    key_ = other.key_;
+    value_ = other.value_;
+    value_missing_ = other.value_missing_;
+    // avoid unexpected throw
+    other.value_missing_ = false;
+  }
+
   // If the value is still missing in destruction time throw an error.
   ~AttrInitEntry() DMLC_THROW_EXCEPTION {
     if (value_missing_) {
@@ -463,7 +475,7 @@ class AttrInitVisitor {
     } else {
       opt.value_missing_ = true;
     }
-    return opt;
+    return std::move(opt);
   }
 
  private:

Reply via email to