summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-08-13 17:31:39 +0430
committerAli Mohammad Pur <ali.mpfard@gmail.com>2021-08-13 17:31:39 +0430
commit15f95220aea5e9cbe670d756b1eb0a9df73a8453 (patch)
tree74f60e540faacec26d0c9b1dfddb32ec608e39ce /Userland
parent90e6b9d453560f044e6c5dcbea20a0c7f8398437 (diff)
downloadserenity-15f95220aea5e9cbe670d756b1eb0a9df73a8453.zip
AK+Everywhere: Delete Variant's default constructor
This was exposed to the user by mistake, and even accumulated a bunch of users that didn't blow up out of sheer luck.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibRegex/RegexParser.cpp13
-rw-r--r--Userland/Libraries/LibRegex/RegexParser.h2
-rw-r--r--Userland/Libraries/LibSQL/Value.cpp3
-rw-r--r--Userland/Libraries/LibSQL/Value.h2
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp18
5 files changed, 27 insertions, 11 deletions
diff --git a/Userland/Libraries/LibRegex/RegexParser.cpp b/Userland/Libraries/LibRegex/RegexParser.cpp
index 8fa19de4b8..c854042a87 100644
--- a/Userland/Libraries/LibRegex/RegexParser.cpp
+++ b/Userland/Libraries/LibRegex/RegexParser.cpp
@@ -1556,7 +1556,7 @@ bool ECMA262Parser::parse_atom_escape(ByteCode& stack, size_t& match_length_mini
}
if (unicode) {
- PropertyEscape property {};
+ PropertyEscape property { Empty {} };
bool negated = false;
if (parse_unicode_property_escape(property, negated)) {
@@ -1575,7 +1575,8 @@ bool ECMA262Parser::parse_atom_escape(ByteCode& stack, size_t& match_length_mini
compares.empend(CompareTypeAndValuePair { CharacterCompareType::ScriptExtension, (ByteCodeValueType)script.script });
else
compares.empend(CompareTypeAndValuePair { CharacterCompareType::Script, (ByteCodeValueType)script.script });
- });
+ },
+ [](Empty&) { VERIFY_NOT_REACHED(); });
stack.insert_bytecode_compare_values(move(compares));
match_length_minimum += 1;
return true;
@@ -1818,7 +1819,7 @@ bool ECMA262Parser::parse_nonempty_class_ranges(Vector<CompareTypeAndValuePair>&
if (try_skip("-"))
return { CharClassRangeElement { .code_point = '-', .is_character_class = false } };
- PropertyEscape property {};
+ PropertyEscape property { Empty {} };
bool negated = false;
if (parse_unicode_property_escape(property, negated)) {
return property.visit(
@@ -1833,7 +1834,8 @@ bool ECMA262Parser::parse_nonempty_class_ranges(Vector<CompareTypeAndValuePair>&
return CharClassRangeElement { .script = script.script, .is_negated = negated, .is_character_class = true, .is_script_extension = true };
else
return CharClassRangeElement { .script = script.script, .is_negated = negated, .is_character_class = true, .is_script = true };
- });
+ },
+ [](Empty&) -> CharClassRangeElement { VERIFY_NOT_REACHED(); });
}
}
@@ -1983,7 +1985,8 @@ bool ECMA262Parser::parse_unicode_property_escape(PropertyEscape& property, bool
return true;
},
[](Unicode::GeneralCategory) { return true; },
- [](Script) { return true; });
+ [](Script) { return true; },
+ [](Empty&) -> bool { VERIFY_NOT_REACHED(); });
}
StringView ECMA262Parser::read_capture_group_specifier(bool take_starting_angle_bracket)
diff --git a/Userland/Libraries/LibRegex/RegexParser.h b/Userland/Libraries/LibRegex/RegexParser.h
index 117ea4cd8c..9f1a934406 100644
--- a/Userland/Libraries/LibRegex/RegexParser.h
+++ b/Userland/Libraries/LibRegex/RegexParser.h
@@ -218,7 +218,7 @@ private:
Unicode::Script script {};
bool is_extension { false };
};
- using PropertyEscape = Variant<Unicode::Property, Unicode::GeneralCategory, Script>;
+ using PropertyEscape = Variant<Unicode::Property, Unicode::GeneralCategory, Script, Empty>;
Optional<PropertyEscape> read_unicode_property_escape();
bool parse_pattern(ByteCode&, size_t&, bool unicode, bool named);
diff --git a/Userland/Libraries/LibSQL/Value.cpp b/Userland/Libraries/LibSQL/Value.cpp
index 06bf3b41cc..122ad7c41b 100644
--- a/Userland/Libraries/LibSQL/Value.cpp
+++ b/Userland/Libraries/LibSQL/Value.cpp
@@ -10,11 +10,13 @@
namespace SQL {
Value::Value(SQLType sql_type)
+ : m_impl(0)
{
setup(sql_type);
}
Value::Value(SQLType sql_type, ByteBuffer& buffer, size_t& offset)
+ : m_impl(0)
{
setup(sql_type);
m_deserialize(buffer, offset);
@@ -22,6 +24,7 @@ Value::Value(SQLType sql_type, ByteBuffer& buffer, size_t& offset)
}
Value::Value(Value const& other)
+ : m_impl(0)
{
setup(other.type());
m_is_null = other.is_null();
diff --git a/Userland/Libraries/LibSQL/Value.h b/Userland/Libraries/LibSQL/Value.h
index 74c90a8fea..655aac93f0 100644
--- a/Userland/Libraries/LibSQL/Value.h
+++ b/Userland/Libraries/LibSQL/Value.h
@@ -102,7 +102,7 @@ private:
SQLType m_type { SQLType::Text };
bool m_is_null { true };
- Variant<String, int, double> m_impl {};
+ Variant<String, int, double> m_impl;
};
}
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index e04834f81b..a0d9da7371 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -2197,7 +2197,10 @@ Optional<CalculatedStyleValue::CalcValue> Parser::parse_calc_value(ParsingContex
OwnPtr<CalculatedStyleValue::CalcProductPartWithOperator> Parser::parse_calc_product_part_with_operator(ParsingContext const& context, TokenStream<StyleComponentValueRule>& tokens)
{
- auto product_with_operator = make<CalculatedStyleValue::CalcProductPartWithOperator>();
+ // Note: The default value is not used or passed around.
+ auto product_with_operator = make<CalculatedStyleValue::CalcProductPartWithOperator>(
+ CalculatedStyleValue::CalcProductPartWithOperator::Multiply,
+ CalculatedStyleValue::CalcNumberValue(0));
tokens.skip_whitespace();
@@ -2232,7 +2235,10 @@ OwnPtr<CalculatedStyleValue::CalcProductPartWithOperator> Parser::parse_calc_pro
OwnPtr<CalculatedStyleValue::CalcNumberProductPartWithOperator> Parser::parse_calc_number_product_part_with_operator(ParsingContext const& context, TokenStream<StyleComponentValueRule>& tokens)
{
- auto number_product_with_operator = make<CalculatedStyleValue::CalcNumberProductPartWithOperator>();
+ // Note: The default value is not used or passed around.
+ auto number_product_with_operator = make<CalculatedStyleValue::CalcNumberProductPartWithOperator>(
+ CalculatedStyleValue::CalcNumberProductPartWithOperator::Multiply,
+ CalculatedStyleValue::CalcNumberValue(0));
tokens.skip_whitespace();
@@ -2263,7 +2269,9 @@ OwnPtr<CalculatedStyleValue::CalcNumberProductPartWithOperator> Parser::parse_ca
OwnPtr<CalculatedStyleValue::CalcNumberProduct> Parser::parse_calc_number_product(ParsingContext const& context, TokenStream<StyleComponentValueRule>& tokens)
{
- auto calc_number_product = make<CalculatedStyleValue::CalcNumberProduct>();
+ auto calc_number_product = make<CalculatedStyleValue::CalcNumberProduct>(
+ CalculatedStyleValue::CalcNumberValue(0),
+ NonnullOwnPtrVector<CalculatedStyleValue::CalcNumberProductPartWithOperator> {});
auto first_calc_number_value_or_error = parse_calc_number_value(context, tokens);
if (!first_calc_number_value_or_error.has_value())
@@ -2348,7 +2356,9 @@ Optional<CalculatedStyleValue::CalcNumberValue> Parser::parse_calc_number_value(
OwnPtr<CalculatedStyleValue::CalcProduct> Parser::parse_calc_product(ParsingContext const& context, TokenStream<StyleComponentValueRule>& tokens)
{
- auto calc_product = make<CalculatedStyleValue::CalcProduct>();
+ auto calc_product = make<CalculatedStyleValue::CalcProduct>(
+ CalculatedStyleValue::CalcValue(0),
+ NonnullOwnPtrVector<CalculatedStyleValue::CalcProductPartWithOperator> {});
auto first_calc_value_or_error = parse_calc_value(context, tokens);
if (!first_calc_value_or_error.has_value())