clang 23.0.0git
AnnexKDetection.h
Go to the documentation of this file.
1//==- AnnexKDetection.h - Annex K availability detection ---------*- 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// This file provides utilities for detecting C11 Annex K (Bounds-checking
10// interfaces) availability.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_CLANG_ANALYSIS_ANNEXKDETECTION_H
15#define LLVM_CLANG_ANALYSIS_ANNEXKDETECTION_H
16
17namespace clang {
18class Preprocessor;
19class LangOptions;
20} // namespace clang
21
22namespace clang::analysis {
23
24/// Calculates whether Annex K is available for the current translation unit
25/// based on the macro definitions and the language options.
26///
27/// Annex K (Bounds-checking interfaces) is available when:
28/// 1. C11 standard is enabled
29/// 2. __STDC_LIB_EXT1__ macro is defined (indicates library support)
30/// 3. __STDC_WANT_LIB_EXT1__ macro is defined and equals "1" (indicates user
31/// opt-in)
32///
33/// \param PP The preprocessor instance to check macro definitions.
34/// \param LO The language options to check C11 standard.
35/// \returns true if Annex K is available, false otherwise.
36[[nodiscard]] bool isAnnexKAvailable(Preprocessor *PP, const LangOptions &LO);
37
38} // namespace clang::analysis
39
40#endif // LLVM_CLANG_ANALYSIS_ANNEXKDETECTION_H
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
bool isAnnexKAvailable(Preprocessor *PP, const LangOptions &LO)
Calculates whether Annex K is available for the current translation unit based on the macro definitio...
The JSON file list parser is used to communicate input to InstallAPI.