clang 23.0.0git
SSAFBuiltinForceLinker.h
Go to the documentation of this file.
1//===- SSAFBuiltinForceLinker.h ---------------------------------*- C++ -*-===//
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/// \file
10/// This file pulls in all built-in SSAF extractor and format registrations
11/// by referencing their anchor symbols, preventing the static linker from
12/// discarding the containing object files.
13///
14/// Include this header (with IWYU pragma: keep) in any translation unit that
15/// must guarantee these registrations are active — typically the entry point
16/// of a binary that uses clangScalableStaticAnalysisFrameworkCore.
17///
18//===----------------------------------------------------------------------===//
19
20#ifndef LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_SSAFBUILTINFORCELINKER_H
21#define LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_SSAFBUILTINFORCELINKER_H
22
23// TODO: Move these to the `clang::ssaf` namespace.
24
25// This anchor is used to force the linker to link the JSONFormat registration.
26extern volatile int SSAFJSONFormatAnchorSource;
27[[maybe_unused]] static int SSAFJSONFormatAnchorDestination =
29
30// This anchor is used to force the linker to link the AnalysisRegistry.
31extern volatile int SSAFAnalysisRegistryAnchorSource;
32[[maybe_unused]] static int SSAFAnalysisRegistryAnchorDestination =
34
38
39// This anchor is used to force the linker to link the CallGraphExtractor.
40extern volatile int CallGraphExtractorAnchorSource;
41[[maybe_unused]] static int CallGraphExtractorAnchorDestination =
43
44// This anchor is used to force the linker to link the CallGraph JSON format.
45extern volatile int CallGraphJSONFormatAnchorSource;
46[[maybe_unused]] static int CallGraphJSONFormatAnchorDestination =
48
49#endif // LLVM_CLANG_SCALABLESTATICANALYSISFRAMEWORK_SSAFBUILTINFORCELINKER_H
static int CallGraphExtractorAnchorDestination
volatile int SSAFJSONFormatAnchorSource
static int SSAFAnalysisRegistryAnchorDestination
volatile int CallGraphExtractorAnchorSource
volatile int SSAFAnalysisRegistryAnchorSource
static int UnsafeBufferUsageSSAFJSONFormatAnchorDestination
volatile int UnsafeBufferUsageSSAFJSONFormatAnchorSource
static int SSAFJSONFormatAnchorDestination
static int CallGraphJSONFormatAnchorDestination
volatile int CallGraphJSONFormatAnchorSource