Age | Commit message (Collapse) | Author | Files | Lines |
|
The clangd test was testing the previous diagnostic logic and now it's
testing with the new warning flag.
|
|
The wrong constructor of json::Value got called, making every tag an
array instead of a number.
|
|
(#84133)
This avoids a known libFormat bug where the heuristic can OOM on certain
large files (particularly single-header libraries such as miniaudio.h).
The OOM will still happen on affected files if you actually try to
format them (this is harder to avoid since the underlyting issue affects
the actual formatting logic, not just the language-guessing heuristic),
but at least it's avoided during non-modifying operations like hover,
and modifying operations that do local formatting like code completion.
Fixes https://github.com/clangd/clangd/issues/719
Fixes https://github.com/clangd/clangd/issues/1384
Fixes https://github.com/llvm/llvm-project/issues/70945
|
|
operator overloading (#84489)
|
|
LLVM is inconsistent about how it converts `errno` to `std::error_code`.
This can cause problems because values outside of `std::errc` compare
differently if one is system and one is generic on POSIX systems.
This is even more of a problem on Windows where use of the system
category is just wrong, as that is for Windows errors, which have a
completely different mapping than POSIX/generic errors. This patch fixes
one instance of this mistake in `JSONTransport.cpp`.
This patch adds `errnoAsErrorCode()` which makes it so people do not
need to think about this issue in the future. It also cleans up a lot of
usage of `errno` in LLVM and Clang.
|
|
Fix handling of Hungarian Prefix when configured to LowerCase.
Warnings no longer will be emited for names that already match
this style.
Fixes: #80268
|
|
with the same prefix as the default argument (#84333)
|
|
... using method syntax:
```
struct S {
static void f()
};
void DoIt(S& s) {
s.f(); // Does not mutate `s` through the `this` parameter.
}
```
|
|
non-const reference parameters (#84095)
Fixes: #84092
|
|
Show argument names in signature help when calling a function pointer
struct field.
|
|
toHalfOpenFileRange() already handles translating macro locations to
file locations, and it can provide a better result by knowing about both
ends of the range.
Fixes https://github.com/clangd/clangd/issues/1941
|
|
getFormatStyleForFile() (#82948)
|
|
The base class llvm::ThreadPoolInterface will be renamed
llvm::ThreadPool in a subsequent commit.
This is a breaking change: clients who use to create a ThreadPool must
now create a DefaultThreadPool instead.
|
|
(#83987)
Try to fix https://github.com/llvm/llvm-project/issues/83845
When `std::forward` is invoked in a function, make sure it uses correct
parameter by checking if the bounded `var` equals the parameter.
Co-authored-by: huqizhi <836744285@qq.com>
|
|
This will give us insight into what users are renaming in practice - for
instance, try to gauge the impact of the ObjC rename support.
|
|
Detects error-prone Curiously Recurring Template Pattern usage, when the CRTP
can be constructed outside itself and the derived class.
|
|
`std::forward` (#82673)
Add support for std::forward.
Fixes #82023
|
|
The parameter `CheckedFunctions` now supports regexes
Fixes #63107
|
|
DependentNameTypes (#83542)
When resolving names inside templates that implement recursive
compile-time functions (e.g. waldo<N>::type is defined in terms
of waldo<N-1>::type), HeuristicResolver could get into an infinite
recursion, specifically one where resolveDependentNameType() can
be called recursively with the same DependentNameType*.
To guard against this, HeuristicResolver tracks, for each external
call into a HeuristicResolver function, the set of DependentNameTypes
that it has seen, and bails if it sees the same DependentNameType again.
To implement this, a helper class HeuristicResolverImpl is introduced
to store state that persists for the duration of an external call into
HeuristicResolver (but does not persist between such calls).
Fixes https://github.com/clangd/clangd/issues/1951
|
|
`explicit(bool)` (#82689)
We now treat `explicit(false)` the same way we treat `noexcept(false)`
in the noexcept checks, which is ignoring it.
Also introduced a new warning message if a constructor has an `explicit`
declaration which evaluates to false and no longer emit a faulty FixIt.
Fixes #81121
|
|
Instance of DenseMap were copied into local variable,
and as a result reference to string stored in that local
variable were returned from function. At the end fix-it
were applied with already destroyed string causing some
non utf-8 characters to be printed.
Related to #80541
|
|
|
|
specializations (#83392)
|
|
deleted functions (#83055)
Improved check by no longer giving false positives for deleted functions.
|
|
This uses a more systematic approach for determining whcich
`DeclRefExpr`s mutate the underlying object: Instead of using a few
matchers, we walk up the AST until we find a parent that we can prove
cannot change the underlying object.
This allows us to handle most address taking and dereference, bindings
to value and const& variables, and track constness of pointee (see
changes in DeclRefExprUtilsTest.cpp).
This allows supporting more patterns in
`performance-unnecessary-copy-initialization`.
Those two patterns are relatively common:
```
const auto e = (*vector_ptr)[i]
```
and
```
const auto e = vector_ptr->at(i);
```
In our codebase, we have around 25% additional findings from
`performance-unnecessary-copy-initialization` with this change. I did
not see any additional false positives.
|
|
database (#82416)
I added the option -source-filter to the
`run-clang-tidy.py` script in the clang-tools-extra.
This option allows for handing over a regex, to filter out source files
from the compilation database (not run `clang-tidy` on them).
|
|
Use the legacy non-ObjC rename logic when dealing with selectors that
have zero or one arguments. In addition, make sure we don't add an extra
`:` during the rename.
Add a few more tests to verify this works (thanks to @ahoppen for the
tests and finding this bug).
|
|
|
|
|
|
Update include-cleaner tests. Now that we have proper found-decls set up
for VarTemplates, in case of instationtations we point to primary
templates and not specializations. To be changed in a follow-up patch.
|
|
textDocument/rename (#78454)
Co-authored-by: Nathan Ridge <zeratul976@hotmail.com>
|
|
That would turn:
int x = f() + 1;
into:
auto placeholder = f() + 1;
int x = placeholder;
which makes little sense and is clearly not intended, as stated
explicitly by a comment in eligibleForExtraction(). It appears that the
declaration case was simply forgotten (the assignment case was already
implemented).
|
|
style for file (#81985)
Summary:
Some build systems create symlinks in a temporary build directory for
headers in the source tree for isolation purposes. These symlinks
prevent `readability-identifier-naming` detecting issues and applying
fixes. Without this fix clang-tidy is checking .clang-tidy config file
in a temporary directory instead of source source location.
Test Plan: check-clang-tools
|
|
(#82166)
Fixes #56021.
|
|
- Fixed issue with invalid code being generated when static_cast is put
into fix, and no space were added before it.
- Fixed issue with duplicate parentheses being added when double
implicit cast is used.
Closes #71848
|
|
bugprone-non-zero-enum-to-bool-conversion (#81890)
Properly ignore parentheses in bitwise operators.
Closes #81515
|
|
prefer-member-initializer (#81560)
|
|
pieces (#76466)
This adds support for renaming Objective-C methods, which are unique since their method names can be split across multiple tokens.
|
|
llvm-project/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp:921:45:
error: missing field 'Annotations' initializer [-Werror,-Wmissing-field-initializers]
TextEdit{Main.range("virtual1"), ""}}};
^
llvm-project/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp:926:45:
error: missing field 'Annotations' initializer [-Werror,-Wmissing-field-initializers]
TextEdit{Main.range("virtual2"), ""}}};
^
2 errors generated.
|
|
When applying the recommended fix for the
"modernize-use-override" clang-tidy diagnostic
there was a stray whitespace. This PR fixes that.
Resolves https://github.com/clangd/clangd/issues/1704
|
|
members (#81423)
Updated the check to ignore point static data members with in class
initializer since removing the inline specifier would generate a
compilation error
Fixes #80684
|
|
bugprone-unused-local-non-trivial-variable (#81563)
|
|
|
|
Minor fixes in documentation & release notes.
|
|
variable is used as loop bound (#81183)
Changed LibASTMatcher to give an appropriate warning
when a const loop bound is initialized with a function declaration.
Fixes: #79580
|
|
The following test case in
`clang-tools-extra/test/clang-tidy/infrastructure/diagnostic.cpp` is
failing:
```
#ifdef PR64602 // Should not crash
template <class T = void>
struct S
{
auto foo(auto);
};
template <>
auto S<>::foo(auto)
{
return 1;
}
// CHECK8: error: template parameter list matching the non-templated nested type 'S<>' should be empty ('template<>') [clang-diagnostic-error]
#endif
```
#80864 fixes a bug where we would (incorrectly) append invented template
parameters to empty template parameter lists, which causes this test to
fail.
|
|
(#81061)
This patch provides more information to the
`PPCallbacks::InclusionDirective()` hook. We now always pass the
suggested module, regardless of whether it was actually imported or not.
The extra `bool ModuleImported` parameter then denotes whether the
header `#include` will be automatically translated into import the the
module.
The main change is in `clang/lib/Lex/PPDirectives.cpp`, where we take
care to not modify `SuggestedModule` after it's been populated by
`LookupHeaderIncludeOrImport()`. We now exclusively use the `SM`
(`ModuleToImport`) variable instead, which has been equivalent to
`SuggestedModule` until now. This allows us to use the original
non-modified `SuggestedModule` for the callback itself.
(This patch turns out to be necessary for
https://github.com/apple/llvm-project/pull/8011).
|
|
std::min/std::max (#77816)
This pull request fixes #64914 where author suggests adding a
readability check to propose the replacement of conditional statements
with std::min/std::max for improved code readability. Additionally,
reference is made to PyLint's similar checks:
[consider-using-min-builtin](https://pylint.pycqa.org/en/latest/user_guide/messages/refactor/consider-using-min-builtin.html)
and
[consider-using-max-builtin](https://pylint.pycqa.org/en/latest/user_guide/messages/refactor/consider-using-max-builtin.html)
|
|
clang-apply-replacements used to apply format even without --format is
specified. This because, methods like createReplacementsForHeaders only
takes the Spec.Style and would re-order the headers even when it was not
requested. The fix is to set up Spec.Style only if --format is provided.
Also added note to ReleaseNotes.rst
Based on https://github.com/llvm/llvm-project/pull/70801
---------
Co-authored-by: Kugan <34810920+kuganv@users.noreply.github.com>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
|
|
Fixes https://github.com/clangd/clangd/issues/1925
|