[clang-tools-extra] [clang][dataflow]Use cast_or_null instead cast to prevent crash (PR #68510)
Yitzhak Mandelbaum via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 10 08:23:49 PDT 2023
================
@@ -180,3 +180,44 @@ void std_forward_rvalue_ref_safe(absl::optional<int>&& opt) {
std::forward<absl::optional<int>>(opt).value();
}
+
+namespace std {
+
+template<typename T>
+class optional {
+public:
+ template <typename U>
+ optional& operator=(const U &u){
+ data = u;
+ }
+private:
+ T data;
+};
+
+template <typename T>
+class vector {
+public:
+ vector() {}
+ T &operator[](unsigned long index) { return data[index]; }
+ bool empty() { return size == 0UL; }
+
+private:
+ T *data;
+ unsigned long size;
----------------
ymand wrote:
I think simpler would be better here -- please leave out the definitions of the methods and the private data.
https://github.com/llvm/llvm-project/pull/68510
More information about the cfe-commits
mailing list