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