From 036e092282f50d65d78a47d3a009e8baf2e74f46 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Fri, 16 Dec 2022 23:41:36 +0000 Subject: [CodeGen] 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 fixes LLVMMIRParser, LLVMGlobalISel, LLVMAsmPrinter, LLVMSelectionDAG. --- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp') diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index e31135e..c89c634 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -2802,7 +2802,7 @@ void CodeViewDebug::emitLocalVariableList(const FunctionInfo &FI, // If ConstantValue is set we will emit it as a S_CONSTANT instead of a // S_LOCAL in order to be able to represent it at all. const DIType *Ty = L.DIVar->getType(); - APSInt Val(L.ConstantValue.value()); + APSInt Val(*L.ConstantValue); emitConstantSymbolRecord(Ty, Val, std::string(L.DIVar->getName())); } else { emitLocalVariable(FI, L); -- cgit v1.1