32913 Commits

Author SHA1 Message Date
Walter Erquinigo
9ba844eb3a
[ELF][LLDB] Add an nvsass triple (#159459)
When handling CUDA ELF files via objdump or LLDB, the ELF parser in LLVM
needs to distinguish if an ELF file is sass or not, which requires a
triple for sass to exist in llvm. This patch includes all the necessary
changes for LLDB and objdump to correctly identify these files with the
correct triple.
2025-09-19 14:14:20 -04:00
Anthony Latsis
16880116c9
[lldb] Fix Linux build when LLDB_ENABLE_PYTHON is OFF (#159825)
Remove 'lldb-python-scripts' from LLVM_DISTRIBUTION_COMPONENTS when
Python scripting is disabled. Otherwise we get

```
Specified distribution component 'lldb-python-scripts' doesn't have an install target
```
2025-09-19 11:13:34 -07:00
Jonathan Thackray
0ce6052a0c
[lldb] install lldb-tblgen by default to ease cross-compilation (one-liner) (#159812)
Right now, cross-building `lldb` means either installing a native
`lldb-tblgen` by hand (non-trivial, as CMake is painful) or first
building all of native clang because of how the CMake rules work, which
is not fun.

In keeping with the pattern established by llvm-tblgen and clang-tblgen,
install lldb-tblgen to ease cross-compilation.

Co-authored-by: Ross Burton <ross.burton@arm.com>
2025-09-19 10:56:26 -07:00
Jonas Devlieghere
15223548ad
[lldb] Add a static_assert that g_core_definitions matches the Core enum (#159452)
This PR uses the same trick as 7ced9fff95473 to ensure the
`g_core_definitions` table is correctly indexed by the Core enum. It's
easy to make a mistake. Case in point: this caught two entries that
appeared in the wrong order.
2025-09-19 09:06:07 -07:00
David Spickett
19bc0d6543
Revert "RISCV unwinding enable" (#159790)
Reverts llvm/llvm-project#158161

Due to reported failures on remote Linux and Swift buildbots.
2025-09-19 16:19:46 +01:00
David Spickett
b21dd44dbc
[lldb][test] Enable non-address bit WritePointerToMemory test on Linux (#157435)
First added in #153585 for Darwin only. All Linux AArch64 systems also
have Top Byte Ignore enabled in userspace so the test "just works"
there.

FreeBSD has very recently gained Top Byte Ignore support:
4c6c27d3fb

However it's so recent, I don't want to assume it'll be available on any
random FreeBSD system out there.

There isn't really a good place to put this test, so I put it in the top
level of API, next to the other non-address bit test that didn't have a
good home either.
2025-09-19 16:00:33 +01:00
Felipe de Azevedo Piovezan
bce48c89a0
[lldb] Don't call FixDataAddress when reading fp in ReadGPRValue (#159606)
Based on testing on processors that use pointer metadata, and with all
the work done to delay calls to FixDataAddress, this is no longer
necessary.

Note that, with debugserver in particular, this is an NFC change: the
code path here is for frame zero, and debugserver will strip metadata
when reading fp from frame zero anyway.
2025-09-19 07:45:08 -07:00
Jonas Devlieghere
1de6f6517b
[lldb] Fix build when LLDB_ENABLE_PYTHON is OFF (#159665)
Even if Python scripting is disabled, we still need a Python interpreter
to build, for example to generate SBLanguages.h or fix up the framework
headers.
2025-09-18 22:39:44 +00:00
Jonas Devlieghere
082d1d911c
[lldb-dap] Bump form-data from 4.0.1 to 4.0.4
Bumps form-data from 4.0.1 to 4.0.4 to resolve a critical security
vulnerability in form-data.
2025-09-18 14:40:18 -07:00
Felipe de Azevedo Piovezan
a6662866e8
[lldb][NFC] Simplify logic in ABIMacOSX_arm64::FixDataAddress (#159612)
I've intentionally split this into two commits to make it easier that
this is an NFC patch; don't think we need to preserve them separately
though upon merging.
2025-09-18 13:49:56 -07:00
barsolo2000
1c95d80ba6
RISCV enable assembly unwinding (#158161)
**Added emulator unwinding support for RISCV files.**

Emulated Instructions:
ADD (addi sp, sp, imm)
STORE (sd ra, offset(sp))
LOAD (ld ra, offset(sp)).

We had to overwrite SetInstructions() since UnwindAssemblyInstEmulation
calls EvaluateInstruction() directly after calling SetInstruction(), but
it never calls ReadInstruction(). This means that the m_decoded member
variable in the instruction emulator is never properly initialized. By
overriding SetInstruction(), we decode the instruction bytes and set
m_decoded directly. This ensures that subsequent emulation (including
unwinding) operates on the correct instruction.

We also had to change the the OpCode GetOpcodeBytes function since
recent changes made it so GetOpcodeBytes will return None for type
eType16_32Tuples (an alternative and longer way, would've been to type
check during the overwritten SetInstruction() and call a DataExtractor
with .GetU16(&offset) to set the inst_data.

Added a test - TestSimpleRiscvFunction (took inspiration from:
[link](https://github.com/llvm/llvm-project/blob/main/lldb/unittests/UnwindAssembly/ARM64/TestArm64InstEmulation.cpp))

[----------] 1 test from TestRiscvInstEmulation
[ RUN      ] TestRiscvInstEmulation.TestSimpleRiscvFunction
[       OK ] TestRiscvInstEmulation.TestSimpleRiscvFunction (1 ms)
[----------] 1 test from TestRiscvInstEmulation (1 ms total)

[----------] Global test environment tear-down
[==========] 63 tests from 5 test suites ran. (11 ms total)
[  PASSED  ] 63 tests.

---------

Co-authored-by: Bar Soloveychik <barsolo@fb.com>
2025-09-18 15:41:16 -05:00
Felipe de Azevedo Piovezan
113357f1a8
[lldb][nfc] Remove no-op calls to Fix*Address (#159586)
The first call, in InitializeNonZerothFrame, is inside a logging branch.
For that, it's better to log the real value instead of the fixed one.

The second call, inside RegisterContextUnwind::ReadFrameAddress, is
computing an address which is then passed to
ReadRegisterValueFromMemory, which boils down to a Process::ReadMemory,
which fixes the address if it wants to. The current variable names are
misleading, making readers believe it is the cfa value itself that is
being passed to Fix*Address; that's not the case. This commit renames
the variable to make this abundantly clear.
2025-09-18 10:33:51 -07:00
David Peixotto
44a1f7e7ca
[lldb] Fix unsafe map mutation in ProcessElfCore::FindModuleUUID (#159444)
The `ProcessElfCore::FindModuleUUID` function can be called by multiple
threads at the same time when `target.parallel-module-load` is true. We
were using the `operator[]` to lookup the UUID which will mutate the map
when the key is not present. This is unsafe in a multi-threaded contex
so we now use a read-only `find` operation and explicitly return an
invalid UUID when the key is not present.

The `m_uuids` map can follow a create-then-query pattern. It is
populated in the `DoLoadCore` function which looks like it is only
called in a single-threaded context so we do not need extra locking as
long as we keep the other accesses read-only.

Other fixes I considered

* Use a lock to protect access - We don't need to modify the map after
creation so we can allow concurrent read-only access.
* Store the map in a const pointer container to prevent accidental
mutation in other places.
     - Only accessed in one place currently so just added a comment.
* Store the UUID in the NT_FILE_Entry after building the mapping
correctly in `UpdateBuildIdForNTFileEntries`. - The map lets us avoid a
linear search in `FindModuleUUID`.

This commit also reverts the temporary workaround from #159395 which
disabled parallel module loading to avoid the test failure.

Fixes #159377
2025-09-18 08:20:09 -07:00
Vy Nguyen
09e0f1e035
[LLDB]Fix buffer-over-flow bug introduced in 157170 (#159588)
If `pr_name` is longer than 16, it would be a non-null terminated
string. Assigning it to `std::string m_executable_name` would cause an
overflow read. Instead, just copy the name from thread_data.name.

To repro, run the `elf-core/TestLinuxCore.py` with asan
(Question: why is the new variable needed in the first place? can't the
thread_data.name be used?)
2025-09-18 10:43:42 -04:00
Walter Erquinigo
4f72abd840
[LLDB] Add support for the structured data plugins in lldb-server (#159457)
The LLDB client has support for structured data plugins, but lldb-server
doesn't have corresponding support for it. This patch adds the missing
functionality in LLGS for servers to register their supported plugins
and send corresponding async messages.
2025-09-18 10:40:55 -04:00
David Spickett
1fc9b34488
[lldb][test] Disable a procfile test when threading is not enabled (#159559)
As is done for other procfile tests.
2025-09-18 13:01:55 +01:00
David Spickett
1dc6bf3ff9
[lldb][lldb-dap] Disable all lldb-dap tests on Windows on Arm (#159542)
This reverts the following commits:
a0a82ee19d6f2ff1013407ba4c973bfe5428423f
757bb36a58c7d7151a28c6a5fc7caa2e1f44de87
83b48b13f3a70bf56053e92593270c519859cfd7
b45f1fb377636a34c01e34b89341c97d19975554
d2e153981e62fb2ea781ef456ff744f9893e0733
e2d1bbebbb099c7010a31fad62a9128166ef14a0
71cae12442e7476e6397fd73db05e127bfe2d035
7dd879bdc01297a551196a60bb5a5a90ca4dd1ed
f3b542e3148cfc244f63cb7c987ccf8ebc71942b

Where I had disabled specific tests due to them being flakey on our
Windows on Arm bot.

Clearly this strategy isn't working because
every day I see a new random test failing.

Until something can be done about this, disable
every lldb-dap test on Windows on Arm. The coverage we get is just not
worth spamming contributors
who have nothing to do with lldb-dap.

See #137660
2025-09-18 11:01:19 +01:00
nerix
4625c8f076
[LLDB][NativePDB] Add modifiers to modified type name (#159296)
When creating LLDB types from `LF_MODIFIER` records, the type name of
the modified type was used. This didn't include the modifiers
(`const`/`volatile`/`__unaligned`). With this PR, they're included.

The DIA plugin had a test for this. That test also assumed that function
types had a name. I removed that check here, because function/procedure
types themselves in PDB don't have a name:

```
  0x1015 | LF_ARGLIST [size = 20, hash = 0xBCB6]
           0x0074 (int): `int`
           0x1013: `int* __restrict`
           0x1014: `int& __restrict`
  0x1016 | LF_PROCEDURE [size = 16, hash = 0x3F611]
           return type = 0x0003 (void), # args = 3, param list = 0x1015
           calling conv = cdecl, options = None
```

I assume DIA gets the name from the function symbol itself. In the
native plugin, that name isn't included and multiple functions with the
same signature will reuse one type, whereas DIA would create a new type
for each function. The
[Shell/SymbolFile/PDB/func-symbols.test](b29c7ded31/lldb/test/Shell/SymbolFile/PDB/func-symbols.test)
also relies on this.
2025-09-18 11:55:15 +02:00
nerix
a868f28c6e
[LLDB][ProcessWindows] Set exit status on instance rather than going through all targets (#159308)
When quitting LLDB on Windows while a process was still running, LLDB
would take unusually long to exit. This was due to a temporary deadlock:

The main thread was destroying the processes. In doing so, it iterated
over the target list:

88c64f76ed/lldb/source/Core/Debugger.cpp (L1095-L1098)

This locks the list for the whole iteration. Finalizing the process
would eventually lead to `DebuggerThread::StopDebugging`, which
terminates the process and waits for it to exit:

88c64f76ed/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp (L196)
The debugger loop (on a separate thread) would see that the process
exited and call
[`ProcessWindows::OnExitProcess`](88c64f76ed/lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp (L656-L673)).
This calls the static function
[`Process::SetProcessExitStatus`](0a7a7d56fc/lldb/source/Target/Process.cpp (L1098-L1126)).
This tries to find the process by its ID from the debugger's target
list. Doing so requires locking the list, so the debugger thread would
then be stuck on

0a7a7d56fc/lldb/source/Target/TargetList.cpp (L403)

After 5s, the main thread would give up waiting. So every exit where the
process was still running would be delayed by about 5s.

Since `ProcessWindows` would find itself when calling
`SetProcessExitStatus`, we can call `SetExitStatus` directly.

This can also make some tests run faster. For example, the DIA PDB tests
previously took 15s to run on my PC (24 jobs) and now take 5s. For all
shell tests, the difference isn't that big (only about 3s), because most
don't run into this and the tests run in parallel.
2025-09-18 11:27:25 +02:00
David Spickett
88b5c7435e
[lldb] Correct 32-bit build failure in StopInfoMachException.cpp (#159523)
uintptr_t is usually a good idea when handling pointers, but lldb has to
handle 64-bit addresses that might be from a remote system, on a 32-bit
system.

So I've changed a few instances here to use addr_t which is 64-bit
everywhere.

Before we got:
https://lab.llvm.org/buildbot/#/builders/18/builds/21247

```
../llvm-project/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp:81:28: error: constexpr variable 'g_mte_tag_mask' must be initialized by a constant expression
   81 | static constexpr uintptr_t g_mte_tag_mask = (uintptr_t)0x0f << g_mte_tag_shift;
      |                            ^                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../llvm-project/lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp:81:61: note: shift count 56 >= width of type 'uintptr_t' (aka 'unsigned int') (32 bits)
   81 | static constexpr uintptr_t g_mte_tag_mask = (uintptr_t)0x0f << g_mte_tag_shift;
      |                                                             ^
1 error generated.
```

Original code added by #159117.
2025-09-18 09:59:02 +01:00
Felipe de Azevedo Piovezan
bb013a4a22
Reland "Revert "[lldb] Fix OP_deref evaluation for large integer resu… (#159482)
…lts (#159460)""

The original had an issue on "AArch-less" bots.
Fixed it with some ifdefs around the presence of the AArch ABI plugin.

This reverts commit 1a4685df13282ae5c1d7dce055a71a7130bfab3c.
2025-09-17 17:02:24 -07:00
John Harrison
5cc41936f2
[lldb-mcp] Fix servers accepting more than one client. (#158357)
This fixes an issue where the MCP server would stop the main loop after
the first client disconnects.

This moves the MainLoop out of the Server instance and lifts the server
up into the ProtocolServerMCP object instead. This allows us to register
the client with the main loop used to accept and process requests.
2025-09-17 16:43:03 -07:00
Druzhkov Sergei
c744f6168f
[lldb-dap] Add memory event (#158437)
This patch adds support for the `memory` event from the
[DAP](https://microsoft.github.io/debug-adapter-protocol/specification#Events_Memory).
After this event is emitted, VS Code refetches the corresponding memory
range and re-renders the memory view. I think this patch and
[PR](https://github.com/llvm/llvm-project/pull/151884) can improve
experience for users who use `setVariable` request.
2025-09-17 15:51:40 -07:00
Felipe de Azevedo Piovezan
1a4685df13 Revert "[lldb] Fix OP_deref evaluation for large integer results (#159460)"
This reverts commit 1d2007ba6f7bacda8848e35298a1833e79f4abd5.
2025-09-17 15:49:09 -07:00
Felipe de Azevedo Piovezan
1d2007ba6f
[lldb] Fix OP_deref evaluation for large integer results (#159460)
When evaluating any DWARF expression that ended in OP_deref and whose
previous value on the dwarf stack -- the pointer address for the deref
-- was a load address, we were treating the result itself as a pointer,
calling Process:FixCodeAddress(result). This is wrong: there's no
guarantee that the result is a pointer itself.
2025-09-17 15:46:24 -07:00
Jonas Devlieghere
def2020485
[lldb] Recognize MTE fault Mach exceptions (#159117)
Recognize an MTE tag fault Mach exception. A tag fault is an error
reported by Arm's Memory Tagging Extension (MTE) when a memory access
attempts to use a pointer with a tag that doesn't match the tag stored
with the memory. LLDB will print the tag and address to make the issue
easier to diagnose.

This was hand tested by debugging an MTE enabled binary on an iPhone 17
running iOS 26.

rdar://113575216
2025-09-17 11:20:52 -07:00
Martin Storsjö
1c5fcb13e0
[lldb] Avoid build warnings when building for Windows. NFC. (#159345)
This avoids the following warnings from Clang:

    ../../lldb/source/Host/windows/Host.cpp:324:3: warning: default label in switch which covers all enumeration values [-Wcovered-switch-default]
      324 |   default:
          |   ^
    ../../lldb/source/Host/common/File.cpp:662:26: warning: cast from 'const void *' to 'char *' drops const qualifier [-Wcast-qual]
      662 |           .write((char *)buf, num_bytes);
          |                          ^
2025-09-17 20:39:33 +03:00
Martin Storsjö
4ff113f0aa
[lldb] Add unreachable after fully covered switches, avoid GCC warnings. NFC. (#159327)
This avoids the following kind of warning with GCC:

    warning: control reaches end of non-void function [-Wreturn-type]
2025-09-17 20:34:30 +03:00
David Spickett
d0bdc5d945
[lldb][test] Disable parallel module loading for TestNetBSDCore.py (#159395)
Since #157170 this test has been flakey on several LLDB buildbots. I
suspect it's to do with mutli-threading, there are more details in
#159377.

Disable parallel loading for now so we are not spamming people making
unrelated changes.
2025-09-17 17:40:36 +01:00
cmtice
9855d546a4
[LLDB] Add boolean literals to DIL. (#157992)
This adds the ability to recognize (and create ValueObjects for) boolean
literals ("true", "false") to DIL. This is a preliminary step to adding
type casting (and also for the ternary op).
2025-09-16 16:04:42 -07:00
Druzhkov Sergei
90d96b3e9c
[NFC][lldb-dap] Fix typo in invalidated event (#158338)
Fixed a typo in the `invalidated` event according to
[DAP](https://microsoft.github.io/debug-adapter-protocol/specification#Events_Invalidated)
specification. While the field is `frameId` elsewhere, it must be
`stackFrameId` in this event.
2025-09-16 18:28:13 +00:00
Druzhkov Sergei
1819798227
[lldb-dap] Add stdio redirection (#158609)
As far as I understand, lldb-dap does not currently support stdio
redirection. I have added support for this via a new field in the launch
configuration named `stdio`. It was inspired by the same named field in
[CodeLLDB](https://github.com/vadimcn/codelldb/blob/master/MANUAL.md#stdio-redirection).
2025-09-16 11:07:24 -07:00
John Harrison
ba5ca37f40
[lldb-mcp] Launch lldb on demand, if needed. (#158701)
Adding support for launching lldb with `-O protocol start MCP` if a
valid ~/.lldb/lldb-mcp-*.json` file is not found.

---------

Co-authored-by: Jonas Devlieghere <jonas@devlieghere.com>
2025-09-16 09:57:37 -07:00
Jan Svoboda
30633f3089
[clang] Initialize the file system explicitly (#158381)
This PR is a part of the effort to make the VFS used in the compiler
more explicit and consistent.

Instead of creating the VFS deep within the compiler (in
`CompilerInstance::createFileManager()`), clients are now required to
explicitly call `CompilerInstance::createVirtualFileSystem()` and
provide the base VFS from the outside.

This PR also helps in breaking up the dependency cycle where creating a
properly configured `DiagnosticsEngine` requires a properly configured
VFS, but creating properly configuring a VFS requires the
`DiagnosticsEngine`.

Both `CompilerInstance::create{FileManager,Diagnostics}()` now just use
the VFS already in `CompilerInstance` instead of taking one as a
parameter, making the VFS consistent across the instance sub-object.
2025-09-16 08:21:06 -07:00
David Spickett
a0a82ee19d
[lldb][lldb-dap] Disable more DAP tests on Windows (#158906)
Flakey on Windows on Arm:
https://lab.llvm.org/buildbot/#/builders/141/builds/11540

See #137660
2025-09-16 10:58:49 +01:00
Michael Buch
f5022bd03e [lldb][test] import-std-module: skip vector tests
This unblocks https://github.com/llvm/llvm-project/pull/158606. The tests are failing because libc++ is now using lambdas in function bodies in the vector header. Ever since https://github.com/llvm/llvm-project/issues/149477 we bail out of importing types when we encounter lambdas. Until we fix ASTImport of `clang::LambdaExpr` nodes properly, this will need to be skipped.
2025-09-16 10:30:49 +01:00
Sirraide
9b95e10d5e
[LLDB] [Tests] Downgrade -Wincompatible-pointer-types to a warning in some tests (#158756)
These no longer compile because the warning now defaults to an error
after #157364, so downgrade the error to a warning for now; I’m not
familiar enough with either LLDB or MacOS to fix these warnings properly
(assuming they’re unintended).
2025-09-16 02:02:01 +02:00
Michael Buch
95d5d984db
[lldb][TypeSystem] Enable colored AST dump (#86159)
This patch causes the various AST dump commands (`target modules dump
ast`/`target dump typesystem`) to be color-highlighted. I added a `bool
show_color` parameter to `SymbolFile::DumpClangAST` and
`TypeSystem::Dump`. In `TypeSystemClang` I temporarily sets the
`getShowColors` flag on the owned Clang AST (using an RAII helper) for
the duration of the AST dump. We use `Debugger::GetUseColors` to decide
whether to color the AST dump.
2025-09-15 18:03:55 +01:00
Sirraide
b24769855d
[Clang] [Sema] Make -Wincompatible-pointer-types an error by default (#157364)
GCC 14 also made this an error by default, so we’re following suit.

Fixes #74605
2025-09-15 16:55:00 +00:00
John Harrison
ec8819f185
[lldb-mcp] Adding a tool to list debuggers again. (#158340)
This brings back the tool for listing debuggers.

This is helpful when an LLM doesn't support resources, like gemini-cli.

I also fixed an issue with `ServerInfoHandle` not always cleaning up the
`~/lldb/lldb-mcp-<pid>.json` file correctly.
2025-09-15 09:43:10 -07:00
Ebuka Ezike
5e118eca93
[lldb][test] Fix unordered-map test. (#158286)
The build step is overidden so it uses `libstdc++` instead of `libc++`
on linux
2025-09-15 15:21:56 +01:00
Ebuka Ezike
f1a02c681f
[lldb] Fix unordered-map data formatter for const types (#156033)
The test was failing because the const qualifier is not removed when checking if the type is an `unordered_map`
2025-09-15 15:19:55 +01:00
nerix
4de9bee7e5
[LLDB][PDB] Require Windows for for testing PDB plugin-selection again (#158559)
Amends #158284 and fixes the failure on `lldb-remote-linux-win` from
https://github.com/llvm/llvm-project/pull/158284#issuecomment-3290154510.
That builder is configured with the DIA SDK but builds for Linux, so the
debug information will be DWARF, not PDB.
2025-09-15 11:07:42 +02:00
David Spickett
757bb36a58 [lldb][test] Disable a test from TestDAP_cancel.py on Windows
Flakey on our Windows on Arm bot:
https://lab.llvm.org/buildbot/#/builders/141/builds/11516

See https://github.com/llvm/llvm-project/issues/137660
2025-09-15 08:48:04 +00:00
nerix
b31f8cb1c9
[LLDB] Require DIA SDK for testing the PDB plugin-selection setting (#158284)
If LLDB is built without the DIA SDK enabled, then the native plugin is
used regardless of `plugin.symbol-file.pdb.reader` or
`LLDB_USE_NATIVE_PDB_READER`. This made the test fail on Windows when
the DIA SDK was disabled
(https://github.com/llvm/llvm-project/issues/114906#issuecomment-3241796062).

This PR changes the requirement for the test from `target-windows` to
`diasdk` (only used in this test).
2025-09-13 09:15:52 +00:00
Med Ismail Bennani
261000760f
[lldb/docs] Breakdown python reference into multiple files (#158331)
This pages improve the LLDB website documentation readability and
discoverability by breaking down the very long python-reference page
into multiple subpages each explaining a specific topic.

The long term goal is to have tutorials for every scripting extension.

This also converts the pages to markdown, since it's easier to write.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2025-09-12 20:03:36 -07:00
Alex Langford
120d7475d3
[lldb] Change directory creation logic in framework-header-fix (#158355)
It's possible for this logic to fail if the build system runs this
script in parallel. One instance could create the directory in between
another instance's checking of its existence and attempt at creation.

Instead, always try to create it and ignore any FileExistsErrors.

rdar://160120161
2025-09-12 16:38:29 -07:00
Andrew Gontarek
4826039058
[LLDB][NVIDIA] Add NVPTX architecture support (#158334)
- Introduced a new method `IsNVPTX()` in `ArchSpec` to check for NVPTX
architecture.
- Implemented the corresponding method in `ArchSpec.cpp` to utilize the
existing triple architecture checks.
2025-09-12 14:46:51 -04:00
Dmitry Vasilyev
a848008e19
[lldb] Fixed UB in CPlusPlusLanguage plug-in (#158304)
C++11 allows the use of Universal Character Names (UCNs) in identifiers,
including function names.

According to the spec the behavior of std::isalpha(ch) and
std::isalnum(ch) is undefined if the argument's value is neither
representable as unsigned char nor equal to EOF. To use these functions
safely with plain chars (or signed chars), the argument should first be
converted to unsigned char.
2025-09-12 20:56:21 +04:00
Matheus Izvekov
ba9d1c41c4
[clang] AST: remove DependentTemplateSpecializationType (#158109)
A DependentTemplateSpecializationType (DTST) is basically just a
TemplateSpecializationType (TST) with a hardcoded DependentTemplateName
(DTN) as its TemplateName.

This removes the DTST and replaces all uses of it with a TST, removing a
lot of duplication in the implementation.

Technically the hardcoded DTN is an optimization for a most common case,
but the TST implementation is in better shape overall and with other
optimizations, so this patch ends up being an overall performance
positive:
<img width="1465" height="38" alt="image"
src="https://github.com/user-attachments/assets/084b0694-2839-427a-b664-eff400f780b5"
/>

A DTST also didn't allow a template name representing a DTN that was
substituted, such as from an alias template, while the TST does allow it
by the simple fact it can hold an arbitrary TemplateName, so this patch
also increases the amount of sugar retained, while still being faster
overall.

Example (from included test case):
```C++
template<template<class> class TT> using T1 = TT<int>;
template<class T> using T2 = T1<T::template X>;
```

Here we can now represent in the AST that `TT` was substituted for the
dependent template name `T::template X`.
2025-09-12 13:55:38 -03:00