aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support
AgeCommit message (Collapse)AuthorFilesLines
14 days[support] Add packed_endian_specific_integral::value() (#147974)Pavel Labath1-0/+1
They are already implicitly convertible to the underlying type, but that doesn't work in some contexts, and it can be useful to get the underlying value without needing the remember/guess the right type. I converted a couple of call sites to demonstrate usefulness, but there's likely more of them. I know at least of at least a few in LLDB, but I don't want to make this a cross-project patch.
2025-07-09[support] Make ScopedPrinter compatible with bitmask enums (#147512)Pavel Labath1-0/+29
.. produced by ADT/BitmaskEnum.h. These aren't implicitly convertible to an integer, so I needed to tweak a couple of bitwise operations and add an explicit constructor for HexNumber and FlagEntry. Motivation: I'd like to use this in the SFrame data structures (#147264)
2025-07-08[Support] Add signed operations to DataExtractor (#147261)Pavel Labath1-0/+15
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-04[llvm] Use llvm::fill instead of std::fill(NFC) (#146911)Austin1-3/+3
Use llvm::fill instead of std::fill
2025-06-30[LLVM][Clang] Enable strict mode for `getTrailingObjects` (#144930)Rahul Joshi1-3/+4
Disallow calls to templated `getTrailingObjects` if there is a single trailing type (strict mode). Add `getTrailingObjectsNonStrict` for cases when it's not possible to know statically if there will be a single or multiple trailing types (like in OpenMPClause.h) to bypass the struct checks. This will ensure that future users of TrailingObjects class do not accidently use the templated `getTrailingObjects` when they have a single trailing type.
2025-06-28[llvm] Compare std::optional<T> to values directly (NFC) (#146222)Kazu Hirata1-1/+1
This patch transforms: X && *X == Y to: X == Y where X is of std::optional<T>, and Y is of T or similar.
2025-06-26[llvm] Use a new constructor of ArrayRef (NFC) (#146008)Kazu Hirata1-1/+1
ArrayRef now has a new constructor that takes a parameter whose type has data() and size(). This patch migrates: ArrayRef<T>(X.data(), X.size() to: ArrayRef<T>(X)
2025-06-19[llvm] Use "= delete" to delete constructors (NFC) (#144938)Kazu Hirata1-3/+1
None of the constructors touched in this patch has a corresponding definition. This patch explicitly deletes them with "= delete" while moving them to the public section of respective classes. Note that "= delete" itself serves as documentation. Identified with modernize-use-equals-delete.
2025-06-08[llvm] Compare std::optional<T> to values directly (NFC) (#143340)Kazu Hirata1-1/+1
This patch transforms: X && *X == Y to: X == Y where X is of std::optional<T>, and Y is of T or similar.
2025-05-28[NFCI] Change SpecialCaseList::inSectionBlame to return pair<uint, uint> ↵Qinkun Bao1-16/+41
(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-5/+26
Issue #139128 needs to find the last one in the file. Pull Request: https://github.com/llvm/llvm-project/pull/141697
2025-05-27[NFC][SpecialCaseList] Add unit test for line numbersVitaly Buka1-0/+20
2025-05-26[LLVM] [NFC] - Remove duplicate #include headers from the files of llvm dir ↵Akash Agrawal2-3/+0
(#141057) A few files of llvm dir had duplicate headers included. This patch removes those redundancies. --------- Co-authored-by: Akash Agrawal <akashag@qti.qualcomm.com>
2025-05-20Create a EncodingConverter class with both iconv and icu support. (#138893)Abhina Sree3-2/+302
This patch adds a wrapper class called EncodingConverter for ConverterEBCDIC. This class is then extended to support the ICU library or iconv library. The ICU library currently takes priority over the iconv library. Relevant RFCs: https://discourse.llvm.org/t/rfc-adding-a-charset-converter-to-the-llvm-support-library/69795 https://discourse.llvm.org/t/rfc-enabling-fexec-charset-support-to-llvm-and-clang-reposting/71512 Stacked PR to enable fexec-charset that depends on this: https://github.com/llvm/llvm-project/pull/138895 See old PR for review and commit history: https://github.com/llvm/llvm-project/pull/74516
2025-05-14Support,lld: Rename misnamed F_no_mmap to F_mmapFangrui Song1-1/+1
`F_no_mmap` introduced by https://reviews.llvm.org/D69294 is misnamed. It oughts to be `F_mmap` When the output is a regular file or do not exist, `--no-mmap-output-file` is the default. Relands #134787 by fixing the lld option default. Note: changing the default to --map-output-file would likely fail on llvm-clang-x86_64-sie-win (https://lab.llvm.org/buildbot/#/builders/46/builds/14847) Pull Request: https://github.com/llvm/llvm-project/pull/139836
2025-05-12[Support] Change test to use TrailingObjects API per documentation (#139319)Rahul Joshi1-16/+24
- Use private inheritance for TrailingObjects as recommended in TrailingObjects.h - No need to define `numTrailingObjects` for the last trailing type. - Fix comment typos.
2025-05-09[Support] Avoid setting minor/subminor/build in ↵Cyndy Ishida1-0/+30
VersionTuple::withMajorReplaced (#139318) The expectation of this API is that it only changes the major version of a preexisting version tuple. However, it was adding 0's, which caused unintended changes in serialization or printing. Instead, check for the existence of the non-major parts of the tuple.
2025-05-09[LLVM][Support] Add getTrailingObjects() for single trailing type (#138970)Rahul Joshi1-2/+8
Add a specialization of getTrailingObjects() for a single trailing type. This is a common case and with the specialization you don't need to specify the single trailing type redundantly. Also add an overload for getTrailingObjects which takes size and returns an ArryaRef/MutableArrayRef as that's a common use case as well.
2025-05-07[NFC][Support] Add llvm::uninitialized_copy (#138174)Rahul Joshi1-9/+10
Add `llvm::uninitialized_copy` that accepts a range instead of start/end iterator for the source of the copy.
2025-05-04[llvm] Remove unused local variables (NFC) (#138454)Kazu Hirata1-3/+0
2025-05-03[llvm] Remove unused using decls (NFC) (#138386)Kazu Hirata2-2/+0
2025-05-02[llvm][Support] Disable runOnNewStack test when threading is disabledDavid Spickett1-0/+6
On our buildbot https://lab.llvm.org/buildbot/#/builders/122/builds/1478, one of the new tests added by https://github.com/llvm/llvm-project/pull/136046 failed. This is because on non-Apple Silicon platforms, the implementation is to start a new thread, but when threading is disabled this is the same as calling a function normally.
2025-04-30Reland: [llvm][clang] Allocate a new stack instead of spawning a new thread ↵Michael Spencer2-0/+36
to get more stack space (#136046) Reland https://github.com/llvm/llvm-project/pull/133173 Clang spawns a new thread to avoid running out of stack space. This can make debugging and performance analysis more difficult as how the threads are connected is difficult to recover. This patch introduces `runOnNewStack` and applies it in Clang. On platforms that have good support for it this allocates a new stack and moves to it using assembly. Doing split stacks like this actually runs on most platforms, but many debuggers and unwinders reject the large or backwards stack offsets that occur. Apple platforms and tools are known to support this, so this only enables it there for now.
2025-04-26[llvm] Use llvm::replace (NFC) (#137481)Kazu Hirata1-4/+2
2025-04-23[CostModel] Remove optional from InstructionCost::getValue() (#135596)David Green1-3/+2
InstructionCost is already an optional value, containing an Invalid state that can be checked with isValid(). There is little point in returning another optional from getValue(). Most uses do not make use of it being a std::optional, dereferencing the value directly (either isValid has been checked previously or the Cost is assumed to be valid). The one case that does in AMDGPU used value_or which has been replaced by a isValid() check.
2025-04-22Modify the localCache API to require an explicit commit on CachedFile… ↵anjenner2-0/+158
(#136121) …Stream. CachedFileStream has previously performed the commit step in its destructor, but this means its only recourse for error handling is report_fatal_error. Modify this to add an explicit commit() method, and call this in the appropriate places with appropriate error handling for the location. Currently the destructor of CacheStream gives an assert failure in Debug builds if commit() was not called. This will help track down any remaining uses of the API that assume the old destructior behaviour. In Release builds we fall back to the previous behaviour and call report_fatal_error if the commit fails. This is version 2 of this PR, superseding reverted PR https://github.com/llvm/llvm-project/pull/115331 . I have incorporated a change to the testcase to make it more reliable on Windows, as well as two follow-up changes (https://github.com/llvm/llvm-project/commit/df79000896101acc9b8d7435e59f767b36c00ac8 and https://github.com/llvm/llvm-project/commit/b0baa1d8bd68a2ce2f7c5f2b62333e410e9122a1) that were also reverted when 115331 was reverted. --------- Co-authored-by: Augie Fackler <augie@google.com> Co-authored-by: Vitaly Buka <vitalybuka@google.com>
2025-04-18[Support] Allow `llvm::interleaved` with custom ostream types (#136318)Jakub Kuderski1-0/+22
This makes `llvm::interleaved` useable with ostream types that define custom stream operators that print in a different format from `raw_ostream`. For example, MLIR's OpAsmPrinter prints values as operands: https://github.com/llvm/llvm-project/blob/6c5f50f18694a4d91d7ce53a14188c54ee7c6f3b/mlir/include/mlir/IR/OpImplementation.h#L534-L552
2025-04-15[Support] Add format object for interleaved ranges (#135517)Jakub Kuderski2-1/+72
Add two new format functions for printing ranges: `interleaved` and `interleaved_array`. This is meant to improve the ergonomics of printing ranges. Before this patch, we have to either use `llvm::interleave` or write a for loop by hand. For example: Before: ```c++ ArrayRef<Type> types = ...; ArrayRef<Values> values = ...; LLVM_DEBUG({ llvm::dbgs() << "Types: "; llvm::interleave_comma(llvm::dbgs(), types); llvm::dbgs() << "\n"; llvm::dbgs() << "Values: ["; llvm::interleave_comma(llvm::dbgs(), values); llvm::dbgs() << "]\n"; }): ``` After: ```c++ ArrayRef<Type> types = ...; ArrayRef<Values> values = ...; LLVM_DEBUG(llvm::dbgs() << "Types: " << interleaved(types) << "\n"); LLVM_DEBUG(llvm::dbgs() << "Values: " << interleaved_array(values) << "\n"); ``` The separator and the prefix/suffix strings are customizable.
2025-04-15Revert "[llvm][clang] Allocate a new stack instead of spawning a new … ↵Daniel Thornburgh2-36/+0
(#135865) …thread to get more stack space (#133173)" This change breaks the Clang build on Mac AArch64. This reverts commit d0c973a7a0149db3b71767d4c5a20a31e6a8ed5b. This reverts commit 429a84f8a4bf559f43f50072747ef49d3e3b2cf1. This reverts commit 4f64c80d5a23c244f942193e58ecac666c173308.
2025-04-15[llvm][clang] Allocate a new stack instead of spawning a new thread to get ↵Michael Spencer2-0/+36
more stack space (#133173) Clang spawns a new thread to avoid running out of stack space. This can make debugging and performance analysis more difficult as how the threads are connected is difficult to recover. This patch introduces `runOnNewStack` and applies it in Clang. On platforms that have good support for it this allocates a new stack and moves to it using assembly. Doing split stacks like this actually runs on most platforms, but many debuggers and unwinders reject the large or backwards stack offsets that occur. Apple platforms and tools are known to support this, so this only enables it there for now.
2025-04-08Revert "Rename `F_no_mmap` to `F_mmap`" (#134924)Douglas1-1/+1
Reverts llvm/llvm-project#134787 Causes the LIT test `lld\test\ELF\link-open-file.test` to fail on the `llvm-clang-x86_64-sie-win` Build Bot. First instance of the failure observed in: https://lab.llvm.org/buildbot/#/builders/46/builds/14847
2025-04-08Rename `F_no_mmap` to `F_mmap` (#134787)Dmitry Chestnykh1-1/+1
The `F_no_mmap` flag was introduced by https://github.com/llvm/llvm-project/commit/68142324290f2932df0e271747cdccc371d6dded
2025-03-27[YAML] fix output incorrect format for block scalar string (#132897)Congcong Cai1-1/+1
After outputting block scalar string, the indent will be wrong. This patch fixes Padding after block scalar string to ensure the correct format of yaml. The new added ut will fail in main. ```diff @@ -3,4 +3,4 @@ Just a block scalar doc -scalar: a + scalar: a ...\n ```
2025-03-25Reapply "[YAML][NFC] precommit wrong test case (#131782)" (#132936)Congcong Cai1-0/+30
This reverts commit 64779455b8f4875c7de690dd4c3e324dbbcb3029.
2025-03-25Revert "[YAML][NFC] precommit wrong test case (#131782)"Martin Storsjö1-30/+0
This reverts commit cb4ae35de0b4c19149379f16c7b279d80a669f9d. That commit broke compilation with GCC: ../unittests/Support/YAMLIOTest.cpp:1280:20: error: explicit specialization of template<class T> struct llvm::yaml::MappingTraits’ outside its namespace must u se a nested-name-specifier [-fpermissive] 1280 | template <> struct MappingTraits<V> { | ^~~~~~~~~~~~~~~~
2025-03-25[YAML][NFC] precommit wrong test case (#131782)Congcong Cai1-0/+30
2025-03-24Reland Support for mustache templating language (#132467)Paul Kirth2-0/+1227
The last version of this patch had memory leaks due to using the BumpPtrAllocator for data types that required destructors to run to release heap memory (e.g. via std::vector and std::string). This version avoids that by using smart pointers, and dropping support for BumpPtrAllocator. We should refactor this code to use the BumpPtrAllocator again, but that can be addressed in future patches, since those are more invasive changes that need to refactor many of the core data types to avoid owning allocations. Adds Support for the Mustache Templating Language. See specs here: https://mustache.github.io/mustache.5.html This patch implements support+tests for majority of the features of the language including: - Variables - Comments - Lambdas - Sections This meant as a library to support places where we have to generate HTML, such as in clang-doc. Co-authored-by: Peter Chou <peter.chou@mail.utoronto.ca>
2025-03-13Revert "reapply [llvm] add support for mustache templating language" (#131228)PeterChou12-1227/+0
This broke: https://lab.llvm.org/buildbot/#/builders/64/builds/2486 https://lab.llvm.org/buildbot/#/builders/146/builds/2476
2025-03-12[llvm][Timer] Don't print timers in TimerGroup when all Timers are removed ↵Arthur Eubanks1-1/+17
(#131026) Only print them on TimerGroup destruction (or eagerly when TimerGroup::printAll() is called). We should be able to destroy all Timers in a TimerGroup while delaying printing the stored TimeRecords.
2025-03-12reapply [llvm] add support for mustache templating language (#130876)PeterChou12-0/+1227
Reapply https://github.com/llvm/llvm-project/pull/130732 Fixes errors which broke build bot that uses GCC as a compiler https://lab.llvm.org/buildbot/#/builders/66/builds/11049 GCC threw an warning due to an issue std::move with a temporary object which prevents copy elision. Fixes the issue by removing the std::move Adds Support for the Mustache Templating Language. See specs here: https://mustache.github.io/mustache.5.html This patch implements support+tests for majority of the features of the language including: - Variables - Comments - Lambdas - Sections This meant as a library to support places where we have to generate HTML, such as in clang-doc.
2025-03-11Revert "[llvm] add support for mustache templating language (#105893)" (#130873)PeterChou12-1227/+0
This patch caused certain GCC buildbots to failed errors: https://lab.llvm.org/buildbot/#/builders/66/builds/11049
2025-03-11reapply [llvm] add support for mustache templating language (#130732)PeterChou12-0/+1227
Reapply https://github.com/llvm/llvm-project/pull/105893 Fixes errors which broke build bot that uses GCC as a compiler https://lab.llvm.org/buildbot/#/builders/136/builds/3100 The issue here was that using Accessor defined in the anonymous namespace introduces Accessor as a type alias. Which is, later redeclare as members in classes Token and ASTNode with the same name which causes error in GCC. The patch fixes it by renaming the Accesor to AccessorValue. It also fixes warnings caused by the compile due to initialization Adds Support for the Mustache Templating Language. See specs here: https://mustache.github.io/mustache.5.html This patch implements support+tests for majority of the features of the language including: - Variables - Comments - Lambdas - Sections This meant as a library to support places where we have to generate HTML, such as in clang-doc.
2025-03-11[Support] Return `LockFileManager` errors right away (#130627)Jan Svoboda1-4/+5
This patch removes some internal state out of `LockFileManager` by moving the locking code from the constructor into new member function `tryLock()` which returns the errors right away. This simplifies and modernizes the interface.
2025-03-10Revert "[llvm] add support for mustache templating language (#105893)" (#130676)PeterChou12-1227/+0
This broke some build bot warnings https://lab.llvm.org/buildbot/#/builders/160/builds/14381/steps/5/logs/stdio reverts: https://github.com/llvm/llvm-project/pull/105893
2025-03-10[llvm] add support for mustache templating language (#105893)PeterChou12-0/+1227
Adds Support for the Mustache Templating Language. See specs here: https://mustache.github.io/mustache.5.html This patch implements support+tests for majority of the features of the language including: - Variables - Comments - Lambdas - Sections This meant as a library to support places where we have to generate HTML, such as in clang-doc.
2025-03-10[readobj][Arm][AArch64] Refactor Build Attributes parsing under ↵SivanShani-Arm4-8/+8
ELFAtributeParser and add support for AArch64 Build Attributes (#128727) Refactor readobj to integrate AArch64 Build Attributes under ELFAttributeParser. ELFAttributeParser now serves as a base class for: - ELFCompactAttrParser, handling Arm-style attributes with a single build attribute subsection. - ELFExtendedAttrParser, handling AArch64-style attributes with multiple build attribute subsections. This improves code organization and better aligns with the attribute parsing model. Add support for parsing AArch64 Build Attributes.
2025-03-08Revert "Modify the localCache API to require an explicit commit on ↵Douglas Yung2-164/+0
CachedFile… (#115331)" This reverts commit ce9e1d3c15ed6290f1cb07b482939976fa8115cd. The unittest added in this commit seems to be flaky causing random failure on buildbots: - https://lab.llvm.org/buildbot/#/builders/46/builds/13235 - https://lab.llvm.org/buildbot/#/builders/46/builds/13232 - https://lab.llvm.org/buildbot/#/builders/46/builds/13228 - https://lab.llvm.org/buildbot/#/builders/46/builds/13224 - https://lab.llvm.org/buildbot/#/builders/46/builds/13220 - https://lab.llvm.org/buildbot/#/builders/46/builds/13210 - https://lab.llvm.org/buildbot/#/builders/46/builds/13208 - https://lab.llvm.org/buildbot/#/builders/46/builds/13207 - https://lab.llvm.org/buildbot/#/builders/46/builds/13202 - https://lab.llvm.org/buildbot/#/builders/46/builds/13196 and - https://lab.llvm.org/buildbot/#/builders/180/builds/14266 - https://lab.llvm.org/buildbot/#/builders/180/builds/14254 - https://lab.llvm.org/buildbot/#/builders/180/builds/14250 - https://lab.llvm.org/buildbot/#/builders/180/builds/14245 - https://lab.llvm.org/buildbot/#/builders/180/builds/14244 - https://lab.llvm.org/buildbot/#/builders/180/builds/14226
2025-03-07Modify the localCache API to require an explicit commit on CachedFile… ↵anjenner2-0/+164
(#115331) …Stream. CachedFileStream has previously performed the commit step in its destructor, but this means its only recourse for error handling is report_fatal_error. Modify this to add an explicit commit() method, and call this in the appropriate places with appropriate error handling for the location. Currently the destructor of CacheStream gives an assert failure in Debug builds if commit() was not called. This will help track down any remaining uses of the API that assume the old destructior behaviour. In Release builds we fall back to the previous behaviour and call report_fatal_error if the commit fails.
2025-03-05Support: Fix program error test failures when using fork (#129252)Matt Arsenault1-5/+17
2025-03-02unittests: Use EXPECT_ instead of ASSERT_ in a few tests (#129251)Matt Arsenault1-6/+6