Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / compilerplugins / clang / test / unreffun.cxx
blob315c699b77480662f10a8e9f7dbb191a8370d352
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 "config_clang.h"
12 #include "unreffun.hxx"
14 template <typename> struct S
16 friend void f();
19 void f() {}
21 void g(); // expected-error {{Unreferenced function declaration [loplugin:unreffun]}}
23 void h() // expected-error {{Unreferenced externally visible function definition [loplugin:unreffun]}}
27 void i() {}
29 extern void j(); // expected-error {{Unreferenced function declaration [loplugin:unreffun]}}
31 extern void
32 k() // expected-error {{Unreferenced externally visible function definition [loplugin:unreffun]}}
36 extern void l(); // expected-note {{first declaration is here [loplugin:unreffun]}}
37 void l() // expected-error {{Unreferenced externally visible function definition [loplugin:unreffun]}}
41 void m()
43 // The below produced a false "Unreferenced externally invisible function definition" for Local::f
44 // prior to <https://github.com/llvm/llvm-project/commit/d812488d3c54c07f24d4bef79e329f17e7f19c3b>
45 // "Call MarkVirtualMembersReferenced on an actual class definition" in Clang 17:
46 #if CLANG_VERSION >= 170000
47 struct Local;
48 #endif
49 struct Local
51 virtual void f() {}
53 Local x;
54 (void)x;
57 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */