aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/DebugInfo/Symbolize
AgeCommit message (Collapse)AuthorFilesLines
2025-05-16Rename GsymDIContext to GsymContext (#140227)Mariusz Kwiczala1-3/+3
Renaming based on suggestion here: https://github.com/llvm/llvm-project/pull/139686#discussion_r2089538528
2025-05-13LLVM symbolizer gsym support - attempt 2 (#139686)Mariusz Kwiczala2-23/+72
Add support for gsym files to llvm-symbolizer. co-author @sfc-gh-sgiesecke Notes: There was a PR that was approved and merged: https://github.com/llvm/llvm-project/pull/134847 and reverted: https://github.com/llvm/llvm-project/pull/139660 Due to buildbot failures: https://lab.llvm.org/buildbot/#/builders/66/builds/13851 - it looks like related https://lab.llvm.org/buildbot/#/builders/51/builds/16018 - it looks like related https://lab.llvm.org/buildbot/#/builders/146/builds/2905 - it looks like it's not related to changes Fix: To fix missing GSYM symbols ``` + diff -u expected.new undefined.new +_ZN4llvm4gsym10GsymReader8openFileENS_9StringRefE U +_ZN4llvm4gsym10GsymReaderC1EOS1_ U +_ZN4llvm4gsym10GsymReaderD1Ev U +_ZN4llvm4gsym13GsymDIContextC1ENSt20__InternalSymbolizer10unique_ptrINS0_10GsymReaderENS2_14default_deleteIS4_EEEE U + echo 'Failed: unexpected symbols' ``` for script compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh LLVMDebugInfoGSYM was added. Please check the commit: https://github.com/llvm/llvm-project/pull/139686/commits/ba55425db9fd8fd1ebb06a4c8d8c95eef213444f That's the only change compare to https://github.com/llvm/llvm-project/pull/134847
2025-05-12Revert "LLVM symbolizer gsym support" (#139660)Qinkun Bao2-72/+23
Reverts llvm/llvm-project#134847
2025-05-12LLVM symbolizer gsym support (#134847)Mariusz Kwiczala2-23/+72
Add support for gsym files to llvm-symbolizer. co-author @sfc-gh-sgiesecke --------- Co-authored-by: David Blaikie <dblaikie@gmail.com>
2025-04-16[DebugInfo] Use StringRef::starts_with (NFC) (#135933)Kazu Hirata1-1/+1
2025-04-11[NFC][LLVM] Apply std::move to object being pushed back in findSymbolCommon ↵Shafik Yaghmour1-1/+1
(#135290) Static analysis found that we could move LineInfo into the Result vector instead of just copying it.
2025-03-25[Symbolize] Always use filename:line from debug info when debug info for the ↵Zequan Wu1-6/+13
given address is available. (#128619) To reland https://github.com/llvm/llvm-project/pull/124846, we need to make symbolizer consistent with the case when line number is 0. Always using filename and line from debug info even if the line number is 0 sounds like the reasonable path to go.
2025-03-17[NFC][DebugInfo] Wrap DILineInfo return type with std::optional to handle ↵Zequan Wu1-6/+10
missing debug info. (#129792) Currently, `DIContext::getLineInfoForAddress` and `DIContext::getLineInfoForDataAddress` returns empty DILineInfo when the debug info is missing for the given address. This is not differentiable with the case when debug info is found for the given address but the debug info is default value (filename:linenum is <invalid>:0). This change wraps the return types of `DIContext::getLineInfoForAddress` and `DIContext::getLineInfoForDataAddress` with `std::optional`.
2024-11-29[DebugInfo] Clean up LLVMSymbolizer::DemangleName API: const string& -> ↵itrofimow1-3/+3
StringRef (#118056)
2024-11-17[DebugInfo] Remove unused includes (NFC) (#116551)Kazu Hirata4-6/+0
Identified with misc-include-cleaner.
2024-08-21[Symbolizer, DebugInfo] Clean up LLVMSymbolizer API: const string& -> ↵itrofimow1-10/+11
StringRef (#104541) Nothing in the affected code depends on the `ModuleName` being null-terminated, so take it by `StringRef` instead of `const std::string &`. This change simplifies API consumption, since one doesn't always have a `std::string` at the call site (might have `std::string_view` instead), and also gives some minor performance improvements by removing string-copies in the cache-hit path of `getOrCreateModuleInfo`.
2024-08-05[Symbolizer] Support for Missing Line Numbers. (#82240)Amit Kumar Pandey2-4/+18
LLVM Symbolizer attempt to symbolize addresses of optimized binaries reports missing line numbers for some cases. It maybe due to compiler which sometimes cannot map an instruction to line number due to optimizations. Symbolizer should handle those cases gracefully. Adding an option '--skip-line-zero' to symbolizer so as to report the nearest non-zero line number. --------- Co-authored-by: Amit Pandey <amit.pandey@amd.com>
2024-05-07[Analysis, CodeGen, DebugInfo] Use StringRef::operator== instead of ↵Kazu Hirata1-1/+1
StringRef::equals (NFC) (#91304) I'm planning to remove StringRef::equals in favor of StringRef::operator==. - StringRef::operator==/!= outnumber StringRef::equals by a factor of 53 under llvm/ in terms of their usage. - The elimination of StringRef::equals brings StringRef closer to std::string_view, which has operator== but not equals. - S == "foo" is more readable than S.equals("foo"), especially for !Long.Expression.equals("str") vs Long.Expression != "str".
2024-03-15[llvm-profgen] Support COFF binary (#83972)Haohai Wen1-3/+10
Intel Vtune/SEP has supported collecting LBR on Windows and generating perf-script file which is same format as Linux perf script. This patch teaches llvm-profgen to disassemble COFF binary so that we can do Sampling based PGO on Windows.
2024-01-19[llvm] Use SmallString::operator std::string (NFC)Kazu Hirata1-1/+1
2024-01-17[DebugInfo] Use StringRef::consume_front (NFC)Kazu Hirata1-2/+2
2024-01-11[llvm] Use SmallString::operator std::string() (NFC)Kazu Hirata1-3/+3
2024-01-11[llvm] Use StringRef::consume_front_insensitive (NFC)Kazu Hirata1-6/+3
2023-12-15[symbolizer] Support symbol+offset lookup (#75067)Serge Pavlov2-11/+17
GNU addr2line supports lookup by symbol name in addition to the existing address lookup. llvm-symbolizer starting from e144ae54dcb96838a6176fd9eef21028935ccd4f supports lookup by symbol name. This change extends this lookup with possibility to specify optional offset. Now the address for which source information is searched for can be specified with offset: llvm-symbolize --obj=abc.so "SYMBOL func_22+0x12" It decreases the gap in features of llvm-symbolizer and GNU addr2line. This lookup now is supported for code only. Migrated from: https://reviews.llvm.org/D139859 Pull request: https://github.com/llvm/llvm-project/pull/75067
2023-12-14[DebugInfo] Pass string ownership to MarkupFilter (#75403)Vitaly Buka1-4/+6
Last `getline` call destroys `InputString`, and `finish` accesses dead `StringRef`. Detected with #72677. Fixes https://lab.llvm.org/buildbot/#/builders/sanitizer-x86_64-linux-fast
2023-11-06[DebugInfo] Use StringRef::starts_with/ends_with instead of ↵Simon Pilgrim3-4/+4
startswith/endswith. NFC. startswith/endswith wrap starts_with/ends_with and will eventually go away (to more closely match string_view)
2023-11-01[symbolizer] Support symbol lookupSerge Pavlov3-0/+83
Recent versions of GNU binutils starting from 2.39 support symbol+offset lookup in addition to the usual numeric address lookup. This change adds symbol lookup to llvm-symbolize and llvm-addr2line. Now llvm-symbolize behaves closer to GNU addr2line, - if the value specified as address in command line or input stream is not a number, it is treated as a symbol name. For example: llvm-symbolize --obj=abc.so func_22 llvm-symbolize --obj=abc.so "CODE func_22" This lookup is now supported only for functions. Specification with offset is not supported yet. This is a recommit of 2b27948783e4bbc1132d3220d8517ef62607b558, reverted in 39fec5457c0925bd39f67f63fe17391584e08258 because the test llvm/test/Support/interrupts.test started failing on Windows. The test was changed in 18f036d0105589c3175bb51a518c5d272dae61e2 and is also updated in this commit. Differential Revision: https://reviews.llvm.org/D149759
2023-10-02Revert "[symbolizer] Support symbol lookup"Serge Pavlov3-83/+0
This reverts commit 2b27948783e4bbc1132d3220d8517ef62607b558. On some buildbots the test LLVM::interrupts.test start failing.
2023-10-02[symbolizer] Support symbol lookupSerge Pavlov3-0/+83
Recent versions of GNU binutils starting from 2.39 support symbol+offset lookup in addition to the usual numeric address lookup. This change adds symbol lookup to llvm-symbolize and llvm-addr2line. Now llvm-symbolize behaves closer to GNU addr2line, - if the value specified as address in command line or input stream is not a number, it is treated as a symbol name. For example: llvm-symbolize --obj=abc.so func_22 llvm-symbolize --obj=abc.so "CODE func_22" This lookup is now supported only for functions. Specification with offset is not supported yet. Differential Revision: https://reviews.llvm.org/D149759
2023-08-30[symbolizer] Change reaction on invalid inputSerge Pavlov1-16/+4
If llvm-symbolizer finds a malformed command, it echoes it to the standard output. New versions of binutils (starting from 2.39) allow to specify an address by a symbols. Implementation of this feature in llvm-symbolizer makes the current reaction on invalid input inappropriate. Almost any invalid command may be treated as a symbol name, so the right reaction should be "symbol not found" in such case. The exception are commands that are recognized but have incorrect syntax, like "FILE:FILE:". The utility must produce descriptive diagnostic for such input and route it to the stderr. This change implements the new reaction on invalid input and is a prerequisite for implementation of symbol lookup in llvm-symbolizer. Differential Revision: https://reviews.llvm.org/D157210
2023-08-12Revert "[symbolizer] Change reaction on invalid input"Douglas Yung1-4/+16
This reverts commit a5fe6c7f5e2d1d265bd7c312ef55259fee7a68f9. This change is causing problems with Windows build bots due to a hanging zombie llvm-symbolizer.exe process.
2023-08-12[symbolizer] Change reaction on invalid inputSerge Pavlov1-16/+4
If llvm-symbolizer finds a malformed command, it echoes it to the standard output. New versions of binutils (starting from 2.39) allow to specify an address by a symbols. Implementation of this feature in llvm-symbolizer makes the current reaction on invalid input inappropriate. Almost any invalid command may be treated as a symbol name, so the right reaction should be "symbol not found" in such case. The exception are commands that are recognized but have incorrect syntax, like "FILE:FILE:". The utility must produce descriptive diagnostic for such input and route it to the stderr. This change implements the new reaction on invalid input and is a prerequisite for implementation of symbol lookup in llvm-symbolizer. Differential Revision: https://reviews.llvm.org/D157210
2023-07-12[BPF][DebugInfo] Use .BPF.ext for line info when DWARF is not availableEduard Zingerman2-1/+14
"BTF" is a debug information format used by LLVM's BPF backend. The format is much smaller in scope than DWARF, the following info is available: - full set of C types used in the binary file; - types for global values; - line number / line source code information . BTF information is embedded in ELF as .BTF and .BTF.ext sections. Detailed format description could be found as a part of Linux Source tree, e.g. here: [1]. This commit modifies `llvm-objdump` utility to use line number information provided by BTF if DWARF information is not available. E.g., the goal is to make the following to print source code lines, interleaved with disassembly: $ clang --target=bpf -g test.c -o test.o $ llvm-strip --strip-debug test.o $ llvm-objdump -Sd test.o test.o: file format elf64-bpf Disassembly of section .text: <foo>: ; void foo(void) { r1 = 0x1 ; consume(1); call -0x1 r1 = 0x2 ; consume(2); call -0x1 ; } exit A common production use case for BPF programs is to: - compile separate object files using clang with `-g -c` flags; - link these files as a final "static" binary using bpftool linker ([2]). The bpftool linker discards most of the DWARF sections (line information sections as well) but merges .BTF and .BTF.ext sections. Hence, having `llvm-objdump` capable to print source code using .BTF.ext is valuable. The commit consists of the following modifications: - llvm/lib/DebugInfo/BTF aka `DebugInfoBTF` component is added to host the code needed to process BTF (with assumption that BTF support would be added to some other tools as well, e.g. `llvm-readelf`): - `DebugInfoBTF` provides `llvm::BTFParser` class, that loads information from `.BTF` and `.BTF.ext` sections of a given `object::ObjectFile` instance and allows to query this information. Currently only line number information is loaded. - `DebugInfoBTF` also provides `llvm::BTFContext` class, which is an implementation of `DIContext` interface, used by `llvm-objdump` to query information about line numbers corresponding to specific instructions. - Structure `DILineInfo` is modified with field `LineSource`. `DIContext` interface uses `DILineInfo` structure to communicate line number and source code information. Specifically, `DILineInfo::Source` field encodes full file source code, if available. BTF only stores source code for selected lines of the file, not a complete source file. Moreover, stored lines are not guaranteed to be sorted in a specific order. To avoid reconstruction of a file source code from a set of available lines, this commit adds `LineSource` field instead. - `Symbolize` class is modified to use `BTFContext` instead of `DWARFContext` when DWARF sections are not available but BTF sections are present in the object file. (`Symbolize` is instantiated by `llvm-objdump`). - Integration and unit tests. Note, that DWARF has a notion of "instruction sequence". DWARF implementation of `DIContext::getLineInfoForAddress()` provides inexact responses if exact address information is not available but address falls within "instruction sequence" with some known line information (see `DWARFDebugLine::LineTable::findRowInSeq()`). BTF does not provide instruction sequence groupings, thus `getLineInfoForAddress()` queries only return exact matches. This does not seem to be a big issue in practice, but output of the `llvm-objdump -Sd` might differ slightly when BTF is used instead of DWARF. [1] https://www.kernel.org/doc/html/latest/bpf/btf.html [2] https://github.com/libbpf/bpftool Depends on https://reviews.llvm.org/D149501 Reviewed By: MaskRay, yonghong-song, nickdesaulniers, #debug-info Differential Revision: https://reviews.llvm.org/D149058
2023-06-28[Symbolizer] Ignore unknown additional symbolizer markup fieldsDaniel Thornburgh1-20/+17
The symbolizer markup syntax is structured such that fields require only previous fields for their interpretation; this was originally intended to make adding new fields a natural extension mechanism for existing elements. This codifies this into the spec and makes the behavior of the llvm-symbolizer match. Extra fields are now warned about, but ignored, rather than ignoring the whole element. Reviewed By: mcgrathr Differential Revision: https://reviews.llvm.org/D153821
2023-06-23[llvm-addr2line] Replace checkFileExists with getOrCreateModuleInfoFangrui Song1-22/+8
GNU addr2line exits immediately if -e (default to a.out) specifies a file that cannot be open or a directory. llvm-addr2line used to wait for input on if the input file cannot be open and addresses are not specified in command line. Replace the D147652 checkFileExists with getOrCreateModuleInfo to avoid a separate `sys::fs::status` operation. Reviewed By: sepavloff Differential Revision: https://reviews.llvm.org/D153595
2023-06-23[symbolizer] Check existence of input file in GNU modeSerge Pavlov1-8/+22
GNU addr2line exits immediately if it cannot open the file specified as executable/relocatable. In contrast llvm-addr2line does not exit and, if addresses are not specified in command line, waits for input on stdin. This causes the test compiler-rt/test/asan/TestCases/Posix/asan-symbolize-bad-path.cc to block forever on Gentoo (see https://reviews.llvm.org/rG27c4777f41d2ab204c1cf84ff1cccd5ba41354da#1190273). To fix this issue the behavior llvm-addr2line now exits if executable/relocatable file cannot be found. It fixes https://github.com/llvm/llvm-project/issues/42099 (llvm-addr2line does not exit when passed a non-existent file). Differential Revision: https://reviews.llvm.org/D147652
2023-06-05[Demangle] convert microsoftDemangle to take a std::string_viewNick Desaulniers1-1/+1
This should be last of the "bottom-up conversions" of various demanglers to accept std::string_view. After this, D149104 may be revisited. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D152176
2023-06-02[Demangle] convert itaniumDemangle and nonMicrosoftDemangle to use ↵Nick Desaulniers1-2/+2
std::string_view D149104 converted llvm::demangle to use std::string_view. Enabling "expensive checks" (via -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON) causes lld/test/wasm/why-extract.s to fail. The reason for this is obscure: Reason #10007 why std::string_view is dangerous: Consider the following pattern: std::string_view s = ...; const char *c = s.data(); std::strlen(c); Is c a NUL-terminated C style string? It depends; but if it's not then it's not safe to call std::strlen on the std::string_view::data(). std::string_view::length() should be used instead. Fixing this fixes the one lone test that caught this. microsoftDemangle, rustDemangle, and dlangDemangle should get this same treatment, too. I will do that next. Reviewed By: MaskRay, efriedma Differential Revision: https://reviews.llvm.org/D149675
2023-04-23[symbolizer] Change error message if module not found (recommit)Serge Pavlov2-11/+5
This is a recommit of 75f1f158812d, reverted in 7a443b1c493d, because it caused compilation error in compiler-rt/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp. The error was fixed by Kasimir Georgiev in de4c038c7ba2, but this commit was reverted in de088dd3a0aa, because the initial commit was reverted. This commit reverts both the reverting commits, 7a443b1c493d and de088dd3a0aa. Original commit message is below. If llvm-symbolize did not find module, the error looked like: LLVMSymbolizer: error reading file: No such file or directory This message does not follow common practice: LLVMSymbolizer is not an utility name. Also the message did not not contain the name of missed file. With this change the error message looks differently: llvm-symbolizer: error: 'abc': No such file or directory This format is closer to messages produced by other utilities and allow proper coloring. Differential Revision: https://reviews.llvm.org/D148032
2023-04-21[Demangle] remove unused params of microsoftDemangleNick Desaulniers1-1/+1
No call sites use these parameters, so drop them. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D148940
2023-04-14Revert "[symbolizer] Change error message if module not found"Serge Pavlov2-5/+11
This reverts commit 75f1f158812dabc03e70697b6b9c272230bce63d. It caused fail on https://lab.llvm.org/buildbot#builders/37/builds/21461
2023-04-14[symbolizer] Change error message if module not foundSerge Pavlov2-11/+5
If llvm-symbolize did not find module, the error looked like: LLVMSymbolizer: error reading file: No such file or directory This message does not follow common practice: LLVMSymbolizer is not an utility name. Also the message did not not contain the name of missed file. With this change the error message looks differently: llvm-symbolizer: error: 'abc': No such file or directory This format is closer to messages produced by other utilities and allow proper coloring. Differential Revision: https://reviews.llvm.org/D148032
2023-04-13Revert "[symbolizer] Treat invalid address as addr2line does"Serge Pavlov1-5/+0
This reverts commit 27c4777f41d2ab204c1cf84ff1cccd5ba41354da. It created problems for testing on Gentoo, see: https://reviews.llvm.org/rG27c4777f41d2ab204c1cf84ff1cccd5ba41354da#1190273 Reverted until https://reviews.llvm.org/D147652 has been landed.
2023-04-05[Object] Refactor build ID parsing into Object lib.Daniel Thornburgh2-15/+9
This makes parsing for build IDs in the markup filter slightly more permissive, in line with fromHex. It also removes the distinction between missing build ID and empty build ID; empty build IDs aren't a useful concept, since their purpose is to uniquely identify a binary. This removes a layer of indirection wherever build IDs are obtained. Reviewed By: jhenderson Differential Revision: https://reviews.llvm.org/D147485
2023-03-29[symbolizer] Factor out conversion DILineInfo->JSON. NFCSerge Pavlov1-15/+19
Move the conversion of DILineInfo to JSON into a separate function, so it can be used in other places too. This is a prerequisite patch for implementation of symbol+offset lookup. Differential Revision: https://reviews.llvm.org/D147112
2023-03-29[symbolizer] Treat invalid address as addr2line doesSerge Pavlov1-0/+5
llvm-symbolizer echoed input if it was not recognized as a valid address. This behavior was extended to llvm-addr2line as well. GNU addr2line in this case optputs "??:0". This difference prevents implementation of symbol+offset lookup available in the recent versions of GNU binutils. In that case a string that is not an address may be a symbol. This change make reaction of llvm-addr2line on unrecognized input closer to GNU addr2line.
2023-02-15[Symbolize][MinGW] Support demangling i386 call-conv-decorated C++ namesAlvin Wong1-7/+20
On i386 Windows, after C++ names have been Itanium-mangled, the C name mangling specific to its call convention may also be applied on top. This change teaches symbolizer to be able to demangle this type of mangled names. As part of this change, `demanglePE32ExternCFunc` has also been modified to fix unwanted stripping for vectorcall names when the demangled name is supposed to contain a leading `_`. Notice that the vectorcall mangling does not add either an `_` or `@` prefix. The old code always tries to strip the prefix first, which for Itanium mangled names in vectorcall, the leading underscore of the Itanium name gets stripped instead and breaks the Itanium demangler. Differential Revision: https://reviews.llvm.org/D144049
2023-02-07[NFC][TargetParser] Remove llvm/ADT/Triple.hArchibald Elliott1-1/+1
I also ran `git clang-format` to get the headers in the right order for the new location, which has changed the order of other headers in two files.
2022-12-20[Support] Move TargetParsers to new componentArchibald Elliott1-0/+1
This is a fairly large changeset, but it can be broken into a few pieces: - `llvm/Support/*TargetParser*` are all moved from the LLVM Support component into a new LLVM Component called "TargetParser". This potentially enables using tablegen to maintain this information, as is shown in https://reviews.llvm.org/D137517. This cannot currently be done, as llvm-tblgen relies on LLVM's Support component. - This also moves two files from Support which use and depend on information in the TargetParser: - `llvm/Support/Host.{h,cpp}` which contains functions for inspecting the current Host machine for info about it, primarily to support getting the host triple, but also for `-mcpu=native` support in e.g. Clang. This is fairly tightly intertwined with the information in `X86TargetParser.h`, so keeping them in the same component makes sense. - `llvm/ADT/Triple.h` and `llvm/Support/Triple.cpp`, which contains the target triple parser and representation. This is very intertwined with the Arm target parser, because the arm architecture version appears in canonical triples on arm platforms. - I moved the relevant unittests to their own directory. And so, we end up with a single component that has all the information about the following, which to me seems like a unified component: - Triples that LLVM Knows about - Architecture names and CPUs that LLVM knows about - CPU detection logic for LLVM Given this, I have also moved `RISCVISAInfo.h` into this component, as it seems to me to be part of that same set of functionality. If you get link errors in your components after this patch, you likely need to add TargetParser into LLVM_LINK_COMPONENTS in CMake. Differential Revision: https://reviews.llvm.org/D137838
2022-12-06[ADT] Don't including None.h (NFC)Kazu Hirata1-1/+0
These source files no longer use None, so they do not need to include None.h. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-04[llvm] Use std::nullopt instead of None in comments (NFC)Kazu Hirata1-1/+1
This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-04[llvm] Use std::nullopt instead of None in comments (NFC)Kazu Hirata1-1/+1
This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-04[llvm] Use std::nullopt instead of None in comments (NFC)Kazu Hirata1-1/+2
This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-05[DebugInfo] llvm::Optional => std::optionalFangrui Song3-36/+38
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-04[llvm] Use std::nullopt instead of None (NFC)Kazu Hirata1-1/+1
I've verified that every change in this patch affects generated files and would reduce the number of warnings if None were deprecated. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716