summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/test/unusedindex.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-12-15 08:23:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-12-15 08:23:53 +0200
commit5f4b126f74b1fa85f99a0ee3dfdf45368b6a1bb7 (patch)
tree40822be7451d6e7e8e42c66ab9e2336dd28587b7 /compilerplugins/clang/test/unusedindex.cxx
parenta45548c39537a0d881c79484be35c948b216f84b (diff)
once off loplugin: unusedindex
Change-Id: Ifdf5da1f014c4f130eafed475c6781c029d54f1d
Diffstat (limited to 'compilerplugins/clang/test/unusedindex.cxx')
-rw-r--r--compilerplugins/clang/test/unusedindex.cxx23
1 files changed, 23 insertions, 0 deletions
diff --git a/compilerplugins/clang/test/unusedindex.cxx b/compilerplugins/clang/test/unusedindex.cxx
new file mode 100644
index 000000000000..69ad7000b38c
--- /dev/null
+++ b/compilerplugins/clang/test/unusedindex.cxx
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <vector>
+
+void func1()
+{
+ std::vector<int> v1;
+ int n = 0;
+
+ for (int i = 0; i < 10; ++i) // expected-error {{loop variable not used [loplugin:unusedindex]}}
+ n += 1;
+ for (int i = 0; i < 10; ++i)
+ n += i;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */