This option is not part of the Unused diagnostic group until the warnings on llvm codebase are fixed
and we are ready to turn it on. Suggestion by Daniel.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111298
91177308-0d34-0410-b5e6-
96231b3b80d8
def UnusedArgument : DiagGroup<"unused-argument">;
def UnusedExceptionParameter : DiagGroup<"unused-exception-parameter">;
def UnusedFunction : DiagGroup<"unused-function">;
+def UnusedMethod : DiagGroup<"unused-method">;
def UnusedLabel : DiagGroup<"unused-label">;
def UnusedParameter : DiagGroup<"unused-parameter">;
def UnusedValue : DiagGroup<"unused-value">;
def Unused : DiagGroup<"unused",
[UnusedArgument, UnusedFunction, UnusedLabel,
// UnusedParameter, (matches GCC's behavior)
+ // UnusedMethod, (clean-up llvm before enabling)
UnusedValue, UnusedVariable]>,
DiagCategory<"Unused Entity Issue">;
InitializerOverrides,
SemiBeforeMethodBody,
SignCompare,
+ UnusedMethod,
UnusedParameter
]>;
"declaration of %0 will not be visible outside of this function">;
def warn_unused_function : Warning<"unused function %0">,
InGroup<UnusedFunction>, DefaultIgnore;
+def warn_unused_method : Warning<"unused method %0">,
+ InGroup<UnusedMethod>, DefaultIgnore;
def warn_implicit_function_decl : Warning<
"implicit declaration of function %0">,
const FunctionDecl *DiagD;
if (!FD->hasBody(DiagD))
DiagD = FD;
- Diag(DiagD->getLocation(), diag::warn_unused_function)
+ Diag(DiagD->getLocation(),
+ isa<CXXMethodDecl>(DiagD) ? diag::warn_unused_method
+ : diag::warn_unused_function)
<< DiagD->getDeclName();
} else {
const VarDecl *DiagD = cast<VarDecl>(*I)->getDefinition();
-// RUN: %clang_cc1 -fsyntax-only -verify -Wunused %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wunused -Wunused-method %s
static void f1(); // expected-warning{{unused}}