================
@@ -1512,7 +1492,25 @@ class opt
   opt &operator=(const opt &) = delete;
 
   // setInitialValue - Used by the cl::init modifier...
-  void setInitialValue(const DataType &V) { this->setValue(V, true); }
+  void setInitialValue(const DataType &V) {
+    this->setValue(V);
+    Default = V;
+  }
+
+  bool setLocation(Option &O, DataType &L) {
+    // Only external storage options can have their location set. For these we
+    // also need to set the default value.
+    if constexpr (ExternalStorage) {
+      if (opt_storage<DataType, ExternalStorage,
+                      std::is_class_v<DataType>>::setLocation(O, L))
+        return true;
+      Default = L;
+      return false;
+    }
----------------
yrouban wrote:

I would re-phrase:
```
    if constexpr (ExternalStorage)
      if (!opt_storage<DataType, ExternalStorage,
                      std::is_class_v<DataType>>::setLocation(O, L)) {
        Default = L;
        return false;
      }
```

https://github.com/llvm/llvm-project/pull/184581
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to