std::optional::value => operator*/operator->

value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).

This commit fixes LLVMAnalysis and its dependencies.
This commit is contained in:
Fangrui Song committed 2022-12-16 22:44:08 +00:00
1 parent 27249c06b7
commit 2fa744e631
39 files changed
+144 -159

No files matched your search

+5 -5
View File
@@ -2724,14 +2724,14 @@ void JSONWriter::write(ArrayRef<YAMLVFSEntry> Entries,
OS << "{\n"
" 'version': 0,\n";
if (IsCaseSensitive)
OS << " 'case-sensitive': '"
<< (IsCaseSensitive.value() ? "true" : "false") << "',\n";
OS << " 'case-sensitive': '" << (*IsCaseSensitive ? "true" : "false")
<< "',\n";
if (UseExternalNames)
OS << " 'use-external-names': '"
<< (UseExternalNames.value() ? "true" : "false") << "',\n";
OS << " 'use-external-names': '" << (*UseExternalNames ? "true" : "false")
<< "',\n";
bool UseOverlayRelative = false;
if (IsOverlayRelative) {
UseOverlayRelative = IsOverlayRelative.value();
UseOverlayRelative = *IsOverlayRelative;
OS << " 'overlay-relative': '" << (UseOverlayRelative ? "true" : "false")
<< "',\n";
}