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
20class IdentifierInfo;
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
67 return MacroLoc;
68 }
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
149
150
152 }
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.
Implements the simple state machine that the Lexer class uses to detect files subject to the 'multipl...
const IdentifierInfo * GetDefinedMacro() const
If the ControllingMacro is followed by a macro definition, return the macro that was defined.
void Invalidate()
Invalidate - Permanently mark this file as not being suitable for the include-file optimization.
bool getHasReadAnyTokensVal() const
getHasReadAnyTokensVal - This is used for the #ifndef handshake at the top of the file when reading p...
void ExitTopLevelConditional()
Called when the lexer exits the top-level conditional.
void SetDefinedMacro(IdentifierInfo *M, SourceLocation Loc)
void SetReadToken(bool Value)
SetReadToken - Set whether the value of 'ReadAnyTokens'.
bool getImmediatelyAfterTopLevelIfndef() const
getImmediatelyAfterTopLevelIfndef - returns true if the last directive was an #ifndef at the beginnin...
const IdentifierInfo * GetControllingMacroAtEndOfFile() const
Once the entire file has been lexed, if there is a controlling macro, return it.
SourceLocation GetDefinedLocation() const
void EnterTopLevelConditional()
Invoked when a top level conditional (except #ifndef) is found.
void resetImmediatelyAfterTopLevelIfndef()
SourceLocation GetMacroLocation() const
void EnterTopLevelIfndef(const IdentifierInfo *M, SourceLocation Loc)
Called when entering a top-level #ifndef directive (or the "\#if !defined" equivalent) without any pr...
void ExpandedMacro()
ExpandedMacro - When a macro is expanded with this lexer as the current buffer, this method is called...
Encodes a location in the source.
The JSON file list parser is used to communicate input to InstallAPI.