Please use GitHub pull requests for new patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
cfe/trunk/include/clang/Lex/Preprocessor.h
Show First 20 Lines • Show All 714 Lines • ▼ Show 20 Lines | private: | ||||
/// The predefined macros that preprocessor should use from the | /// The predefined macros that preprocessor should use from the | ||||
/// command line etc. | /// command line etc. | ||||
std::string Predefines; | std::string Predefines; | ||||
/// The file ID for the preprocessor predefines. | /// The file ID for the preprocessor predefines. | ||||
FileID PredefinesFileID; | FileID PredefinesFileID; | ||||
/// The file ID for the PCH through header. | |||||
FileID PCHThroughHeaderFileID; | |||||
/// Whether tokens are being skipped until the through header is seen. | |||||
bool SkippingUntilPCHThroughHeader = false; | |||||
/// \{ | /// \{ | ||||
/// Cache of macro expanders to reduce malloc traffic. | /// Cache of macro expanders to reduce malloc traffic. | ||||
enum { TokenLexerCacheSize = 8 }; | enum { TokenLexerCacheSize = 8 }; | ||||
unsigned NumCachedTokenLexers; | unsigned NumCachedTokenLexers; | ||||
std::unique_ptr<TokenLexer> TokenLexerCache[TokenLexerCacheSize]; | std::unique_ptr<TokenLexer> TokenLexerCache[TokenLexerCacheSize]; | ||||
/// \} | /// \} | ||||
/// Keeps macro expanded tokens for TokenLexers. | /// Keeps macro expanded tokens for TokenLexers. | ||||
▲ Show 20 Lines • Show All 404 Lines • ▼ Show 20 Lines | public: | ||||
/// Retrieve the preprocessing record, or NULL if there is no | /// Retrieve the preprocessing record, or NULL if there is no | ||||
/// preprocessing record. | /// preprocessing record. | ||||
PreprocessingRecord *getPreprocessingRecord() const { return Record; } | PreprocessingRecord *getPreprocessingRecord() const { return Record; } | ||||
/// Create a new preprocessing record, which will keep track of | /// Create a new preprocessing record, which will keep track of | ||||
/// all macro expansions, macro definitions, etc. | /// all macro expansions, macro definitions, etc. | ||||
void createPreprocessingRecord(); | void createPreprocessingRecord(); | ||||
/// Returns true if the FileEntry is the PCH through header. | |||||
bool isPCHThroughHeader(const FileEntry *File); | |||||
/// True if creating a PCH with a through header. | |||||
bool creatingPCHWithThroughHeader(); | |||||
/// True if using a PCH with a through header. | |||||
bool usingPCHWithThroughHeader(); | |||||
/// Skip tokens until after the #include of the through header. | |||||
void SkipTokensUntilPCHThroughHeader(); | |||||
/// Process directives while skipping until the through header is found. | |||||
void HandleSkippedThroughHeaderDirective(Token &Result, | |||||
SourceLocation HashLoc); | |||||
/// Enter the specified FileID as the main source file, | /// Enter the specified FileID as the main source file, | ||||
/// which implicitly adds the builtin defines etc. | /// which implicitly adds the builtin defines etc. | ||||
void EnterMainSourceFile(); | void EnterMainSourceFile(); | ||||
/// Inform the preprocessor callbacks that processing is complete. | /// Inform the preprocessor callbacks that processing is complete. | ||||
void EndSourceFile(); | void EndSourceFile(); | ||||
/// Add a source file to the top of the include stack and | /// Add a source file to the top of the include stack and | ||||
▲ Show 20 Lines • Show All 864 Lines • ▼ Show 20 Lines | private: | ||||
void EnterSourceFileWithPTH(PTHLexer *PL, const DirectoryLookup *Dir); | void EnterSourceFileWithPTH(PTHLexer *PL, const DirectoryLookup *Dir); | ||||
/// Set the FileID for the preprocessor predefines. | /// Set the FileID for the preprocessor predefines. | ||||
void setPredefinesFileID(FileID FID) { | void setPredefinesFileID(FileID FID) { | ||||
assert(PredefinesFileID.isInvalid() && "PredefinesFileID already set!"); | assert(PredefinesFileID.isInvalid() && "PredefinesFileID already set!"); | ||||
PredefinesFileID = FID; | PredefinesFileID = FID; | ||||
} | } | ||||
/// Set the FileID for the PCH through header. | |||||
void setPCHThroughHeaderFileID(FileID FID); | |||||
/// Returns true if we are lexing from a file and not a | /// Returns true if we are lexing from a file and not a | ||||
/// pragma or a macro. | /// pragma or a macro. | ||||
static bool IsFileLexer(const Lexer* L, const PreprocessorLexer* P) { | static bool IsFileLexer(const Lexer* L, const PreprocessorLexer* P) { | ||||
return L ? !L->isPragmaLexer() : P != nullptr; | return L ? !L->isPragmaLexer() : P != nullptr; | ||||
} | } | ||||
static bool IsFileLexer(const IncludeStackInfo& I) { | static bool IsFileLexer(const IncludeStackInfo& I) { | ||||
return IsFileLexer(I.TheLexer.get(), I.ThePPLexer); | return IsFileLexer(I.TheLexer.get(), I.ThePPLexer); | ||||
▲ Show 20 Lines • Show All 165 Lines • Show Last 20 Lines |