Commit graph

4386 commits

Author SHA1 Message Date
Corentin Jabot
e24eb10725
[Clang] Treat line directives as header names. (#211512)
We treated line directives as being unevaluated string literal. However
- The standard has no such restriction - or rather the standard has
different, unclear restriction (https://wg21.link/CWG2693)
- Because of Windows paths, it's common for "C:\foo\bar" to be used, and
these should not form escape sequences.

To remain consistent with other implementations, we do not allow `#line
1 <>` at this time. We do however support `#line 1 ""` to avoid a
breaking change.

Fixes a regression introduced by #201413
2026-07-29 19:04:17 +02:00
Nathan Ridge
e9240abc52
[clangd] Respect ArgumentLists for struct templates (#212094)
Also fix a bug in index::getSymbolKind where the returned symbol kind
would be Class for a struct template.

Fixes https://github.com/clangd/clangd/issues/2684
2026-07-27 03:07:00 +02:00
David Zbarsky
15ae01dd24
[clangd][Support] Outline LSP payload decode errors (#203121)
Move failed payload handling from `clangd::LSPBinder::parse<T>` and
`llvm::lsp::MessageHandler::parse<T>` into their non-inline
`handleParseError` functions, while keeping successful payload
conversion specialized in each `parse<T>` instantiation.

For a Darwin arm64 build, stripped clangd decreased by 32,848 bytes and
`__TEXT,__text` decreased by 25,180 bytes.

`ClangdTests --gtest_filter=LSPBinderTest.*` passes, and
`llvm/lib/Support/LSP/Transport.cpp` passes a standalone syntax compile.

Work towards #202616

AI tool disclosure: Co-authored with OpenAI Codex.

Co-authored-by: OpenAI Codex <noreply@openai.com>
2026-07-17 08:38:19 +03:00
Access
25682c3470
[clangd] highlight import and export keywords for C++20 modules (#204511)
Add syntax highlighting for C++20 module `import` and `export` keywords.

Note: Highlighting of the `export` keyword in a module export statement is not possible, because such statements don't appear in the AST
2026-07-15 16:44:02 +03:00
David Zbarsky
c4830afdbb
[clangd] Use unique_function for config handlers (#203008)
`ConfigYAML.cpp`'s `DictParser` owns its callbacks for one parse and
never copies them, so this replaces `std::function` with move-only
`llvm::unique_function` and removes the unused copy machinery for each
lambda.

In a matched Release AArch64 build, `ConfigYAML.cpp.o` shrank by 94,560
bytes, stripped clangd shrank by 16,848 bytes, unstripped clangd shrank
by 82,512 bytes, and dyld fixups fell by 336.

Validated with the 16 `ParseYAML` unit tests and `clangd --check`; 12
paired runs of 100,000 parses improved mean user CPU time by 3.46% (95%
CI: 1.31% to 5.61%).

Work towards #202616

AI tool disclosure: Co-authored with OpenAI Codex.
2026-07-15 01:58:57 -04:00
Aiden Grossman
dcbf2a9eee
[clang-tools-extra] Drop option to use external shell
The external shell is going to be removed from lit soon, so drop the
option to enable using it.

Reviewers: petrhosek, compnerd, ilovepi

Pull Request: https://github.com/llvm/llvm-project/pull/209625
2026-07-14 20:30:03 -07:00
Aleksandr Platonov
372e0ab3a8
[clangd][remote] Fix SmallVector assertion in uriToRelativePath for Windows paths (#208830)
After https://github.com/llvm/llvm-project/pull/207202 buildbot has
detected a new failure.
Assertion happens in newly created test:
```
ClangdTests: /vol/worker/clangd-ubuntu-clang/clangd-ubuntu-tsan/llvm-project/llvm/include/llvm/ADT/SmallVector.h:196: void llvm::SmallVectorTemplateCommon<char>::assertSafeToReferenceAfterResize(const void *, size_t) [T = char]: Assertion `isSafeToReferenceAfterResize(Elt, NewSize) && "Attempting to reference an element of the vector in an operation " "that invalidates it"' failed.
```
The root cause is that `Path` is a `StringRef` aliasing `Result`s
buffer. Assigning `Result` to `Path.drop_front()` triggers
`SmallVector`s `assertSafeToReferenceAfterResize` assertion (that
assertion checks if we are passing an iterator that points into the own
buffer).

With this patch we convert `Path.drop_front()` to `std::string` to break
the aliasing before assignment.
2026-07-11 00:02:46 +03:00
timon-ul
4d834cd764
[clangd] CodeCompletion surface param names if possible (#206716)
Resolves issue https://github.com/clangd/clangd/issues/2651
2026-07-10 19:07:42 +02:00
Bartosz Wiklak
ff5363bf29
[clangd][remote] Add clangd-index-server support for cross platform indexes (#207202)
The main use case is to serve windows index on linux server. 

Without this change server wasn't able to check if project_root path is
absolute and was closed with error: "Index root should be an absolute
path."

This change is meant to solve issue:
https://github.com/clangd/clangd/issues/2646
2026-07-10 17:34:56 +03:00
Hans Wennborg
092f4451ce
Revert "[clang] Reland: fix getTemplateInstantiationArgs (#208285)" (#208426)
It caused various breakages; see comments on the PR.

This reverts commit 031b773b01.
2026-07-09 12:11:45 +00:00
Matheus Izvekov
031b773b01
[clang] Reland: fix getTemplateInstantiationArgs (#208285)
Relands https://github.com/llvm/llvm-project/pull/199528
Previous: https://github.com/llvm/llvm-project/pull/207825

This implements a new strategy for collecting the template arguments, by
relying on the qualifiers and template parameter lists to navigate the
template
context of out-of-line definitions.

This greatly simplifies the signature of that function, by removing a
bunch
of workarounds, and simpliffying a couple that weren't removed yet.

Since this now relies on qualifiers and template parameter lists,
this patch expends most of its effort making sure these are placed,
transformed and propagated to template instantiations.

Also makes the explicit specialization AST nodes stop abusing the
template
parameter lists by storing it's own template parameter list, creating a
dedicated field for them, similar to partial specializations.

Fixes https://github.com/llvm/llvm-project/issues/202106
Fixes https://github.com/llvm/llvm-project/issues/202109
Fixes #208100
Fixes #202358

Changes since last landing:

* Instantiated method decls uses a separate path, also needs merging of
deduced return type.
* Handle failures instantiating redeclaration for default arguments
(fails in some error recovery scenarios).
2026-07-08 16:53:43 -03:00
Petr Hosek
6d1566cecf
Revert "[clang] Reland: fix getTemplateInstantiationArgs" (#208064)
Reverts llvm/llvm-project#207825 since it's causing a crash in Clang.
2026-07-07 12:32:10 -07:00
Matheus Izvekov
ff11bbce9e
[clang] Reland: fix getTemplateInstantiationArgs (#207825)
Relands https://github.com/llvm/llvm-project/pull/199528
Previous: https://github.com/llvm/llvm-project/pull/202088

This implements a new strategy for collecting the template arguments, by
relying on the qualifiers and template parameter lists to navigate the
template
context of out-of-line definitions.

This greatly simplifies the signature of that function, by removing a
bunch
of workarounds, and simpliffying a couple that weren't removed yet.

Since this now relies on qualifiers and template parameter lists,
this patch expends most of its effort making sure these are placed,
transformed and propagated to template instantiations.

Also makes the explicit specialization AST nodes stop abusing the
template
parameter lists by storing it's own template parameter list, creating a
dedicated field for them, similar to partial specializations.

Fixes #202106
Fixes #202109
2026-07-06 18:50:26 -03:00
ingoneuse
ae3d310fa3
[clangd] Null-check AutoTypeLoc in CollectExtraHighlightings::VisitDeclaratorDecl (#207323)
A Decl's getType() can have a getContainedAutoType() without
its TypeSourceInfo's type having one, because the two types
can differ in type sugar such as DecltypeType which
getContainedAutoType[Loc]() deliberately does not look through.

Fixes https://github.com/llvm/llvm-project/issues/207139
2026-07-06 03:03:07 -04:00
Berkay Sahin
d7cd957bee
[clangd] Invalidate preamble when new module imports are added (#199460)
When using `SkipPreambleBuild`, adding a new `import` statement to a
file did
not invalidate the existing preamble because `isPreambleCompatible` only
checked whether existing prerequisite modules were up-to-date, not
whether
the set of required modules itself had changed.

Fixes: #199389
Partially addresses: #126350
2026-07-03 08:57:39 +08:00
tcottin
22ad1d6eee
[clangd] Use plaintext newline handling for escaped markdown hover style (#185197)
For clangd 22 there are [3 new
options](https://clangd.llvm.org/config#documentation) to control the
content of the hover information. Using the default Plaintext option,
Markdown syntax is escaped.
But whitespaces (like newlines etc.) are not "escaped" anymore as it was
before the introduction of Markdown and Doxygen rendering.

Some clients do not render Markdown even if they request Markdown
content from the server.
At least the [neovim client](https://github.com/clangd/clangd/issues/95)
does not render Markdown whitespace correctly.
Therefore, with clangd 22, the rendering for these clients looks
different, especially for newlines.
Without the escaping, newlines are rendered as written in the
documentation comment, which is not desired for these clients.

This patch fixes the regression by using the same whitespace escaping as
clangd < 22.
2026-07-02 00:04:50 +02:00
Joseph Huber
2a215f473f
[Clang] Refactor and consolidate color diagnostic handling (#202441)
Summary:
This PR tries to consolidate the color output handling in Clang. The
motivation was noticing that `-Xclang -ast-dump` would not behave like
`-fcolor-diagnostics` and would output ANSI codes to a file when I tried
to pipe it.

This PR primarily turns the handling into a tri-state enum keyed off of
`-f[no]-color-diagnostics`. The default/auto case will be if the target
stream supports colors. Getting this to work required a lot of seemingly
unrelated plumbing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 15:30:10 -05:00
Aditya Medhane
49cf5a7ba0
[clangd] Remove unused onlyValue<bool> overload (NFC) (#206312)
BundledEntry has three `std::string` members and no bool member, so the
bool overload of onlyValue can never be instantiated. It has been dead
since it was added and trips -Wunused-template.

NFC. Part of #202945.
2026-06-28 21:05:58 -04:00
Fangrui Song
ca59c69132
[Allocator] Drop RedZoneSize (non-sanitizer) and BytesAllocated members (#205711)
`RedZoneSize` is only read inside `#if LLVM_ADDRESS_SANITIZER_BUILD`.
Additionally gate it under `LLVM_ENABLE_ABI_BREAKING_CHECKS` so that
release-non-assertions builds don't incur the overhead. To support
non-asan build with asan library users, the variable is only omitted in
`!LLVM_ENABLE_ABI_BREAKING_CHECKS` builds.

`BytesAllocated` is incremented on every Allocate (a hot-path memory
read-modify-write) only to back `getBytesAllocated()`. Drop the member.
There is a measurable stage2 instruction-count reduction.

https://llvm-compile-time-tracker.com/compare.php?from=25a6b5be6853b2c493ef392d41e43dd35ad4839a&to=8ebc975635ad717deb392d20b50f1a1f6bb16054&stat=instructions:u

Migrate the in-tree consumers:

- TableGen dumpAllocationStats drops the line; the clangd debug log
reports
  getTotalMemory().
- clang's PPMemoryAllocationsTest measures getTotalMemory()/#define;
over 1M
defines this is 120.06 B/define, matching the prior ~120 B, so the
existing
  bound holds.
- lldb's ConstString MemoryStats (https://reviews.llvm.org/D117914)
  drops bytes_used/bytes_unused

Aided by Claude Opus 4.8
2026-06-28 02:15:56 +00:00
Yuli Fiterman
f0bbae6641
[clangd] Navigate go-to-definition through forwarding wrappers to the constructor (#199480)
When the user invokes **Go to Definition** on a call like
`std::make_unique<T>(args...)` or `std::make_shared<T>(args...)`,
surface the constructor of `T` that is actually invoked inside the
wrapper, alongside the wrapper itself. The constructor is added before
the wrapper so LSP clients that auto-jump to the first target land on
it; clients that present a menu still let the user reach the wrapper.

This is the forward-direction counterpart to the find-references work in
#169742 (clangd/clangd#716): the same `isLikelyForwardingFunction` +
`searchConstructorsInForwardingFunction` machinery, applied to
`locateASTReferent`.
2026-06-26 11:26:31 +02:00
tcottin
94ae3dd241
[clangd] Fix unknown doxygen command parsing in parameter documentation (#202121)
This patch mainly fixes a bug with parsing of unknown doxygen commands
in function parameter documentation.

To extract the parameter documentation from the function documentation,
the whole function documentation is parsed first.
Then the documentation paragraph for the requested parameter is
"converted" to a string and stored as the documentation for the
parameter. The string is converted by visiting and dumping all chunks of
the parsed paragraph.

When unknown doxygen commands are parsed (during the function
documentation parsing step), they are registered in a
`clang::comments::CommandTraits` object.
Visiting the unknown command requires to query the registered commands
through the `clang::comments::CommandTraits` object to get the command
name.

The bug was that the function documentation parsing and the visiting
step used 2 different `clang::comments::CommandTraits` objects. Hence
the visiting step fails (array access out of bounds) when trying to
retrieve the command names for unknown commands.

The patch moves the function documentation parsing step to the
construction of the `SymbolDocCommentVisitor` which is also responsible
for converting the parameter documentation paragraph to a string.
This way the same `clang::comments::CommandTraits` is used and the query
for unknown command names is correct.

Additional fixes:

- correct some whitespace behaviour for doxygen inline commands
- add a new token kind for the clang comment parser to distinguish
unknown "backslash" and "at" commands to correctly show them in the
clangd hover info

Related issue: clangd/clangd#2671
2026-06-25 14:21:45 +02:00
Nikolas Klauser
34bdee76b8
Remove unused variables in the monorepo (#204994)
https://github.com/llvm/llvm-project/pull/203084 adds diagnostics about
unused variables to the libc++ containers. This patch is the fallout
from the projects I tried to build with it.
2026-06-24 11:50:30 +02:00
Yihan Wang
83528bad5c
[clangd] fix preprocessor caching-lexer state tracking (#203716)
Fix `recomputeCurLexerKind` to avoid default fallback to
`CurLexerCallback = CLK_CachingLexer;`.

This prevents code-completion EOF handling from accidentally restoring
CLK_CachingLexer while a tentative parse is still active, which could
trigger a caching lexer re-entry assertion in clangd signature help.

Fixes https://github.com/llvm/llvm-project/issues/200677

---------

Signed-off-by: yronglin <yronglin777@gmail.com>
2026-06-23 23:25:02 +08:00
Zeyi Xu
3abbf06dd1
[clang-tidy] Avoid token merging in redundant-parentheses fix-its (#202365)
The readability-redundant-parentheses check emitted fix-its that simply
removed both parentheses. Tools that apply those fix-its directly could
join adjacent tokens and produce invalid code, e.g. `return(0)` becoming
`return0`.

Replace the opening parenthesis with a space when removing it would
merge identifier characters across the removed token.

AI Usage: Test assisted by Codex.
Closes https://github.com/llvm/llvm-project/issues/185108
2026-06-23 19:06:04 +08:00
Walter Lee
5b687a501b
Be more permissive on spaces in command line argument parsing (#205111)
Fixes c888371ff0.

This change properly accommodates both presence and absence of extra
trailing arguments like -resource-dir.
2026-06-22 10:19:17 -04:00
Akshay Kumar Dubey
685af3ab08
[clangd] Log environment variables that influence compilation at startup (#204990)
When users face missing system include issues (especially on Windows), 
it's difficult to diagnose whether the problem is caused by missing
environment variables like `INCLUDE`, `CPATH`, etc.

This patch logs the values of environment variables that influence how the
compiler finds headers and libraries, at startup alongside the existing
version/PID/argv logs. Only variables that are actually set are printed.

  Variables logged:
- MSVC (set by vcvarsall.bat): `INCLUDE`, `LIB`, `LIBPATH`, `CL`, `_CL_`
- GCC/Clang: `CPATH`, `C_INCLUDE_PATH`, `CPLUS_INCLUDE_PATH`,
`OBJC_INCLUDE_PATH`, `LIBRARY_PATH`, `GCC_EXEC_PREFIX`

Fixes https://github.com/clangd/clangd/issues/2657
2026-06-22 09:41:22 -04:00
player
c888371ff0
[clangd] Look for resource-dir relative to detected compiler path as a fallback (#203332)
If the standard resource directory (which is searched for relative to the clangd
executable) does not exist, look for one relative to the detected compiler as a
fallback. This handles some packaging schemes where clangd and clang are
installed in different prefixes and the resource directory is only located in the
latter.

Also print an error message to the log if the fallback didn't find an existing
directory either.
2026-06-20 11:44:22 -04:00
Ian Anderson
d0734df2c4
cp -r replaces symlinks, update to cp -R (#201463)
`cp -r` translates to `cp -RL` on at least FreeBSD and macOS. `-L`
replaces symlinks with flat directories which effectively breaks Apple
style bundles like frameworks. Switch to `-R` so that the symlinks don't
get broken.
2026-06-18 16:09:10 -07:00
Qixi
2cd778c206
[clangd] Replay macro definitions from preamble for clang-tidy checks (#202495)
Clang-tidy checkers observe preprocessor events via PPCallbacks. When
using a preamble, macro definitions in the preamble region of the main
file are not replayed during the main-file build, causing checkers like
bugprone-reserved-identifier to miss them.

This patch extends ReplayPreamble::replay() to also replay MacroDefined
events for macros defined directly in the preamble region of the open
file, similar to how InclusionDirective events are already replayed.

Fixes: https://github.com/clangd/clangd/issues/2501
2026-06-17 11:00:11 +03:00
David Zbarsky
161d8a7806
[clangd][nfc] Avoid type erasure for local recursive callbacks (#203042)
Four local clangd callbacks use std::function only to call themselves.
Switch to local structs and static functions to avoid std::function
type-erasure and copy-support machinery.

In matched Release AArch64 builds, the four object files shrink by 8,152
bytes and 131 relocations; linked clangd shrinks by 3,872 bytes
unstripped and 16 bytes stripped, with __text down 360 bytes,
__DATA_CONST,__const down 208 bytes, unwind data down 32 bytes, and 21
fewer dyld fixups.

Work towards #202616

AI tool disclosure: Co-authored with OpenAI Codex.
2026-06-16 10:09:03 +03:00
Ryan Mansfield
89a086927f
[clangd] Keep ModuleCache alive for captured preamble AST (#203952)
Since #164889 made ModuleManager's ModuleCache reference non-owning, the
preamble's CompilerInstance solely owns the module buffers so retain the
shared_ptr<ModuleCache> in CapturedASTCtx.

Fixes #203799
2026-06-15 14:03:53 -04:00
Devon Loehr
8d478d367b
Revert "[clang] Reland: fix getTemplateInstantiationArgs (#202088)" (#203024)
This reverts commit aca0ce5a73.

That commit is causing several compile failures (in
[chromium](https://github.com/llvm/llvm-project/pull/202088#issuecomment-4664022394))
and assertion failures (#202109, #202106), so let's back it out for now.
2026-06-10 10:37:50 -07:00
Fangrui Song
ffb7404d1e
[clangd] Add missing direct includes for bit.h. NFC (#202840)
This currently compile only because llvm/ADT/Hashing.h transitively
pulls in llvm/Support/SwapByteOrder.h (which includes llvm/ADT/bit.h).
2026-06-09 20:13:44 -07:00
Access
620cdfb1d1
[clangd][Mangler] Drop unknown compile options (#200001)
this pr remove the options that not work for clang, which will make
compile failed for clang++, and this will make modules completions of
clangd work. And we will also log the unsupported options
2026-06-09 16:29:57 +08:00
Matheus Izvekov
aca0ce5a73
[clang] Reland: fix getTemplateInstantiationArgs (#202088)
Relands https://github.com/llvm/llvm-project/pull/199528
Previous: #201373

This implements a new strategy for collecting the template arguments, by
relying on the qualifiers and template parameter lists to navigate the
template
context of out-of-line definitions.

This greatly simplifies the signature of that function, by removing a
bunch
of workarounds, and simpliffying a couple that weren't removed yet.

Since this now relies on qualifiers and template parameter lists,
this patch expends most of its effort making sure these are placed,
transformed and propagated to template instantiations.

Also makes the explicit specialization AST nodes stop abusing the
template
parameter lists by storing it's own template parameter list, creating a
dedicated field for them, similar to partial specializations.
2026-06-07 01:06:29 +02:00
Fangrui Song
c5c9676496
[clang][clang-tools-extra] Remove unused DenseMapInfo::getEmptyKey (#201987)
After #201281 DenseMapInfo<T>::getEmptyKey() is no longer used by
DenseMap. Remove the unused getEmptyKey definitions and dead sentinel
uses.
2026-06-06 13:38:23 -07:00
Hans Wennborg
e668f64146
Revert "[clang] Reland: fix getTemplateInstantiationArgs" (#201864)
Reverts llvm/llvm-project#201373

This caused compilation errors. See comment on the original PR.
2026-06-05 16:51:26 +00:00
Aleksandr Platonov
e3260943a9
[clangd][modules] Provide correct context to ModulesBuilder::hasRequiredModules() call (#201419)
To make command mangler to use compile command edits from the
configuration, we need to provide the correct context to it.
Without this patch compile command edits declared in .clangd file are
not used during required modules check, which can lead to compile errors
appearing and false negative `ModulesBuilder::hadRequiredModules()`
return result.

This PR addresses problem described here
https://github.com/llvm/llvm-project/pull/200001#issuecomment-4590514342
2026-06-05 09:47:24 +03:00
Matheus Izvekov
bcdb732df2
[clang] Reland: fix getTemplateInstantiationArgs (#201373)
Relands #199528 

This implements a new strategy for collecting the template arguments, by
relying on the qualifiers and template parameter lists to navigate the
template
context of out-of-line definitions.

This greatly simplifies the signature of that function, by removing a
bunch
of workarounds, and simpliffying a couple that weren't removed yet.

Since this now relies on qualifiers and template parameter lists,
this patch expends most of its effort making sure these are placed,
transformed and propagated to template instantiations.

Also makes the explicit specialization AST nodes stop abusing the
template
parameter lists by storing it's own template parameter list, creating a
dedicated field for them, similar to partial specializations.
2026-06-04 15:29:45 -03:00
Nathan Ridge
9bb17a0092
[clangd] Disable PCH reuse for ClangdTests (#201232)
Fixes https://github.com/llvm/llvm-project/issues/200999
2026-06-03 02:55:38 -04:00
Nathan Ridge
a47bddccec
[clangd] Handle dependent call to function with explicit object parameter in InlayHintVisitor (#201264)
Dependent calls do not yet have the implicit object argument preprended
to the CallExpr's argument list, so the first argument should not be
expected to be present and dropped in this case.

Fixes https://github.com/llvm/llvm-project/issues/198588
2026-06-03 00:46:45 -04:00
Jan Svoboda
bc056ea2c2
[clang] Remove FileSystemStatCache (#198411)
This mechanism is not used anywhere, and can be easily reimplemented in
terms of a VFS if needed.
2026-06-02 10:21:09 -07:00
Hans Wennborg
b29352f7ea
Revert "[clang] fix getTemplateInstantiationArgs" (#201093)
This caused bootstrap builds on macOS to fail with

  error: definition with same mangled name ... as another definition

in JSONGenerator.cpp. See comments on the original PR.

Reverts llvm/llvm-project#199528
2026-06-02 11:43:23 +00:00
Fangrui Song
ad6366d6cc
[clang][clang-tools-extra] Remove unused DenseMapInfo::getTombstoneKey (#200634)
#200595 changed DenseMap to no longer create tombstone buckets, so
DenseMapInfo<T>::getTombstoneKey() is never called. Remove dead
definitions and dead tombstone branches.
2026-06-02 01:20:19 +00:00
Matheus Izvekov
ccd2606d0c
[clang] fix getTemplateInstantiationArgs (#199528)
This implements a new strategy for collecting the template arguments, by
relying on the qualifiers and template parameter lists to navigate the
template context of out-of-line definitions.

This greatly simplifies the signature of that function, by removing a
bunch of workarounds, and simpliffying a couple that weren't removed
yet.

Since this now relies on qualifiers and template parameter lists, this
patch expends most of its effort making sure these are placed,
transformed and propagated to template instantiations.

Also makes the explicit specialization AST nodes stop abusing the
template parameter lists by storing it's own template parameter list,
creating a dedicated field for them, similar to partial specializations.

Fixes #101330
2026-06-01 22:07:01 -03:00
Nathan Ridge
f9ae788567
[clang][HeuristicResolver] Handle non-dependent TemplateSpecializationType gracefully (#200714)
Fixes https://github.com/llvm/llvm-project/issues/197716
2026-06-01 20:57:44 -04:00
Christian Kandeler
3e92883e83
[clangd] Remove redundant symbol name from hierarchy item details (#170112)
Closes clangd/clangd#2346.
2026-05-28 16:41:38 +02:00
Baranov Victor
2245dd779f
[clangd] Prefer .hpp files over .h with header source switch (#198152)
Previously, The "Switch Between Source/Header" action picked `.h` over
`.hpp` when both files existed next to a `.cpp` file, because `.h` is
listed first in the header-extension list.

This patch reorders `HeaderExtensions` and `SourceExtensions` so the
`C++`-flavored extensions come before `.h` and `.c`. `C++`-flavor of
file is preffered since (at least in my opinion) more people using
`clangd` for `C++` than `C` with `.hpp` ext so switching from `.cpp`
should go into `.hpp`, not `.h`.

This brings an edje case that when swithing from `.c` it will go into
`.hpp` instead of `.h`, but I think this situation is more rare than
having `.cpp` with `.hpp` and `.h` combination since `.h` headers can be
used as `extern "C"` wrapper of cpp library.
2026-05-27 13:19:20 +03:00
Yanzuo Liu
ca9884dd06
[clang] Add missing type source info of decltype specifier in destructor call to AST (#197680)
The type source info will be stored in `MemberExpr::MemberDNLoc`.

This patch fixes the underlying issue of #195788.
2026-05-26 22:03:32 +08:00
Li-Zheng-Rong
fe3d6b051b
[NFC] [clangd] [C++20] [Modules] Fix false duplicate module warning for equivalent paths (#199343)
When checking for multiple source files declaring the same module, the
comparison used raw string equality on file paths. This causes false
positives when the same file is represented by different but equivalent
path strings.

Use pathEqual(normalizePath(...), normalizePath(...)) instead to compare
canonical paths, consistent with how clangd handles path comparisons
elsewhere.
2026-05-26 06:05:17 +00:00