Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,16 @@ void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
return;
}
// Check user-defined literals
if (const auto *UDL = Result.Nodes.getNodeAs<UserDefinedLiteral>("used"))
removeFromFoundDecls(UDL->getCalleeDecl());
if (const auto *UDL = Result.Nodes.getNodeAs<UserDefinedLiteral>("used")) {
const Decl *CalleeDecl = UDL->getCalleeDecl();
if (const auto *FD = dyn_cast<FunctionDecl>(CalleeDecl)) {
if (const FunctionTemplateDecl *FPT = FD->getPrimaryTemplate()) {
removeFromFoundDecls(FPT);
return;
}
}
removeFromFoundDecls(CalleeDecl);
}
}

void UnusedUsingDeclsCheck::removeFromFoundDecls(const Decl *D) {
Expand Down
4 changes: 4 additions & 0 deletions clang-tools-extra/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ Changes in existing checks
<clang-tidy/checks/performance/move-const-arg>` check by fixing false negatives
on ternary operators calling ``std::move``.

- Improved :doc:`misc-unused-using-decls
<clang-tidy/checks/misc/unused-using-decls>` check by fixing false positives
on ``operator""`` with template parameters.

Removed checks
^^^^^^^^^^^^^^

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,19 @@ using gh69714::StructGH69714_1;
using gh69714::StructGH69714_2;
struct StructGH69714_1 a;
struct StructGH69714_2 *b;

namespace gh53444 {
namespace my_literals {
template <char... Ts>
int operator""_r() {
return {};
}
}

using my_literals::operator"" _r;

int foo() {
auto x2 = 123_r;
}

}