clang: include/clang/Lex/PreprocessorLexer.h Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef LLVM_CLANG_LEX_PREPROCESSORLEXER_H
15#define LLVM_CLANG_LEX_PREPROCESSORLEXER_H
16
21#include "llvm/ADT/ArrayRef.h"
22#include "llvm/ADT/SmallVector.h"
23#include
24
26
27class FileEntry;
28class Preprocessor;
29
31 virtual void anchor();
32
33protected:
35
36
38
39
41
42
44
45
46
47
48
49
51
52
54
55
56
57
58
59
60
61
62
63
64
65
66
67
69
70
71
73
74
75
77
81
83
84
86
87
88
89
90
91
92
94 bool FoundNonSkip, bool FoundElse) {
96 CI.IfLoc = DirectiveStart;
101 }
104 }
105
106
107
108
111 return true;
113 return false;
114 }
115
116
117
119 assert(.empty() && "No conditionals active!");
121 }
122
124
125public:
128
129
130
131
132
134
135
136
139 }
140
141
143
144
146
148 assert(PP &&
149 "PreprocessorLexer::getFileID() should only be used with a Preprocessor");
150 return FID;
151 }
152
153
156 }
157
158
159
161
162
163
166
169 }
170
173 }
174
178 }
179};
180
181}
182
183#endif
Defines interfaces for clang::FileEntry and clang::FileEntryRef.
Defines the MultipleIncludeOpt interface.
Defines the clang::SourceLocation class and associated facilities.
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Implements the simple state machine that the Lexer class uses to detect files subject to the 'multipl...
conditional_iterator conditional_begin() const
unsigned getInitialNumSLocEntries() const
Number of SLocEntries before lexing the file.
virtual void IndirectLex(Token &Result)=0
conditional_iterator conditional_end() const
SmallVectorImpl< PPConditionalInfo >::const_iterator conditional_iterator
Iterator that traverses the current stack of preprocessor conditional directives (#if/#ifdef/#ifndef)...
void pushConditionalLevel(SourceLocation DirectiveStart, bool WasSkipping, bool FoundNonSkip, bool FoundElse)
pushConditionalLevel - When we enter a #if directive, this keeps track of what we are currently in fo...
PreprocessorLexer & operator=(const PreprocessorLexer &)=delete
unsigned getConditionalStackDepth() const
bool LexingRawMode
True if in raw mode.
PreprocessorLexer(const PreprocessorLexer &)=delete
virtual ~PreprocessorLexer()=default
void setParsingPreprocessorDirective(bool f)
Inform the lexer whether or not we are currently lexing a preprocessor directive.
SmallVector< PPConditionalInfo, 4 > ConditionalStack
Information about the set of #if/#ifdef/#ifndef blocks we are currently in.
bool ParsingPreprocessorDirective
True when parsing #XXX; turns '\n' into a tok::eod token.
void pushConditionalLevel(const PPConditionalInfo &CI)
MultipleIncludeOpt MIOpt
A state machine that detects the #ifndef-wrapping a file idiom for the multiple-include optimization.
void setConditionalLevels(ArrayRef< PPConditionalInfo > CL)
bool popConditionalLevel(PPConditionalInfo &CI)
popConditionalLevel - Remove an entry off the top of the conditional stack, returning information abo...
bool ParsingFilename
True after #include; turns or "xxx" into a tok::header_name token.
OptionalFileEntryRef getFileEntry() const
getFileEntry - Return the FileEntry corresponding to this FileID.
void LexIncludeFilename(Token &FilenameTok)
Lex a token, producing a header-name token if possible.
PPConditionalInfo & peekConditionalLevel()
Return the top of the conditional stack.
bool isLexingRawMode() const
Return true if this lexer is in raw mode or not.
unsigned InitialNumSLocEntries
Number of SLocEntries before lexing the file.
Preprocessor * getPP() const
Return the preprocessor object for this lexer.
virtual SourceLocation getSourceLocation()=0
Return the source location for the next observable location.
const FileID FID
The SourceManager FileID corresponding to the file being lexed.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Encodes a location in the source.
Token - This structure provides full information about a lexed token.
The JSON file list parser is used to communicate input to InstallAPI.
@ Result
The result type of a method or function.
Information about the conditional stack (#if directives) currently active.
bool FoundNonSkip
True if we have emitted tokens already, and now we're in an #else block or something.
SourceLocation IfLoc
Location where the conditional started.
bool WasSkipping
True if this was contained in a skipping directive, e.g., in a "\#if 0" block.
bool FoundElse
True if we've seen a #else in this block.