xref: /freebsd/contrib/llvm-project/clang/include/clang/Basic/CFProtectionOptions.h (revision 700637cbb5e582861067a11aaca4d053546871d2)
1 //===--- CFProtectionOptions.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 //  This file defines constants for -fcf-protection and other related flags.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_BASIC_CFPROTECTIONOPTIONS_H
14 #define LLVM_CLANG_BASIC_CFPROTECTIONOPTIONS_H
15 
16 #include "llvm/Support/ErrorHandling.h"
17 
18 namespace clang {
19 
20 enum class CFBranchLabelSchemeKind {
21   Default,
22 #define CF_BRANCH_LABEL_SCHEME(Kind, FlagVal) Kind,
23 #include "clang/Basic/CFProtectionOptions.def"
24 };
25 
26 static inline const char *
getCFBranchLabelSchemeFlagVal(const CFBranchLabelSchemeKind Scheme)27 getCFBranchLabelSchemeFlagVal(const CFBranchLabelSchemeKind Scheme) {
28 #define CF_BRANCH_LABEL_SCHEME(Kind, FlagVal)                                  \
29   if (Scheme == CFBranchLabelSchemeKind::Kind)                                 \
30     return #FlagVal;
31 #include "clang/Basic/CFProtectionOptions.def"
32 
33   llvm::report_fatal_error("invalid scheme");
34 }
35 
36 } // namespace clang
37 
38 #endif // #ifndef LLVM_CLANG_BASIC_CFPROTECTIONOPTIONS_H
39