clang
6.0.0
|
Engages in a tight little dance with the lexer to efficiently preprocess tokens. More...
#include "clang/Lex/Preprocessor.h"
Classes | |
struct | CachedTokensRange |
struct | PreambleSkipInfo |
class | ResetMacroExpansionHelper |
Public Member Functions | |
Preprocessor (std::shared_ptr< PreprocessorOptions > PPOpts, DiagnosticsEngine &diags, LangOptions &opts, SourceManager &SM, MemoryBufferCache &PCMCache, HeaderSearch &Headers, ModuleLoader &TheModuleLoader, IdentifierInfoLookup *IILookup=nullptr, bool OwnsHeaderSearch=false, TranslationUnitKind TUKind=TU_Complete) | |
~Preprocessor () | |
void | Initialize (const TargetInfo &Target, const TargetInfo *AuxTarget=nullptr) |
Initialize the preprocessor using information about the target. More... | |
void | InitializeForModelFile () |
Initialize the preprocessor to parse a model file. More... | |
void | FinalizeForModelFile () |
Cleanup after model file parsing. More... | |
PreprocessorOptions & | getPreprocessorOpts () const |
Retrieve the preprocessor options used to initialize this preprocessor. More... | |
DiagnosticsEngine & | getDiagnostics () const |
void | setDiagnostics (DiagnosticsEngine &D) |
const LangOptions & | getLangOpts () const |
const TargetInfo & | getTargetInfo () const |
const TargetInfo * | getAuxTargetInfo () const |
FileManager & | getFileManager () const |
SourceManager & | getSourceManager () const |
MemoryBufferCache & | getPCMCache () const |
HeaderSearch & | getHeaderSearchInfo () const |
IdentifierTable & | getIdentifierTable () |
const IdentifierTable & | getIdentifierTable () const |
SelectorTable & | getSelectorTable () |
Builtin::Context & | getBuiltinInfo () |
llvm::BumpPtrAllocator & | getPreprocessorAllocator () |
void | setPTHManager (PTHManager *pm) |
PTHManager * | getPTHManager () |
void | setExternalSource (ExternalPreprocessorSource *Source) |
ExternalPreprocessorSource * | getExternalSource () const |
ModuleLoader & | getModuleLoader () const |
Retrieve the module loader associated with this preprocessor. More... | |
bool | hadModuleLoaderFatalFailure () const |
bool | isParsingIfOrElifDirective () const |
True if we are currently preprocessing a if or #elif directive. More... | |
void | SetCommentRetentionState (bool KeepComments, bool KeepMacroComments) |
Control whether the preprocessor retains comments in output. More... | |
bool | getCommentRetentionState () const |
void | setPragmasEnabled (bool Enabled) |
bool | getPragmasEnabled () const |
void | SetSuppressIncludeNotFoundError (bool Suppress) |
bool | GetSuppressIncludeNotFoundError () |
void | setPreprocessedOutput (bool IsPreprocessedOutput) |
Sets whether the preprocessor is responsible for producing output or if it is producing tokens to be consumed by Parse and Sema. More... | |
bool | isPreprocessedOutput () const |
Returns true if the preprocessor is responsible for generating output, false if it is producing tokens to be consumed by Parse and Sema. More... | |
bool | isCurrentLexer (const PreprocessorLexer *L) const |
Return true if we are lexing directly from the specified lexer. More... | |
PreprocessorLexer * | getCurrentLexer () const |
Return the current lexer being lexed from. More... | |
PreprocessorLexer * | getCurrentFileLexer () const |
Return the current file lexer being lexed from. More... | |
Module * | getCurrentLexerSubmodule () const |
Return the submodule owning the file being lexed. More... | |
FileID | getPredefinesFileID () const |
Returns the FileID for the preprocessor predefines. More... | |
bool | isMacroDefined (StringRef Id) |
bool | isMacroDefined (const IdentifierInfo *II) |
bool | isMacroDefinedInLocalModule (const IdentifierInfo *II, Module *M) |
Determine whether II is defined as a macro within the module M, if that is a module that we've already preprocessed. More... | |
MacroDefinition | getMacroDefinition (const IdentifierInfo *II) |
MacroDefinition | getMacroDefinitionAtLoc (const IdentifierInfo *II, SourceLocation Loc) |
MacroDirective * | getLocalMacroDirective (const IdentifierInfo *II) const |
Given an identifier, return its latest non-imported MacroDirective if it is #define'd and not #undef'd, or null if it isn't #define'd. More... | |
const MacroInfo * | getMacroInfo (const IdentifierInfo *II) const |
MacroInfo * | getMacroInfo (const IdentifierInfo *II) |
MacroDirective * | getLocalMacroDirectiveHistory (const IdentifierInfo *II) const |
Given an identifier, return the latest non-imported macro directive for that identifier. More... | |
void | appendMacroDirective (IdentifierInfo *II, MacroDirective *MD) |
Add a directive to the macro directive history for this identifier. More... | |
DefMacroDirective * | appendDefMacroDirective (IdentifierInfo *II, MacroInfo *MI, SourceLocation Loc) |
DefMacroDirective * | appendDefMacroDirective (IdentifierInfo *II, MacroInfo *MI) |
void | setLoadedMacroDirective (IdentifierInfo *II, MacroDirective *ED, MacroDirective *MD) |
Set a MacroDirective that was loaded from a PCH file. More... | |
ModuleMacro * | addModuleMacro (Module *Mod, IdentifierInfo *II, MacroInfo *Macro, ArrayRef< ModuleMacro *> Overrides, bool &IsNew) |
Register an exported macro for a module and identifier. More... | |
ModuleMacro * | getModuleMacro (Module *Mod, IdentifierInfo *II) |
ArrayRef< ModuleMacro * > | getLeafModuleMacros (const IdentifierInfo *II) const |
Get the list of leaf (non-overridden) module macros for a name. More... | |
StringRef | getLastMacroWithSpelling (SourceLocation Loc, ArrayRef< TokenValue > Tokens) const |
Return the name of the macro defined before Loc that has spelling Tokens . More... | |
const std::string & | getPredefines () const |
void | setPredefines (const char *P) |
Set the predefines for this Preprocessor. More... | |
void | setPredefines (StringRef P) |
IdentifierInfo * | getIdentifierInfo (StringRef Name) const |
Return information about the specified preprocessor identifier token. More... | |
void | AddPragmaHandler (StringRef Namespace, PragmaHandler *Handler) |
Add the specified pragma handler to this preprocessor. More... | |
void | AddPragmaHandler (PragmaHandler *Handler) |
void | RemovePragmaHandler (StringRef Namespace, PragmaHandler *Handler) |
Remove the specific pragma handler from this preprocessor. More... | |
void | RemovePragmaHandler (PragmaHandler *Handler) |
void | IgnorePragmas () |
Install empty handlers for all pragmas (making them ignored). More... | |
void | addCommentHandler (CommentHandler *Handler) |
Add the specified comment handler to the preprocessor. More... | |
void | removeCommentHandler (CommentHandler *Handler) |
Remove the specified comment handler. More... | |
void | setCodeCompletionHandler (CodeCompletionHandler &Handler) |
Set the code completion handler to the given object. More... | |
CodeCompletionHandler * | getCodeCompletionHandler () const |
Retrieve the current code-completion handler. More... | |
void | clearCodeCompletionHandler () |
Clear out the code completion handler. More... | |
void | CodeCompleteNaturalLanguage () |
Hook used by the lexer to invoke the "natural language" code completion point. More... | |
void | setCodeCompletionIdentifierInfo (IdentifierInfo *Filter) |
Set the code completion token for filtering purposes. More... | |
StringRef | getCodeCompletionFilter () |
Get the code completion token for filtering purposes. More... | |
PreprocessingRecord * | getPreprocessingRecord () const |
Retrieve the preprocessing record, or NULL if there is no preprocessing record. More... | |
void | createPreprocessingRecord () |
Create a new preprocessing record, which will keep track of all macro expansions, macro definitions, etc. More... | |
void | EnterMainSourceFile () |
Enter the specified FileID as the main source file, which implicitly adds the builtin defines etc. More... | |
void | EndSourceFile () |
Inform the preprocessor callbacks that processing is complete. More... | |
bool | EnterSourceFile (FileID CurFileID, const DirectoryLookup *Dir, SourceLocation Loc) |
Add a source file to the top of the include stack and start lexing tokens from it instead of the current buffer. More... | |
void | EnterMacro (Token &Identifier, SourceLocation ILEnd, MacroInfo *Macro, MacroArgs *Args) |
Add a Macro to the top of the include stack and start lexing tokens from it instead of the current buffer. More... | |
void | EnterTokenStream (std::unique_ptr< Token[]> Toks, unsigned NumToks, bool DisableMacroExpansion) |
void | EnterTokenStream (ArrayRef< Token > Toks, bool DisableMacroExpansion) |
void | RemoveTopOfLexerStack () |
Pop the current lexer/macro exp off the top of the lexer stack. More... | |
void | EnableBacktrackAtThisPos () |
From the point that this method is called, and until CommitBacktrackedTokens() or Backtrack() is called, the Preprocessor keeps track of the lexed tokens so that a subsequent Backtrack() call will make the Preprocessor re-lex the same tokens. More... | |
void | CommitBacktrackedTokens () |
Disable the last EnableBacktrackAtThisPos call. More... | |
CachedTokensRange | LastCachedTokenRange () |
Returns the range of cached tokens that were lexed since EnableBacktrackAtThisPos() was previously called. More... | |
void | EraseCachedTokens (CachedTokensRange TokenRange) |
Erase the range of cached tokens that were lexed since EnableBacktrackAtThisPos() was previously called. More... | |
void | Backtrack () |
Make Preprocessor re-lex the tokens that were lexed since EnableBacktrackAtThisPos() was previously called. More... | |
bool | isBacktrackEnabled () const |
True if EnableBacktrackAtThisPos() was called and caching of tokens is on. More... | |
void | Lex (Token &Result) |
Lex the next token for this preprocessor. More... | |
void | LexAfterModuleImport (Token &Result) |
Lex a token following the 'import' contextual keyword. More... | |
void | makeModuleVisible (Module *M, SourceLocation Loc) |
SourceLocation | getModuleImportLoc (Module *M) const |
bool | LexStringLiteral (Token &Result, std::string &String, const char *DiagnosticTag, bool AllowMacroExpansion) |
Lex a string literal, which may be the concatenation of multiple string literals and may even come from macro expansion. More... | |
bool | FinishLexStringLiteral (Token &Result, std::string &String, const char *DiagnosticTag, bool AllowMacroExpansion) |
Complete the lexing of a string literal where the first token has already been lexed (see LexStringLiteral). More... | |
void | LexNonComment (Token &Result) |
Lex a token. More... | |
void | LexUnexpandedToken (Token &Result) |
Just like Lex, but disables macro expansion of identifier tokens. More... | |
void | LexUnexpandedNonComment (Token &Result) |
Like LexNonComment, but this disables macro expansion of identifier tokens. More... | |
bool | parseSimpleIntegerLiteral (Token &Tok, uint64_t &Value) |
Parses a simple integer literal to get its numeric value. More... | |
void | SetMacroExpansionOnlyInDirectives () |
Disables macro expansion everywhere except for preprocessor directives. More... | |
const Token & | LookAhead (unsigned N) |
Peeks ahead N tokens and returns that token without consuming any tokens. More... | |
void | RevertCachedTokens (unsigned N) |
When backtracking is enabled and tokens are cached, this allows to revert a specific number of tokens. More... | |
void | EnterToken (const Token &Tok) |
Enters a token in the token stream to be lexed next. More... | |
void | AnnotateCachedTokens (const Token &Tok) |
We notify the Preprocessor that if it is caching tokens (because backtrack is enabled) it should replace the most recent cached tokens with the given annotation token. More... | |
SourceLocation | getLastCachedTokenLocation () const |
Get the location of the last cached token, suitable for setting the end location of an annotation token. More... | |
bool | IsPreviousCachedToken (const Token &Tok) const |
Whether Tok is the most recent token (CachedLexPos - 1 ) in CachedTokens. More... | |
void | ReplacePreviousCachedToken (ArrayRef< Token > NewToks) |
Replace token in CachedLexPos - 1 in CachedTokens by the tokens in NewToks . More... | |
void | ReplaceLastTokenWithAnnotation (const Token &Tok) |
Replace the last token with an annotation token. More... | |
void | EnterAnnotationToken (SourceRange Range, tok::TokenKind Kind, void *AnnotationVal) |
Enter an annotation token into the token stream. More... | |
void | TypoCorrectToken (const Token &Tok) |
Update the current token to represent the provided identifier, in order to cache an action performed by typo correction. More... | |
void | recomputeCurLexerKind () |
Recompute the current lexer kind based on the CurLexer/CurPTHLexer/ CurTokenLexer pointers. More... | |
bool | isIncrementalProcessingEnabled () const |
Returns true if incremental processing is enabled. More... | |
void | enableIncrementalProcessing (bool value=true) |
Enables the incremental processing. More... | |
bool | SetCodeCompletionPoint (const FileEntry *File, unsigned Line, unsigned Column) |
Specify the point at which code-completion will be performed. More... | |
bool | isCodeCompletionEnabled () const |
Determine if we are performing code completion. More... | |
SourceLocation | getCodeCompletionLoc () const |
Returns the location of the code-completion point. More... | |
SourceLocation | getCodeCompletionFileLoc () const |
Returns the start location of the file of code-completion point. More... | |
bool | isCodeCompletionReached () const |
Returns true if code-completion is enabled and we have hit the code-completion point. More... | |
void | setCodeCompletionReached () |
Note that we hit the code-completion point. More... | |
SourceLocation | getPragmaARCCFCodeAuditedLoc () const |
The location of the currently-active #pragma clang arc_cf_code_audited begin. More... | |
void | setPragmaARCCFCodeAuditedLoc (SourceLocation Loc) |
Set the location of the currently-active #pragma clang arc_cf_code_audited begin. More... | |
SourceLocation | getPragmaAssumeNonNullLoc () const |
The location of the currently-active #pragma clang assume_nonnull begin. More... | |
void | setPragmaAssumeNonNullLoc (SourceLocation Loc) |
Set the location of the currently-active #pragma clang assume_nonnull begin. More... | |
void | setMainFileDir (const DirectoryEntry *Dir) |
Set the directory in which the main file should be considered to have been found, if it is not a real file. More... | |
void | setSkipMainFilePreamble (unsigned Bytes, bool StartOfLine) |
Instruct the preprocessor to skip part of the main source file. More... | |
DiagnosticBuilder | Diag (SourceLocation Loc, unsigned DiagID) const |
Forwarding function for diagnostics. More... | |
DiagnosticBuilder | Diag (const Token &Tok, unsigned DiagID) const |
StringRef | getSpelling (SourceLocation loc, SmallVectorImpl< char > &buffer, bool *invalid=nullptr) const |
Return the 'spelling' of the token at the given location; does not go up to the spelling location or down to the expansion location. More... | |
std::string | getSpelling (const Token &Tok, bool *Invalid=nullptr) const |
Return the 'spelling' of the Tok token. More... | |
unsigned | getSpelling (const Token &Tok, const char *&Buffer, bool *Invalid=nullptr) const |
Get the spelling of a token into a preallocated buffer, instead of as an std::string. More... | |
StringRef | getSpelling (const Token &Tok, SmallVectorImpl< char > &Buffer, bool *Invalid=nullptr) const |
Get the spelling of a token into a SmallVector. More... | |
bool | getRawToken (SourceLocation Loc, Token &Result, bool IgnoreWhiteSpace=false) |
Relex the token at the specified location. More... | |
char | getSpellingOfSingleCharacterNumericConstant (const Token &Tok, bool *Invalid=nullptr) const |
Given a Token Tok that is a numeric constant with length 1, return the character. More... | |
StringRef | getImmediateMacroName (SourceLocation Loc) |
Retrieve the name of the immediate macro expansion. More... | |
void | CreateString (StringRef Str, Token &Tok, SourceLocation ExpansionLocStart=SourceLocation(), SourceLocation ExpansionLocEnd=SourceLocation()) |
Plop the specified string into a scratch buffer and set the specified token's location and length to it. More... | |
SourceLocation | getLocForEndOfToken (SourceLocation Loc, unsigned Offset=0) |
Computes the source location just past the end of the token at this source location. More... | |
bool | isAtStartOfMacroExpansion (SourceLocation loc, SourceLocation *MacroBegin=nullptr) const |
Returns true if the given MacroID location points at the first token of the macro expansion. More... | |
bool | isAtEndOfMacroExpansion (SourceLocation loc, SourceLocation *MacroEnd=nullptr) const |
Returns true if the given MacroID location points at the last token of the macro expansion. More... | |
void | DumpToken (const Token &Tok, bool DumpFlags=false) const |
Print the token to stderr, used for debugging. More... | |
void | DumpLocation (SourceLocation Loc) const |
void | DumpMacro (const MacroInfo &MI) const |
void | dumpMacroInfo (const IdentifierInfo *II) |
SourceLocation | AdvanceToTokenCharacter (SourceLocation TokStart, unsigned Char) const |
Given a location that specifies the start of a token, return a new location that specifies a character within the token. More... | |
void | IncrementPasteCounter (bool isFast) |
Increment the counters for the number of token paste operations performed. More... | |
void | PrintStats () |
size_t | getTotalMemory () const |
void | HandleMicrosoftCommentPaste (Token &Tok) |
When the macro expander pastes together a comment (/##/) in Microsoft mode, this method handles updating the current state, returning the token on the next source line. More... | |
IdentifierInfo * | LookUpIdentifierInfo (Token &Identifier) const |
Given a tok::raw_identifier token, look up the identifier information for the token and install it into the token, updating the token kind accordingly. More... | |
void | SetPoisonReason (IdentifierInfo *II, unsigned DiagID) |
Specifies the reason for poisoning an identifier. More... | |
void | HandlePoisonedIdentifier (Token &Tok) |
Display reason for poisoned identifier. More... | |
void | MaybeHandlePoisonedIdentifier (Token &Identifier) |
void | PoisonSEHIdentifiers (bool Poison=true) |
bool | HandleIdentifier (Token &Identifier) |
Callback invoked when the lexer reads an identifier and has filled in the tokens IdentifierInfo member. More... | |
bool | HandleEndOfFile (Token &Result, bool isEndOfMacro=false) |
Callback invoked when the lexer hits the end of the current file. More... | |
bool | HandleEndOfTokenLexer (Token &Result) |
Callback invoked when the current TokenLexer hits the end of its token stream. More... | |
void | HandleDirective (Token &Result) |
Callback invoked when the lexer sees a # token at the start of a line. More... | |
void | CheckEndOfDirective (const char *Directive, bool EnableMacros=false) |
Ensure that the next token is a tok::eod token. More... | |
void | DiscardUntilEndOfDirective () |
Read and discard all tokens remaining on the current line until the tok::eod token is found. More... | |
bool | SawDateOrTime () const |
Returns true if the preprocessor has seen a use of DATE or TIME in the file so far. More... | |
unsigned | getCounterValue () const |
void | setCounterValue (unsigned V) |
Module * | getCurrentModule () |
Retrieves the module that we're currently building, if any. More... | |
MacroInfo * | AllocateMacroInfo (SourceLocation L) |
Allocate a new MacroInfo object with the provided SourceLocation. More... | |
bool | GetIncludeFilenameSpelling (SourceLocation Loc, StringRef &Filename) |
Turn the specified lexer token into a fully checked and spelled filename, e.g. More... | |
const FileEntry * | LookupFile (SourceLocation FilenameLoc, StringRef Filename, bool isAngled, const DirectoryLookup *FromDir, const FileEntry *FromFile, const DirectoryLookup *&CurDir, SmallVectorImpl< char > *SearchPath, SmallVectorImpl< char > *RelativePath, ModuleMap::KnownHeader *SuggestedModule, bool *IsMapped, bool SkipCache=false) |
Given a "foo" or <foo> reference, look up the indicated file. More... | |
const DirectoryLookup * | GetCurDirLookup () |
Get the DirectoryLookup structure used to find the current FileEntry, if CurLexer is non-null and if applicable. More... | |
bool | isInPrimaryFile () const |
Return true if we're in the top-level file, not in a #include. More... | |
bool | ConcatenateIncludeName (SmallString< 128 > &FilenameBuffer, SourceLocation &End) |
Handle cases where the #include name is expanded from a macro as multiple tokens, which need to be glued together. More... | |
bool | LexOnOffSwitch (tok::OnOffSwitch &OOS) |
Lex an on-off-switch (C99 6.10.6p2) and verify that it is followed by EOD. More... | |
bool | CheckMacroName (Token &MacroNameTok, MacroUse isDefineUndef, bool *ShadowFlag=nullptr) |
void | EnterSubmodule (Module *M, SourceLocation ImportLoc, bool ForPragma) |
Module * | LeaveSubmodule (bool ForPragma) |
Module * | getModuleForLocation (SourceLocation Loc) |
Find the module that owns the source or header file that Loc points to. More... | |
const FileEntry * | getModuleHeaderToIncludeForDiagnostics (SourceLocation IncLoc, Module *M, SourceLocation MLoc) |
We want to produce a diagnostic at location IncLoc concerning a missing module import. More... | |
bool | isRecordingPreamble () const |
bool | hasRecordedPreamble () const |
ArrayRef< PPConditionalInfo > | getPreambleConditionalStack () const |
void | setRecordedPreambleConditionalStack (ArrayRef< PPConditionalInfo > s) |
void | setReplayablePreambleConditionalStack (ArrayRef< PPConditionalInfo > s, llvm::Optional< PreambleSkipInfo > SkipInfo) |
llvm::Optional< PreambleSkipInfo > | getPreambleSkipInfo () const |
void | HandlePragmaOnce (Token &OnceTok) |
HandlePragmaOnce - Handle #pragma once. OnceTok is the 'once'. More... | |
void | HandlePragmaMark () |
void | HandlePragmaPoison () |
HandlePragmaPoison - Handle #pragma GCC poison. PoisonTok is the 'poison'. More... | |
void | HandlePragmaSystemHeader (Token &SysHeaderTok) |
HandlePragmaSystemHeader - Implement #pragma GCC system_header. More... | |
void | HandlePragmaDependency (Token &DependencyTok) |
HandlePragmaDependency - Handle #pragma GCC dependency "foo" blah. More... | |
void | HandlePragmaPushMacro (Token &Tok) |
Handle #pragma push_macro. More... | |
void | HandlePragmaPopMacro (Token &Tok) |
Handle #pragma pop_macro. More... | |
void | HandlePragmaIncludeAlias (Token &Tok) |
void | HandlePragmaModuleBuild (Token &Tok) |
IdentifierInfo * | ParsePragmaPushOrPopMacro (Token &Tok) |
ParsePragmaPushOrPopMacro - Handle parsing of pragma push_macro/pop_macro. More... | |
bool | HandleComment (Token &Token, SourceRange Comment) |
void | markMacroAsUsed (MacroInfo *MI) |
A macro is used, update information about macros that need unused warnings. More... | |
PPCallbacks * | getPPCallbacks () const |
Accessors for preprocessor callbacks. More... | |
void | addPPCallbacks (std::unique_ptr< PPCallbacks > C) |
Static Public Member Functions | |
static bool | checkModuleIsAvailable (const LangOptions &LangOpts, const TargetInfo &TargetInfo, DiagnosticsEngine &Diags, Module *M) |
Check that the given module is available, producing a diagnostic if not. More... | |
Friends | |
class | VAOptDefinitionContext |
class | VariadicMacroScopeGuard |
class | ASTReader |
class | MacroArgs |
void | TokenLexer::ExpandFunctionArguments () |
using | macro_iterator = MacroMap::const_iterator |
macro_iterator | macro_begin (bool IncludeExternalMacros=true) const |
macro_iterator | macro_end (bool IncludeExternalMacros=true) const |
llvm::iterator_range< macro_iterator > | macros (bool IncludeExternalMacros=true) const |
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Lexers know only about tokens within a single source file, and don't know anything about preprocessor-level issues like the #include stack, token expansion, etc.
Definition at line 127 of file Preprocessor.h.
using clang::Preprocessor::macro_iterator = MacroMap::const_iterator |
Iterators for the macro history table. Currently defined macros have IdentifierInfo::hasMacroDefinition() set and an empty MacroInfo::getUndefLoc() at the head of the list.
Definition at line 1040 of file Preprocessor.h.
Preprocessor::Preprocessor | ( | std::shared_ptr< PreprocessorOptions > | PPOpts, |
DiagnosticsEngine & | diags, | ||
LangOptions & | opts, | ||
SourceManager & | SM, | ||
MemoryBufferCache & | PCMCache, | ||
HeaderSearch & | Headers, | ||
ModuleLoader & | TheModuleLoader, | ||
IdentifierInfoLookup * | IILookup = nullptr , |
||
bool | OwnsHeaderSearch = false , |
||
TranslationUnitKind | TUKind = TU_Complete |
||
) |
Definition at line 81 of file Preprocessor.cpp.
References clang::frontend::CPlusPlus2a, getIdentifierInfo(), getLangOpts(), and SetPoisonReason().
Preprocessor::~Preprocessor | ( | ) |
Definition at line 154 of file Preprocessor.cpp.
void Preprocessor::addCommentHandler | ( | CommentHandler * | Handler | ) |
Add the specified comment handler to the preprocessor.
Definition at line 925 of file Preprocessor.cpp.
Referenced by clang::Parser::Parser().
ModuleMacro * Preprocessor::addModuleMacro | ( | Module * | Mod, |
IdentifierInfo * | II, | ||
MacroInfo * | Macro, | ||
ArrayRef< ModuleMacro *> | Overrides, | ||
bool & | IsNew | ||
) |
Register an exported macro for a module and identifier.
Definition at line 130 of file PPMacroExpansion.cpp.
References clang::ModuleMacro::create(), clang::ModuleMacro::Profile(), and clang::IdentifierInfo::setHasMacroDefinition().
|
inline |
Definition at line 912 of file Preprocessor.h.
Referenced by clang::AttachDependencyGraphGen(), clang::AttachHeaderIncludeGen(), clang::DependencyCollector::attachToPreprocessor(), clang::ModuleDependencyCollector::attachToPreprocessor(), clang::arcmt::MigrateSourceAction::CreateASTConsumer(), clang::CodeGenAction::CreateASTConsumer(), clang::arcmt::ObjCMigrateAction::CreateASTConsumer(), createPreprocessingRecord(), clang::DoPrintPreprocessedInput(), clang::arcmt::getFileRemappings(), and clang::RewriteIncludesInInput().
void Preprocessor::AddPragmaHandler | ( | StringRef | Namespace, |
PragmaHandler * | Handler | ||
) |
Add the specified pragma handler to this preprocessor.
AddPragmaHandler - Add the specified pragma handler to the preprocessor.
If Namespace
is non-null, then it is a token required to exist on the pragma line before the pragma string starts, e.g. "STDC" or "GCC".
If 'Namespace' is non-null, then it is a token required to exist on the pragma line before the pragma string starts, e.g. "STDC" or "GCC".
Definition at line 882 of file Pragma.cpp.
References clang::PragmaNamespace::AddPragma(), clang::PragmaNamespace::FindHandler(), clang::PragmaNamespace::getIfNamespace(), and clang::PragmaHandler::getName().
Referenced by clang::DoPrintPreprocessedInput().
|
inline |
Definition at line 1077 of file Preprocessor.h.
|
inline |
Given a location that specifies the start of a token, return a new location that specifies a character within the token.
Definition at line 1665 of file Preprocessor.h.
Referenced by GetLineValue(), isTargetEnvironment(), clang::NumericLiteralParser::isValidUDSuffix(), and clang::NumericLiteralParser::NumericLiteralParser().
MacroInfo * Preprocessor::AllocateMacroInfo | ( | SourceLocation | L | ) |
Allocate a new MacroInfo object with the provided SourceLocation.
Definition at line 59 of file PPDirectives.cpp.
Referenced by isConfigurationPattern().
|
inline |
We notify the Preprocessor that if it is caching tokens (because backtrack is enabled) it should replace the most recent cached tokens with the given annotation token.
This function has no effect if backtracking is not enabled.
Note that the use of this function is just for optimization, so that the cached tokens doesn't get re-parsed and re-resolved after a backtrack is invoked.
Definition at line 1357 of file Preprocessor.h.
References clang::Token::isAnnotation().
Referenced by clang::Parser::ParseTopLevelDecl(), clang::Parser::TryAnnotateTypeOrScopeToken(), and clang::Parser::TryAnnotateTypeOrScopeTokenAfterScopeSpec().
|
inline |
Definition at line 1006 of file Preprocessor.h.
Referenced by isConfigurationPattern().
|
inline |
Definition at line 1012 of file Preprocessor.h.
References clang::MacroInfo::getDefinitionLoc().
void Preprocessor::appendMacroDirective | ( | IdentifierInfo * | II, |
MacroDirective * | MD | ||
) |
Add a directive to the macro directive history for this identifier.
Definition at line 69 of file PPMacroExpansion.cpp.
References clang::MacroDirective::getPrevious(), clang::MacroDirective::isDefined(), clang::IdentifierInfo::isFromAST(), clang::IdentifierInfo::setChangedSinceDeserialization(), clang::IdentifierInfo::setHasMacroDefinition(), and clang::MacroDirective::setPrevious().
Referenced by isConfigurationPattern(), and ReadLineMarkerFlags().
void Preprocessor::Backtrack | ( | ) |
Make Preprocessor re-lex the tokens that were lexed since EnableBacktrackAtThisPos() was previously called.
Definition at line 63 of file PPCaching.cpp.
References clang::C, EraseCachedTokens(), isBacktrackEnabled(), Lex(), clang::None, recomputeCurLexerKind(), and clang::Result.
Referenced by clang::Parser::getTypeAnnotation(), and clang::PragmaNamespace::HandlePragma().
Ensure that the next token is a tok::eod token.
If not, emit a diagnostic and consume up until the eod. If EnableMacros
is true, then we consider macros that expand to zero tokens as being ok.
If not, emit a diagnostic and consume up until the eod. If EnableMacros is true, then we consider macros that expand to zero tokens as being ok.
Definition at line 316 of file PPDirectives.cpp.
References clang::CodeCompletionHandler::CodeCompleteInConditionalExclusion(), clang::FixItHint::CreateInsertion(), clang::PPCallbacks::CVK_False, clang::PPCallbacks::CVK_True, Diag(), DiscardUntilEndOfDirective(), clang::comments::tok::eof, clang::PPConditionalInfo::FoundElse, clang::PPConditionalInfo::FoundNonSkip, clang::Token::getIdentifierInfo(), clang::Token::getLocation(), clang::IdentifierInfo::getPPKeywordID(), clang::Token::getRawIdentifier(), clang::PreprocessorLexer::getSourceLocation(), getSpelling(), clang::PPConditionalInfo::IfLoc, clang::Token::is(), clang::Token::isAtStartOfLine(), clang::Token::isNot(), Lex(), clang::PreprocessorLexer::LexingRawMode, LexUnexpandedToken(), clang::Token::needsCleaning(), clang::PreprocessorLexer::ParsingPreprocessorDirective, clang::PreprocessorLexer::peekConditionalLevel(), clang::PreprocessorLexer::popConditionalLevel(), clang::PreprocessorLexer::pushConditionalLevel(), setCodeCompletionReached(), clang::format::Tok, and clang::PPConditionalInfo::WasSkipping.
Referenced by checkModuleIsAvailable(), GetLineValue(), isConfigurationPattern(), LexOnOffSwitch(), and ReadLineMarkerFlags().
bool Preprocessor::CheckMacroName | ( | Token & | MacroNameTok, |
MacroUse | isDefineUndef, | ||
bool * | ShadowFlag = nullptr |
||
) |
Definition at line 217 of file PPDirectives.cpp.
References clang::CodeCompletionHandler::CodeCompleteMacroName(), Diag(), DiscardUntilEndOfDirective(), clang::SourceManager::getBufferName(), clang::Token::getIdentifierInfo(), clang::Token::getKind(), getLangOpts(), clang::Token::getLocation(), getMacroInfo(), clang::IdentifierInfo::getPPKeywordID(), clang::Token::is(), clang::MacroInfo::isBuiltinMacro(), clang::IdentifierInfo::isCPlusPlusOperatorKeyword(), clang::SourceManager::isInSystemHeader(), clang::Token::isNot(), LexUnexpandedToken(), MD_KeywordDef, MD_NoWarn, MD_ReservedMacro, clang::MU_Define, clang::MU_Other, clang::MU_Undef, setCodeCompletionReached(), clang::Token::setKind(), shouldWarnOnMacroDef(), and shouldWarnOnMacroUndef().
Referenced by EvaluateDefined().
|
static |
Check that the given module is available, producing a diagnostic if not.
true
if the check failed (because the module is not available). false
if the module appears to be usable. Definition at line 1653 of file PPDirectives.cpp.
References clang::SrcMgr::C_User, CheckEndOfDirective(), ConcatenateIncludeName(), clang::FixItHint::CreateReplacement(), clang::LangOptions::CurrentModule, clang::Module::DefinitionLoc, Diag(), diagnoseAutoModuleImport(), DiscardUntilEndOfDirective(), End, clang::comments::tok::eof, clang::Module::UnresolvedHeaderDirective::FileName, Filename, clang::Module::UnresolvedHeaderDirective::FileNameLoc, clang::CharSourceRange::getCharRange(), getDiagnostics(), clang::Module::getFullModuleName(), clang::Token::getIdentifierInfo(), getIdentifierInfo(), GetIncludeFilenameSpelling(), clang::Token::getKind(), getLangOpts(), clang::Token::getLength(), clang::Token::getLocation(), clang::SourceLocation::getLocWithOffset(), clang::ModuleMap::KnownHeader::getModule(), clang::IdentifierInfo::getNameStart(), getSpelling(), getTargetInfo(), clang::Module::getTopLevelModuleName(), hadModuleLoaderFatalFailure(), clang::Module::Hidden, clang::Module::isAvailable(), clang::ModuleLoadResult::isConfigMismatch(), clang::ModuleLoadResult::isMissingExpected(), clang::Module::UnresolvedHeaderDirective::IsUmbrella, clang::SourceLocation::isValid(), LookupFile(), max(), clang::Module::Parent, clang::DiagnosticsEngine::Report(), clang::Result, clang::Token::startToken(), and clang::FileEntry::tryGetRealPathName().
Referenced by prepareToBuildModule().
|
inline |
Clear out the code completion handler.
Definition at line 1113 of file Preprocessor.h.
Referenced by clang::Parser::~Parser().
void Preprocessor::CodeCompleteNaturalLanguage | ( | ) |
Hook used by the lexer to invoke the "natural language" code completion point.
Definition at line 434 of file Preprocessor.cpp.
References clang::CodeCompletionHandler::CodeCompleteNaturalLanguage(), and setCodeCompletionReached().
Referenced by isEndOfBlockCommentWithEscapedNewLine(), clang::Lexer::ReadToEndOfLine(), and clang::MacroArgs::StringifyArgument().
void Preprocessor::CommitBacktrackedTokens | ( | ) |
Disable the last EnableBacktrackAtThisPos call.
Definition at line 32 of file PPCaching.cpp.
Referenced by clang::Parser::getTypeAnnotation(), and clang::PragmaNamespace::HandlePragma().
bool Preprocessor::ConcatenateIncludeName | ( | SmallString< 128 > & | FilenameBuffer, |
SourceLocation & | End | ||
) |
Handle cases where the #include name is expanded from a macro as multiple tokens, which need to be glued together.
This occurs for code like:
because in this case, "<x/y.h>" is returned as 7 tokens, not one.
This code concatenates and consumes tokens up to the '>' token. It returns false if the > was found, otherwise it returns true if it finds and consumes the EOD marker.
Definition at line 1512 of file PPDirectives.cpp.
References Diag(), clang::Token::getLength(), clang::Token::getLocation(), getSpelling(), clang::Token::hasLeadingSpace(), clang::Token::is(), clang::Token::isNot(), Lex(), and setCodeCompletionReached().
Referenced by checkModuleIsAvailable(), and EvaluateHasIncludeCommon().
void Preprocessor::createPreprocessingRecord | ( | ) |
Create a new preprocessing record, which will keep track of all macro expansions, macro definitions, etc.
Definition at line 959 of file Preprocessor.cpp.
References addPPCallbacks(), and getSourceManager().
void Preprocessor::CreateString | ( | StringRef | Str, |
Token & | Tok, | ||
SourceLocation | ExpansionLocStart = SourceLocation() , |
||
SourceLocation | ExpansionLocEnd = SourceLocation() |
||
) |
Plop the specified string into a scratch buffer and set the specified token's location and length to it.
CreateString - Plop the specified string into a scratch buffer and return a location for it.
If specified, the source location provides a location of the expansion point of the token.
If specified, the source location provides a source location for the token.
Definition at line 465 of file Preprocessor.cpp.
References clang::SourceManager::createExpansionLoc(), clang::Token::is(), clang::Token::isLiteral(), clang::SourceLocation::isValid(), clang::Token::setLength(), clang::Token::setLiteralData(), clang::Token::setLocation(), and clang::Token::setRawIdentifierData().
Referenced by ComputeDATE_TIME(), isTargetEnvironment(), and clang::MacroArgs::StringifyArgument().
|
inline |
Forwarding function for diagnostics.
This emits a diagnostic at the specified Token's location, translating the token's start position in the current buffer into a SourcePosition object for rendering.
Definition at line 1513 of file Preprocessor.h.
References clang::DiagnosticsEngine::Report().
Referenced by buildMSAsmString(), clang::CharLiteralParser::CharLiteralParser(), checkConfigMacro(), CheckEndOfDirective(), CheckMacroName(), checkModuleIsAvailable(), ConcatenateIncludeName(), CreateSLocExpansionAbbrev(), clang::Lexer::Diag(), diagnoseUnexpectedOperator(), EvaluateDefined(), EvaluateDirectiveSubExpr(), EvaluateFeatureLikeBuiltinMacro(), EvaluateHasIncludeCommon(), EvaluateHasIncludeNext(), EvaluateValue(), ExpectFeatureIdentifierInfo(), FinishLexStringLiteral(), GetLineValue(), HandleDirective(), HandleIdentifier(), HandlePoisonedIdentifier(), clang::PragmaNamespace::HandlePragma(), clang::TokenLexer::Init(), isConfigurationPattern(), clang::TokenLexer::isParsingPreprocessorDirective(), isTargetEnvironment(), isTrivialSingleTokenExpansion(), clang::NumericLiteralParser::isValidUDSuffix(), clang::PTHLexer::Lex(), clang::PreprocessorLexer::LexIncludeFilename(), LexModuleNameComponent(), LexOnOffSwitch(), makeModuleVisible(), clang::NumericLiteralParser::NumericLiteralParser(), ParseAlignPragma(), ParseLoopHintValue(), ReadLineMarkerFlags(), clang::Lexer::ReadToEndOfLine(), shouldIgnoreMacro(), and clang::MacroArgs::StringifyArgument().
|
inline |
Definition at line 1517 of file Preprocessor.h.
References clang::Token::getLocation(), and clang::DiagnosticsEngine::Report().
void Preprocessor::DiscardUntilEndOfDirective | ( | ) |
Read and discard all tokens remaining on the current line until the tok::eod token is found.
Definition at line 83 of file PPDirectives.cpp.
References clang::comments::tok::eof, clang::Token::isNot(), and LexUnexpandedToken().
Referenced by CheckEndOfDirective(), CheckMacroName(), checkModuleIsAvailable(), GetLineValue(), HandleDirective(), isConfigurationPattern(), LexOnOffSwitch(), ParseAlignPragma(), and ReadLineMarkerFlags().
void Preprocessor::DumpLocation | ( | SourceLocation | Loc | ) | const |
Definition at line 242 of file Preprocessor.cpp.
References clang::SourceLocation::dump().
Referenced by DumpToken().
void Preprocessor::DumpMacro | ( | const MacroInfo & | MI | ) | const |
Definition at line 246 of file Preprocessor.cpp.
References DumpToken(), clang::MacroInfo::getNumTokens(), and clang::MacroInfo::getReplacementToken().
void Preprocessor::dumpMacroInfo | ( | const IdentifierInfo * | II | ) |
Definition at line 258 of file PPMacroExpansion.cpp.
References clang::IdentifierInfo::getNameStart(), clang::None, and State.
Referenced by LexOnOffSwitch().
Print the token to stderr, used for debugging.
Definition at line 218 of file Preprocessor.cpp.
References DumpLocation(), clang::SourceManager::getCharacterData(), clang::Token::getKind(), clang::Token::getLength(), clang::Token::getLocation(), getSpelling(), clang::tok::getTokenName(), clang::Token::hasLeadingSpace(), clang::Token::isAtStartOfLine(), clang::Token::isExpandDisabled(), and clang::Token::needsCleaning().
Referenced by DumpMacro(), clang::DumpRawTokensAction::ExecuteAction(), and clang::DumpTokensAction::ExecuteAction().
void Preprocessor::EnableBacktrackAtThisPos | ( | ) |
From the point that this method is called, and until CommitBacktrackedTokens() or Backtrack() is called, the Preprocessor keeps track of the lexed tokens so that a subsequent Backtrack() call will make the Preprocessor re-lex the same tokens.
Nested backtracks are allowed, meaning that EnableBacktrackAtThisPos can be called multiple times and CommitBacktrackedTokens/Backtrack calls will be combined with the EnableBacktrackAtThisPos calls in reverse order.
NOTE: DO NOT forget to call either CommitBacktrackedTokens or Backtrack at some point after EnableBacktrackAtThisPos. If you don't, caching of tokens will continue indefinitely.
Definition at line 26 of file PPCaching.cpp.
Referenced by clang::Parser::getTypeAnnotation(), and clang::PragmaNamespace::HandlePragma().
Enables the incremental processing.
Definition at line 1415 of file Preprocessor.h.
References Line.
void Preprocessor::EndSourceFile | ( | ) |
Inform the preprocessor callbacks that processing is complete.
Definition at line 552 of file Preprocessor.cpp.
Referenced by clang::FrontendAction::EndSourceFile().
void Preprocessor::EnterAnnotationToken | ( | SourceRange | Range, |
tok::TokenKind | Kind, | ||
void * | AnnotationVal | ||
) |
Enter an annotation token into the token stream.
Push a token onto the token stream containing an annotation.
Definition at line 1561 of file PPDirectives.cpp.
References clang::SourceRange::getBegin(), clang::SourceRange::getEnd(), clang::Token::setAnnotationEndLoc(), clang::Token::setAnnotationValue(), clang::Token::setKind(), clang::Token::setLocation(), and clang::Token::startToken().
Referenced by LexOnOffSwitch().
void Preprocessor::EnterMacro | ( | Token & | Tok, |
SourceLocation | ILEnd, | ||
MacroInfo * | Macro, | ||
MacroArgs * | Args | ||
) |
Add a Macro to the top of the include stack and start lexing tokens from it instead of the current buffer.
EnterMacro - Add a Macro to the top of the include stack and start lexing tokens from it instead of the current buffer.
Args | specifies the tokens input to a function-like macro. |
ILEnd | specifies the location of the ')' for a function-like macro or the identifier for an object-like macro. |
Definition at line 160 of file PPLexerChange.cpp.
References clang::format::Tok.
Referenced by isTrivialSingleTokenExpansion().
void Preprocessor::EnterMainSourceFile | ( | ) |
Enter the specified FileID as the main source file, which implicitly adds the builtin defines etc.
EnterMainSourceFile - Enter the specified FileID as the main source file, which implicitly adds the builtin defines etc.
Definition at line 498 of file Preprocessor.cpp.
References clang::SourceManager::createFileID(), EnterSourceFile(), clang::SourceManager::getFileEntryForID(), clang::SourceManager::getMainFileID(), clang::HeaderSearch::IncrementIncludeCount(), clang::SourceManager::isLoadedFileID(), clang::FileID::isValid(), and clang::PreprocessorLexer::setConditionalLevels().
Referenced by clang::CacheTokens(), DoPrintMacros(), clang::DoPrintPreprocessedInput(), clang::DumpTokensAction::ExecuteAction(), clang::PreprocessOnlyAction::ExecuteAction(), clang::RewriteIncludesInInput(), and clang::RewriteMacrosInInput().
bool Preprocessor::EnterSourceFile | ( | FileID | FID, |
const DirectoryLookup * | CurDir, | ||
SourceLocation | Loc | ||
) |
Add a source file to the top of the include stack and start lexing tokens from it instead of the current buffer.
EnterSourceFile - Add a source file to the top of the include stack and start lexing tokens from it instead of the current buffer.
Emits a diagnostic, doesn't enter the file, and returns true on error.
Definition at line 70 of file PPLexerChange.cpp.
References Diag(), and clang::PPCallbacks::EnterFile.
Referenced by EnterMainSourceFile().
void Preprocessor::EnterSubmodule | ( | Module * | M, |
SourceLocation | ImportLoc, | ||
bool | ForPragma | ||
) |
Definition at line 661 of file PPLexerChange.cpp.
References clang::ModuleMap::resolveConflicts(), clang::ModuleMap::resolveExports(), clang::ModuleMap::resolveUses(), and State.
|
inline |
Enters a token in the token stream to be lexed next.
If BackTrack() is called afterwards, the token will remain at the insertion point.
Definition at line 1344 of file Preprocessor.h.
References clang::format::Tok.
Referenced by FixDigraph(), LexOnOffSwitch(), ParseAlignPragma(), clang::Parser::ParseConstraintExpression(), clang::Parser::ParseTopLevelDecl(), and clang::Parser::TryAnnotateTypeOrScopeToken().
|
inline |
Definition at line 1180 of file Preprocessor.h.
|
inline |
Definition at line 1185 of file Preprocessor.h.
void Preprocessor::EraseCachedTokens | ( | CachedTokensRange | TokenRange | ) |
Erase the range of cached tokens that were lexed since EnableBacktrackAtThisPos() was previously called.
Definition at line 44 of file PPCaching.cpp.
References clang::Preprocessor::CachedTokensRange::Begin, and clang::Preprocessor::CachedTokensRange::End.
Referenced by Backtrack(), and clang::PragmaNamespace::HandlePragma().
void Preprocessor::FinalizeForModelFile | ( | ) |
Cleanup after model file parsing.
Definition at line 207 of file Preprocessor.cpp.
bool Preprocessor::FinishLexStringLiteral | ( | Token & | Result, |
std::string & | String, | ||
const char * | DiagnosticTag, | ||
bool | AllowMacroExpansion | ||
) |
Complete the lexing of a string literal where the first token has already been lexed (see LexStringLiteral).
Definition at line 866 of file Preprocessor.cpp.
References Diag(), clang::StringLiteralParser::GetString(), clang::StringLiteralParser::hadError, clang::Token::hasUDSuffix(), clang::Token::is(), clang::StringLiteralParser::isAscii(), clang::Token::isNot(), Lex(), LexUnexpandedToken(), and clang::StringLiteralParser::Pascal.
Referenced by isTargetEnvironment(), and LexOnOffSwitch().
|
inline |
Definition at line 817 of file Preprocessor.h.
|
inline |
Definition at line 826 of file Preprocessor.h.
References BuiltinInfo.
Referenced by clang::CompilerInstance::createASTContext().
|
inline |
Returns the start location of the file of code-completion point.
Returns an invalid location if code-completion is not enabled or the file containing the code-completion point has not been lexed yet.
Definition at line 1449 of file Preprocessor.h.
Referenced by isEndOfBlockCommentWithEscapedNewLine(), clang::PTHLexer::Lex(), and clang::Lexer::ReadToEndOfLine().
|
inline |
Get the code completion token for filtering purposes.
Definition at line 1127 of file Preprocessor.h.
References clang::IdentifierInfo::getName().
|
inline |
Retrieve the current code-completion handler.
Definition at line 1108 of file Preprocessor.h.
Referenced by EvaluateDefined(), and EvaluateValue().
|
inline |
Returns the location of the code-completion point.
Returns an invalid location if code-completion is not enabled or the file containing the code-completion point has not been lexed yet.
Definition at line 1443 of file Preprocessor.h.
Referenced by findPlaceholderEnd().
|
inline |
Definition at line 859 of file Preprocessor.h.
Referenced by HandleComment(), PrintPreprocessedTokens(), and clang::Lexer::resetExtendedTokenMode().
|
inline |
Definition at line 1786 of file Preprocessor.h.
Referenced by shouldIgnoreMacro().
|
inline |
Get the DirectoryLookup structure used to find the current FileEntry, if CurLexer is non-null and if applicable.
This allows us to implement #include_next and find directory-specific properties.
Definition at line 1824 of file Preprocessor.h.
References clang::prec::Conditional, End, clang::FileID::isInvalid(), clang::Lexer::isPragmaLexer(), clang::MU_Other, and P.
Referenced by EvaluateHasIncludeNext().
PreprocessorLexer * Preprocessor::getCurrentFileLexer | ( | ) | const |
Return the current file lexer being lexed from.
getCurrentLexer - Return the current file lexer being lexed from.
Note that this ignores any potentially active macro expansions and _Pragma expansions going on at the time.
Definition at line 51 of file PPLexerChange.cpp.
Referenced by isTargetEnvironment(), and LookupFile().
|
inline |
Return the current lexer being lexed from.
Note that this ignores any potentially active macro expansions and _Pragma expansions going on at the time.
Definition at line 891 of file Preprocessor.h.
Referenced by EvaluateHasIncludeCommon(), and EvaluateHasIncludeNext().
|
inline |
Return the submodule owning the file being lexed.
This may not be the current module if we have changed modules since entering the file.
Definition at line 901 of file Preprocessor.h.
Referenced by EvaluateHasIncludeNext().
Module * Preprocessor::getCurrentModule | ( | ) |
Retrieves the module that we're currently building, if any.
Definition at line 485 of file Preprocessor.cpp.
References getHeaderSearchInfo(), getLangOpts(), and clang::HeaderSearch::lookupModule().
Referenced by clang::Sema::ActOnEndOfTranslationUnit(), LookupFile(), and markIdentifierFromAST().
|
inline |
Definition at line 812 of file Preprocessor.h.
Referenced by clang::AttachHeaderIncludeGen(), clang::CharLiteralParser::CharLiteralParser(), checkModuleIsAvailable(), clang::ento::CreateAnalysisConsumer(), clang::DependencyFileGenerator::CreateAndAttachToPreprocessor(), clang::CompilerInstance::createCodeCompletionConsumer(), EnableCodeCompletion(), findPlaceholderEnd(), clang::PCHGenerator::HandleTranslationUnit(), HasExtension(), clang::html::HighlightMacros(), isConfigurationPattern(), isTargetEnvironment(), LexOnOffSwitch(), maybeDiagnoseUTF8Homoglyph(), ParseAlignPragma(), and clang::Lexer::ReadToEndOfLine().
|
inline |
Definition at line 837 of file Preprocessor.h.
Referenced by getFutureCompatDiagKind(), and isTrivialSingleTokenExpansion().
|
inline |
Definition at line 818 of file Preprocessor.h.
Referenced by clang::CacheTokens(), EnableCodeCompletion(), and getNumberOfModules().
|
inline |
Definition at line 821 of file Preprocessor.h.
Referenced by clang::Sema::ActOnEndOfTranslationUnit(), clang::Sema::ActOnStartOfTranslationUnit(), clang::DependencyCollector::attachToPreprocessor(), clang::ModuleDependencyCollector::attachToPreprocessor(), compileModuleImpl(), clang::CompilerInstance::createPCHExternalASTSource(), DetectEOL(), clang::FrontendAction::EndSourceFile(), clang::FrontendAction::Execute(), clang::FrontendAction::getCurrentModule(), getCurrentModule(), getInputBufferForModule(), getTopImportImplicitModule(), clang::PCHGenerator::HandleTranslationUnit(), clang::CompilerInstance::loadGlobalModuleIndex(), loadModuleMapForModuleBuild(), and prepareToBuildModule().
|
inline |
Return information about the specified preprocessor identifier token.
Definition at line 1068 of file Preprocessor.h.
Referenced by checkConfigMacro(), checkModuleIsAvailable(), checkTupleLikeDecomposition(), DiagnoseCallingConvCast(), clang::Sema::DiagnoseOwningPropertyGetterSynthesis(), getFallthroughAttrSpelling(), clang::Parser::getTypeAnnotation(), clang::Parser::Initialize(), clang::Sema::Initialize(), isTargetEnvironment(), isTupleLike(), LexAfterModuleImport(), LexModuleNameComponent(), LookUpIdentifierInfo(), and Preprocessor().
|
inline |
Definition at line 823 of file Preprocessor.h.
Referenced by BuildNonArrayForRange(), clang::CompilerInstance::createASTContext(), clang::Sema::DeclareGlobalNewDelete(), clang::FrontendAction::EndSourceFile(), getDeclForLocalLookup(), clang::Parser::Initialize(), LookupMemberExpr(), LookupMethodInReceiverType(), LookupStdInitializerList(), lookupStdTypeTraitMember(), and shouldIgnoreMacro().
|
inline |
Definition at line 824 of file Preprocessor.h.
|
inline |
Retrieve the name of the immediate macro expansion.
This routine starts from a source location, and finds the name of the macro responsible for its immediate expansion. It looks through any intervening macro argument expansions to compute this. It returns a StringRef that refers to the SourceManager-owned buffer of the source where that macro name is spelled. Thus, the result shouldn't out-live the SourceManager.
Definition at line 1604 of file Preprocessor.h.
Referenced by lookThroughRangesV3Condition().
bool Preprocessor::GetIncludeFilenameSpelling | ( | SourceLocation | Loc, |
StringRef & | Buffer | ||
) |
Turn the specified lexer token into a fully checked and spelled filename, e.g.
GetIncludeFilenameSpelling - Turn the specified lexer token into a fully checked and spelled filename, e.g.
as an operand of #include.
The caller is expected to provide a buffer that is large enough to hold the spelling of the filename, but is also expected to handle the case when this method decides to use a different buffer.
as an operand of #include. This returns true if the input filename was in <>'s or false if it were in ""'s. The caller is expected to provide a buffer that is large enough to hold the spelling of the filename, but is also expected to handle the case when this method decides to use a different buffer.
Definition at line 1460 of file PPDirectives.cpp.
Referenced by checkModuleIsAvailable(), DetectEOL(), and EvaluateHasIncludeCommon().
|
inline |
Definition at line 815 of file Preprocessor.h.
Referenced by AddFunctionParameterChunks(), AddMacroResults(), clang::TokenConcatenation::AvoidConcat(), clang::CharLiteralParser::CharLiteralParser(), CheckMacroName(), checkModuleIsAvailable(), diagnoseAutoModuleImport(), clang::DoPrintPreprocessedInput(), clang::DoRewriteTest(), emitPremigrationErrors(), EvaluateDirectiveSubExpr(), EvaluateHasIncludeNext(), EvaluateValue(), clang::DumpRawTokensAction::ExecuteAction(), getCurrentModule(), getDeclForLocalLookup(), getFallthroughAttrSpelling(), clang::Parser::getLangOpts(), getModuleForLocation(), getModuleHeaderToIncludeForDiagnostics(), HandleDirective(), HandleIdentifier(), clang::PCHGenerator::HandleTranslationUnit(), HasExtension(), HasFeature(), clang::html::HighlightMacros(), clang::TokenLexer::Init(), clang::InitializePreprocessor(), isConfigurationPattern(), isInterestingIdentifier(), IsStringPrefix(), isTargetEnvironment(), clang::NumericLiteralParser::isValidUDSuffix(), clang::TokenLexer::Lex(), LexAfterModuleImport(), LexRawTokensFromMainFile(), LookUpIdentifierInfo(), MaybeAddSentinel(), clang::NumericLiteralParser::NumericLiteralParser(), ParseLoopHintValue(), Preprocessor(), PrintPreprocessedTokens(), clang::RewriteMacrosInInput(), shouldWarnOnMacroDef(), shouldWarnOnMacroUndef(), clang::html::SyntaxHighlight(), and clang::TokenConcatenation::TokenConcatenation().
|
inline |
Get the location of the last cached token, suitable for setting the end location of an annotation token.
Definition at line 1365 of file Preprocessor.h.
Referenced by IsPreviousCachedToken().
StringRef Preprocessor::getLastMacroWithSpelling | ( | SourceLocation | Loc, |
ArrayRef< TokenValue > | Tokens | ||
) | const |
Return the name of the macro defined before Loc
that has spelling Tokens
.
If there are multiple macros with same spelling, return the last one defined.
Definition at line 338 of file Preprocessor.cpp.
Referenced by DiagnoseCallingConvCast(), clang::Sema::DiagnoseOwningPropertyGetterSynthesis(), and getFallthroughAttrSpelling().
|
inline |
Get the list of leaf (non-overridden) module macros for a name.
Definition at line 1027 of file Preprocessor.h.
References clang::IdentifierInfo::isOutOfDate().
|
inline |
Given an identifier, return its latest non-imported MacroDirective if it is #define'd and not #undef'd, or null if it isn't #define'd.
Definition at line 974 of file Preprocessor.h.
References clang::MacroDirective::getDefinition(), clang::IdentifierInfo::hasMacroDefinition(), and clang::MacroDirective::DefInfo::isUndefined().
Referenced by ReadLineMarkerFlags().
MacroDirective * Preprocessor::getLocalMacroDirectiveHistory | ( | const IdentifierInfo * | II | ) | const |
Given an identifier, return the latest non-imported macro directive for that identifier.
One can iterate over all previous macro directives from the most recent one.
Definition at line 61 of file PPMacroExpansion.cpp.
References clang::IdentifierInfo::hadMacroDefinition().
Referenced by checkConfigMacro().
|
inline |
Computes the source location just past the end of the token at this source location.
This routine can be used to produce a source location that points just past the end of the token referenced by Loc
, and is generally used when a diagnostic needs to point just after a token where it expected something different that it received. If the returned source location would not be meaningful (e.g., if it points into a macro), this routine returns an invalid source location.
Offset | an offset from the end of the token, where the source location should refer to. The default offset (0) produces a source location pointing just past the end of the token; an offset of 1 produces a source location pointing to the last character in the token, etc. |
Definition at line 1632 of file Preprocessor.h.
Referenced by AuditedType(), clang::arcmt::ObjCMigrateAction::BeginInvocation(), clang::Parser::Diag(), EvaluateHasIncludeCommon(), clang::Parser::getEndOfPreviousToken(), IsCommonTypo(), isTargetEnvironment(), and clang::Parser::ParseTopLevelDecl().
|
inline |
Definition at line 944 of file Preprocessor.h.
References clang::IdentifierInfo::hasMacroDefinition().
Referenced by AddMacroResults(), EvaluateDefined(), HandleIdentifier(), and isConfigurationPattern().
|
inline |
Definition at line 957 of file Preprocessor.h.
References clang::IdentifierInfo::hadMacroDefinition().
Referenced by hasSuperInitCall().
|
inline |
Definition at line 985 of file Preprocessor.h.
Referenced by checkConfigMacro(), CheckMacroName(), clang::CodeCompletionResult::CreateCodeCompletionString(), isConfigurationPattern(), and isTrivialSingleTokenExpansion().
|
inline |
Definition at line 989 of file Preprocessor.h.
References clang::MacroDirective::getMacroInfo(), and clang::IdentifierInfo::hasMacroDefinition().
Module * Preprocessor::getModuleForLocation | ( | SourceLocation | Loc | ) |
Find the module that owns the source or header file that Loc
points to.
If the location is in a file that was included into a module, or is outside any module, returns nullptr.
Definition at line 644 of file PPDirectives.cpp.
References clang::LangOptions::CurrentModule, clang::ModuleMap::findModuleForHeader(), clang::SourceManager::getExpansionLoc(), clang::SourceManager::getFileEntryForID(), clang::SourceManager::getFileID(), getLangOpts(), clang::ModuleMap::KnownHeader::getModule(), clang::HeaderSearch::getModuleMap(), clang::SourceManager::isInMainFile(), and clang::HeaderSearch::lookupModule().
Referenced by getModuleHeaderToIncludeForDiagnostics(), and LookupFile().
const FileEntry * Preprocessor::getModuleHeaderToIncludeForDiagnostics | ( | SourceLocation | IncLoc, |
Module * | M, | ||
SourceLocation | MLoc | ||
) |
We want to produce a diagnostic at location IncLoc concerning a missing module import.
IncLoc | The location at which the missing import was detected. |
M | The desired module. |
MLoc | A location within the desired module at which some desired effect occurred (eg, where a desired entity was declared). |
Definition at line 665 of file PPDirectives.cpp.
References clang::ModuleMap::findAllModulesForHeader(), clang::SourceManager::getExpansionLoc(), clang::SourceManager::getFileEntryForID(), clang::SourceManager::getFileID(), clang::SourceManager::getIncludeLoc(), getLangOpts(), getModuleForLocation(), clang::HeaderSearch::getModuleMap(), getSourceManager(), clang::Module::getTopLevelModule(), clang::SourceManager::isInMainFile(), clang::SourceLocation::isInvalid(), SM, and clang::ModuleMap::TextualHeader.
|
inline |
Definition at line 1246 of file Preprocessor.h.
|
inline |
Retrieve the module loader associated with this preprocessor.
Definition at line 842 of file Preprocessor.h.
Referenced by clang::PCHGenerator::HandleTranslationUnit(), and LexOnOffSwitch().
ModuleMacro * Preprocessor::getModuleMacro | ( | Module * | Mod, |
IdentifierInfo * | II | ||
) |
Definition at line 172 of file PPMacroExpansion.cpp.
References clang::SourceManager::isInSystemHeader(), and clang::ModuleMacro::Profile().
|
inline |
Definition at line 820 of file Preprocessor.h.
Referenced by clang::RewriteIncludesAction::RewriteImportsListener::visitModuleFile().
|
inline |
Accessors for preprocessor callbacks.
Note that this class takes ownership of any PPCallbacks object given to it.
Definition at line 911 of file Preprocessor.h.
Referenced by EvaluateDefined(), LexOnOffSwitch(), and ParseAlignPragma().
|
inline |
The location of the currently-active #pragma clang arc_cf_code_audited begin.
Returns an invalid location if there is no such pragma active.
Definition at line 1469 of file Preprocessor.h.
Referenced by clang::Sema::AddCFAuditedAttribute().
|
inline |
The location of the currently-active #pragma clang assume_nonnull begin.
Returns an invalid location if there is no such pragma active.
Definition at line 1483 of file Preprocessor.h.
|
inline |
Definition at line 862 of file Preprocessor.h.
|
inline |
Definition at line 2110 of file Preprocessor.h.
Referenced by shouldIgnoreMacro().
|
inline |
Definition at line 2125 of file Preprocessor.h.
Referenced by shouldIgnoreMacro().
|
inline |
Definition at line 1058 of file Preprocessor.h.
|
inline |
Returns the FileID for the preprocessor predefines.
Definition at line 904 of file Preprocessor.h.
Referenced by checkConfigMacro(), isConfigurationPattern(), clang::RewriteIncludesInInput(), and shouldIgnoreMacro().
|
inline |
Retrieve the preprocessing record, or NULL if there is no preprocessing record.
Definition at line 1135 of file Preprocessor.h.
Referenced by shouldIgnoreMacro().
|
inline |
Definition at line 827 of file Preprocessor.h.
Referenced by clang::ModuleMacro::create(), LexOnOffSwitch(), ParseAlignPragma(), and ParseLoopHintValue().
|
inline |
Retrieve the preprocessor options used to initialize this preprocessor.
Definition at line 810 of file Preprocessor.h.
Referenced by findPlaceholderEnd().
|
inline |
Definition at line 831 of file Preprocessor.h.
References clang::PTHManager::get().
|
inline |
Relex the token at the specified location.
Definition at line 1573 of file Preprocessor.h.
Referenced by AuditedType(), and UseNSOptionsMacro().
|
inline |
Definition at line 825 of file Preprocessor.h.
Referenced by clang::CompilerInstance::createASTContext(), LookupMemberExpr(), and LookupMethodInReceiverType().
|
inline |
Definition at line 819 of file Preprocessor.h.
Referenced by addConstexprToLambdaDeclSpecifier(), AddFunctionParameterChunks(), clang::DependencyCollector::attachToPreprocessor(), clang::ModuleDependencyCollector::attachToPreprocessor(), AuditedType(), clang::TokenConcatenation::AvoidConcat(), clang::arcmt::ObjCMigrateAction::BeginInvocation(), clang::VerifyDiagnosticConsumer::BeginSourceFile(), clang::CacheTokens(), clang::CharLiteralParser::CharLiteralParser(), checkConfigMacro(), clang::Lexer::Create_PragmaLexer(), clang::CompilerInstance::createASTContext(), clang::PTHManager::CreateLexer(), createPreprocessingRecord(), DetectEOL(), clang::DoPrintPreprocessedInput(), clang::DoRewriteTest(), emitPremigrationErrors(), EvaluateDefined(), clang::DumpRawTokensAction::ExecuteAction(), clang::PreprocessorLexer::getFileEntry(), GetFirstChar(), GetMappedTokenLoc(), getModuleHeaderToIncludeForDiagnostics(), clang::VerifyDiagnosticConsumer::HandleComment(), clang::html::HighlightMacros(), clang::TokenLexer::Init(), isConfigurationPattern(), clang::TokenLexer::isParsingPreprocessorDirective(), IsPreviousCachedToken(), IsStringPrefix(), clang::TokenLexer::Lex(), LexRawTokensFromMainFile(), LookUpIdentifierInfo(), clang::Parser::ParseConstraintExpression(), clang::PreprocessorLexer::PreprocessorLexer(), clang::PTHLexer::PTHLexer(), ReadLineMarkerFlags(), clang::RewriteIncludesInInput(), clang::RewriteMacrosInInput(), SelectDigraphErrorMessage(), shouldIgnoreMacro(), clang::html::SyntaxHighlight(), updateConsecutiveMacroArgTokens(), and UseNSOptionsMacro().
|
inline |
Return the 'spelling' of the token at the given location; does not go up to the spelling location or down to the expansion location.
buffer | A buffer which will be used only if the token requires "cleaning", e.g. if it contains trigraphs or escaped newlines |
invalid | If non-null, will be set true if an error occurs. |
Definition at line 1528 of file Preprocessor.h.
Referenced by buildMSAsmString(), CheckEndOfDirective(), checkModuleIsAvailable(), ConcatenateIncludeName(), DetectEOL(), DumpToken(), EvaluateHasIncludeCommon(), EvaluateValue(), GetLineValue(), IsCommonTypo(), LexOnOffSwitch(), LookUpIdentifierInfo(), clang::Parser::ParseConstraintExpression(), ParseLoopHintValue(), ParseOpenMPDirectiveKind(), parseSimpleIntegerLiteral(), ReadLineMarkerFlags(), clang::RewriteMacrosInInput(), and clang::MacroArgs::StringifyArgument().
|
inline |
Return the 'spelling' of the Tok token.
The spelling of a token is the characters used to represent the token in the source file after trigraph expansion and escaped-newline folding. In particular, this wants to get the true, uncanonicalized, spelling of things like digraphs, UCNs, etc.
Invalid | If non-null, will be set true if an error occurs. |
Definition at line 1542 of file Preprocessor.h.
|
inline |
Get the spelling of a token into a preallocated buffer, instead of as an std::string.
The caller is required to allocate enough space for the token, which is guaranteed to be at least Tok.getLength() bytes long. The length of the actual result is returned.
Note that this method may do two possible things: it may either fill in the buffer specified with characters, or it may change the input pointer to point to a constant buffer with the data already in it (avoiding a copy). The caller is not allowed to modify the returned buffer pointer if an internal buffer is returned.
Definition at line 1558 of file Preprocessor.h.
StringRef Preprocessor::getSpelling | ( | const Token & | Tok, |
SmallVectorImpl< char > & | Buffer, | ||
bool * | Invalid = nullptr |
||
) | const |
Get the spelling of a token into a SmallVector.
getSpelling - This method is used to get the spelling of a token into a SmallVector.
Note that the returned StringRef may not point to the supplied buffer if a copy can be avoided.
Definition at line 443 of file Preprocessor.cpp.
|
inline |
Given a Token Tok
that is a numeric constant with length 1, return the character.
Definition at line 1581 of file Preprocessor.h.
References clang::SourceManager::getCharacterData(), clang::Token::getLength(), clang::Token::getLiteralData(), clang::Token::getLocation(), clang::Token::is(), and clang::Token::needsCleaning().
|
inline |
Definition at line 868 of file Preprocessor.h.
|
inline |
Definition at line 816 of file Preprocessor.h.
Referenced by clang::CharLiteralParser::CharLiteralParser(), checkModuleIsAvailable(), EvaluateValue(), clang::Parser::getTargetInfo(), HasExtension(), HasFeature(), and isTargetEnvironment().
size_t Preprocessor::getTotalMemory | ( | ) | const |
Definition at line 308 of file Preprocessor.cpp.
Referenced by PrintStats().
|
inline |
Definition at line 844 of file Preprocessor.h.
References clang::ModuleLoader::HadFatalFailure.
Referenced by checkModuleIsAvailable().
bool Preprocessor::HandleComment | ( | Token & | Token, |
SourceRange | Comment | ||
) |
Definition at line 939 of file Preprocessor.cpp.
References getCommentRetentionState(), Lex(), clang::CodeCompletionHandler::~CodeCompletionHandler(), clang::CommentHandler::~CommentHandler(), and clang::ModuleLoader::~ModuleLoader().
Referenced by isEndOfBlockCommentWithEscapedNewLine().
void Preprocessor::HandleDirective | ( | Token & | Result | ) |
Callback invoked when the lexer sees a # token at the start of a line.
HandleDirective - This callback is invoked when the lexer sees a # token at the start of a line.
This consumes the directive, modifies the lexer/preprocessor state, and advances the lexer(s) so that the next token read is the correct one.
Definition at line 873 of file PPDirectives.cpp.
References Diag(), DiscardUntilEndOfDirective(), clang::Token::getIdentifierInfo(), clang::Token::getKind(), getLangOpts(), clang::Token::getLocation(), clang::IdentifierInfo::getPPKeywordID(), clang::Token::is(), LexUnexpandedToken(), clang::PIK_HashPragma, clang::Result, and setCodeCompletionReached().
Referenced by clang::PTHLexer::Lex().
Callback invoked when the lexer hits the end of the current file.
HandleEndOfFile - This callback is invoked when the lexer hits the end of the current file.
This either returns the EOF token and returns true, or pops a level off the include stack and returns false, at which point the client should call lex again.
This either returns the EOF token or pops a level off the include stack and keeps going.
Definition at line 335 of file PPLexerChange.cpp.
References clang::FixItHint::CreateReplacement(), Diag(), clang::comments::tok::eof, clang::PPCallbacks::ExitFile, clang::Token::getLocation(), clang::SourceLocation::getLocWithOffset(), isMacroDefined(), max(), clang::Token::setAnnotationEndLoc(), clang::Token::setAnnotationValue(), clang::Token::setLocation(), clang::Token::startToken(), and clang::TU_Complete.
Referenced by clang::PTHLexer::Lex(), and clang::Lexer::ReadToEndOfLine().
Callback invoked when the current TokenLexer hits the end of its token stream.
HandleEndOfTokenLexer - This callback is invoked when the current TokenLexer hits the end of its token stream.
Definition at line 563 of file PPLexerChange.cpp.
Referenced by clang::TokenLexer::Lex().
Callback invoked when the lexer reads an identifier and has filled in the tokens IdentifierInfo member.
HandleIdentifier - This callback is invoked when the lexer reads an identifier.
This callback potentially macro expands it or turns it into a named token (like 'for').
This callback looks up the identifier in the map and/or potentially macro expands it or turns it into a named token (like 'for').
Note that callers of this method are guarded by checking the IdentifierInfo's 'isHandleIdentifierCase' bit. If this method changes, the IdentifierInfo methods that compute these properties will need to change to match.
Definition at line 659 of file Preprocessor.cpp.
References Diag(), clang::Token::DisableExpand, getFutureCompatDiagKind(), clang::Token::getIdentifierInfo(), getLangOpts(), clang::Token::getLocation(), getMacroDefinition(), HandlePoisonedIdentifier(), clang::Token::is(), clang::Token::isExpandDisabled(), clang::IdentifierInfo::isPoisoned(), clang::Token::setFlag(), and clang::Token::setKind().
Referenced by clang::PTHLexer::Lex(), clang::TokenLexer::Lex(), and maybeDiagnoseUTF8Homoglyph().
void Preprocessor::HandleMicrosoftCommentPaste | ( | Token & | Tok | ) |
When the macro expander pastes together a comment (/##/) in Microsoft mode, this method handles updating the current state, returning the token on the next source line.
HandleMicrosoftCommentPaste - When the macro expander pastes together a comment (/##/) in microsoft mode, this method handles updating the current state, returning the token on the next source line.
Definition at line 601 of file PPLexerChange.cpp.
References clang::comments::tok::eof, clang::Token::is(), clang::Token::isNot(), clang::PreprocessorLexer::LexingRawMode, and clang::PreprocessorLexer::ParsingPreprocessorDirective.
Referenced by clang::TokenLexer::isParsingPreprocessorDirective().
void Preprocessor::HandlePoisonedIdentifier | ( | Token & | Tok | ) |
Display reason for poisoned identifier.
Definition at line 616 of file Preprocessor.cpp.
References Diag(), and clang::Token::getIdentifierInfo().
Referenced by HandleIdentifier(), and clang::TokenLexer::Lex().
void Preprocessor::HandlePragmaDependency | ( | Token & | DependencyTok | ) |
HandlePragmaDependency - Handle #pragma GCC dependency "foo" blah.
Definition at line 488 of file Pragma.cpp.
References Diag(), Filename, clang::Token::getLocation(), clang::FileEntry::getModificationTime(), clang::Token::is(), and clang::Token::isNot().
Referenced by LexOnOffSwitch().
void Preprocessor::HandlePragmaIncludeAlias | ( | Token & | Tok | ) |
Definition at line 655 of file Pragma.cpp.
References Diag(), End, clang::Token::getLocation(), clang::Token::is(), and clang::Token::isNot().
Referenced by LexOnOffSwitch().
void Preprocessor::HandlePragmaMark | ( | ) |
Definition at line 405 of file Pragma.cpp.
Referenced by LexOnOffSwitch().
void Preprocessor::HandlePragmaModuleBuild | ( | Token & | Tok | ) |
Definition at line 799 of file Pragma.cpp.
References Diag(), End, clang::comments::tok::eof, clang::Token::getKind(), clang::Token::getLocation(), clang::IdentifierInfo::getName(), clang::Token::getRawIdentifier(), clang::Token::is(), clang::Token::isAtStartOfLine(), clang::Token::isNot(), and LexModuleNameComponent().
void Preprocessor::HandlePragmaOnce | ( | Token & | OnceTok | ) |
HandlePragmaOnce - Handle #pragma once. OnceTok is the 'once'.
Definition at line 390 of file Pragma.cpp.
References Diag(), IsHeaderFile(), and clang::TU_Prefix.
Referenced by LexOnOffSwitch().
void Preprocessor::HandlePragmaPoison | ( | ) |
HandlePragmaPoison - Handle #pragma GCC poison. PoisonTok is the 'poison'.
Definition at line 414 of file Pragma.cpp.
References Diag(), clang::Token::is(), clang::IdentifierInfo::isFromAST(), isMacroDefined(), clang::Token::isNot(), clang::IdentifierInfo::isPoisoned(), clang::IdentifierInfo::setChangedSinceDeserialization(), clang::IdentifierInfo::setIsPoisoned(), and clang::format::Tok.
Referenced by LexOnOffSwitch().
void Preprocessor::HandlePragmaPopMacro | ( | Token & | PopMacroTok | ) |
Handle #pragma pop_macro.
The syntax is:
Definition at line 620 of file Pragma.cpp.
References Diag(), clang::Token::getLocation(), and clang::IdentifierInfo::getName().
void Preprocessor::HandlePragmaPushMacro | ( | Token & | PushMacroTok | ) |
Handle #pragma push_macro.
The syntax is:
Definition at line 597 of file Pragma.cpp.
References clang::MacroInfo::setIsAllowRedefinitionsWithoutWarning().
void Preprocessor::HandlePragmaSystemHeader | ( | Token & | SysHeaderTok | ) |
HandlePragmaSystemHeader - Implement #pragma GCC system_header.
We know that the whole directive has been parsed.
Definition at line 456 of file Pragma.cpp.
References clang::SrcMgr::C_System, Diag(), clang::PreprocessorLexer::getFileEntry(), clang::PresumedLoc::getFilename(), clang::PresumedLoc::getLine(), clang::Token::getLocation(), clang::PresumedLoc::isInvalid(), and clang::PPCallbacks::SystemHeaderPragma.
Referenced by LexOnOffSwitch().
|
inline |
Definition at line 2106 of file Preprocessor.h.
Referenced by shouldIgnoreMacro().
void Preprocessor::IgnorePragmas | ( | ) |
Install empty handlers for all pragmas (making them ignored).
Ignore all pragmas, useful for modes such as -Eonly which would otherwise warn about those pragmas being unknown.
Definition at line 1840 of file Pragma.cpp.
References clang::EmptyPragmaHandler::EmptyPragmaHandler(), clang::PragmaNamespace::FindHandler(), and clang::PragmaNamespace::getIfNamespace().
Referenced by DoPrintMacros(), clang::PreprocessOnlyAction::ExecuteAction(), and clang::RewriteIncludesInInput().
|
inline |
Increment the counters for the number of token paste operations performed.
If fast was specified, this is a 'fast paste' case we handled.
Definition at line 1674 of file Preprocessor.h.
void Preprocessor::Initialize | ( | const TargetInfo & | Target, |
const TargetInfo * | AuxTarget = nullptr |
||
) |
Initialize the preprocessor using information about the target.
Target | is owned by the caller and must remain valid for the lifetime of the preprocessor. |
AuxTarget | is owned by the caller and must remain valid for the lifetime of the preprocessor. |
Definition at line 180 of file Preprocessor.cpp.
References clang::Builtin::Context::InitializeTarget(), and clang::HeaderSearch::setTarget().
void Preprocessor::InitializeForModelFile | ( | ) |
Initialize the preprocessor to parse a model file.
To parse model files the preprocessor of the original source is reused to preserver the identifier table. However to avoid some duplicate information in the preprocessor some cleanup is needed before it is used to parse model files. This method does that cleanup.
Definition at line 195 of file Preprocessor.cpp.
|
inline |
Returns true if the given MacroID location points at the last token of the macro expansion.
MacroEnd | If non-null and function returns true, it is set to end location of the macro. |
Definition at line 1652 of file Preprocessor.h.
|
inline |
Returns true if the given MacroID location points at the first token of the macro expansion.
MacroBegin | If non-null and function returns true, it is set to begin location of the macro. |
Definition at line 1641 of file Preprocessor.h.
Referenced by clang::Parser::ParseConstraintExpression().
|
inline |
True if EnableBacktrackAtThisPos() was called and caching of tokens is on.
Definition at line 1237 of file Preprocessor.h.
Referenced by Backtrack(), LastCachedTokenRange(), and clang::Parser::ParseTopLevelDecl().
|
inline |
Determine if we are performing code completion.
Definition at line 1437 of file Preprocessor.h.
Referenced by clang::Sema::ActOnEndOfTranslationUnit(), findPlaceholderEnd(), and clang::Parser::Parser().
|
inline |
Returns true if code-completion is enabled and we have hit the code-completion point.
Definition at line 1455 of file Preprocessor.h.
Referenced by clang::Parser::ParseTopLevelDecl().
|
inline |
Return true if we are lexing directly from the specified lexer.
Definition at line 883 of file Preprocessor.h.
|
inline |
Returns true if incremental processing is enabled.
Definition at line 1412 of file Preprocessor.h.
Referenced by clang::Sema::ActOnEndOfTranslationUnit(), clang::Parser::ParseTopLevelDecl(), and clang::Parser::~Parser().
bool Preprocessor::isInPrimaryFile | ( | ) | const |
Return true if we're in the top-level file, not in a #include.
isInPrimaryFile - Return true if we're in the top-level file, not in a #include.
This looks through macro expansions and active _Pragma lexers.
Definition at line 36 of file PPLexerChange.cpp.
Referenced by EvaluateHasIncludeNext(), and clang::Lexer::ReadToEndOfLine().
|
inline |
Definition at line 920 of file Preprocessor.h.
References clang::IdentifierTable::get(), and isMacroDefined().
Referenced by clang::arcmt::trans::getNilString(), MaybeAddSentinel(), ParseLoopHintValue(), and clang::HeaderSearch::ShouldEnterIncludeFile().
|
inline |
Definition at line 923 of file Preprocessor.h.
References bool, and clang::IdentifierInfo::hasMacroDefinition().
|
inline |
Determine whether II is defined as a macro within the module M, if that is a module that we've already preprocessed.
Does not check for macros imported into M.
Definition at line 931 of file Preprocessor.h.
References clang::IdentifierInfo::hasMacroDefinition().
Referenced by clang::HeaderSearch::ShouldEnterIncludeFile().
|
inline |
True if we are currently preprocessing a if or #elif directive.
Definition at line 849 of file Preprocessor.h.
Referenced by EvaluateHasIncludeCommon().
|
inline |
Returns true if the preprocessor is responsible for generating output, false if it is producing tokens to be consumed by Parse and Sema.
Definition at line 880 of file Preprocessor.h.
Referenced by findPlaceholderEnd(), and LexOnOffSwitch().
Whether Tok
is the most recent token (CachedLexPos - 1
) in CachedTokens.
Definition at line 152 of file PPCaching.cpp.
References clang::Token::getKind(), getLastCachedTokenLocation(), clang::Token::getLocation(), and getSourceManager().
|
inline |
Definition at line 2102 of file Preprocessor.h.
Referenced by clang::Lexer::ReadToEndOfLine(), and shouldIgnoreMacro().
Preprocessor::CachedTokensRange Preprocessor::LastCachedTokenRange | ( | ) |
Returns the range of cached tokens that were lexed since EnableBacktrackAtThisPos() was previously called.
Definition at line 38 of file PPCaching.cpp.
References isBacktrackEnabled().
Referenced by clang::PragmaNamespace::HandlePragma().
Definition at line 733 of file PPLexerChange.cpp.
References clang::Module::getTopLevelModuleName().
void Preprocessor::Lex | ( | Token & | Result | ) |
Lex the next token for this preprocessor.
Definition at line 751 of file Preprocessor.cpp.
References clang::Token::getIdentifierInfo(), clang::Token::is(), LexAfterModuleImport(), and setCodeCompletionIdentifierInfo().
Referenced by Backtrack(), clang::CacheTokens(), CheckEndOfDirective(), ConcatenateIncludeName(), clang::Parser::ConsumeToken(), DoPrintMacros(), clang::DoPrintPreprocessedInput(), EvaluateHasIncludeCommon(), clang::DumpTokensAction::ExecuteAction(), clang::PreprocessOnlyAction::ExecuteAction(), FinishLexStringLiteral(), FixDigraph(), GetLineValue(), HandleComment(), LexAfterModuleImport(), clang::PreprocessorLexer::LexIncludeFilename(), LexOnOffSwitch(), ParseAlignPragma(), ParseLoopHintValue(), parseSimpleIntegerLiteral(), ReadLineMarkerFlags(), clang::RewriteIncludesInInput(), clang::RewriteMacrosInInput(), clang::Parser::TryAnnotateTypeOrScopeToken(), and clang::Parser::TryConsumeToken().
void Preprocessor::LexAfterModuleImport | ( | Token & | Result | ) |
Lex a token following the 'import' contextual keyword.
Definition at line 784 of file Preprocessor.cpp.
References clang::Token::getIdentifierInfo(), getIdentifierInfo(), clang::Token::getKind(), getLangOpts(), clang::Token::getLocation(), clang::Module::Hidden, Lex(), clang::ModuleLoader::loadModule(), makeModuleVisible(), and recomputeCurLexerKind().
Referenced by Lex().
|
inline |
Lex a token.
If it's a comment, keep lexing until we get something not a comment.
This is useful in -E -C mode where comments would foul up preprocessor directive handling.
Definition at line 1274 of file Preprocessor.h.
References clang::Token::getKind().
Referenced by EvaluateDefined(), EvaluateDirectiveSubExpr(), EvaluateHasIncludeCommon(), EvaluateValue(), and isTargetEnvironment().
bool Preprocessor::LexOnOffSwitch | ( | tok::OnOffSwitch & | OOS | ) |
Lex an on-off-switch (C99 6.10.6p2) and verify that it is followed by EOD.
Return true if the token is not a valid on-off-switch.
Definition at line 935 of file Pragma.cpp.
References CheckEndOfDirective(), Diag(), Diag(), DiscardUntilEndOfDirective(), dumpMacroInfo(), EnterAnnotationToken(), EnterToken(), clang::diag::Error, clang::diag::Fatal, FinishLexStringLiteral(), getDiagnostics(), clang::Token::getIdentifierInfo(), clang::Token::getKind(), clang::Token::getLocation(), getModuleLoader(), clang::IdentifierInfo::getName(), getPPCallbacks(), getPreprocessorAllocator(), getSpelling(), clang::EmptyPragmaHandler::HandlePragma(), HandlePragmaDependency(), HandlePragmaIncludeAlias(), HandlePragmaMark(), HandlePragmaOnce(), HandlePragmaPoison(), HandlePragmaSystemHeader(), clang::Module::Hidden, clang::diag::Ignored, clang::Token::is(), clang::Token::isNot(), isPreprocessedOutput(), clang::IdentifierInfo::isStr(), Lex(), LexModuleName(), LexUnexpandedToken(), clang::ModuleLoader::loadModule(), makeModuleVisible(), max(), clang::tok::OOS_DEFAULT, clang::tok::OOS_OFF, clang::tok::OOS_ON, P, parseSimpleIntegerLiteral(), clang::PPCallbacks::PMK_Error, clang::PPCallbacks::PMK_Message, clang::PPCallbacks::PMK_Warning, clang::DiagnosticsEngine::popMappings(), clang::PPCallbacks::PragmaDebug(), clang::PPCallbacks::PragmaDiagnostic(), clang::PPCallbacks::PragmaDiagnosticPop(), clang::PPCallbacks::PragmaDiagnosticPush(), clang::PragmaHandler::PragmaHandler(), clang::PPCallbacks::PragmaWarning(), clang::PPCallbacks::PragmaWarningPop(), clang::PPCallbacks::PragmaWarningPush(), clang::DiagnosticsEngine::pushMappings(), clang::diag::Remark, clang::Token::setAnnotationRange(), clang::Token::setAnnotationValue(), clang::Token::setKind(), clang::DiagnosticsEngine::setSeverityForAll(), clang::DiagnosticsEngine::setSeverityForGroup(), Specifier, clang::Token::startToken(), clang::format::Tok, clang::diag::Warning, and clang::diag::WarningOrError.
Referenced by ParseAlignPragma().
|
inline |
Lex a string literal, which may be the concatenation of multiple string literals and may even come from macro expansion.
Definition at line 1253 of file Preprocessor.h.
|
inline |
Like LexNonComment, but this disables macro expansion of identifier tokens.
Definition at line 1294 of file Preprocessor.h.
References clang::Token::getKind(), and clang::format::Tok.
Referenced by EvaluateDefined().
|
inline |
Just like Lex, but disables macro expansion of identifier tokens.
Definition at line 1281 of file Preprocessor.h.
Referenced by CheckEndOfDirective(), CheckMacroName(), DiscardUntilEndOfDirective(), EvaluateFeatureLikeBuiltinMacro(), FinishLexStringLiteral(), HandleDirective(), clang::PragmaNamespace::HandlePragma(), isConfigurationPattern(), isTargetEnvironment(), LexModuleName(), LexModuleNameComponent(), LexOnOffSwitch(), and ParseAlignPragma().
|
inline |
Peeks ahead N tokens and returns that token without consuming any tokens.
LookAhead(0) returns the next token that would be returned by Lex(), LookAhead(1) returns the token after it, etc. This returns normal tokens after phase 5. As such, it is equivalent to using 'Lex', not 'LexUnexpandedToken'.
Definition at line 1318 of file Preprocessor.h.
Referenced by clang::Parser::NextToken(), and ParseOpenMPDirectiveKind().
const FileEntry * Preprocessor::LookupFile | ( | SourceLocation | FilenameLoc, |
StringRef | Filename, | ||
bool | isAngled, | ||
const DirectoryLookup * | FromDir, | ||
const FileEntry * | FromFile, | ||
const DirectoryLookup *& | CurDir, | ||
SmallVectorImpl< char > * | SearchPath, | ||
SmallVectorImpl< char > * | RelativePath, | ||
ModuleMap::KnownHeader * | SuggestedModule, | ||
bool * | IsMapped, | ||
bool | SkipCache = false |
||
) |
Given a "foo" or <foo> reference, look up the indicated file.
Returns null on failure. isAngled
indicates whether the file reference is for system #include's or not (i.e. using <> instead of "").
Definition at line 720 of file PPDirectives.cpp.
References clang::ModuleMap::diagnoseHeaderInclusion(), getCurrentFileLexer(), getCurrentModule(), clang::FileEntry::getDir(), clang::FileManager::getDirectory(), clang::PreprocessorLexer::getFileEntry(), clang::SourceManager::getFileEntryForID(), clang::PreprocessorLexer::getFileID(), clang::SourceManager::getMainFileID(), getModuleForLocation(), clang::HeaderSearch::getModuleMap(), clang::SourceManager::isInMainFile(), clang::Module::IsSystem, clang::HeaderSearch::LookupFile(), and clang::HeaderSearch::LookupSubframeworkHeader().
Referenced by checkModuleIsAvailable(), and EvaluateHasIncludeCommon().
IdentifierInfo * Preprocessor::LookUpIdentifierInfo | ( | Token & | Identifier | ) | const |
Given a tok::raw_identifier token, look up the identifier information for the token and install it into the token, updating the token kind accordingly.
LookUpIdentifierInfo - Given a tok::raw_identifier token, look up the identifier information for the token and install it into the token, updating the token kind accordingly.
Definition at line 565 of file Preprocessor.cpp.
References clang::expandUCNs(), getIdentifierInfo(), getLangOpts(), clang::Token::getLocation(), clang::Token::getRawIdentifier(), getSourceManager(), getSpelling(), clang::Token::hasUCN(), clang::SourceManager::isInSystemHeader(), clang::Token::needsCleaning(), clang::Token::setIdentifierInfo(), and clang::Token::setKind().
Referenced by DetectEOL(), findPlaceholderEnd(), clang::html::HighlightMacros(), LexRawTokensFromMainFile(), maybeDiagnoseUTF8Homoglyph(), and clang::html::SyntaxHighlight().
Preprocessor::macro_iterator Preprocessor::macro_begin | ( | bool | IncludeExternalMacros = true | ) | const |
Definition at line 294 of file Preprocessor.cpp.
References clang::ExternalPreprocessorSource::ReadDefinedMacros().
Referenced by AddMacroResults().
Preprocessor::macro_iterator Preprocessor::macro_end | ( | bool | IncludeExternalMacros = true | ) | const |
Definition at line 321 of file Preprocessor.cpp.
References clang::ExternalPreprocessorSource::ReadDefinedMacros().
Referenced by AddMacroResults().
|
inline |
Definition at line 1046 of file Preprocessor.h.
void Preprocessor::makeModuleVisible | ( | Module * | M, |
SourceLocation | Loc | ||
) |
Definition at line 849 of file Preprocessor.cpp.
References Diag().
Referenced by LexAfterModuleImport(), and LexOnOffSwitch().
void Preprocessor::markMacroAsUsed | ( | MacroInfo * | MI | ) |
A macro is used, update information about macros that need unused warnings.
Definition at line 2002 of file PPMacroExpansion.cpp.
References clang::MacroInfo::getDefinitionLoc(), clang::MacroInfo::isUsed(), clang::MacroInfo::isWarnIfUnused(), and clang::MacroInfo::setIsUsed().
Referenced by EvaluateDefined(), isConfigurationPattern(), and isTrivialSingleTokenExpansion().
|
inline |
Definition at line 1712 of file Preprocessor.h.
References clang::Token::getIdentifierInfo(), and clang::IdentifierInfo::isPoisoned().
IdentifierInfo * Preprocessor::ParsePragmaPushOrPopMacro | ( | Token & | Tok | ) |
ParsePragmaPushOrPopMacro - Handle parsing of pragma push_macro/pop_macro.
Return the IdentifierInfo* associated with the macro to push or pop.
Definition at line 542 of file Pragma.cpp.
References Diag(), clang::Token::getLocation(), clang::Token::hasUDSuffix(), clang::Token::isNot(), clang::Token::startToken(), and clang::format::Tok.
Parses a simple integer literal to get its numeric value.
Floating point literals and user defined literals are rejected. Used primarily to handle pragmas that accept integer arguments.
Definition at line 907 of file Preprocessor.cpp.
References clang::Token::getLocation(), getSpelling(), clang::Token::is(), and Lex().
Referenced by LexOnOffSwitch().
Definition at line 602 of file Preprocessor.cpp.
References clang::IdentifierInfo::setIsPoisoned().
void Preprocessor::PrintStats | ( | ) |
Definition at line 255 of file Preprocessor.cpp.
References getTotalMemory().
Referenced by clang::FrontendAction::EndSourceFile().
void Preprocessor::recomputeCurLexerKind | ( | ) |
Recompute the current lexer kind based on the CurLexer/CurPTHLexer/ CurTokenLexer pointers.
Definition at line 365 of file Preprocessor.cpp.
Referenced by Backtrack(), and LexAfterModuleImport().
void Preprocessor::removeCommentHandler | ( | CommentHandler * | Handler | ) |
Remove the specified comment handler.
It is an error to remove a handler that has not been registered.
Definition at line 932 of file Preprocessor.cpp.
Referenced by clang::Parser::~Parser().
void Preprocessor::RemovePragmaHandler | ( | StringRef | Namespace, |
PragmaHandler * | Handler | ||
) |
Remove the specific pragma handler from this preprocessor.
RemovePragmaHandler - Remove the specific pragma handler from the preprocessor.
If Namespace
is non-null, then it should be the namespace that Handler
was added to. It is an error to remove a handler that has not been registered.
If
Definition at line 913 of file Pragma.cpp.
References clang::PragmaHandler::getIfNamespace(), clang::PragmaNamespace::IsEmpty(), and clang::PragmaNamespace::RemovePragmaHandler().
Referenced by clang::DoPrintPreprocessedInput().
|
inline |
Definition at line 1087 of file Preprocessor.h.
void Preprocessor::RemoveTopOfLexerStack | ( | ) |
Pop the current lexer/macro exp off the top of the lexer stack.
RemoveTopOfLexerStack - Pop the current lexer/macro exp off the top of the lexer stack.
This should only be used in situations where the current state of the top-of-stack lexer is known.
This should only be used in situations where the current state of the top-of-stack lexer is unknown.
Definition at line 584 of file PPLexerChange.cpp.
|
inline |
Replace the last token with an annotation token.
Like AnnotateCachedTokens(), this routine replaces an already-parsed (and resolved) token with an annotation token. However, this routine only replaces the last token with the annotation token; it does not affect any other cached tokens. This function has no effect if backtracking is not enabled.
Definition at line 1389 of file Preprocessor.h.
References clang::Token::isAnnotation().
Replace token in CachedLexPos - 1
in CachedTokens by the tokens in NewToks
.
Useful when a token needs to be split in smaller ones and CachedTokens most recent token must to be updated to reflect that.
Definition at line 170 of file PPCaching.cpp.
|
inline |
When backtracking is enabled and tokens are cached, this allows to revert a specific number of tokens.
Note that the number of tokens being reverted should be up to the last backtrack position, not more.
Definition at line 1330 of file Preprocessor.h.
Referenced by clang::Parser::ParseTopLevelDecl().
|
inline |
Returns true if the preprocessor has seen a use of DATE or TIME in the file so far.
Definition at line 1783 of file Preprocessor.h.
Referenced by shouldIgnoreMacro().
|
inline |
Set the code completion handler to the given object.
Definition at line 1103 of file Preprocessor.h.
Referenced by clang::Parser::Parser().
|
inline |
Set the code completion token for filtering purposes.
Definition at line 1122 of file Preprocessor.h.
Referenced by Lex().
bool Preprocessor::SetCodeCompletionPoint | ( | const FileEntry * | File, |
unsigned | Line, | ||
unsigned | Column | ||
) |
Specify the point at which code-completion will be performed.
File | the file in which code completion should occur. If this file is included multiple times, code-completion will perform completion the first time it is included. If NULL, this function clears out the code-completion point. |
Line | the line at which code completion should occur (1-based). |
Column | the column at which code completion should occur (1-based). |
Definition at line 376 of file Preprocessor.cpp.
Referenced by EnableCodeCompletion().
|
inline |
Note that we hit the code-completion point.
Definition at line 1458 of file Preprocessor.h.
Referenced by CheckEndOfDirective(), CheckMacroName(), CodeCompleteNaturalLanguage(), ConcatenateIncludeName(), EvaluateDefined(), EvaluateValue(), and HandleDirective().
|
inline |
Control whether the preprocessor retains comments in output.
Definition at line 854 of file Preprocessor.h.
Referenced by clang::DoPrintPreprocessedInput().
|
inline |
Definition at line 1787 of file Preprocessor.h.
References Filename.
|
inline |
Definition at line 813 of file Preprocessor.h.
|
inline |
Definition at line 833 of file Preprocessor.h.
void Preprocessor::setLoadedMacroDirective | ( | IdentifierInfo * | II, |
MacroDirective * | ED, | ||
MacroDirective * | MD | ||
) |
Set a MacroDirective that was loaded from a PCH file.
Definition at line 94 of file PPMacroExpansion.cpp.
References clang::MacroDirective::isDefined(), clang::IdentifierInfo::setHasMacroDefinition(), and clang::MacroDirective::setPrevious().
|
inline |
Disables macro expansion everywhere except for preprocessor directives.
Definition at line 1306 of file Preprocessor.h.
Referenced by clang::RewriteIncludesInInput().
|
inline |
Set the directory in which the main file should be considered to have been found, if it is not a real file.
Definition at line 1495 of file Preprocessor.h.
Referenced by prepareToBuildModule().
void Preprocessor::SetPoisonReason | ( | IdentifierInfo * | II, |
unsigned | DiagID | ||
) |
Specifies the reason for poisoning an identifier.
If that identifier is accessed while poisoned, then this reason will be used instead of the default "poisoned" diagnostic.
Definition at line 598 of file Preprocessor.cpp.
Referenced by clang::Parser::Initialize(), and Preprocessor().
|
inline |
Set the location of the currently-active #pragma clang arc_cf_code_audited begin.
An invalid location ends the pragma.
Definition at line 1475 of file Preprocessor.h.
|
inline |
Set the location of the currently-active #pragma clang assume_nonnull begin.
An invalid location ends the pragma.
Definition at line 1489 of file Preprocessor.h.
|
inline |
Definition at line 861 of file Preprocessor.h.
|
inline |
Set the predefines for this Preprocessor.
These predefines are automatically injected when parsing the main file.
Definition at line 1063 of file Preprocessor.h.
References P.
Referenced by createASTReader(), and clang::CompilerInstance::createPCHExternalASTSource().
|
inline |
Definition at line 1064 of file Preprocessor.h.
References P.
|
inline |
Sets whether the preprocessor is responsible for producing output or if it is producing tokens to be consumed by Parse and Sema.
Definition at line 874 of file Preprocessor.h.
void Preprocessor::setPTHManager | ( | PTHManager * | pm | ) |
Definition at line 213 of file Preprocessor.cpp.
References clang::FileManager::addStatCache().
|
inline |
Definition at line 2114 of file Preprocessor.h.
Referenced by clang::Lexer::ReadToEndOfLine().
|
inline |
Definition at line 2118 of file Preprocessor.h.
|
inline |
Instruct the preprocessor to skip part of the main source file.
Bytes | The number of bytes in the preamble to skip. |
StartOfLine | Whether skipping these bytes puts the lexer at the start of a line. |
Definition at line 1505 of file Preprocessor.h.
|
inline |
Definition at line 864 of file Preprocessor.h.
Referenced by clang::DependencyFileGenerator::CreateAndAttachToPreprocessor().
|
inline |
Update the current token to represent the provided identifier, in order to cache an action performed by typo correction.
Definition at line 1401 of file Preprocessor.h.
References clang::Token::getIdentifierInfo().
|
friend |
Definition at line 342 of file Preprocessor.h.
|
friend |
Definition at line 343 of file Preprocessor.h.
|
friend |
|
friend |
Definition at line 128 of file Preprocessor.h.
|
friend |
Definition at line 129 of file Preprocessor.h.
Referenced by isConfigurationPattern().