aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp
AgeCommit message (Collapse)AuthorFilesLines
2025-06-06[symbolizer] Update Release notes. (#142951)Ebuka Ezike1-1/+1
Also add post-commit changes from commit #71ba852 in PR #135857 --------- Co-authored-by: James Henderson <James.Henderson@sony.com>
2025-05-30[symbolizer] Address starting with a plus sign is valid. (#135857)Ebuka Ezike1-3/+6
this is also the same behaviour in `gnu addr2line`. The change only applies if the binary is llvm-addr2line --------- Signed-off-by: Ebuka Ezike <yerimyah1@gmail.com>
2025-05-13LLVM symbolizer gsym support - attempt 2 (#139686)Mariusz Kwiczala1-0/+2
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 Bao1-2/+0
Reverts llvm/llvm-project#134847
2025-05-12LLVM symbolizer gsym support (#134847)Mariusz Kwiczala1-0/+2
Add support for gsym files to llvm-symbolizer. co-author @sfc-gh-sgiesecke --------- Co-authored-by: David Blaikie <dblaikie@gmail.com>
2024-12-11Rework the `Option` library to reduce dynamic relocations (#119198)Chandler Carruth1-6/+8
Apologies for the large change, I looked for ways to break this up and all of the ones I saw added real complexity. This change focuses on the option's prefixed names and the array of prefixes. These are present in every option and the dominant source of dynamic relocations for PIE or PIC users of LLVM and Clang tooling. In some cases, 100s or 1000s of them for the Clang driver which has a huge number of options. This PR addresses this by building a string table and a prefixes table that can be referenced with indices rather than pointers that require dynamic relocations. This removes almost 7k dynmaic relocations from the `clang` binary, roughly 8% of the remaining dynmaic relocations outside of vtables. For busy-boxing use cases where many different option tables are linked into the same binary, the savings add up a bit more. The string table is a straightforward mechanism, but the prefixes required some subtlety. They are encoded in a Pascal-string fashion with a size followed by a sequence of offsets. This works relatively well for the small realistic prefixes arrays in use. Lots of code has to change in order to land this though: both all the option library code has to be updated to use the string table and prefixes table, and all the users of the options library have to be updated to correctly instantiate the objects. Some follow-up patches in the works to provide an abstraction for this style of code, and to start using the same technique for some of the other strings here now that the infrastructure is in place.
2024-08-05[Symbolizer] Support for Missing Line Numbers. (#82240)Amit Kumar Pandey1-0/+1
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-07-05[symbolizer] Empty string is not an error (#97781)Serge Pavlov1-0/+8
This is recommit of llvm/llvm-project#92660, reverted in llvm/llvm-project#94424. Original commit message is below. After commit https://github.com/llvm/llvm-project/commit/1792852f86dc75efa1f44d46b1a0daf386d64afa ([symbolizer] Change reaction on invalid input) llvm-symbolizer issues an error on malformed command instead of echoing it to the standard output, as in previous versions. It turns out this behavior broke a use case when echoing was used to check if llvm-symbolizer is working (https://github.com/llvm/llvm-project/commit/1792852f86dc75efa1f44d46b1a0daf386d64afa#commitcomment-142161925). With this change an empty line as input is not considered as an error anymore and does not produce any output on stderr. llvm-symbolizer still respond on empty line with line not found, this is consistent with GNU addr2line.
2024-06-05Revert "[symbolizer] Empty string is not an error" (#94424)Serge Pavlov1-8/+0
Reverts llvm/llvm-project#92660 It needs more discussion.
2024-06-03[symbolizer] Empty string is not an error (#92660)Serge Pavlov1-0/+8
After commit 1792852f86dc7 ([symbolizer] Change reaction on invalid input) llvm-symbolizer issues an error on malformed command instead of echoing it to the standard output, as in previous versions. It turns out this behavior broke a use case when echoing was used to check if llvm-symbolizer is working (https://github.com/llvm/llvm-project/commit/1792852f86dc75efa1f44d46b1a0daf386d64afa#commitcomment-142161925). With this change an empty line as input is not considered as an error anymore and does not produce any output on stderr. llvm-symbolizer still respond on empty line with line not found, this is consistent with GNU addr2line. --------- Co-authored-by: James Henderson <46713263+jh7370@users.noreply.github.com>
2024-01-11[llvm-driver] Fix usage of `InitLLVM` on Windows (#76306)Alexandre Ganea1-2/+0
Previously, some tools such as `clang` or `lld` which require strict order for certain command-line options, such as `clang -cc1` or `lld -flavor`, would not longer work on Windows, when these tools were linked as part of `llvm-driver`. This was caused by `InitLLVM` which was part of the `*_main()` function of these tools, which in turn calls `windows::GetCommandLineArguments`. That function completly replaces argc/argv by new UTF-8 contents, so any ajustements to argc/argv made by `llvm-driver` prior to calling these tools was reset. `InitLLVM` is now called by the `llvm-driver`. Any tool that participates in (or is part of) the `llvm-driver` doesn't call `InitLLVM` anymore.
2023-12-15[symbolizer] Support symbol+offset lookup (#75067)Serge Pavlov1-12/+38
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-1/+1
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-01[symbolizer] Support symbol lookupSerge Pavlov1-25/+33
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 Pavlov1-33/+25
This reverts commit 2b27948783e4bbc1132d3220d8517ef62607b558. On some buildbots the test LLVM::interrupts.test start failing.
2023-10-02[symbolizer] Support symbol lookupSerge Pavlov1-25/+33
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-25/+56
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-17[llvm-{debuginfod,ml,objdump,symbolizer}, dsymutil] Enable multicall driverAndrés Villegas1-1/+2
Differential Revision: https://reviews.llvm.org/D157670
2023-08-17Revert "[llvm-{debuginfod,ml,objdump,symbolizer}, dsymutil] Enable multicall ↵Petr Hosek1-2/+1
driver" This reverts commit 2628fa3351b021d2ab82dcd833a14d7b52840a01 since it broke the multicall driver build.
2023-08-17[llvm-{debuginfod,ml,objdump,symbolizer}, dsymutil] Enable multicall driverAndrés Villegas1-1/+2
Differential Revision: https://reviews.llvm.org/D157670
2023-08-15Reapply "[Option] Add "Visibility" field and clone the OptTable APIs to use it"Justin Bogner1-0/+1
This reverts commit 4e3b89483a6922d3f48670bb1c50a37f342918c6, with fixes for places I'd missed updating in lld and lldb. I've also renamed OptionVisibility::Default to "DefaultVis" to avoid ambiguity since the undecorated name has to be available anywhere Options.inc is included. Original message follows: This splits OptTable's "Flags" field into "Flags" and "Visibility", updates the places where we instantiate Option tables, and adds variants of the OptTable APIs that use Visibility mask instead of Include/Exclude flags. We need to do this to clean up a bunch of complexity in the clang driver's option handling - there's a whole slew of flags like CoreOption, NoDriverOption, and FlangOnlyOption there today to try to handle all of the permutations of flags that the various drivers need, but it really doesn't scale well, as can be seen by things like the somewhat recently introduced CLDXCOption. Instead, we'll provide an additive model for visibility that's separate from the other flags. For things like "HelpHidden", which is used as a "subtractive" modifier for option visibility, we leave that in "Flags" and handle it as a special case. Note that we don't actually update the users of the Include/Exclude APIs here or change the flags that exist in clang at all - that will come in a follow up that refactors clang's Options.td to use the increased flexibility this change allows. Differential Revision: https://reviews.llvm.org/D157149
2023-08-14Revert "[Option] Add "Visibility" field and clone the OptTable APIs to use it"Justin Bogner1-1/+0
this is failing on bots, reverting to investigate. This reverts commit a16104e6da6f36f3d72dbf53d10ba56495a0d65a.
2023-08-14[Option] Add "Visibility" field and clone the OptTable APIs to use itJustin Bogner1-0/+1
This splits OptTable's "Flags" field into "Flags" and "Visibility", updates the places where we instantiate Option tables, and adds variants of the OptTable APIs that use Visibility mask instead of Include/Exclude flags. We need to do this to clean up a bunch of complexity in the clang driver's option handling - there's a whole slew of flags like CoreOption, NoDriverOption, and FlangOnlyOption there today to try to handle all of the permutations of flags that the various drivers need, but it really doesn't scale well, as can be seen by things like the somewhat recently introduced CLDXCOption. Instead, we'll provide an additive model for visibility that's separate from the other flags. For things like "HelpHidden", which is used as a "subtractive" modifier for option visibility, we leave that in "Flags" and handle it as a special case. Note that we don't actually update the users of the Include/Exclude APIs here or change the flags that exist in clang at all - that will come in a follow up that refactors clang's Options.td to use the increased flexibility this change allows. Differential Revision: https://reviews.llvm.org/D157149
2023-08-13[llvm-objdump,llvm-symbolizer] Remove unused ExitOnErr after D136702. NFCFangrui Song1-2/+0
2023-08-12Revert "[symbolizer] Change reaction on invalid input"Douglas Yung1-36/+22
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-22/+36
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-11[symbolizer][NFC] Reorganize parsing input binary fileSerge Pavlov1-27/+39
Now llvm-symbolizer prints input string if parsing command failed, whithout explanation that is wrong. As a first step in making the interface more user-friendly, this change reorganize parsing so that generation of messages becomes easier. Differential Revision: https://reviews.llvm.org/D157203
2023-08-09[symbolizer][NFC] Move file argument parsing into separate functionSerge Pavlov1-21/+29
The code that gets binary file name is moved to a separate function. It makes the code of `parseCommand` cleaner and allows to reuse the parsing code. Differential Revision: https://reviews.llvm.org/D156978
2023-08-04[llvm] Extract common `OptTable` bits into macrosJan Svoboda1-10/+2
All command-line tools using `llvm::opt` create an enum of option IDs and a table of `OptTable::Info` object. Most of the tools use the same ID (`OPT_##ID`), kind (`Option::KIND##Class`), group ID (`OPT_##GROUP`) and alias ID (`OPT_##ALIAS`). This patch extracts that common code into canonical macros. This results in fewer changes when tweaking the `OPTION` macros emitted by the TableGen backend. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D157028
2023-06-28[symbolizer] Exit early if input file is absentSerge Pavlov1-1/+1
If binary file specified as input with option --obj or -e is absent, now llvm-addr2line exits immediately. This patch extends this behavior to llvm-symbolizer. Previously llvm-symbolizer waited addresses from input stream or command line in this case. Differential Revision: https://reviews.llvm.org/D153219
2023-06-23[llvm-addr2line] Replace checkFileExists with getOrCreateModuleInfoFangrui Song1-6/+9
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-0/+11
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-04-23[symbolizer] Change error message if module not found (recommit)Serge Pavlov1-5/+16
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-14Revert "[symbolizer] Change error message if module not found"Serge Pavlov1-16/+5
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 Pavlov1-5/+16
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-05[Object] Refactor build ID parsing into Object lib.Daniel Thornburgh1-9/+0
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-30[symbolizer] Build 'Request' object in single point. NFCSerge Pavlov1-5/+6
All control paths in executeCommand create Request object for use in calls to 'print' function and do it identically. With this change the Request object is created in a single point, which simplifies changing implementation of Request class. This is a prerequisite patch for implementation of symbol+offset lookup. Differential Revision: https://reviews.llvm.org/D147115
2023-01-26Reland: [llvm-cov] Look up object files using debuginfodDaniel Thornburgh1-7/+1
Reviewed By: gulfem Differential Revision: https://reviews.llvm.org/D136702
2023-01-25Revert "[llvm-cov] Look up object files using debuginfod"Douglas Yung1-1/+7
This reverts commit efbc8bb18eda63007216ad0cb5a8de04963eddd5. This change is causing failures when detecting curl on several build bots: - https://lab.llvm.org/buildbot/#/builders/247/builds/884 - https://lab.llvm.org/buildbot/#/builders/231/builds/7688 - https://lab.llvm.org/buildbot/#/builders/121/builds/27389 - https://lab.llvm.org/buildbot/#/builders/230/builds/8464 - https://lab.llvm.org/buildbot/#/builders/57/builds/24209 - https://lab.llvm.org/buildbot/#/builders/127/builds/42722
2023-01-25[llvm-cov] Look up object files using debuginfodDaniel Thornburgh1-7/+1
Reviewed By: gulfem Differential Revision: https://reviews.llvm.org/D136702
2023-01-12[OptTable] Precompute OptTable prefixes union table through tablegenserge-sans-paille1-2/+2
This avoid rediscovering this table when reading each options, providing a sensible 2% speedup when processing and empty file, and a measurable speedup on typical workloads, see: This is optional, the legacy, on-the-fly, approach can still be used through the GenericOptTable class, while the new one is used through PrecomputedOptTable. https://llvm-compile-time-tracker.com/compare.php?from=4da6cb3202817ee2897d6b690e4af950459caea4&to=19a492b704e8f5c1dea120b9c0d3859bd78796be&stat=instructions:u Differential Revision: https://reviews.llvm.org/D140800
2022-12-27[clang] Use a StringRef instead of a raw char pointer to store builtin and ↵serge-sans-paille1-1/+4
call information This avoids recomputing string length that is already known at compile time. It has a slight impact on preprocessing / compile time, see https://llvm-compile-time-tracker.com/compare.php?from=3f36d2d579d8b0e8824d9dd99bfa79f456858f88&to=e49640c507ddc6615b5e503144301c8e41f8f434&stat=instructions:u This a recommit of e953ae5bbc313fd0cc980ce021d487e5b5199ea4 and the subsequent fixes caa713559bd38f337d7d35de35686775e8fb5175 and 06b90e2e9c991e211fecc97948e533320a825470. The above patchset caused some version of GCC to take eons to compile clang/lib/Basic/Targets/AArch64.cpp, as spotted in aa171833ab0017d9732e82b8682c9848ab25ff9e. The fix is to make BuiltinInfo tables a compilation unit static variable, instead of a private static variable. Differential Revision: https://reviews.llvm.org/D139881
2022-12-25Revert "[clang] Use a StringRef instead of a raw char pointer to store ↵Vitaly Buka1-4/+1
builtin and call information" Revert "Fix lldb option handling since e953ae5bbc313fd0cc980ce021d487e5b5199ea4 (part 2)" Revert "Fix lldb option handling since e953ae5bbc313fd0cc980ce021d487e5b5199ea4" GCC build hangs on this bot https://lab.llvm.org/buildbot/#/builders/37/builds/19104 compiling CMakeFiles/obj.clangBasic.dir/Targets/AArch64.cpp.d The bot uses GNU 11.3.0, but I can reproduce locally with gcc (Debian 12.2.0-3) 12.2.0. This reverts commit caa713559bd38f337d7d35de35686775e8fb5175. This reverts commit 06b90e2e9c991e211fecc97948e533320a825470. This reverts commit e953ae5bbc313fd0cc980ce021d487e5b5199ea4.
2022-12-24[clang] Use a StringRef instead of a raw char pointer to store builtin and ↵serge-sans-paille1-1/+4
call information This avoids recomputing string length that is already known at compile time. It has a slight impact on preprocessing / compile time, see https://llvm-compile-time-tracker.com/compare.php?from=3f36d2d579d8b0e8824d9dd99bfa79f456858f88&to=e49640c507ddc6615b5e503144301c8e41f8f434&stat=instructions:u This is a recommit of 719d98dfa841c522d8d452f0685e503538415a53 that into account a GGC issue (probably https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92181) when dealing with intiailizer_list and constant expressions. Workaround this by avoiding initializer list, at the expense of a temporary plain old array. Differential Revision: https://reviews.llvm.org/D139881
2022-12-23Revert "[clang] Use a StringRef instead of a raw char pointer to store ↵serge-sans-paille1-3/+2
builtin and call information" There are still remaining issues with GCC 12, see for instance https://lab.llvm.org/buildbot/#/builders/93/builds/12669 This reverts commit 5ce4e92264102de21760c94db9166afe8f71fcf6.
2022-12-23[clang] Use a StringRef instead of a raw char pointer to store builtin and ↵serge-sans-paille1-2/+3
call information This avoids recomputing string length that is already known at compile time. It has a slight impact on preprocessing / compile time, see https://llvm-compile-time-tracker.com/compare.php?from=3f36d2d579d8b0e8824d9dd99bfa79f456858f88&to=e49640c507ddc6615b5e503144301c8e41f8f434&stat=instructions:u This is a recommit of 719d98dfa841c522d8d452f0685e503538415a53 with a change to llvm/utils/TableGen/OptParserEmitter.cpp to cope with GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108158 Differential Revision: https://reviews.llvm.org/D139881
2022-12-23Revert "[clang] Use a StringRef instead of a raw char pointer to store ↵serge-sans-paille1-3/+2
builtin and call information" Failing builds: https://lab.llvm.org/buildbot#builders/9/builds/19030 This is GCC specific and has been reported upstream: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108158 This reverts commit 719d98dfa841c522d8d452f0685e503538415a53.
2022-12-23[clang] Use a StringRef instead of a raw char pointer to store builtin and ↵serge-sans-paille1-2/+3
call information This avoids recomputing string length that is already known at compile time. It has a slight impact on preprocessing / compile time, see https://llvm-compile-time-tracker.com/compare.php?from=3f36d2d579d8b0e8824d9dd99bfa79f456858f88&to=e49640c507ddc6615b5e503144301c8e41f8f434&stat=instructions:u Differential Revision: https://reviews.llvm.org/D139881
2022-12-08Store OptTable::Info::Name as a StringRefserge-sans-paille1-1/+1
This is a recommit of 8ae18303f97d5dcfaecc90b4d87effb2011ed82e, with a few cleanups. This avoids implicit conversion to StringRef at several points, which in turns avoid redundant calls to strlen. As a side effect, this greatly simplifies the implementation of StrCmpOptionNameIgnoreCase. It also eventually gives a consistent, humble speedup in compilation time (timing updated since original commit). https://llvm-compile-time-tracker.com/compare.php?from=de4b6a1bc64db33643f001ad45fae7b92b4a4688&to=c23a93d1292052b4be2fbe8c586fa31143d0c7ed&stat=instructions:u Differential Revision: https://reviews.llvm.org/D139274
2022-12-05[DebugInfo] llvm::Optional => std::optionalFangrui Song1-2/+2
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716