[llvm] f072603 - [ADT] Use default member initialization in OptionalStorage (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 5 16:54:57 PST 2022
Author: Kazu Hirata
Date: 2022-02-05T16:29:24-08:00
New Revision: f0726036857ade7a5386251208b668155e4c575d
URL: https://github.com/llvm/llvm-project/commit/f0726036857ade7a5386251208b668155e4c575d
DIFF: https://github.com/llvm/llvm-project/commit/f0726036857ade7a5386251208b668155e4c575d.diff
LOG: [ADT] Use default member initialization in OptionalStorage (NFC)
Added:
Modified:
llvm/include/llvm/ADT/Optional.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/Optional.h b/llvm/include/llvm/ADT/Optional.h
index f4608140a974..f74e5e3b4799 100644
--- a/llvm/include/llvm/ADT/Optional.h
+++ b/llvm/include/llvm/ADT/Optional.h
@@ -62,12 +62,12 @@ class OptionalStorage {
char empty;
T value;
};
- bool hasVal;
+ bool hasVal = false;
public:
~OptionalStorage() { reset(); }
- constexpr OptionalStorage() noexcept : empty(), hasVal(false) {}
+ constexpr OptionalStorage() noexcept : empty() {}
constexpr OptionalStorage(OptionalStorage const &other) : OptionalStorage() {
if (other.hasValue()) {
More information about the llvm-commits
mailing list