Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / compilerplugins / clang / test / mapindex.cxx
blobde7dd2590220eab4d8177b65170f59f1707e8563
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <map>
11 #include <memory>
12 #include <string>
14 struct CallbackFlushHandler
18 struct LibLODocument_Impl
20 std::map<size_t, std::shared_ptr<CallbackFlushHandler>> mpCallbackFlushHandlers;
23 void foo(LibLODocument_Impl* pDoc)
25 std::map<int, int> aMap;
26 if (aMap[0]) // expected-error {{will create an empty entry in the map, you sure about that, rather use count()2 [loplugin:mapindex]}}
29 // expected-error@+1 {{will create an empty entry in the map, you sure about that, rather use count()1 [loplugin:mapindex]}}
30 if (pDoc->mpCallbackFlushHandlers[0])
34 void no_warning_expected(const std::string& payload)
36 for (size_t numberPos = 0; numberPos < payload.length(); ++numberPos)
38 if (payload[numberPos] == ',')
39 break;
43 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */