1 //===- ClangTidyForceLinker.h - clang-tidy --------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYFORCELINKER_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYFORCELINKER_H
11 
12 #include "clang-tidy-config.h"
13 #include "llvm/Support/Compiler.h"
14 
15 namespace clang {
16 namespace tidy {
17 
18 // This anchor is used to force the linker to link the AbseilModule.
19 extern volatile int AbseilModuleAnchorSource;
20 static int LLVM_ATTRIBUTE_UNUSED AbseilModuleAnchorDestination =
21     AbseilModuleAnchorSource;
22 
23 // This anchor is used to force the linker to link the AlteraModule.
24 extern volatile int AlteraModuleAnchorSource;
25 static int LLVM_ATTRIBUTE_UNUSED AlteraModuleAnchorDestination =
26     AlteraModuleAnchorSource;
27 
28 // This anchor is used to force the linker to link the AndroidModule.
29 extern volatile int AndroidModuleAnchorSource;
30 static int LLVM_ATTRIBUTE_UNUSED AndroidModuleAnchorDestination =
31     AndroidModuleAnchorSource;
32 
33 // This anchor is used to force the linker to link the BoostModule.
34 extern volatile int BoostModuleAnchorSource;
35 static int LLVM_ATTRIBUTE_UNUSED BoostModuleAnchorDestination =
36     BoostModuleAnchorSource;
37 
38 // This anchor is used to force the linker to link the BugproneModule.
39 extern volatile int BugproneModuleAnchorSource;
40 static int LLVM_ATTRIBUTE_UNUSED BugproneModuleAnchorDestination =
41     BugproneModuleAnchorSource;
42 
43 // This anchor is used to force the linker to link the CERTModule.
44 extern volatile int CERTModuleAnchorSource;
45 static int LLVM_ATTRIBUTE_UNUSED CERTModuleAnchorDestination =
46     CERTModuleAnchorSource;
47 
48 // This anchor is used to force the linker to link the ConcurrencyModule.
49 extern volatile int ConcurrencyModuleAnchorSource;
50 static int LLVM_ATTRIBUTE_UNUSED ConcurrencyModuleAnchorDestination =
51     ConcurrencyModuleAnchorSource;
52 
53 // This anchor is used to force the linker to link the CppCoreGuidelinesModule.
54 extern volatile int CppCoreGuidelinesModuleAnchorSource;
55 static int LLVM_ATTRIBUTE_UNUSED CppCoreGuidelinesModuleAnchorDestination =
56     CppCoreGuidelinesModuleAnchorSource;
57 
58 // This anchor is used to force the linker to link the DarwinModule.
59 extern volatile int DarwinModuleAnchorSource;
60 static int LLVM_ATTRIBUTE_UNUSED DarwinModuleAnchorDestination =
61     DarwinModuleAnchorSource;
62 
63 // This anchor is used to force the linker to link the FuchsiaModule.
64 extern volatile int FuchsiaModuleAnchorSource;
65 static int LLVM_ATTRIBUTE_UNUSED FuchsiaModuleAnchorDestination =
66     FuchsiaModuleAnchorSource;
67 
68 // This anchor is used to force the linker to link the GoogleModule.
69 extern volatile int GoogleModuleAnchorSource;
70 static int LLVM_ATTRIBUTE_UNUSED GoogleModuleAnchorDestination =
71     GoogleModuleAnchorSource;
72 
73 // This anchor is used to force the linker to link the HICPPModule.
74 extern volatile int HICPPModuleAnchorSource;
75 static int LLVM_ATTRIBUTE_UNUSED HICPPModuleAnchorDestination =
76     HICPPModuleAnchorSource;
77 
78 // This anchor is used to force the linker to link the LinuxKernelModule.
79 extern volatile int LinuxKernelModuleAnchorSource;
80 static int LLVM_ATTRIBUTE_UNUSED LinuxKernelModuleAnchorDestination =
81     LinuxKernelModuleAnchorSource;
82 
83 // This anchor is used to force the linker to link the LLVMModule.
84 extern volatile int LLVMModuleAnchorSource;
85 static int LLVM_ATTRIBUTE_UNUSED LLVMModuleAnchorDestination =
86     LLVMModuleAnchorSource;
87 
88 // This anchor is used to force the linker to link the LLVMLibcModule.
89 extern volatile int LLVMLibcModuleAnchorSource;
90 static int LLVM_ATTRIBUTE_UNUSED LLVMLibcModuleAnchorDestination =
91     LLVMLibcModuleAnchorSource;
92 
93 // This anchor is used to force the linker to link the MiscModule.
94 extern volatile int MiscModuleAnchorSource;
95 static int LLVM_ATTRIBUTE_UNUSED MiscModuleAnchorDestination =
96     MiscModuleAnchorSource;
97 
98 // This anchor is used to force the linker to link the ModernizeModule.
99 extern volatile int ModernizeModuleAnchorSource;
100 static int LLVM_ATTRIBUTE_UNUSED ModernizeModuleAnchorDestination =
101     ModernizeModuleAnchorSource;
102 
103 #if CLANG_TIDY_ENABLE_STATIC_ANALYZER &&                                       \
104     !defined(CLANG_TIDY_DISABLE_STATIC_ANALYZER_CHECKS)
105 // This anchor is used to force the linker to link the MPIModule.
106 extern volatile int MPIModuleAnchorSource;
107 static int LLVM_ATTRIBUTE_UNUSED MPIModuleAnchorDestination =
108     MPIModuleAnchorSource;
109 #endif
110 
111 // This anchor is used to force the linker to link the ObjCModule.
112 extern volatile int ObjCModuleAnchorSource;
113 static int LLVM_ATTRIBUTE_UNUSED ObjCModuleAnchorDestination =
114     ObjCModuleAnchorSource;
115 
116 // This anchor is used to force the linker to link the OpenMPModule.
117 extern volatile int OpenMPModuleAnchorSource;
118 static int LLVM_ATTRIBUTE_UNUSED OpenMPModuleAnchorDestination =
119     OpenMPModuleAnchorSource;
120 
121 // This anchor is used to force the linker to link the PerformanceModule.
122 extern volatile int PerformanceModuleAnchorSource;
123 static int LLVM_ATTRIBUTE_UNUSED PerformanceModuleAnchorDestination =
124     PerformanceModuleAnchorSource;
125 
126 // This anchor is used to force the linker to link the PortabilityModule.
127 extern volatile int PortabilityModuleAnchorSource;
128 static int LLVM_ATTRIBUTE_UNUSED PortabilityModuleAnchorDestination =
129     PortabilityModuleAnchorSource;
130 
131 // This anchor is used to force the linker to link the ReadabilityModule.
132 extern volatile int ReadabilityModuleAnchorSource;
133 static int LLVM_ATTRIBUTE_UNUSED ReadabilityModuleAnchorDestination =
134     ReadabilityModuleAnchorSource;
135 
136 // This anchor is used to force the linker to link the ZirconModule.
137 extern volatile int ZirconModuleAnchorSource;
138 static int LLVM_ATTRIBUTE_UNUSED ZirconModuleAnchorDestination =
139     ZirconModuleAnchorSource;
140 
141 } // namespace tidy
142 } // namespace clang
143 
144 #endif
145