aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support
AgeCommit message (Collapse)AuthorFilesLines
2 days[llvm][clang] Pass VFS to `llvm::cl` command line handling (#159174)Jan Svoboda1-6/+6
This PR passes the VFS down to `llvm::cl` functions so that they don't assume the real file system.
4 daysFix ExecuteAndWait with empty environment on Windows (#158719)Hiroshi Yamauchi1-0/+18
CreateProcessW requires that the environemnt block to be always double null-terminated even with an empty environemnt. https://learn.microsoft.com/en-us/windows/win32/procthread/environment-variables The attached test fails this way without the fix. C:\Users\hiroshi\upstream\llvm-project\llvm\unittests\Support\ProgramTest.cpp(697): error: Value of: ExecutionFailed Actual: true Expected: false Couldn't execute program 'C:\Users\hiroshi\upstream\llvm-project\build\unittests\Support\SupportTests.exe': The parameter is incorrect. (0x57)
5 daysDefault DEBUG_TYPE to the current filename for logging (#158494)Mehdi Amini1-23/+97
This makes it optional to define a debug type and uses the current FileName instead. This both reduced the size of the prefix printed by LDBG() and makes it possible to pass a filename to `--debug-only` to filter on.
9 daysIntroduce LDBG_OS() macro as a variant of LDBG() (#158277)Mehdi Amini1-10/+119
Also, improve LDBG() to accept debug type and level in any order, and add unit-tests for LDBG() and LGDB_OS(). LDBG_OS() is a macro that behaves like LDBG() but instead of directly using it to stream the output, it takes a callback function that will be called with a raw_ostream. This is a re-land with workarounds for older gcc and clang versions. Previous attempts in #157194 and #158260 Co-authored-by: Andrzej Warzyński <andrzej.warzynski@gmail.com>
9 daysRevert "Introduce LDBG_OS() macro as a variant of LDBG() (#157194)" (#158264)Mehdi Amini1-119/+10
Reverts llvm/llvm-project#158260 second attempt to land this fixed some bots, but left others broken, need an extra iteration!
9 daysIntroduce LDBG_OS() macro as a variant of LDBG() (#157194) (#158260)Mehdi Amini1-10/+119
Also, improve LDBG() to accept debug type and level in any order, and add unit-tests for LDBG() and LGDB_OS(). LDBG_OS() is a macro that behaves like LDBG() but instead of directly using it to stream the output, it takes a callback function that will be called with a raw_ostream. Co-authored-by: Andrzej Warzyński <andrzej.warzynski@gmail.com> Co-authored-by: Andrzej Warzyński <andrzej.warzynski@gmail.com>
9 days[Support] Deprecate one form of support::endian::write (NFC) (#156140)Kazu Hirata1-7/+7
We have two forms of write: template <typename value_type, std::size_t alignment = unaligned> inline void write(void *memory, value_type value, endianness endian) template <typename value_type, endianness endian, std::size_t alignment> inline void write(void *memory, value_type value) The difference is that endian is a function parameter in the former but a template parameter in the latter. This patch streamlines the code by migrating the use of the latter to the former while deprecating the latter. I'm planning to do the same for byte_swap and read in follow-up patches to keep this patch simple and small.
9 days[LLVM][MLIR] Move LSP server support library from MLIR into LLVM (#157885)Bertik234-0/+266
This is a second PR on this patch (first #155572), that fixes the linking problem for `flang-aarch64-dylib` test. The SupportLSP library was made a component library. --- This PR moves the generic Language Server Protocol (LSP) server support code that was copied from clangd into MLIR, into the LLVM tree so it can be reused by multiple subprojects. Centralizing the generic LSP support in LLVM lowers the barrier to building new LSP servers across the LLVM ecosystem and avoids each subproject maintaining its own copy. The code originated in clangd and was copied into MLIR for its LSP server. MLIR had this code seperate to be reused by all of their LSP server. This PR relocates the MLIR copy into LLVM as a shared component into LLVM/Support. If this is not a suitable place, please suggest a better one. A follow up to this move could be deduplication with the original clangd implementation and converge on a single shared LSP support library used by clangd, MLIR, and future servers. What changes mlir/include/mlir/Tools/lsp-server-support/{Logging, Protocol, Transport}.h moved to llvm/include/llvm/Support/LSP mlir/lib/Tools/lsp-server-support/{Logging, Protocol, Transport}.cpp moved to llvm/lib/Support/LSP and their namespace was changed from mlir to llvm I ran clang-tidy --fix and clang-format on the whole moved files (last two commits), as they are basically new files and should hold up to the code style used by LLVM. MLIR LSP servers where updated to include these files from their new location and account for the namespace change. This PR is made as part of the LLVM IR LSP project ([RFC](https://discourse.llvm.org/t/rfc-ir-visualization-with-vs-code-extension-using-an-lsp-server/87773))
10 days[Support] Rename CTLog2 to ConstantLog2 in MathExtras.h (#158006)Kazu Hirata1-17/+17
This patch renames CTLog2 to ConstantLog2 for readability. This patch provides a forwarder under LLVM_DEPRECATED because CTLog2 is used downstream.
10 daysRevert "Introduce LDBG_OS() macro as a variant of LDBG()" (#158058)Mehdi Amini1-119/+10
Reverts llvm/llvm-project#157194 Bots are broken, investigation needed.
10 daysIntroduce LDBG_OS() macro as a variant of LDBG() (#157194)Mehdi Amini1-10/+119
Also, improve LDBG() to accept debug type and level in any order, and add unit-tests for LDBG() and LGDB_OS(). LDBG_OS() is a macro that behaves like LDBG() but instead of directly using it to stream the output, it takes a callback function that will be called with a raw_ostream. Co-authored-by: Andrzej Warzyński <andrzej.warzynski@gmail.com>
10 daysFix a `-Wunused-variable` warning on windows (#157973)Justin Bogner1-1/+1
The `UID` variable is only being used inside the `#ifndef _WIN32` block - move the definition into the block as well.
12 daysRevert "[LLVM][MLIR] Move LSP server support library from MLIR into LLVM ↵Nikita Popov4-265/+0
(#155572)" This reverts commit c0aee322f7024250fd4a2c49f56534011178d07c. This reverts commit a0b8d548fd250c92c8f9274b57e38ad3f0b215e9. Fails to link with MLIR dylib build.
12 days[LLVM][MLIR] Move LSP server support library from MLIR into LLVM (#155572)Bertik234-0/+265
This PR moves the generic Language Server Protocol (LSP) server support code that was copied from clangd into MLIR, into the LLVM tree so it can be reused by multiple subprojects. Centralizing the generic LSP support in LLVM lowers the barrier to building new LSP servers across the LLVM ecosystem and avoids each subproject maintaining its own copy. The code originated in clangd and was copied into MLIR for its LSP server. MLIR had this code seperate to be reused by all of their LSP server. This PR relocates the MLIR copy into LLVM as a shared component into `LLVM/Support`. If this is not a suitable place, please suggest a better one. A follow up to this move could be deduplication with the original clangd implementation and converge on a single shared LSP support library used by clangd, MLIR, and future servers. ### What changes * `mlir/include/mlir/Tools/lsp-server-support/{Logging, Protocol, Transport}.h` moved to `llvm/include/llvm/Support/LSP` * `mlir/lib/Tools/lsp-server-support/{Logging, Protocol, Transport}.cpp` moved to `llvm/lib/Support/LSP` and their namespace was changed from `mlir` to `llvm` I ran clang-tidy --fix and clang-format on the whole moved files (last two commits), as they are basically new files and should hold up to the code style used by LLVM. MLIR LSP servers where updated to include these files from their new location and account for the namespace change. This PR is made as part of the LLVM IR LSP project ([RFC](https://discourse.llvm.org/t/rfc-ir-visualization-with-vs-code-extension-using-an-lsp-server/87773))
2025-09-05Support: Add vfs::OutputBackend and OutputFile to virtualize compiler ↵Steven Wu5-0/+1591
outputs (#113363) Add OutputBackend and OutputFile to the `llvm::vfs` namespace for virtualizing compiler outputs. This is intended for use in Clang, The headers are: - llvm/Support/VirtualOutputConfig.h - llvm/Support/VirtualOutputError.h - llvm/Support/VirtualOutputFile.h - llvm/Support/VirtualOutputBackend.h OutputFile is moveable and owns an OutputFileImpl, which is provided by the derived OutputBackend. - OutputFileImpl::keep() and OutputFileImpl::discard() should keep or discard the output. OutputFile guarantees that exactly one of these will be called before destruction. - OutputFile::keep() and OutputFile::discard() wrap OutputFileImpl and catch usage errors such as double-close. - OutputFile::discardOnDestroy() installs an error handler for the destructor to use if the file is still open. The handler will be called if discard() fails. - OutputFile::~OutputFile() calls report_fatal_error() if none of keep(), discard(), or discardOnDestroy() has been called. It still calls OutputFileImpl::discard(). - getOS() returns the wrapped raw_pwrite_stream. For convenience, OutputFile has an implicit conversion to `raw_ostream` and `raw_ostream &operator<<(OutputFile&, T&&)`. OutputBackend can be stored in IntrusiveRefCntPtr. - Most operations are thread-safe. - clone() returns a backend that targets the same destination. All operations are thread-safe when done on different clones. - createFile() takes a path and an OutputConfig (see below) and returns an OutputFile. Backends implement createFileImpl(). OutputConfig has flags to configure the output. Backends may ignore or override flags that aren't relevant or implementable. - The initial flags are: - AtomicWrite: whether the output should appear atomically (e.g., by using a temporary file and renaming it). - CrashCleanup: whether the output should be cleaned up if there's a crash (e.g., with RemoveFileOnSignal). - ImplyCreateDirectories: whether to implicitly create missing directories in the path to the file. - Text: matches sys::fs::OF_Text. - CRLF: matches sys::fs::OF_CRLF. - Append: matches sys::fs::OF_Append and can use with AtomicWrite for atomic append. - OnlyIfDifferent: skip writting the output file if the existing file at the output path is identical to the content to be written. - Each "Flag" has `setFlag(bool)` and `bool getFlag()` and shortcuts `setFlag()` and `setNoFlag()`. The setters are `constexpr` and return `OutputConfig&` to make it easy to declare a default value for a filed in a class or struct. - Setters and getters for Binary and TextWithCRLF are derived from Text and CRLF. For convenience, sys::fs::OpenFlags can be passed directly to setOpenFlags(). This patch intentionally lacks a number of important features that have been left for follow-ups: - Set a (virtual) current working directory. - Create a directory. - Create a file or directory with a unique name (avoiding collisions with existing filenames). Patch originally by dexonsmith
2025-08-27[ThreadPool] Fix Windows failures in the AffinityMask unit test (#155614)Andrew Ng1-4/+10
These thread pool tests are typed and one was failing due to the setting of environment variable `LLVM_THREADPOOL_AFFINITYMASK` leaking out of a previous run of the test. I suspect that this has mainly succeeded because the tests have run in separate shards. Also the re-invocation of the unit test with the process affinity mask set was not actually running the test because `--gtest_filter=` was not set correctly. This has been fixed. The use of the test type (TypeParam) in the AsyncBarrier test has been restored. Without this the typing of these tests would be completely redundant. I suspect that some of these unit tests do not work if `LLVM_ENABLE_THREADS == 0` but that is beyond the scope of this fix.
2025-08-26Support: Add proxies for raw_ostream and raw_pwrite_stream (#113362)Steven Wu2-0/+226
Add proxies classes for `raw_ostream` and `raw_pwrite_stream` called `raw_ostream_proxy` and `raw_pwrite_stream_proxy`. Add adaptor classes, `raw_ostream_proxy_adaptor<>` and `raw_pwrite_stream_proxy_adaptor<>`, to allow subclasses to use a different parent class than `raw_ostream` or `raw_pwrite_stream`. The adaptors are used by a future patch to help a subclass of `llvm::vfs::OutputFile`, an abstract subclass of `raw_pwrite_stream`, to proxy a `raw_fd_ostream`. Patched by dexonsmith.
2025-08-23[Support] Simplify macro conditions involving __GNUC__ (NFC) (#155070)Kazu Hirata1-1/+1
We require GCC 7.4 these days, so we just need to check for defined(__GNUC__).
2025-08-20[NFC][CMake] quote ${CMAKE_SYSTEM_NAME} consistently (#154537)David Tenty1-3/+3
A CMake change included in CMake 4.0 makes `AIX` into a variable (similar to `APPLE`, etc.) https://gitlab.kitware.com/cmake/cmake/-/commit/ff03db6657c38c8cf992877ea66174c33d0bcb0b However, `${CMAKE_SYSTEM_NAME}` unfortunately also expands exactly to `AIX` and `if` auto-expands variable names in CMake. That means you get a double expansion if you write: `if (${CMAKE_SYSTEM_NAME} MATCHES "AIX")` which becomes: `if (AIX MATCHES "AIX")` which is as if you wrote: `if (ON MATCHES "AIX")` You can prevent this by quoting the expansion of "${CMAKE_SYSTEM_NAME}", due to policy [CMP0054](https://cmake.org/cmake/help/latest/policy/CMP0054.html#policy:CMP0054) which is on by default in 4.0+. Most of the LLVM CMake already does this, but this PR fixes the remaining cases where we do not.
2025-08-20[FileSystem] Allow exclusive file lock (#114098)Steven Wu1-0/+83
Add parameter to file lock API to allow exclusive file lock. Both Unix and Windows support lock the file exclusively for write for one process and LLVM OnDiskCAS uses exclusive file lock to coordinate CAS creation.
2025-08-20Update log_level for LLVM_DEBUG and associated macros (#154525)Mehdi Amini1-0/+42
During the review of #150855 we switched from 0 to 1 for the default log level used, but this macro wasn't updated.
2025-08-18[MLIR] Update GreedyRewriter to use the LDBG() debug log mechanism (NFC) ↵Mehdi Amini1-2/+12
(#153961) Also improve a bit the LDBG() implementation
2025-08-14[Support] Add mapped_file_region::sync(), equivalent to msync (#153632)Steven Wu1-0/+37
2025-08-07Remove __SHORT_FILE__ macro definition in CMake (#152344)Mehdi Amini1-5/+0
This per-file macro definition on the command line breaks caching of modules. See discussion in #150677 Instead we use a constexpr function that processes the __FILE__ macro, but prefer also the __FILE_NAME__ macro when available (clang/gcc) to spare compile-time in the frontend. If the constexpr function isn't const-evaluated, it'll be only evaluated when printing the debug message.
2025-08-01[LLVM][Support] Fix tests on Cygwin (#151417)jeremyd20193-5/+23
Cygwin returns -1 for `getconf(_SC_ARG_MAX)`, which makes `llvm::sys::commandLineFitsWithinSystemLimits` always return true, so skip the `ArgumentLimit` test in that case. Skip the `ArgumentLimitWindows` and `ResponseFileWindows` tests on Cygwin also as it doesn't suffer from the Windows limits either. Cygwin requires the same `dllexport` annotation as Win32 in the `DynamicLibrary` test, so add its preprocessor check to PipSqueak.h. Cygwin's `getcwd` function does not fail with `ENOENT` if the current working directory is unlinked. According to POSIX issue 8, this is not required. Skip the `PhysicalFileSystemWorkingDirFailure` test on Cygwin as it relies on this behavior.
2025-08-01[MLIR] Migrate pattern application / dialect conversion to the LDBG logging ↵Mehdi Amini1-1/+1
format (#150991) This prefix the output with the DEBUG_TYPE. Dialect conversion is using a ScopedPrinter, we insert the raw_ldbg_ostream to consistently prefix each new line.
2025-07-31NFC: Clean up construction of IntrusiveRefCntPtr from raw pointers for ↵James Y Knight1-123/+97
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.
2025-07-28Introduce a "log level" support for DEBUG_TYPE (#150855)Mehdi Amini1-8/+42
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.
2025-07-28Fix `DEBUGLOG_WITH_STREAM_TYPE_AND_FILE` broken in #150750 (#150920)Ingo Müller1-0/+5
This PR fixes the `DEBUGLOG_WITH_STREAM_TYPE_AND_FILE` macro that got broken in #150750. That PR introduces a more sophisitaced version of that macro and refactored some code in that process, making the `getShortFileName` a free function instead of a class member function, but did not adapt this macro to the refactored code. Signed-off-by: Ingo Müller <ingomueller@google.com>
2025-07-28Implement a custom stream for LDBG macro to handle newlines (#150750)Mehdi Amini1-0/+22
This prints the prefix on every new line, allowing for an output that looks like: ``` [dead-code-analysis] DeadCodeAnalysis.cpp:288 Visiting operation: func.func private @private_1() -> (i32, i32) { [dead-code-analysis] DeadCodeAnalysis.cpp:288 %c0_i32 = arith.constant 0 : i32 [dead-code-analysis] DeadCodeAnalysis.cpp:288 %0 = arith.addi %c0_i32, %c0_i32 {tag = "one"} : i32 [dead-code-analysis] DeadCodeAnalysis.cpp:288 return %c0_i32, %0 : i32, i32 [dead-code-analysis] DeadCodeAnalysis.cpp:288 } [dead-code-analysis] DeadCodeAnalysis.cpp:313 Visiting callable operation: func.func private @private_1() -> (i32, i32) { [dead-code-analysis] DeadCodeAnalysis.cpp:313 %c0_i32 = arith.constant 0 : i32 [dead-code-analysis] DeadCodeAnalysis.cpp:313 %0 = arith.addi %c0_i32, %c0_i32 {tag = "one"} : i32 [dead-code-analysis] DeadCodeAnalysis.cpp:313 return %c0_i32, %0 : i32, i32 [dead-code-analysis] DeadCodeAnalysis.cpp:313 } ```
2025-07-25Adjust LDBG output: surround DebugType between `[` and `]` (#150671)Mehdi Amini1-1/+2
This makes the output more readable by clearly showing the current debug type as a keyword.
2025-07-25[llvm][support] Fix DebugLogTest. (#150585)Jacques Pienaar1-1/+1
Fails on windows with error C2466: cannot allocate an array of constant size 0 else.
2025-07-25[llvm][support] Add LDBG macro. (#143704)Jacques Pienaar2-0/+78
Add macro that mirror a common usage of logging to output .This makes it easy to have streaming log like behavior while still using the base debug logging. I also wanted to avoid inventing a full logging library here while enabling others to change the sink without too much pain, so put it in its own header (this also avoids making Debug depend on raw_ostream beyond forward reference). The should allow a consistent dev experience without fixing the sink too much. --------- Co-authored-by: Mehdi Amini <joker.eph@gmail.com>
2025-07-11[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.