summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/unusedvariablecheck.hxx
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-10-09 14:50:19 +0200
committerLuboš Luňák <l.lunak@suse.cz>2012-10-09 17:25:27 +0200
commit13e39545eac66b628f9ef3c89cc03d2003e5d317 (patch)
tree0b29dc22c823d46c69782c5510bc0a340fcf9abe /compilerplugins/clang/unusedvariablecheck.hxx
parent02a8d36ebf3d54784903f2899eafe010bedf2f4c (diff)
compiler check for unused variables
This is for variables that the compiler itself cannot figure out (e.g. non-trivial ctors). The classes need to be marked manually. Change-Id: I0109972e11e20578b1adc32065f701a871ee21aa
Diffstat (limited to 'compilerplugins/clang/unusedvariablecheck.hxx')
-rw-r--r--compilerplugins/clang/unusedvariablecheck.hxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/compilerplugins/clang/unusedvariablecheck.hxx b/compilerplugins/clang/unusedvariablecheck.hxx
new file mode 100644
index 000000000000..c49532a86414
--- /dev/null
+++ b/compilerplugins/clang/unusedvariablecheck.hxx
@@ -0,0 +1,35 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * Based on LLVM/Clang.
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ */
+
+#ifndef UNUSEDVARIABLECHECK_H
+#define UNUSEDVARIABLECHECK_H
+
+#include <clang/AST/RecursiveASTVisitor.h>
+
+using namespace clang;
+
+namespace loplugin
+{
+
+class UnusedVariableCheck
+ : public RecursiveASTVisitor< UnusedVariableCheck >
+ {
+ public:
+ explicit UnusedVariableCheck( ASTContext& context );
+ void run();
+ bool VisitNamedDecl( NamedDecl* declaration );
+ private:
+ DiagnosticBuilder report( DiagnosticsEngine::Level level, StringRef message, SourceLocation loc );
+ ASTContext& context;
+ };
+
+} // namespace
+
+#endif // UNUSEDVARIABLECHECK_H