Skip to content

Commit

Permalink
Merge pull request #310 from wravery/main
Browse files Browse the repository at this point in the history
fix: schema input type member default init error on clang 14
  • Loading branch information
wravery committed Sep 9, 2024
2 parents f5b412a + 4542107 commit 681b0e1
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 63 deletions.
2 changes: 2 additions & 0 deletions samples/learn/schema/StarWarsSchema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ learn::ReviewInput Argument<learn::ReviewInput>::convert(const response::Value&
namespace learn {

ReviewInput::ReviewInput() noexcept
: stars {}
, commentary {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down
4 changes: 2 additions & 2 deletions samples/learn/schema/StarWarsSchema.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ struct [[nodiscard("unnecessary construction")]] ReviewInput
ReviewInput& operator=(const ReviewInput& other);
ReviewInput& operator=(ReviewInput&& other) noexcept;

int stars {};
std::optional<std::string> commentary {};
int stars;
std::optional<std::string> commentary;
};

namespace object {
Expand Down
28 changes: 28 additions & 0 deletions samples/today/nointrospection/TodaySchema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ today::FirstNestedInput Argument<today::FirstNestedInput>::convert(const respons
namespace today {

CompleteTaskInput::CompleteTaskInput() noexcept
: id {}
, testTaskState {}
, isComplete {}
, clientMutationId {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down Expand Up @@ -285,6 +289,8 @@ CompleteTaskInput& CompleteTaskInput::operator=(CompleteTaskInput&& other) noexc
}

ThirdNestedInput::ThirdNestedInput() noexcept
: id {}
, second {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down Expand Up @@ -332,6 +338,7 @@ ThirdNestedInput& ThirdNestedInput::operator=(ThirdNestedInput&& other) noexcept
}

FourthNestedInput::FourthNestedInput() noexcept
: id {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down Expand Up @@ -374,6 +381,7 @@ FourthNestedInput& FourthNestedInput::operator=(FourthNestedInput&& other) noexc
}

IncludeNullableSelfInput::IncludeNullableSelfInput() noexcept
: self {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down Expand Up @@ -416,6 +424,7 @@ IncludeNullableSelfInput& IncludeNullableSelfInput::operator=(IncludeNullableSel
}

IncludeNonNullableListSelfInput::IncludeNonNullableListSelfInput() noexcept
: selves {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down Expand Up @@ -458,6 +467,18 @@ IncludeNonNullableListSelfInput& IncludeNonNullableListSelfInput::operator=(Incl
}

StringOperationFilterInput::StringOperationFilterInput() noexcept
: and_ {}
, or_ {}
, equal {}
, notEqual {}
, contains {}
, notContains {}
, in {}
, notIn {}
, startsWith {}
, notStartsWith {}
, endsWith {}
, notEndsWith {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down Expand Up @@ -555,6 +576,8 @@ StringOperationFilterInput& StringOperationFilterInput::operator=(StringOperatio
}

SecondNestedInput::SecondNestedInput() noexcept
: id {}
, third {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down Expand Up @@ -602,6 +625,8 @@ SecondNestedInput& SecondNestedInput::operator=(SecondNestedInput&& other) noexc
}

ForwardDeclaredInput::ForwardDeclaredInput() noexcept
: nullableSelf {}
, listSelves {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down Expand Up @@ -649,6 +674,9 @@ ForwardDeclaredInput& ForwardDeclaredInput::operator=(ForwardDeclaredInput&& oth
}

FirstNestedInput::FirstNestedInput() noexcept
: id {}
, second {}
, third {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down
56 changes: 28 additions & 28 deletions samples/today/nointrospection/TodaySchema.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ struct [[nodiscard("unnecessary construction")]] CompleteTaskInput
CompleteTaskInput& operator=(const CompleteTaskInput& other);
CompleteTaskInput& operator=(CompleteTaskInput&& other) noexcept;

response::IdType id {};
std::optional<TaskState> testTaskState {};
std::optional<bool> isComplete {};
std::optional<std::string> clientMutationId {};
response::IdType id;
std::optional<TaskState> testTaskState;
std::optional<bool> isComplete;
std::optional<std::string> clientMutationId;
};

struct SecondNestedInput;
Expand All @@ -90,8 +90,8 @@ struct [[nodiscard("unnecessary construction")]] ThirdNestedInput
ThirdNestedInput& operator=(const ThirdNestedInput& other);
ThirdNestedInput& operator=(ThirdNestedInput&& other) noexcept;

response::IdType id {};
std::unique_ptr<SecondNestedInput> second {};
response::IdType id;
std::unique_ptr<SecondNestedInput> second;
};

struct [[nodiscard("unnecessary construction")]] FourthNestedInput
Expand All @@ -106,7 +106,7 @@ struct [[nodiscard("unnecessary construction")]] FourthNestedInput
FourthNestedInput& operator=(const FourthNestedInput& other);
FourthNestedInput& operator=(FourthNestedInput&& other) noexcept;

response::IdType id {};
response::IdType id;
};

struct [[nodiscard("unnecessary construction")]] IncludeNullableSelfInput
Expand All @@ -121,7 +121,7 @@ struct [[nodiscard("unnecessary construction")]] IncludeNullableSelfInput
IncludeNullableSelfInput& operator=(const IncludeNullableSelfInput& other);
IncludeNullableSelfInput& operator=(IncludeNullableSelfInput&& other) noexcept;

std::unique_ptr<IncludeNullableSelfInput> self {};
std::unique_ptr<IncludeNullableSelfInput> self;
};

struct [[nodiscard("unnecessary construction")]] IncludeNonNullableListSelfInput
Expand All @@ -136,7 +136,7 @@ struct [[nodiscard("unnecessary construction")]] IncludeNonNullableListSelfInput
IncludeNonNullableListSelfInput& operator=(const IncludeNonNullableListSelfInput& other);
IncludeNonNullableListSelfInput& operator=(IncludeNonNullableListSelfInput&& other) noexcept;

std::vector<IncludeNonNullableListSelfInput> selves {};
std::vector<IncludeNonNullableListSelfInput> selves;
};

struct [[nodiscard("unnecessary construction")]] StringOperationFilterInput
Expand All @@ -162,18 +162,18 @@ struct [[nodiscard("unnecessary construction")]] StringOperationFilterInput
StringOperationFilterInput& operator=(const StringOperationFilterInput& other);
StringOperationFilterInput& operator=(StringOperationFilterInput&& other) noexcept;

std::optional<std::vector<StringOperationFilterInput>> and_ {};
std::optional<std::vector<StringOperationFilterInput>> or_ {};
std::optional<std::string> equal {};
std::optional<std::string> notEqual {};
std::optional<std::string> contains {};
std::optional<std::string> notContains {};
std::optional<std::vector<std::string>> in {};
std::optional<std::vector<std::string>> notIn {};
std::optional<std::string> startsWith {};
std::optional<std::string> notStartsWith {};
std::optional<std::string> endsWith {};
std::optional<std::string> notEndsWith {};
std::optional<std::vector<StringOperationFilterInput>> and_;
std::optional<std::vector<StringOperationFilterInput>> or_;
std::optional<std::string> equal;
std::optional<std::string> notEqual;
std::optional<std::string> contains;
std::optional<std::string> notContains;
std::optional<std::vector<std::string>> in;
std::optional<std::vector<std::string>> notIn;
std::optional<std::string> startsWith;
std::optional<std::string> notStartsWith;
std::optional<std::string> endsWith;
std::optional<std::string> notEndsWith;
};

struct [[nodiscard("unnecessary construction")]] SecondNestedInput
Expand All @@ -189,8 +189,8 @@ struct [[nodiscard("unnecessary construction")]] SecondNestedInput
SecondNestedInput& operator=(const SecondNestedInput& other);
SecondNestedInput& operator=(SecondNestedInput&& other) noexcept;

response::IdType id {};
ThirdNestedInput third {};
response::IdType id;
ThirdNestedInput third;
};

struct [[nodiscard("unnecessary construction")]] ForwardDeclaredInput
Expand All @@ -206,8 +206,8 @@ struct [[nodiscard("unnecessary construction")]] ForwardDeclaredInput
ForwardDeclaredInput& operator=(const ForwardDeclaredInput& other);
ForwardDeclaredInput& operator=(ForwardDeclaredInput&& other) noexcept;

std::unique_ptr<IncludeNullableSelfInput> nullableSelf {};
IncludeNonNullableListSelfInput listSelves {};
std::unique_ptr<IncludeNullableSelfInput> nullableSelf;
IncludeNonNullableListSelfInput listSelves;
};

struct [[nodiscard("unnecessary construction")]] FirstNestedInput
Expand All @@ -224,9 +224,9 @@ struct [[nodiscard("unnecessary construction")]] FirstNestedInput
FirstNestedInput& operator=(const FirstNestedInput& other);
FirstNestedInput& operator=(FirstNestedInput&& other) noexcept;

response::IdType id {};
SecondNestedInput second {};
ThirdNestedInput third {};
response::IdType id;
SecondNestedInput second;
ThirdNestedInput third;
};

namespace object {
Expand Down
28 changes: 28 additions & 0 deletions samples/today/schema/TodaySchema.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ today::FirstNestedInput Argument<today::FirstNestedInput>::convert(const respons
namespace today {

CompleteTaskInput::CompleteTaskInput() noexcept
: id {}
, testTaskState {}
, isComplete {}
, clientMutationId {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down Expand Up @@ -285,6 +289,8 @@ CompleteTaskInput& CompleteTaskInput::operator=(CompleteTaskInput&& other) noexc
}

ThirdNestedInput::ThirdNestedInput() noexcept
: id {}
, second {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down Expand Up @@ -332,6 +338,7 @@ ThirdNestedInput& ThirdNestedInput::operator=(ThirdNestedInput&& other) noexcept
}

FourthNestedInput::FourthNestedInput() noexcept
: id {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down Expand Up @@ -374,6 +381,7 @@ FourthNestedInput& FourthNestedInput::operator=(FourthNestedInput&& other) noexc
}

IncludeNullableSelfInput::IncludeNullableSelfInput() noexcept
: self {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down Expand Up @@ -416,6 +424,7 @@ IncludeNullableSelfInput& IncludeNullableSelfInput::operator=(IncludeNullableSel
}

IncludeNonNullableListSelfInput::IncludeNonNullableListSelfInput() noexcept
: selves {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down Expand Up @@ -458,6 +467,18 @@ IncludeNonNullableListSelfInput& IncludeNonNullableListSelfInput::operator=(Incl
}

StringOperationFilterInput::StringOperationFilterInput() noexcept
: and_ {}
, or_ {}
, equal {}
, notEqual {}
, contains {}
, notContains {}
, in {}
, notIn {}
, startsWith {}
, notStartsWith {}
, endsWith {}
, notEndsWith {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down Expand Up @@ -555,6 +576,8 @@ StringOperationFilterInput& StringOperationFilterInput::operator=(StringOperatio
}

SecondNestedInput::SecondNestedInput() noexcept
: id {}
, third {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down Expand Up @@ -602,6 +625,8 @@ SecondNestedInput& SecondNestedInput::operator=(SecondNestedInput&& other) noexc
}

ForwardDeclaredInput::ForwardDeclaredInput() noexcept
: nullableSelf {}
, listSelves {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down Expand Up @@ -649,6 +674,9 @@ ForwardDeclaredInput& ForwardDeclaredInput::operator=(ForwardDeclaredInput&& oth
}

FirstNestedInput::FirstNestedInput() noexcept
: id {}
, second {}
, third {}
{
// Explicit definition to prevent ODR violations when LTO is enabled.
}
Expand Down
Loading

0 comments on commit 681b0e1

Please sign in to comment.