File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ void UnusedUsingDeclsCheck::registerMatchers(MatchFinder *Finder) {
54
54
Finder->addMatcher (loc (templateSpecializationType (forEachTemplateArgument (
55
55
templateArgument ().bind (" used" )))),
56
56
this );
57
+ Finder->addMatcher (userDefinedLiteral ().bind (" used" ), this );
57
58
// Cases where we can identify the UsingShadowDecl directly, rather than
58
59
// just its target.
59
60
// FIXME: cover more cases in this way, as the AST supports it.
@@ -150,7 +151,11 @@ void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
150
151
if (const auto *USD = dyn_cast<UsingShadowDecl>(ND))
151
152
removeFromFoundDecls (USD->getTargetDecl ()->getCanonicalDecl ());
152
153
}
154
+ return ;
153
155
}
156
+ // Check user-defined literals
157
+ if (const auto *UDL = Result.Nodes .getNodeAs <UserDefinedLiteral>(" used" ))
158
+ removeFromFoundDecls (UDL->getCalleeDecl ());
154
159
}
155
160
156
161
void UnusedUsingDeclsCheck::removeFromFoundDecls (const Decl *D) {
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ template <typename T> int UsedInTemplateFunc() { return 1; }
48
48
void OverloadFunc (int );
49
49
void OverloadFunc (double );
50
50
int FuncUsedByUsingDeclInMacro () { return 1 ; }
51
+ long double operator " " _w(long double );
51
52
52
53
class ostream {
53
54
public:
@@ -106,6 +107,7 @@ using n::UnusedInstance; // UnusedInstance
106
107
using n::UnusedFunc; // UnusedFunc
107
108
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: using decl 'UnusedFunc' is unused
108
109
// CHECK-FIXES: {{^}}// UnusedFunc
110
+ using n::operator " " _w;
109
111
using n::cout;
110
112
using n::endl;
111
113
@@ -183,6 +185,7 @@ void g() {
183
185
UsedInstance.i ;
184
186
UsedFunc ();
185
187
UsedTemplateFunc<int >();
188
+ 1 .5_w;
186
189
cout << endl;
187
190
Color2 color2;
188
191
int t1 = Color3::Yellow;
You can’t perform that action at this time.
0 commit comments