xref: /llvm-project/clang-tools-extra/clang-tidy/ClangTidyForceLinker.h (revision 4718da506091a37ca4863d979bc541e359b79b10)
137512e58SIvan Donchevskii //===- ClangTidyForceLinker.h - clang-tidy --------------------------------===//
237512e58SIvan Donchevskii //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
637512e58SIvan Donchevskii //
737512e58SIvan Donchevskii //===----------------------------------------------------------------------===//
837512e58SIvan Donchevskii 
937512e58SIvan Donchevskii #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYFORCELINKER_H
1037512e58SIvan Donchevskii #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYFORCELINKER_H
1137512e58SIvan Donchevskii 
1233c9dbbdSNico Weber #include "clang-tidy-config.h"
1337512e58SIvan Donchevskii #include "llvm/Support/Compiler.h"
1437512e58SIvan Donchevskii 
15*4718da50SCarlos Galvez namespace clang::tidy {
1637512e58SIvan Donchevskii 
1737512e58SIvan Donchevskii // This anchor is used to force the linker to link the AbseilModule.
1837512e58SIvan Donchevskii extern volatile int AbseilModuleAnchorSource;
1937512e58SIvan Donchevskii static int LLVM_ATTRIBUTE_UNUSED AbseilModuleAnchorDestination =
2037512e58SIvan Donchevskii     AbseilModuleAnchorSource;
2137512e58SIvan Donchevskii 
22156b1279SFrank Derry Wanye // This anchor is used to force the linker to link the AlteraModule.
23156b1279SFrank Derry Wanye extern volatile int AlteraModuleAnchorSource;
24156b1279SFrank Derry Wanye static int LLVM_ATTRIBUTE_UNUSED AlteraModuleAnchorDestination =
25156b1279SFrank Derry Wanye     AlteraModuleAnchorSource;
26156b1279SFrank Derry Wanye 
27df5fa487SWhisperity // This anchor is used to force the linker to link the AndroidModule.
28df5fa487SWhisperity extern volatile int AndroidModuleAnchorSource;
29df5fa487SWhisperity static int LLVM_ATTRIBUTE_UNUSED AndroidModuleAnchorDestination =
30df5fa487SWhisperity     AndroidModuleAnchorSource;
31df5fa487SWhisperity 
3237512e58SIvan Donchevskii // This anchor is used to force the linker to link the BoostModule.
3337512e58SIvan Donchevskii extern volatile int BoostModuleAnchorSource;
3437512e58SIvan Donchevskii static int LLVM_ATTRIBUTE_UNUSED BoostModuleAnchorDestination =
3537512e58SIvan Donchevskii     BoostModuleAnchorSource;
3637512e58SIvan Donchevskii 
3737512e58SIvan Donchevskii // This anchor is used to force the linker to link the BugproneModule.
3837512e58SIvan Donchevskii extern volatile int BugproneModuleAnchorSource;
3937512e58SIvan Donchevskii static int LLVM_ATTRIBUTE_UNUSED BugproneModuleAnchorDestination =
4037512e58SIvan Donchevskii     BugproneModuleAnchorSource;
4137512e58SIvan Donchevskii 
42df5fa487SWhisperity // This anchor is used to force the linker to link the CERTModule.
43df5fa487SWhisperity extern volatile int CERTModuleAnchorSource;
44df5fa487SWhisperity static int LLVM_ATTRIBUTE_UNUSED CERTModuleAnchorDestination =
45df5fa487SWhisperity     CERTModuleAnchorSource;
46eb41cc61SPaula Toth 
478da7efbbSVasily Kulikov // This anchor is used to force the linker to link the ConcurrencyModule.
488da7efbbSVasily Kulikov extern volatile int ConcurrencyModuleAnchorSource;
498da7efbbSVasily Kulikov static int LLVM_ATTRIBUTE_UNUSED ConcurrencyModuleAnchorDestination =
508da7efbbSVasily Kulikov     ConcurrencyModuleAnchorSource;
518da7efbbSVasily Kulikov 
5237512e58SIvan Donchevskii // This anchor is used to force the linker to link the CppCoreGuidelinesModule.
5337512e58SIvan Donchevskii extern volatile int CppCoreGuidelinesModuleAnchorSource;
5437512e58SIvan Donchevskii static int LLVM_ATTRIBUTE_UNUSED CppCoreGuidelinesModuleAnchorDestination =
5537512e58SIvan Donchevskii     CppCoreGuidelinesModuleAnchorSource;
5637512e58SIvan Donchevskii 
57405c3a6bSDmitri Gribenko // This anchor is used to force the linker to link the DarwinModule.
58405c3a6bSDmitri Gribenko extern volatile int DarwinModuleAnchorSource;
59405c3a6bSDmitri Gribenko static int LLVM_ATTRIBUTE_UNUSED DarwinModuleAnchorDestination =
60405c3a6bSDmitri Gribenko     DarwinModuleAnchorSource;
61405c3a6bSDmitri Gribenko 
6237512e58SIvan Donchevskii // This anchor is used to force the linker to link the FuchsiaModule.
6337512e58SIvan Donchevskii extern volatile int FuchsiaModuleAnchorSource;
6437512e58SIvan Donchevskii static int LLVM_ATTRIBUTE_UNUSED FuchsiaModuleAnchorDestination =
6537512e58SIvan Donchevskii     FuchsiaModuleAnchorSource;
6637512e58SIvan Donchevskii 
6737512e58SIvan Donchevskii // This anchor is used to force the linker to link the GoogleModule.
6837512e58SIvan Donchevskii extern volatile int GoogleModuleAnchorSource;
6937512e58SIvan Donchevskii static int LLVM_ATTRIBUTE_UNUSED GoogleModuleAnchorDestination =
7037512e58SIvan Donchevskii     GoogleModuleAnchorSource;
7137512e58SIvan Donchevskii 
72df5fa487SWhisperity // This anchor is used to force the linker to link the HICPPModule.
73df5fa487SWhisperity extern volatile int HICPPModuleAnchorSource;
74df5fa487SWhisperity static int LLVM_ATTRIBUTE_UNUSED HICPPModuleAnchorDestination =
75df5fa487SWhisperity     HICPPModuleAnchorSource;
76df5fa487SWhisperity 
77df5fa487SWhisperity // This anchor is used to force the linker to link the LinuxKernelModule.
78df5fa487SWhisperity extern volatile int LinuxKernelModuleAnchorSource;
79df5fa487SWhisperity static int LLVM_ATTRIBUTE_UNUSED LinuxKernelModuleAnchorDestination =
80df5fa487SWhisperity     LinuxKernelModuleAnchorSource;
81df5fa487SWhisperity 
82df5fa487SWhisperity // This anchor is used to force the linker to link the LLVMModule.
83df5fa487SWhisperity extern volatile int LLVMModuleAnchorSource;
84df5fa487SWhisperity static int LLVM_ATTRIBUTE_UNUSED LLVMModuleAnchorDestination =
85df5fa487SWhisperity     LLVMModuleAnchorSource;
86df5fa487SWhisperity 
87df5fa487SWhisperity // This anchor is used to force the linker to link the LLVMLibcModule.
88df5fa487SWhisperity extern volatile int LLVMLibcModuleAnchorSource;
89df5fa487SWhisperity static int LLVM_ATTRIBUTE_UNUSED LLVMLibcModuleAnchorDestination =
90df5fa487SWhisperity     LLVMLibcModuleAnchorSource;
9137512e58SIvan Donchevskii 
9237512e58SIvan Donchevskii // This anchor is used to force the linker to link the MiscModule.
9337512e58SIvan Donchevskii extern volatile int MiscModuleAnchorSource;
9437512e58SIvan Donchevskii static int LLVM_ATTRIBUTE_UNUSED MiscModuleAnchorDestination =
9537512e58SIvan Donchevskii     MiscModuleAnchorSource;
9637512e58SIvan Donchevskii 
9737512e58SIvan Donchevskii // This anchor is used to force the linker to link the ModernizeModule.
9837512e58SIvan Donchevskii extern volatile int ModernizeModuleAnchorSource;
9937512e58SIvan Donchevskii static int LLVM_ATTRIBUTE_UNUSED ModernizeModuleAnchorDestination =
10037512e58SIvan Donchevskii     ModernizeModuleAnchorSource;
10137512e58SIvan Donchevskii 
10233c9dbbdSNico Weber #if CLANG_TIDY_ENABLE_STATIC_ANALYZER &&                                       \
103d69fa737SNico Weber     !defined(CLANG_TIDY_DISABLE_STATIC_ANALYZER_CHECKS)
10437512e58SIvan Donchevskii // This anchor is used to force the linker to link the MPIModule.
10537512e58SIvan Donchevskii extern volatile int MPIModuleAnchorSource;
10637512e58SIvan Donchevskii static int LLVM_ATTRIBUTE_UNUSED MPIModuleAnchorDestination =
10737512e58SIvan Donchevskii     MPIModuleAnchorSource;
10837512e58SIvan Donchevskii #endif
10937512e58SIvan Donchevskii 
110df5fa487SWhisperity // This anchor is used to force the linker to link the ObjCModule.
111df5fa487SWhisperity extern volatile int ObjCModuleAnchorSource;
112df5fa487SWhisperity static int LLVM_ATTRIBUTE_UNUSED ObjCModuleAnchorDestination =
113df5fa487SWhisperity     ObjCModuleAnchorSource;
114df5fa487SWhisperity 
115819bedf3SRoman Lebedev // This anchor is used to force the linker to link the OpenMPModule.
116819bedf3SRoman Lebedev extern volatile int OpenMPModuleAnchorSource;
117819bedf3SRoman Lebedev static int LLVM_ATTRIBUTE_UNUSED OpenMPModuleAnchorDestination =
118819bedf3SRoman Lebedev     OpenMPModuleAnchorSource;
119819bedf3SRoman Lebedev 
12037512e58SIvan Donchevskii // This anchor is used to force the linker to link the PerformanceModule.
12137512e58SIvan Donchevskii extern volatile int PerformanceModuleAnchorSource;
12237512e58SIvan Donchevskii static int LLVM_ATTRIBUTE_UNUSED PerformanceModuleAnchorDestination =
12337512e58SIvan Donchevskii     PerformanceModuleAnchorSource;
12437512e58SIvan Donchevskii 
12537512e58SIvan Donchevskii // This anchor is used to force the linker to link the PortabilityModule.
12637512e58SIvan Donchevskii extern volatile int PortabilityModuleAnchorSource;
12737512e58SIvan Donchevskii static int LLVM_ATTRIBUTE_UNUSED PortabilityModuleAnchorDestination =
12837512e58SIvan Donchevskii     PortabilityModuleAnchorSource;
12937512e58SIvan Donchevskii 
13037512e58SIvan Donchevskii // This anchor is used to force the linker to link the ReadabilityModule.
13137512e58SIvan Donchevskii extern volatile int ReadabilityModuleAnchorSource;
13237512e58SIvan Donchevskii static int LLVM_ATTRIBUTE_UNUSED ReadabilityModuleAnchorDestination =
13337512e58SIvan Donchevskii     ReadabilityModuleAnchorSource;
13437512e58SIvan Donchevskii 
13537512e58SIvan Donchevskii // This anchor is used to force the linker to link the ZirconModule.
13637512e58SIvan Donchevskii extern volatile int ZirconModuleAnchorSource;
13737512e58SIvan Donchevskii static int LLVM_ATTRIBUTE_UNUSED ZirconModuleAnchorDestination =
13837512e58SIvan Donchevskii     ZirconModuleAnchorSource;
13937512e58SIvan Donchevskii 
140*4718da50SCarlos Galvez } // namespace clang::tidy
14137512e58SIvan Donchevskii 
14237512e58SIvan Donchevskii #endif
143