clang  20.0.0git
PPEmbedParameters.h
Go to the documentation of this file.
1 //===--- PPEmbedParameters.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 // Defines all of the preprocessor directive parmeters for #embed
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_LEX_PPEMBEDPARAMETERS_H
14 #define LLVM_CLANG_LEX_PPEMBEDPARAMETERS_H
15 
17 #include "clang/Lex/Token.h"
18 #include "llvm/ADT/SmallVector.h"
19 
20 namespace clang {
21 
22 /// Preprocessor extension embed parameter "clang::offset"
23 /// `clang::offset( constant-expression )`
25 public:
26  size_t Offset;
27 
30 };
31 
32 /// Preprocessor standard embed parameter "limit"
33 /// `limit( constant-expression )`
35 public:
36  size_t Limit;
37 
40 };
41 
42 /// Preprocessor standard embed parameter "prefix"
43 /// `prefix( balanced-token-seq )`
45 public:
47 
49  : PPDirectiveParameter(R), Tokens(std::move(Tokens)) {}
50 };
51 
52 /// Preprocessor standard embed parameter "suffix"
53 /// `suffix( balanced-token-seq )`
55 public:
57 
59  : PPDirectiveParameter(R), Tokens(std::move(Tokens)) {}
60 };
61 
62 /// Preprocessor standard embed parameter "if_empty"
63 /// `if_empty( balanced-token-seq )`
65 public:
67 
69  : PPDirectiveParameter(R), Tokens(std::move(Tokens)) {}
70 };
71 
73  std::optional<PPEmbedParameterLimit> MaybeLimitParam;
74  std::optional<PPEmbedParameterOffset> MaybeOffsetParam;
75  std::optional<PPEmbedParameterIfEmpty> MaybeIfEmptyParam;
76  std::optional<PPEmbedParameterPrefix> MaybePrefixParam;
77  std::optional<PPEmbedParameterSuffix> MaybeSuffixParam;
79 
80  size_t PrefixTokenCount() const {
81  if (MaybePrefixParam)
82  return MaybePrefixParam->Tokens.size();
83  return 0;
84  }
85  size_t SuffixTokenCount() const {
86  if (MaybeSuffixParam)
87  return MaybeSuffixParam->Tokens.size();
88  return 0;
89  }
90 };
91 } // end namespace clang
92 
93 #endif
Captures basic information about a preprocessor directive parameter.
Preprocessor standard embed parameter "if_empty" if_empty( balanced-token-seq )
SmallVector< Token, 2 > Tokens
PPEmbedParameterIfEmpty(SmallVectorImpl< Token > &&Tokens, SourceRange R)
Preprocessor standard embed parameter "limit" limit( constant-expression )
PPEmbedParameterLimit(size_t Limit, SourceRange R)
Preprocessor extension embed parameter "clang::offset" clang::offset( constant-expression )
PPEmbedParameterOffset(size_t Offset, SourceRange R)
Preprocessor standard embed parameter "prefix" prefix( balanced-token-seq )
SmallVector< Token, 2 > Tokens
PPEmbedParameterPrefix(SmallVectorImpl< Token > &&Tokens, SourceRange R)
Preprocessor standard embed parameter "suffix" suffix( balanced-token-seq )
PPEmbedParameterSuffix(SmallVectorImpl< Token > &&Tokens, SourceRange R)
SmallVector< Token, 2 > Tokens
A trivial tuple used to represent a source range.
The JSON file list parser is used to communicate input to InstallAPI.
std::optional< PPEmbedParameterIfEmpty > MaybeIfEmptyParam
std::optional< PPEmbedParameterOffset > MaybeOffsetParam
std::optional< PPEmbedParameterLimit > MaybeLimitParam
std::optional< PPEmbedParameterSuffix > MaybeSuffixParam
std::optional< PPEmbedParameterPrefix > MaybePrefixParam