aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support
AgeCommit message (Collapse)AuthorFilesLines
2 days[APFloat] Properly implement next for DoubleAPFloatDavid Majnemer1-4/+126
Rather than converting to the legacy 106-bit format, perform next() on the low APFloat. Of course, we need to renormalize the two APFloats if either of the two constraints are violated: 1. abs(low) <= ulp(high)/2 2. high = rtne(high + low) Should renormalization be needed, it will increment the high component and set low to the smallest value which obeys these rules.
3 days[Support] [Windows] Conditionally compile the SetThreadInformation calls ↵Martin Storsjö1-0/+2
(#151388) The declarations for this API are missing in older mingw-w64 headers (versions before v12). This API is also hidden if building with MS WinSDK if targeting versions before Windows 10. Check whether THREAD_POWER_THROTTLING_CURRENT_VERSION is defined before using this API; this constant is a #define in both WinSDK and mingw-w64.
3 days[win][arm64ec] Fixes to unblock building LLVM and Clang as Arm64EC (#150068)Daniel Paoliello1-1/+2
These changes allow LLVM and Clang to be built with Clang targeting Arm64EC using the MSVC linker. Built with these options: ``` -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_HOST_TRIPLE=arm64ec-pc-windows-msvc -DCMAKE_C_COMPILER=clang-cl.exe -DCMAKE_C_COMPILER_TARGET=arm64ec-pc-windows-msvc -DCMAKE_CXX_COMPILER=clang-cl.exe -DCMAKE_CXX_COMPILER_TARGET=arm64ec-pc-windows-msvc -DCMAKE_LINKER_TYPE=MSVC ```
3 daysNFC: Clean up construction of IntrusiveRefCntPtr from raw pointers for ↵James Y Knight2-6/+8
llvm::vfs::FileSystem. (#151407) This switches to `makeIntrusiveRefCnt<FileSystem>` where creating a new object, and to passing/returning by `IntrusiveRefCntPtr<FileSystem>` instead of `FileSystem*` or `FileSystem&`, when dealing with existing objects. Part of cleanup #151026.
5 daysWindows: use EcoQoS for ThreadPriority::Background (#148797)Tim Blechmann1-0/+60
The SetThreadInformation API allows threads to be scheduled on the most efficient cores on the most efficient frequency. Using this API for ThreadPriority::Background should make clangd-based IDEs a little less CPU hungry. --------- Co-authored-by: Alexandre Ganea <aganea@havenstudios.com>
5 days[Support] Remove an unnecessary cast (NFC) (#151083)Kazu Hirata1-1/+1
NumRead is already of ssize_t.
6 daysIntroduce a "log level" support for DEBUG_TYPE (#150855)Mehdi Amini1-12/+57
This allows to set an optional integer level for a given debug type. The string format is `type[:level]`, and the integer is interpreted as such: - if not provided: all debugging for this debug type is enabled. - if >0: all debug that is < to the level is enabled. - if 0: same as for >0 but also does not disable the other debug-types, it acts as a negative filter. The LDBG() macro is updated to accept an optional log level to illustrate the feature. Here is the expected behavior: LDBG() << "A"; // Identical to LDBG(1) << "A"; LDBG(2) << "B"; With `--debug-only=some_type`: we'll see A and B in the output. With `--debug-only=some_type:1`: we'll see A but not B in the output. With `--debug-only=some_type:2`: we'll see A and B in the output. (same with any level above 2) With `--debug-only=some_type:0`: we'll see neither A nor B in the output, but we'll see any other logging for other debug types.
9 daysRevert "fix: replace report_fatal_error with Diags and exit" (#150662)Aaron Ballman1-24/+6
Reverts llvm/llvm-project#147959
9 daysfix: replace report_fatal_error with Diags and exit (#147959)woruyu1-6/+24
report_fatal_error is not a good way to report diagnostics to the users, so this switches to using actual diagnostic reporting mechanisms instead. Fixes #147187
10 days[llvm] get cl::opt instantiations working with MSVC DLL build (#147810)Andrew Rogers1-5/+22
## Purpose This patch is one in a series of code-mods that annotate LLVM’s public interface for export. This patch annotates the `llvm::cl::opt` explicit template instantiations for export with `LLVM_TEMPLATE_ABI` and `LLVM_EXPORT_TEMPLATE`. This annotation currently has no meaningful impact on the LLVM build; however, it is a prerequisite to support an LLVM Windows DLL (shared library) build. ## Background This effort is tracked in #109483. Additional context is provided in [this discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307), and documentation for `LLVM_ABI` and related annotations is found in the LLVM repo [here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst). Annotating the `llvm::cl::opt` template instances for DLL export was not straight-forward like other explicit template instances that have already been annotated. Annotating them as documented [here](https://github.com/llvm/llvm-project/blob/main/llvm/docs/InterfaceExportAnnotations.rst#templates) results in link errors when building a Windows DLL using MSVC. ## Overview There are two specific issues that appear when exporting the `llvm::cl::opt` templates and compiling a Windows DLL with MSVC: 1. We cannot export `opt<std::string>`. This is because MSVC exports all ancestor classes when exporting an instantiated template class. Since one of `opt`'s ancestor classes is its type argument (via `opt_storage`), it is an ancestor of `std::string`. Therefore, if we export `opt<std::string>` from the LLVM DLL, MSVC forces `std::basic_string` to also be exported. This leads to duplicate symbol errors and generally seems like a bad idea. Compiling with `clang-cl` does not exhibit this behavior. 2. The `opt` template instances other than `opt<bool>` get optimized out because they are not referenced in the TU (`opt<bool>` actually is). It is unclear exactly why MSVC optimizes these template instances away, but `clang-cl` does not. Adding explicit references to the instantiated `opt` template classes' vtables via implicit virtual destructor forces MSVC to export them. ## Validation Windows with MSVC Windows with Clang
10 days [lld][AArch64][Build Attributes] Add support for AArch64 Build Attributes ↵Mark Murray1-0/+27
(#147970) This patch enables lld to read AArch64 Build Attributes and convert them into GNU Properties. Changes: - Parses AArch64 Build Attributes from input object files. - Converts known attributes into corresponding GNU Properties. - Merges attributes when linking multiple objects. Spec reference: https://github.com/ARM-software/abi-aa/pull/230/files#r1030 Co-authored-by: Sivan Shani <sivan.shani@arm.com> --------- Co-authored-by: Sivan Shani <sivan.shani@arm.com>
2025-07-19[Support] System include SipHash.h (#149499)Guy David1-2/+2
A regular include may not search the system include path.
2025-07-19StringMap: Remove redundant member init in constructor (#149491)Matt Arsenault1-10/+2
These are already zeroinitialized in the field definitions.
2025-07-18[Support/BLAKE3] quick fix for Cygwin build (#148635)Tomohiro Kashiwada2-2/+2
BLAKE3 1.8.2 ( imported in d2ad63a193216d008c8161879a59c5f42e0125cc ) fails to build for the Cygwin target. see: https://github.com/BLAKE3-team/BLAKE3/issues/494 As a temporary workaround, add `&& !defined(__CYGWIN__)` to BLAKE3 locally. resolves https://github.com/llvm/llvm-project/issues/148365
2025-07-16[Support][BLAKE3] Restore static on blake3_hash4_neon (#149046)Nikita Popov1-4/+5
This was dropped in #147948 and causes symbol conflicts if libblake3 is also linked.
2025-07-16Revert "[Support] Error if SocketPath is too long" (#149096)Marina Taylor1-8/+0
Reverts llvm/llvm-project#148903 due to bot failure https://lab.llvm.org/buildbot/#/builders/187/builds/8162
2025-07-16[Support] Error if SocketPath is too long (#148903)Marina Taylor1-0/+8
If the path is longer than sockaddr_un's buffer, it will be truncated, at which point it may become indistinguishable from similar truncated paths. This will cause `bind` to fail with an "Address already in use" error. There is some existing code that checks `fs::exists` to catch these errors, but since `fs::exists` compares the full un-truncated paths, a too-long path will prevent those checks from working. rdar://154397133
2025-07-16[Support][BLAKE3] Prefix more blake3 methods (#149007)Jordan Rupprecht1-0/+2
Added by #147948, blake3_xof_many and blake3_compress_subtree_wide cause conflicts when linking llvm and blake3 statically into the same binary. Similar to #148607.
2025-07-15[Support/rpmalloc] Updated fake atomics with Interlocked functions (#148303)Dmitry Vasilyev1-7/+11
Most atomic functions used Interlocked functions in case of MSVC (since MSVC does not do C11 yet). But few load/store functions are dummy. Use Interlocked functions for these atomics to ensure they are thread-safe. This PR fixes #146205. LLVM is on VS 2019 version 16.7 currently and eventually we require VS 2022 if we wanted to use stdatomics in rpmalloc, etc. In the meanwhile, we use the Interlocked intrinsics when building with MSVC.
2025-07-14[Support][BLAKE3] Prefix blake3_xof_many_avx512 (#148607)Nikita Popov1-0/+2
This symbol was introduced in #147948, but not prefixed, resulting in conflicts if libblake3 and LLVM are both linked statically into the same binary.
2025-07-12[Support/BLAKE3] Make g_cpu_features thread safe (#147948)Dmitry Vasilyev14-90/+2660
`g_cpu_features` can be updated multiple times by `get_cpu_features()`, which reports a thread sanitizer error when used with multiple lld threads. This PR updates BLAKE3 to v1.8.2.
2025-07-10[NFC][LLVM][ADT] Simplify `StringRef` case insensitive compare (#147994)Rahul Joshi1-9/+8
Change `ascii_strncasecmp` to use a range for loop and use StringRef parameters.
2025-07-09Extract SipHash implementation into a header.Peter Collingbourne2-130/+6
This is so that we'll be able to use it in compiler-rt as well. Dependencies on LLVM Support were removed from the header by restoring code from the original SipHash implementation. Reviewers: kuhar, dwblaikie, ahmedbougacha Reviewed By: dwblaikie Pull Request: https://github.com/llvm/llvm-project/pull/134197
2025-07-09[Support] Don't re-raise signals sent from kernel (#145759)Alex Langford1-3/+18
When an llvm tool crashes (e.g. from a segmentation fault), SignalHandler will re-raise the signal. The effect is that crash reports now contain SignalHandler in the stack trace. The crash reports are still useful, but the presence of SignalHandler can confuse tooling and automation that deduplicate or analyze crash reports. rdar://150464802
2025-07-09ErrorHandling: Check for EINTR and partial writes (#147595)Matthias Braun1-5/+16
Calls to the posix `write` function can return -1 and set errno to `EINTR` or perform partial writes when interrupted by signals. In those cases applications are supposed to just try again. See for example the documentation in glibc: https://sourceware.org/glibc/manual/latest/html_node/I_002fO-Primitives.html#index-write This fixes the uses in `ErrorHandling.cpp` to retry as needed.
2025-07-08[Support] Remove an unnecessary cast (NFC) (#147548)Kazu Hirata1-1/+1
I is already of int64_t.
2025-07-08[Support] Add signed operations to DataExtractor (#147261)Pavel Labath1-4/+4
This is motivated by the [SFrame format](https://discourse.llvm.org/t/rfc-adding-sframe-support-to-llvm/86900), which contains several signed fields. Having explicit signed operations makes the parsing code read better and avoids potential surprises if e.g. a "signed" uint8_t value is converted ta greater width.
2025-07-03[Support] Remove an unnecessary cast (NFC) (#146810)Kazu Hirata1-1/+1
We don't need to cast std::string to std::string.
2025-07-03[analyzer] Correct Z3 test cases, fix exposed crashes (#146597)vabridgers1-1/+2
PR145731 corrected the analyzer test runner to consider use of z3 when used by testcases, which exposed problems in test cases PR37855.c and crashes in z3-crosscheck.c This change fixes those crashes and re-enables the test cases that were "XFAIL"'d out. Co-authored-by: einvbri <vince.a.bridgers@ericsson.com>
2025-07-02[SystemZ][z/OS] Fix error about const char in Text Encoding (#146727)Abhina Sree1-1/+1
This patch fixes the following error: ``` llvm/lib/Support/TextEncoding.cpp:274:11: error: cannot initialize a variable of type 'char *' with an rvalue of type 'const char *' 274 | char *Input = InputLength ? const_cast<char *>(Source.data()) : ""; | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
2025-07-02[DLCov] Origin-Tracking: Enable collecting and symbolizing stack traces ↵Stephen Tozer3-65/+161
(#143591) This patch is part of a series that adds origin-tracking to the debugify source location coverage checks, allowing us to report symbolized stack traces of the point where missing source locations appear. This patch adds a pair of new functions in `signals.h` that can be used to collect and symbolize stack traces respectively. This has major implementation overlap with the existing stack trace collection/symbolizing methods, but the existing functions are specialized for dumping a stack trace to stderr when LLVM crashes, while these new functions are meant to be called repeatedly during the execution of the program, and therefore we need a separate set of functions.
2025-06-26[Support] Remove workarounds for building with mingw.org toolchains (#145683)Martin Storsjö1-64/+0
Assume that mingw builds are made with mingw-w64 headers. The old mingw.org distribution isn't even accessible at the moment, and their project hosting site (osdn.net) seems to have been down for a couple of years, and their old project hosting (at sourceforge.net) hasn't been updated since 2018.
2025-06-24[LLVM][Support][Cygwin] Add threading support for Cygwin host (#145314)Tomohiro Kashiwada1-4/+11
Cygwin environment has pthread functionality but LLVM integration doesn't care it nor provide fallback. Using Linux integration for Cygwin works fine.
2025-06-24[Support] Remove an outdated MinGW workaround (#145294)Martin Storsjö1-5/+0
mingw-w64 has had the _HEAPOK define since the initial commits in 2007; unclear when/where it was added for mingw.org headers, but it does seem to exist there as well (at least in versions from 2011). This workaround stems from 53fbecce6e8b7d1f024e3dc6df4160fe9a577ff1 from 2004 - it is no longer relevant today.
2025-06-18[llvm] build Blake3 source with LLVM_EXPORTS defined (#144753)Andrew Rogers1-0/+6
## Purpose This patch ensures that the BLAKE3 implementation in the LLVM Support library exports its public interface with `__declspec(dllexport)` when building LLVM as a Windows DLL. ## Background The effort to support building LLVM as a Windows DLL is tracked in #109483. Additional context is provided in [this discourse](https://discourse.llvm.org/t/psa-annotating-llvm-public-interface/85307). ## Overview Replicate [this logic](https://github.com/llvm/llvm-project/blob/main/llvm/cmake/modules/AddLLVM.cmake#L662-L664) from `llvm_add_library()` for the `LLVMSupportBlake3` target. Without this change, the `llvm_blake_` functions will only be annotated with `__declspec(dllimport)` when building LLVM as a Windows DLL which leads to inconsistent DLL linkage warnings from MSVC and `clang-cl`.
2025-06-17[LLVM] [Support] Disable `ioctl()` terminal size check on Solaris (#144600)Sirraide1-1/+1
#143514 broke the `clang-solaris11-sparcv9` bot; from what I can tell that’s Solaris and according to `SolarisTargetInfo::getOSDefines`, the macro `__sun__` should be defined on Solaris, so check for that and don’t try to query the terminal size if it is defined. Not sure this is the best solution but hopefully it fixes the bot.
2025-06-17[LLVM] [Support] Query the terminal width using `ioctl()` (#143514)Sirraide1-6/+18
On unix systems, we were trying to determine the terminal width using the `COULMNS` environment variable. Unfortunately, `COLUMNS` is not exported by all shells and thus not available on some systems. We were previously using `ioctl()` for this; fall back to doing so if `COLUMNS` does not exist or does not store a positive integer. This essentially reverts a3eb3d3d92d037fe3c9deaad87f6fc42fe9ea766 and parts of https://reviews.llvm.org/D61326. For more information, see #139499. Fixes #139499.
2025-06-13[SystemZ][z/OS] Refactor AutoConvert more (#143955)Abhina Sree3-4/+3
This patch removes the C++ disablezOSAutoConversion,enablezOSAutoConversion declarations and also updates Path.inc to use the common function.
2025-06-11[SystemZ][z/OS] Refactor AutoConvert.h to remove large MVS guard (#143174)Abhina Sree4-46/+34
This AutoConvert.h header frequently gets mislabeled as an unused include because it is guarded by MVS internally and every usage is also guarded. This refactors the change to remove this guard and instead make these functions a noop on other non-z/OS platforms.
2025-06-09[Support][Cygwin] Fix handling of Process symbol lookup. (#143072)jeremyd20193-8/+8
In Unix/DynamicLibrary.inc, it was already known that Cygwin required use of `RTLD_DEFAULT` as the `Handle` parameter to `DLSym` to search all modules for a symbol. Unfortunately, RTLD_DEFAULT is defined as NULL, so the existing checks of the `Process` handle meant `DLSym` would never be called on Cygwin. Use the existing `&Invalid` sentinel instead of `nullptr` for the `Process` handle.
2025-06-06[llvm] Call hash_combine_range with ranges (NFC) (#143225)Kazu Hirata1-1/+1
We can now invoke hash_combine_range with a range.
2025-06-06[NFC] [DebugCounter] warn if --debug-counter is unused in NDEBUG (#143057)Florian Mayer1-0/+5
Co-authored-by: Nikita Popov <npopov@redhat.com>
2025-06-06[SystemZ][z/OS] add back headers needed for strnlen, autoconversionAbhina Sreeskantharajan1-0/+1
2025-06-06[Support] Properly zero initialize CPU set when querying affinity (#142924)Christian Ulmann1-0/+1
This commit resolves a potential issue of working with uninitialized memory when querying the CPU's affinity. The man page of `sched_getaffinity` does not guarantee that the memory will be fully overwritten, so this change should ensure that issues are avoided.
2025-06-04[Support] Restore a couple of includesKazu Hirata1-0/+2
A build failure has been reported at: https://github.com/llvm/llvm-project/pull/142733#issuecomment-2942753737
2025-06-04[llvm] Remove unused includes (NFC) (#142733)Kazu Hirata7-11/+0
These are identified by misc-include-cleaner. I've filtered out those that break builds. Also, I'm staying away from llvm-config.h, config.h, and Compiler.h, which likely cause platform- or compiler-specific build failures.
2025-06-04[llvm][mustache] Fix UB in ASTNode::render() (#142249)Paul Kirth1-24/+33
The current implementation set a reference to a nullptr, leading to all kinds of problems. Instead, we can check the various uses to ensure we don't deref invalid memory, and improve the logic for how contexts are passed to children, since that was also subtly wrong in some cases.
2025-06-04[lldb][llvm][AIX] Added support for getProcFile with TID (#142586)Hemang Gadhavi1-0/+2
This PR is in reference to porting LLDB on AIX. Link to discussions on llvm discourse and github: 1. https://discourse.llvm.org/t/port-lldb-to-ibm-aix/80640 2. https://github.com/llvm/llvm-project/issues/101657 The complete changes for porting are present in this draft PR: https://github.com/llvm/llvm-project/pull/102601 - Added changes to getProcFile() with threadID, including testcase for AIX. - Added support for AIX to get_threadid() from llvm.
2025-05-28[NFCI] Change SpecialCaseList::inSectionBlame to return pair<uint, uint> ↵Qinkun Bao1-16/+19
(FileIdx, LineNo). (#141540) Accoring to the discussion in https://github.com/llvm/llvm-project/pull/140529, we need to SSCL can be created from multiple ignore list files, so we can repeat-fsanitize-ignorelist=. The change is necessary to achieve the feature described in https://github.com/llvm/llvm-project/issues/139128.
2025-05-27[SpecialCaseList] Iterate sections and matchers in reverse orderQinkun Bao1-3/+4
Issue #139128 needs to find the last one in the file. Pull Request: https://github.com/llvm/llvm-project/pull/141697