clang
3.9.0
|
Implements the simple state machine that the Lexer class uses to detect files subject to the 'multiple-include' optimization. More...
#include <MultipleIncludeOpt.h>
Public Member Functions | |
MultipleIncludeOpt () | |
SourceLocation | GetMacroLocation () const |
SourceLocation | GetDefinedLocation () const |
void | resetImmediatelyAfterTopLevelIfndef () |
void | SetDefinedMacro (IdentifierInfo *M, SourceLocation Loc) |
void | Invalidate () |
Invalidate - Permanently mark this file as not being suitable for the include-file optimization. More... | |
bool | getHasReadAnyTokensVal () const |
getHasReadAnyTokensVal - This is used for the #ifndef hande-shake at the top of the file when reading preprocessor directives. More... | |
bool | getImmediatelyAfterTopLevelIfndef () const |
getImmediatelyAfterTopLevelIfndef - returns true if the last directive was an #ifndef at the beginning of the file. More... | |
void | ReadToken () |
void | ExpandedMacro () |
ExpandedMacro - When a macro is expanded with this lexer as the current buffer, this method is called to disable the MIOpt if needed. More... | |
void | EnterTopLevelIfndef (const IdentifierInfo *M, SourceLocation Loc) |
Called when entering a top-level #ifndef directive (or the "\#if !defined" equivalent) without any preceding tokens. More... | |
void | EnterTopLevelConditional () |
Invoked when a top level conditional (except #ifndef) is found. More... | |
void | ExitTopLevelConditional () |
Called when the lexer exits the top-level conditional. More... | |
const IdentifierInfo * | GetControllingMacroAtEndOfFile () const |
Once the entire file has been lexed, if there is a controlling macro, return it. More... | |
const IdentifierInfo * | GetDefinedMacro () const |
If the ControllingMacro is followed by a macro definition, return the macro that was defined. More... | |
Implements the simple state machine that the Lexer class uses to detect files subject to the 'multiple-include' optimization.
The public methods in this class are triggered by various events that occur when a file is lexed, and after the entire file is lexed, information about which macro (if any) controls the header is returned.
Definition at line 29 of file MultipleIncludeOpt.h.
|
inline |
Definition at line 59 of file MultipleIncludeOpt.h.
|
inline |
Invoked when a top level conditional (except #ifndef) is found.
Definition at line 143 of file MultipleIncludeOpt.h.
References Invalidate().
|
inline |
Called when entering a top-level #ifndef directive (or the "\#if !defined" equivalent) without any preceding tokens.
Note, we don't care about the input value of 'ReadAnyTokens'. The caller ensures that this is only called if there are no tokens read before the #ifndef. The caller is required to do this, because reading the #if line obviously reads in in tokens.
Definition at line 123 of file MultipleIncludeOpt.h.
References Invalidate().
|
inline |
Called when the lexer exits the top-level conditional.
Definition at line 150 of file MultipleIncludeOpt.h.
References Invalidate().
|
inline |
ExpandedMacro - When a macro is expanded with this lexer as the current buffer, this method is called to disable the MIOpt if needed.
Definition at line 114 of file MultipleIncludeOpt.h.
|
inline |
Once the entire file has been lexed, if there is a controlling macro, return it.
Definition at line 164 of file MultipleIncludeOpt.h.
Referenced by clang::Preprocessor::HandleEndOfFile().
|
inline |
Definition at line 71 of file MultipleIncludeOpt.h.
Referenced by clang::Preprocessor::HandleEndOfFile().
|
inline |
If the ControllingMacro is followed by a macro definition, return the macro that was defined.
Definition at line 174 of file MultipleIncludeOpt.h.
Referenced by clang::Preprocessor::HandleEndOfFile().
|
inline |
getHasReadAnyTokensVal - This is used for the #ifndef hande-shake at the top of the file when reading preprocessor directives.
Otherwise, reading the "ifndef x" would count as reading tokens.
Definition at line 98 of file MultipleIncludeOpt.h.
Referenced by clang::Preprocessor::HandleDirective().
|
inline |
getImmediatelyAfterTopLevelIfndef - returns true if the last directive was an #ifndef at the beginning of the file.
Definition at line 102 of file MultipleIncludeOpt.h.
Referenced by clang::Preprocessor::HandleDirective().
|
inline |
Definition at line 67 of file MultipleIncludeOpt.h.
Referenced by clang::Preprocessor::HandleEndOfFile().
|
inline |
Invalidate - Permanently mark this file as not being suitable for the include-file optimization.
Definition at line 86 of file MultipleIncludeOpt.h.
Referenced by EnterTopLevelConditional(), EnterTopLevelIfndef(), and ExitTopLevelConditional().
|
inline |
Definition at line 107 of file MultipleIncludeOpt.h.
Referenced by clang::PTHLexer::Lex().
|
inline |
Definition at line 75 of file MultipleIncludeOpt.h.
Referenced by clang::Preprocessor::HandleDirective().
|
inline |
Definition at line 79 of file MultipleIncludeOpt.h.