clang: include/clang/Lex/MultipleIncludeOpt.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CLANG_LEX_MULTIPLEINCLUDEOPT_H
15#define LLVM_CLANG_LEX_MULTIPLEINCLUDEOPT_H
16
18
21
22
23
24
25
26
27
29
30
31
32
33
34 bool ReadAnyTokens;
35
36
37
38
39 bool ImmediatelyAfterTopLevelIfndef;
40
41
42
43
44
45
46 bool DidMacroExpansion;
47
48
49
51
52
54
57public:
59 ReadAnyTokens = false;
60 ImmediatelyAfterTopLevelIfndef = false;
61 DidMacroExpansion = false;
62 TheMacro = nullptr;
63 DefinedMacro = nullptr;
64 }
65
69
71 return DefinedLoc;
72 }
73
75 ImmediatelyAfterTopLevelIfndef = false;
76 }
77
79 DefinedMacro = M;
80 DefinedLoc = Loc;
81 }
82
83
84
86
87
88 ReadAnyTokens = true;
89 ImmediatelyAfterTopLevelIfndef = false;
90 DefinedMacro = nullptr;
91 TheMacro = nullptr;
92 }
93
94
95
96
98
99
100
102 return ImmediatelyAfterTopLevelIfndef;
103 }
104
105
107 ReadAnyTokens = true;
108 ImmediatelyAfterTopLevelIfndef = false;
109 }
110
111
112
113
114
116
117
118
120
121
122
123
124
125
126
127
129
130 if (TheMacro)
132
133
134
135
136
137 if (DidMacroExpansion)
139
140
141 ReadAnyTokens = true;
142 ImmediatelyAfterTopLevelIfndef = true;
143 TheMacro = M;
144 MacroLoc = Loc;
145 }
146
147
153
154
156
157
158
160
161
162
163 ReadAnyTokens = false;
164 ImmediatelyAfterTopLevelIfndef = false;
165 }
166
167
168
170
171
172 if (!ReadAnyTokens)
173 return TheMacro;
174 return nullptr;
175 }
176
177
178
180 return DefinedMacro;
181 }
182};
183
184}
185
186#endif
Defines the clang::SourceLocation class and associated facilities.
One of these records is kept for each identifier that is lexed.
MultipleIncludeOpt()
Definition MultipleIncludeOpt.h:58
const IdentifierInfo * GetDefinedMacro() const
If the ControllingMacro is followed by a macro definition, return the macro that was defined.
Definition MultipleIncludeOpt.h:179
void Invalidate()
Invalidate - Permanently mark this file as not being suitable for the include-file optimization.
Definition MultipleIncludeOpt.h:85
bool getHasReadAnyTokensVal() const
getHasReadAnyTokensVal - This is used for the #ifndef handshake at the top of the file when reading p...
Definition MultipleIncludeOpt.h:97
void ExitTopLevelConditional()
Called when the lexer exits the top-level conditional.
Definition MultipleIncludeOpt.h:155
void SetDefinedMacro(IdentifierInfo *M, SourceLocation Loc)
Definition MultipleIncludeOpt.h:78
void SetReadToken(bool Value)
SetReadToken - Set whether the value of 'ReadAnyTokens'.
Definition MultipleIncludeOpt.h:115
bool getImmediatelyAfterTopLevelIfndef() const
getImmediatelyAfterTopLevelIfndef - returns true if the last directive was an ifndef at the beginning...
Definition MultipleIncludeOpt.h:101
const IdentifierInfo * GetControllingMacroAtEndOfFile() const
Once the entire file has been lexed, if there is a controlling macro, return it.
Definition MultipleIncludeOpt.h:169
void ReadToken()
Definition MultipleIncludeOpt.h:106
SourceLocation GetDefinedLocation() const
Definition MultipleIncludeOpt.h:70
void EnterTopLevelConditional()
Invoked when a top level conditional (except #ifndef) is found.
Definition MultipleIncludeOpt.h:148
void resetImmediatelyAfterTopLevelIfndef()
Definition MultipleIncludeOpt.h:74
SourceLocation GetMacroLocation() const
Definition MultipleIncludeOpt.h:66
void EnterTopLevelIfndef(const IdentifierInfo *M, SourceLocation Loc)
Called when entering a top-level #ifndef directive (or the "\#if !defined" equivalent) without any pr...
Definition MultipleIncludeOpt.h:128
void ExpandedMacro()
ExpandedMacro - When a macro is expanded with this lexer as the current buffer, this method is called...
Definition MultipleIncludeOpt.h:119
Encodes a location in the source.
The JSON file list parser is used to communicate input to InstallAPI.