2018-12-14 15:29:06 +08:00
|
|
|
//===- ClangTidyForceLinker.h - clang-tidy --------------------------------===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2018-12-14 15:29:06 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYFORCELINKER_H
|
|
|
|
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CLANGTIDYFORCELINKER_H
|
|
|
|
|
2020-09-04 07:37:29 +08:00
|
|
|
#include "clang-tidy-config.h"
|
2018-12-14 15:29:06 +08:00
|
|
|
#include "llvm/Support/Compiler.h"
|
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace tidy {
|
|
|
|
|
|
|
|
// This anchor is used to force the linker to link the AbseilModule.
|
|
|
|
extern volatile int AbseilModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED AbseilModuleAnchorDestination =
|
|
|
|
AbseilModuleAnchorSource;
|
|
|
|
|
2020-09-08 21:35:14 +08:00
|
|
|
// This anchor is used to force the linker to link the AlteraModule.
|
|
|
|
extern volatile int AlteraModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED AlteraModuleAnchorDestination =
|
|
|
|
AlteraModuleAnchorSource;
|
|
|
|
|
2020-03-21 18:30:30 +08:00
|
|
|
// This anchor is used to force the linker to link the AndroidModule.
|
|
|
|
extern volatile int AndroidModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED AndroidModuleAnchorDestination =
|
|
|
|
AndroidModuleAnchorSource;
|
|
|
|
|
2018-12-14 15:29:06 +08:00
|
|
|
// This anchor is used to force the linker to link the BoostModule.
|
|
|
|
extern volatile int BoostModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED BoostModuleAnchorDestination =
|
|
|
|
BoostModuleAnchorSource;
|
|
|
|
|
|
|
|
// This anchor is used to force the linker to link the BugproneModule.
|
|
|
|
extern volatile int BugproneModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED BugproneModuleAnchorDestination =
|
|
|
|
BugproneModuleAnchorSource;
|
|
|
|
|
2020-03-21 18:30:30 +08:00
|
|
|
// This anchor is used to force the linker to link the CERTModule.
|
|
|
|
extern volatile int CERTModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED CERTModuleAnchorDestination =
|
|
|
|
CERTModuleAnchorSource;
|
[clang-tidy] Add module for llvm-libc and restrict-system-libc-header-check.
Summary: This adds a new module to enforce standards specific to the llvm-libc project. This change also adds the first check which restricts user from including system libc headers accidentally which can lead to subtle bugs that would be a challenge to detect.
Reviewers: alexfh, hokein, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: juliehockett, arphaman, jfb, abrachet, sivachandra, Eugene.Zelenko, njames93, mgorny, xazax.hun, MaskRay, cfe-commits
Tags: #clang-tools-extra, #libc-project, #clang
Differential Revision: https://reviews.llvm.org/D75332
2020-03-13 02:38:05 +08:00
|
|
|
|
2018-12-14 15:29:06 +08:00
|
|
|
// This anchor is used to force the linker to link the CppCoreGuidelinesModule.
|
|
|
|
extern volatile int CppCoreGuidelinesModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED CppCoreGuidelinesModuleAnchorDestination =
|
|
|
|
CppCoreGuidelinesModuleAnchorSource;
|
|
|
|
|
[clang-tidy] New check to warn when storing dispatch_once_t in non-static, non-global storage.
Summary:
Creates a new darwin ClangTidy module and adds the darwin-dispatch-once-nonstatic check that warns about dispatch_once_t variables not in static or global storage. This catches a missing static for local variables in e.g. singleton initialization behavior, and also warns on storing dispatch_once_t values in Objective-C instance variables. C/C++ struct/class instances may potentially live in static/global storage, and are ignored for this check.
The osx.API static analysis checker can find the non-static storage use of dispatch_once_t; I thought it useful to also catch this issue in clang-tidy when possible.
This is a re-land of https://reviews.llvm.org/D67567
Reviewers: thakis, gribozavr, stephanemoore
Subscribers: Eugene.Zelenko, mgorny, xazax.hun, jkorous, arphaman, kadircet, usaxena95
Tags: #clang-tools-extra, #clang, #llvm
Differential Revision: https://reviews.llvm.org/D68109
llvm-svn: 373065
2019-09-27 18:49:12 +08:00
|
|
|
// This anchor is used to force the linker to link the DarwinModule.
|
|
|
|
extern volatile int DarwinModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED DarwinModuleAnchorDestination =
|
|
|
|
DarwinModuleAnchorSource;
|
|
|
|
|
2018-12-14 15:29:06 +08:00
|
|
|
// This anchor is used to force the linker to link the FuchsiaModule.
|
|
|
|
extern volatile int FuchsiaModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED FuchsiaModuleAnchorDestination =
|
|
|
|
FuchsiaModuleAnchorSource;
|
|
|
|
|
|
|
|
// This anchor is used to force the linker to link the GoogleModule.
|
|
|
|
extern volatile int GoogleModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED GoogleModuleAnchorDestination =
|
|
|
|
GoogleModuleAnchorSource;
|
|
|
|
|
2020-03-21 18:30:30 +08:00
|
|
|
// This anchor is used to force the linker to link the HICPPModule.
|
|
|
|
extern volatile int HICPPModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED HICPPModuleAnchorDestination =
|
|
|
|
HICPPModuleAnchorSource;
|
|
|
|
|
|
|
|
// This anchor is used to force the linker to link the LinuxKernelModule.
|
|
|
|
extern volatile int LinuxKernelModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED LinuxKernelModuleAnchorDestination =
|
|
|
|
LinuxKernelModuleAnchorSource;
|
|
|
|
|
|
|
|
// This anchor is used to force the linker to link the LLVMModule.
|
|
|
|
extern volatile int LLVMModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED LLVMModuleAnchorDestination =
|
|
|
|
LLVMModuleAnchorSource;
|
|
|
|
|
|
|
|
// This anchor is used to force the linker to link the LLVMLibcModule.
|
|
|
|
extern volatile int LLVMLibcModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED LLVMLibcModuleAnchorDestination =
|
|
|
|
LLVMLibcModuleAnchorSource;
|
2018-12-14 15:29:06 +08:00
|
|
|
|
|
|
|
// This anchor is used to force the linker to link the MiscModule.
|
|
|
|
extern volatile int MiscModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED MiscModuleAnchorDestination =
|
|
|
|
MiscModuleAnchorSource;
|
|
|
|
|
|
|
|
// This anchor is used to force the linker to link the ModernizeModule.
|
|
|
|
extern volatile int ModernizeModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED ModernizeModuleAnchorDestination =
|
|
|
|
ModernizeModuleAnchorSource;
|
|
|
|
|
2020-09-04 07:37:29 +08:00
|
|
|
#if CLANG_TIDY_ENABLE_STATIC_ANALYZER && \
|
2019-09-27 20:56:14 +08:00
|
|
|
!defined(CLANG_TIDY_DISABLE_STATIC_ANALYZER_CHECKS)
|
2018-12-14 15:29:06 +08:00
|
|
|
// This anchor is used to force the linker to link the MPIModule.
|
|
|
|
extern volatile int MPIModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED MPIModuleAnchorDestination =
|
|
|
|
MPIModuleAnchorSource;
|
|
|
|
#endif
|
|
|
|
|
2020-03-21 18:30:30 +08:00
|
|
|
// This anchor is used to force the linker to link the ObjCModule.
|
|
|
|
extern volatile int ObjCModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED ObjCModuleAnchorDestination =
|
|
|
|
ObjCModuleAnchorSource;
|
|
|
|
|
[clang-tidy] A new OpenMP module
Summary:
Just the empty skeleton.
Previously reviewed as part of D57113.
Reviewers: JonasToth, aaron.ballman, alexfh, xazax.hun, hokein, gribozavr
Reviewed By: JonasToth, gribozavr
Subscribers: jdoerfert, mgorny, rnkovacs, guansong, arphaman, cfe-commits
Tags: #clang-tools-extra, #openmp, #clang
Differential Revision: https://reviews.llvm.org/D57571
llvm-svn: 356800
2019-03-23 03:46:01 +08:00
|
|
|
// This anchor is used to force the linker to link the OpenMPModule.
|
|
|
|
extern volatile int OpenMPModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED OpenMPModuleAnchorDestination =
|
|
|
|
OpenMPModuleAnchorSource;
|
|
|
|
|
2018-12-14 15:29:06 +08:00
|
|
|
// This anchor is used to force the linker to link the PerformanceModule.
|
|
|
|
extern volatile int PerformanceModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED PerformanceModuleAnchorDestination =
|
|
|
|
PerformanceModuleAnchorSource;
|
|
|
|
|
|
|
|
// This anchor is used to force the linker to link the PortabilityModule.
|
|
|
|
extern volatile int PortabilityModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED PortabilityModuleAnchorDestination =
|
|
|
|
PortabilityModuleAnchorSource;
|
|
|
|
|
|
|
|
// This anchor is used to force the linker to link the ReadabilityModule.
|
|
|
|
extern volatile int ReadabilityModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED ReadabilityModuleAnchorDestination =
|
|
|
|
ReadabilityModuleAnchorSource;
|
|
|
|
|
|
|
|
// This anchor is used to force the linker to link the ZirconModule.
|
|
|
|
extern volatile int ZirconModuleAnchorSource;
|
|
|
|
static int LLVM_ATTRIBUTE_UNUSED ZirconModuleAnchorDestination =
|
|
|
|
ZirconModuleAnchorSource;
|
|
|
|
|
|
|
|
} // namespace tidy
|
|
|
|
} // namespace clang
|
|
|
|
|
|
|
|
#endif
|