[clang] Use std::optional::value_or (NFC) (#109894)
This commit is contained in:
@@ -39,7 +39,7 @@ class EnumPropertyType<string typeName = ""> : PropertyType<typeName> {}
|
||||
/// Supports optional values by using the null representation.
|
||||
class RefPropertyType<string className> : PropertyType<className # "*"> {
|
||||
let PackOptional =
|
||||
"value ? *value : nullptr";
|
||||
"value.value_or(nullptr)";
|
||||
let UnpackOptional =
|
||||
"value ? std::optional<" # CXXName # ">(value) : std::nullopt";
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ public:
|
||||
bool RequiresNullTerminator = true,
|
||||
std::optional<int64_t> MaybeLimit = std::nullopt) const {
|
||||
return getBufferForFileImpl(Filename,
|
||||
/*FileSize=*/(MaybeLimit ? *MaybeLimit : -1),
|
||||
/*FileSize=*/MaybeLimit.value_or(-1),
|
||||
isVolatile, RequiresNullTerminator);
|
||||
}
|
||||
|
||||
|
||||
@@ -757,8 +757,8 @@ public:
|
||||
OutInfo.addTypeInfo(idx++, N);
|
||||
audited = Nullability.size() > 0 || ReturnNullability;
|
||||
if (audited)
|
||||
OutInfo.addTypeInfo(0, ReturnNullability ? *ReturnNullability
|
||||
: NullabilityKind::NonNull);
|
||||
OutInfo.addTypeInfo(0,
|
||||
ReturnNullability.value_or(NullabilityKind::NonNull));
|
||||
if (!audited)
|
||||
return;
|
||||
OutInfo.NullabilityAudited = audited;
|
||||
|
||||
Reference in New Issue
Block a user