[llvm] 644159e - [AsmPrinter] Use std::optional::value_or (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 26 14:21:37 PST 2022
Author: Kazu Hirata
Date: 2022-11-26T14:21:32-08:00
New Revision: 644159e20b9db43988b8501303e2dd332c7f9195
URL: https://github.com/llvm/llvm-project/commit/644159e20b9db43988b8501303e2dd332c7f9195
DIFF: https://github.com/llvm/llvm-project/commit/644159e20b9db43988b8501303e2dd332c7f9195.diff
LOG: [AsmPrinter] Use std::optional::value_or (NFC)
Added:
Modified:
llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index 7437ed624ff3..021a72c5a9ff 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -341,7 +341,7 @@ void DwarfCompileUnit::addLocationAttribute(
// correctly interpret address space of the variable address.
const unsigned NVPTX_ADDR_global_space = 5;
addUInt(*VariableDIE, dwarf::DW_AT_address_class, dwarf::DW_FORM_data1,
- NVPTXAddressSpace ? *NVPTXAddressSpace : NVPTX_ADDR_global_space);
+ NVPTXAddressSpace.value_or(NVPTX_ADDR_global_space));
}
if (Loc)
addBlock(*VariableDIE, dwarf::DW_AT_location, DwarfExpr->finalize());
@@ -896,7 +896,7 @@ DIE *DwarfCompileUnit::constructVariableDIEImpl(const DbgVariable &DV,
// correctly interpret address space of the variable address.
const unsigned NVPTX_ADDR_local_space = 6;
addUInt(*VariableDie, dwarf::DW_AT_address_class, dwarf::DW_FORM_data1,
- NVPTXAddressSpace ? *NVPTXAddressSpace : NVPTX_ADDR_local_space);
+ NVPTXAddressSpace.value_or(NVPTX_ADDR_local_space));
}
addBlock(*VariableDie, dwarf::DW_AT_location, DwarfExpr.finalize());
if (DwarfExpr.TagOffset)
More information about the llvm-commits
mailing list