[llvm] [BOLT][DWARF] Updated DW_AT_comp_dir/DW_AT_dwo_name for DWO TUs. (PR #91486)

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 15:35:27 PDT 2024


================
@@ -41,6 +42,92 @@ extern cl::opt<unsigned> Verbosity;
 namespace llvm {
 namespace bolt {
 
+/// Returns DWO Name to be used. Handles case where user specifies output DWO
+/// directory, and there are duplicate names. Assumes DWO ID is unique.
+static std::string
+getDWOName(llvm::DWARFUnit &CU,
+           std::unordered_map<std::string, uint32_t> &NameToIndexMap,
+           std::optional<StringRef> &DwarfOutputPath) {
+  std::optional<uint64_t> DWOId = CU.getDWOId();
+  assert(DWOId && "DWO ID not found.");
----------------
dcci wrote:

you can probably just fold it in the assertion to avoid the cast to void, i.e.

`assert(CU.getDWOID(), ...)`

https://github.com/llvm/llvm-project/pull/91486


More information about the llvm-commits mailing list