Engages in a tight little dance with the lexer to efficiently preprocess tokens. More...
#include "clang/Lex/Preprocessor.h"
Loc
that has spelling Tokens
.
Tok
is the most recent token (CachedLexPos - 1
) in CachedTokens.
CachedLexPos - 1
in CachedTokens by the tokens in NewToks
.
Tok
that is a numeric constant with length 1, return the value of constant as an unsigned 8-bit integer.
Loc
points to.
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 138 of file Preprocessor.h.
◆ IncludedFilesSet ◆ macro_iterator ◆ Preprocessor() ◆ ~Preprocessor() Preprocessor::~Preprocessor ( ) ◆ addCommentHandler() ◆ addFinalLoc() ◆ addMacroDeprecationMsg() ◆ addModuleMacro() ◆ addPPCallbacks() void clang::Preprocessor::addPPCallbacks ( std::unique_ptr< PPCallbacks > C ) inlineDefinition at line 1303 of file Preprocessor.h.
References clang::C.
Referenced by clang::AttachDependencyGraphGen(), clang::AttachHeaderIncludeGen(), clang::DependencyCollector::attachToPreprocessor(), clang::ModuleDependencyCollector::attachToPreprocessor(), clang::tooling::dependencies::ModuleDepCollector::attachToPreprocessor(), clang::CodeGenAction::CreateASTConsumer(), clang::ExtractAPIAction::CreateASTConsumer(), clang::WrappingExtractAPIAction::CreateASTConsumer(), createPreprocessingRecord(), clang::DoPrintPreprocessedInput(), clang::MacroExpansionContext::registerForPreprocessor(), clang::RewriteIncludesInInput(), clang::Sema::Sema(), clang::CodeGen::CoverageMappingModuleGen::setUpCoverageCallbacks(), and clang::syntax::TokenCollector::TokenCollector().
◆ AddPragmaHandler() [1/2] void clang::Preprocessor::AddPragmaHandler ( PragmaHandler * Handler ) inline ◆ AddPragmaHandler() [2/2] void Preprocessor::AddPragmaHandler ( StringRef Namespace, PragmaHandler * Handler ) ◆ addRestrictExpansionMsg() ◆ AdvanceToTokenCharacter() ◆ AllocateMacroInfo() ◆ alreadyIncluded() ◆ AnnotateCachedTokens() void clang::Preprocessor::AnnotateCachedTokens ( const Token & Tok ) inline ◆ appendDefMacroDirective() [1/2] ◆ appendDefMacroDirective() [2/2] ◆ appendMacroDirective() ◆ Backtrack() void Preprocessor::Backtrack ( ) ◆ CheckEndOfDirective()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.
Returns the location of the end of the directive.
Definition at line 438 of file PPDirectives.cpp.
References clang::FixItHint::CreateInsertion(), Diag(), DiscardUntilEndOfDirective(), clang::SourceRange::getEnd(), clang::Token::getLocation(), clang::Token::is(), Lex(), and LexUnexpandedToken().
◆ CheckMacroName() bool Preprocessor::CheckMacroName ( Token & MacroNameTok, MacroUse isDefineUndef, bool * ShadowFlag =nullptr
)
Definition at line 343 of file PPDirectives.cpp.
References D, Diag(), clang::SourceManager::getBufferName(), clang::Token::getIdentifierInfo(), clang::Token::getKind(), getLangOpts(), clang::Token::getLocation(), clang::IdentifierInfo::getName(), clang::IdentifierInfo::getPPKeywordID(), clang::Token::is(), clang::IdentifierInfo::isCPlusPlusOperatorKeyword(), clang::SourceManager::isInSystemHeader(), MD_KeywordDef, MD_NoWarn, MD_ReservedAttributeIdentifier, MD_ReservedMacro, clang::MU_Define, clang::MU_Other, clang::MU_Undef, shouldWarnOnMacroDef(), and shouldWarnOnMacroUndef().
Referenced by EvaluateDefined().
◆ checkModuleIsAvailable()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 1998 of file PPDirectives.cpp.
References clang::Module::DefinitionLoc, clang::Module::Requirement::FeatureName, clang::Module::UnresolvedHeaderDirective::FileName, clang::Module::UnresolvedHeaderDirective::FileNameLoc, clang::Module::getFullModuleName(), clang::Module::isAvailable(), clang::Module::UnresolvedHeaderDirective::IsUmbrella, clang::SourceLocation::isValid(), clang::Module::Name, clang::DiagnosticsEngine::Report(), and clang::Module::Requirement::RequiredState.
Referenced by clang::CompilerInstance::loadModule(), and prepareToBuildModule().
◆ clearCodeCompletionHandler() void clang::Preprocessor::clearCodeCompletionHandler ( ) inline ◆ CodeCompleteIncludedFile() void Preprocessor::CodeCompleteIncludedFile ( llvm::StringRef Dir, bool IsAngled ) ◆ CodeCompleteNaturalLanguage() void Preprocessor::CodeCompleteNaturalLanguage ( ) ◆ CollectPpImportSuffix() ◆ CommitBacktrackedTokens() void Preprocessor::CommitBacktrackedTokens ( ) ◆ createPreprocessingRecord() void Preprocessor::createPreprocessingRecord ( ) ◆ CreateString()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 488 of file Preprocessor.cpp.
References clang::SourceManager::createExpansionLoc(), clang::Token::is(), clang::Token::isLiteral(), clang::SourceLocation::isValid(), Loc, clang::Token::setLength(), clang::Token::setLiteralData(), clang::Token::setLocation(), and clang::Token::setRawIdentifierData().
Referenced by ComputeDATE_TIME(), clang::Sema::ExpandFunctionLocalPredefinedMacros(), LexHeaderName(), ParsePragmaPushOrPopMacro(), and clang::MacroArgs::StringifyArgument().
◆ creatingPCHWithPragmaHdrStop() bool Preprocessor::creatingPCHWithPragmaHdrStop ( ) ◆ creatingPCHWithThroughHeader() bool Preprocessor::creatingPCHWithThroughHeader ( ) ◆ Diag() [1/2] ◆ Diag() [2/2]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 2061 of file Preprocessor.h.
References Loc, and clang::DiagnosticsEngine::Report().
Referenced by clang::Sema::ActOnNumericConstant(), buildMSAsmString(), clang::CharLiteralParser::CharLiteralParser(), checkConfigMacro(), CheckEndOfDirective(), CheckMacroName(), clang::Lexer::Diag(), diagnoseAutoModuleImport(), diagnoseUnexpectedOperator(), EnterMainSourceFile(), EnterSourceFile(), EvaluateDefined(), EvaluateDirectiveSubExpr(), EvaluateFeatureLikeBuiltinMacro(), EvaluateHasIncludeCommon(), EvaluateValue(), ExpectFeatureIdentifierInfo(), FinishLexStringLiteral(), GetIncludeFilenameSpelling(), GetLineValue(), HandleDirective(), HandleEndOfFile(), HandleIdentifier(), HandlePoisonedIdentifier(), clang::PragmaNamespace::HandlePragma(), HandlePragmaDependency(), HandlePragmaHdrstop(), HandlePragmaIncludeAlias(), HandlePragmaModuleBuild(), HandlePragmaOnce(), HandlePragmaPoison(), HandlePragmaPopMacro(), HandlePragmaSystemHeader(), LexAfterModuleImport(), LexEmbedParameters(), LexHeaderName(), LexModuleNameComponent(), LexOnOffSwitch(), makeModuleVisible(), ParseAlignPragma(), ParseLoopHintValue(), ParsePragmaPushOrPopMacro(), clang::Parser::ParseTopLevelDecl(), ReadLineMarkerFlags(), SkipTokensWhileUsingPCH(), and clang::MacroArgs::StringifyArgument().
◆ DiscardUntilEndOfDirective() [1/2] SourceRange clang::Preprocessor::DiscardUntilEndOfDirective ( ) inline ◆ DiscardUntilEndOfDirective() [2/2] ◆ DumpLocation() ◆ DumpMacro() void Preprocessor::DumpMacro ( const MacroInfo & MI ) const ◆ dumpMacroInfo() ◆ DumpToken() void Preprocessor::DumpToken ( const Token & Tok, bool DumpFlags =false
) const
Print the token to stderr, used for debugging.
Definition at line 235 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::isAnnotation(), clang::Token::isAtStartOfLine(), clang::Token::isExpandDisabled(), and clang::Token::needsCleaning().
Referenced by DumpMacro(), clang::DumpRawTokensAction::ExecuteAction(), and clang::DumpTokensAction::ExecuteAction().
◆ emitMacroExpansionWarnings() void clang::Preprocessor::emitMacroExpansionWarnings ( const Token & Identifier, bool IsIfnDef =false
) const inline ◆ EnableBacktrackAtThisPos() void Preprocessor::EnableBacktrackAtThisPos ( bool Unannotated = false
)
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 34 of file PPCaching.cpp.
◆ enableIncrementalProcessing() void clang::Preprocessor::enableIncrementalProcessing ( bool value =true
) inline ◆ EndSourceFile() void Preprocessor::EndSourceFile ( ) ◆ EnterAnnotationToken() ◆ EnterMacro()
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.
Definition at line 150 of file PPLexerChange.cpp.
◆ EnterMainSourceFile() 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 544 of file Preprocessor.cpp.
References clang::SrcMgr::C_User, clang::SourceManager::createFileID(), Diag(), EnterSourceFile(), clang::File, clang::SourceManager::getFileEntryRefForID(), clang::SourceManager::getMainFileID(), clang::SourceManager::isLoadedFileID(), clang::FileID::isValid(), LookupFile(), markIncluded(), SkipTokensWhileUsingPCH(), usingPCHWithPragmaHdrStop(), and usingPCHWithThroughHeader().
Referenced by DoPrintMacros(), clang::DoPrintPreprocessedInput(), clang::PrintDependencyDirectivesSourceMinimizerAction::ExecuteAction(), clang::DumpTokensAction::ExecuteAction(), clang::PreprocessOnlyAction::ExecuteAction(), clang::ParseAST(), clang::RewriteIncludesInInput(), and clang::RewriteMacrosInInput().
◆ enterOrExitSafeBufferOptOutRegion()Alter the state of whether this PP currently is in a "-Wunsafe-buffer-usage" opt-out region.
Definition at line 1541 of file Preprocessor.cpp.
References isPPInSafeBufferOptOutRegion(), and Loc.
◆ EnterSourceFile()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 68 of file PPLexerChange.cpp.
References Diag(), clang::File, clang::SourceManager::getBufferName(), clang::SourceManager::getBufferOrNone(), clang::SourceManager::getFileEntryForID(), clang::SourceManager::getFileEntryRefForID(), clang::SourceManager::getLocForStartOfFile(), clang::SourceLocation::getLocWithOffset(), getPreprocessorOpts(), getSourceManager(), isCodeCompletionEnabled(), and Loc.
Referenced by EnterMainSourceFile(), and clang::IncrementalParser::Parse().
◆ EnterSubmodule() ◆ EnterToken() void clang::Preprocessor::EnterToken ( const Token & Tok, bool IsReinject ) inline ◆ EnterTokenStream() [1/2] ◆ EnterTokenStream() [2/2] void clang::Preprocessor::EnterTokenStream ( std::unique_ptr< Token[]> Toks, unsigned NumToks, bool DisableMacroExpansion, bool IsReinject ) inlineDefinition at line 1684 of file Preprocessor.h.
◆ FinalizeForModelFile() void Preprocessor::FinalizeForModelFile ( ) ◆ FinishLexStringLiteral() bool Preprocessor::FinishLexStringLiteral ( Token & Result, std::string & String, const char * DiagnosticTag, bool AllowMacroExpansion ) ◆ getAffectingClangModules() ◆ getAuxTargetInfo() const TargetInfo * clang::Preprocessor::getAuxTargetInfo ( ) const inline ◆ getBuildingSubmodules() ArrayRef< BuildingSubmoduleInfo > clang::Preprocessor::getBuildingSubmodules ( ) const inlineGet the list of submodules that we're currently building.
Definition at line 1451 of file Preprocessor.h.
◆ getBuiltinInfo() ◆ getCheckPoint() const char * Preprocessor::getCheckPoint ( FileID FID, const char * Start ) constReturns a pointer into the given file's buffer that's guaranteed to be between tokens.
The returned pointer is always before Start
. The maximum distance betweenthe returned pointer and Start
is limited by a constant value, but also an implementation detail. If no such check point exists, nullptr
is returned.
Definition at line 1643 of file Preprocessor.cpp.
References clang::Last, and P.
Referenced by highlightLines().
◆ getCodeCompletionFileLoc() SourceLocation clang::Preprocessor::getCodeCompletionFileLoc ( ) const inlineReturns 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 1982 of file Preprocessor.h.
◆ getCodeCompletionFilter() StringRef clang::Preprocessor::getCodeCompletionFilter ( ) inline ◆ getCodeCompletionHandler() ◆ getCodeCompletionLoc()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 1976 of file Preprocessor.h.
◆ getCodeCompletionTokenRange() ◆ getCommentRetentionState() bool clang::Preprocessor::getCommentRetentionState ( ) const inline ◆ getCounterValue() ◆ getCurrentFileLexer() ◆ getCurrentFPEvalMethod() ◆ getCurrentLexer()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 1282 of file Preprocessor.h.
Referenced by clang::ParseAST().
◆ getCurrentLexerSubmodule() Module * clang::Preprocessor::getCurrentLexerSubmodule ( ) const inlineReturn 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 1292 of file Preprocessor.h.
◆ getCurrentModule() Module * Preprocessor::getCurrentModule ( ) ◆ getCurrentModuleImplementation() Module * Preprocessor::getCurrentModuleImplementation ( ) ◆ getDiagnostics()Definition at line 1202 of file Preprocessor.h.
Referenced by clang::Sema::ActOnNumericConstant(), AddImplicitIncludePCH(), clang::AttachHeaderIncludeGen(), clang::CharLiteralParser::CharLiteralParser(), clang::ento::CreateAnalysisConsumer(), EnableCodeCompletion(), EvaluateValue(), clang::PCHGenerator::getDiagnostics(), clang::PCHGenerator::getEmittingModule(), clang::PCHGenerator::HandleTranslationUnit(), HasExtension(), clang::InitializePreprocessor(), ParseDirective(), parseSimpleIntegerLiteral(), clang::PCHValidator::ReadDiagnosticOptions(), setCodeCompletionReached(), and clang::ASTWriter::WriteAST().
◆ getEmptylineHandler() ◆ getExternalSource() ◆ getFileManager() FileManager & clang::Preprocessor::getFileManager ( ) const inline ◆ getHeaderSearchInfo() HeaderSearch & clang::Preprocessor::getHeaderSearchInfo ( ) const inlineDefinition at line 1210 of file Preprocessor.h.
Referenced by clang::Sema::ActOnEndOfTranslationUnit(), clang::Sema::ActOnModuleDecl(), clang::Sema::ActOnPrivateModuleFragmentDecl(), clang::tooling::dependencies::ModuleDepCollector::applyDiscoveredDependencies(), clang::DependencyCollector::attachToPreprocessor(), clang::ModuleDependencyCollector::attachToPreprocessor(), clang::FrontendAction::BeginSourceFile(), clang::Sema::BuildModuleInclude(), clang::SemaCodeCompletion::CodeCompleteIncludedFile(), clang::SemaCodeCompletion::CodeCompleteModuleImport(), compileModule(), clang::CompilerInstance::createPCHExternalASTSource(), clang::FrontendAction::EndSourceFile(), EnterSubmodule(), EvaluateHasIncludeCommon(), clang::FrontendAction::Execute(), clang::installapi::InstallAPIContext::findAndRecordFile(), getCurrentModule(), clang::FrontendAction::getCurrentModule(), getCurrentModuleImplementation(), clang::Sema::getDarwinSDKInfoForAvailabilityChecking(), clang::PCHGenerator::getEmittingModule(), getHeaderNameForHeader(), getHeaderToIncludeForDiagnostics(), getInputBufferForModule(), getTopImportImplicitModule(), clang::VerifyDiagnosticConsumer::HandleDiagnostic(), HandlePragmaIncludeAlias(), clang::CXX20ModulesGenerator::HandleTranslationUnit(), clang::PCHGenerator::InitializeSema(), clang::CompilerInstance::loadGlobalModuleIndex(), clang::CompilerInstance::loadModule(), loadModuleMapForModuleBuild(), clang::Sema::notePreviousDefinition(), prepareToBuildModule(), clang::PCHValidator::ReadHeaderSearchOptions(), and clang::ASTWriter::WriteAST().
◆ getHeaderToIncludeForDiagnostics()We want to produce a diagnostic at location IncLoc concerning an unreachable effect at location MLoc (eg, where a desired entity was declared or defined).
Determine whether the right way to make MLoc reachable is by #include, and if so, what header should be included.
This is not necessarily fast, and might load unexpected module maps, so should only be called by code that intends to produce an error.
Definition at line 904 of file PPDirectives.cpp.
References clang::ModuleMap::ExcludedHeader, clang::HeaderSearch::findAllModulesForHeader(), getHeaderSearchInfo(), getLangOpts(), getModuleForLocation(), getSourceManager(), clang::HeaderSearch::hasModuleMap(), clang::SourceManager::isInSystemHeader(), clang::SourceLocation::isInvalid(), Loc, clang::ObjC, SM, and clang::ModuleMap::TextualHeader.
Referenced by clang::Sema::diagnoseMissingImport().
◆ getIdentifierInfo() IdentifierInfo * clang::Preprocessor::getIdentifierInfo ( StringRef Name ) const inlineReturn information about the specified preprocessor identifier token.
Definition at line 1525 of file Preprocessor.h.
References clang::IdentifierTable::get().
Referenced by clang::Sema::ActOnModuleDecl(), clang::Sema::ActOnModuleImport(), checkConfigMacro(), checkTupleLikeDecomposition(), clang::Sema::DefaultVariadicArgumentPromotion(), DiagnoseCallingConvCast(), clang::SemaObjC::DiagnoseOwningPropertyGetterSynthesis(), clang::Sema::EvaluateStaticAssertMessageAsString(), fixSeparateAttrArgAndNumber(), getFallthroughAttrSpelling(), clang::SemaObjC::getNSErrorIdent(), clang::Sema::getNullabilityKeyword(), clang::Sema::GetOrCreateMSAsmLabel(), getTupleLikeElementType(), highlightLines(), clang::Parser::Initialize(), clang::Sema::Initialize(), isTupleLike(), Lex(), LexAfterModuleImport(), LexModuleNameComponent(), clang::CompilerInstance::loadModule(), LookUpIdentifierInfo(), lookupMember(), Preprocessor(), and clang::ento::tryExpandAsInteger().
◆ getIdentifierTable() [1/2]Definition at line 1212 of file Preprocessor.h.
Referenced by clang::SemaObjC::ActOnClassPropertyRefExpr(), clang::Sema::ActOnCXXTypeid(), clang::SemaOpenMP::ActOnOpenMPInterchangeDirective(), clang::SemaOpenMP::ActOnOpenMPReverseDirective(), clang::SemaOpenMP::ActOnOpenMPTileDirective(), clang::SemaOpenMP::ActOnOpenMPUnrollDirective(), clang::FrontendAction::BeginSourceFile(), buildCoroutineHandle(), clang::Sema::buildCoroutinePromise(), buildMemberCall(), BuildNonArrayForRange(), buildStdNoThrowDeclRef(), buildVarDecl(), clang::CompilerInstance::createASTContext(), clang::createChainedIncludesSource(), clang::Sema::DeclareGlobalNewDelete(), clang::ASTReader::DecodeIdentifierInfo(), clang::FrontendAction::EndSourceFile(), findOMPAllocatorHandleT(), findOMPAlloctraitT(), findOMPDependT(), findOMPEventHandleT(), clang::ASTReader::getIdentifierTable(), clang::Sema::getOrCreateStdNamespace(), clang::SemaObjC::HandleExprPropertyRefExpr(), HandleIdentifier(), handleOwnershipAttr(), highlightLines(), clang::Parser::Initialize(), clang::Sema::isStdInitializerList(), clang::ASTUnit::LoadFromASTFile(), clang::CompilerInstance::loadModule(), lookupCoroutineHandleType(), clang::Sema::lookupCoroutineTraits(), LookupMemberExpr(), lookupPromiseType(), LookupStdInitializerList(), LookupStdSourceLocationImpl(), and lookupStdTypeTraitMember().
◆ getIdentifierTable() [2/2] ◆ getImmediateMacroName() StringRef clang::Preprocessor::getImmediateMacroName ( SourceLocation Loc ) inline ◆ getIncludedFiles() [1/2] ◆ getIncludedFiles() [2/2] ◆ GetIncludeFilenameSpelling()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 1855 of file PPDirectives.cpp.
Referenced by EvaluateHasIncludeCommon(), HandlePragmaDependency(), and HandlePragmaIncludeAlias().
◆ getLangOpts() const LangOptions & clang::Preprocessor::getLangOpts ( ) const inlineDefinition at line 1205 of file Preprocessor.h.
Referenced by clang::Sema::ActOnEndOfTranslationUnit(), clang::Sema::ActOnNumericConstant(), AddFunctionParameterChunks(), AddMacroResults(), clang::TokenConcatenation::AvoidConcat(), clang::FrontendAction::BeginSourceFile(), clang::CharLiteralParser::CharLiteralParser(), clang::Sema::checkLiteralOperatorId(), CheckMacroName(), clang::createChainedIncludesSource(), clang::DoPrintPreprocessedInput(), clang::DoRewriteTest(), EmitAlphaCounter(), emitMacroExpansionWarnings(), EnterSubmodule(), EvaluateDirectiveSubExpr(), EvaluateValue(), clang::DumpRawTokensAction::ExecuteAction(), FindLocsWithCommonFileID(), getCurrentModule(), getCurrentModuleImplementation(), clang::PCHGenerator::getEmittingModule(), getFallthroughAttrSpelling(), getHeaderToIncludeForDiagnostics(), getImmediateMacroName(), getIssueHash(), clang::Parser::getLangOpts(), clang::ASTWriter::getLangOpts(), getModuleForLocation(), HandleDirective(), HandleEndOfFile(), HandleIdentifier(), HandlePragmaOnce(), HasExtension(), HasFeature(), Initialize(), clang::InitializePreprocessor(), isExpandedFromConfigurationMacro(), isInImportingCXXNamedModules(), isInterestingIdentifier(), isMacroDefined(), isReservedCXXAttributeName(), LeaveSubmodule(), Lex(), clang::TokenLexer::Lex(), LexAfterModuleImport(), LexRawTokensFromMainFile(), clang::ASTUnit::LoadFromASTFile(), MaybeAddSentinel(), clang::IncrementalParser::Parse(), ParseAlignPragma(), parseSimpleIntegerLiteral(), PrintPreprocessedTokens(), clang::PCHValidator::ReadHeaderSearchOptions(), clang::PCHValidator::ReadLanguageOptions(), clang::PCHValidator::ReadPreprocessorOptions(), clang::SimpleASTReaderListener::ReadPreprocessorOptions(), clang::RewriteMacrosInInput(), shouldWarnOnMacroDef(), shouldWarnOnMacroUndef(), and clang::TokenConcatenation::TokenConcatenation().
◆ getLastCachedTokenLocation() SourceLocation clang::Preprocessor::getLastCachedTokenLocation ( ) const inline ◆ getLastFPEvalPragmaLocation() SourceLocation clang::Preprocessor::getLastFPEvalPragmaLocation ( ) const inline ◆ getLastMacroWithSpelling()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 357 of file Preprocessor.cpp.
References E, clang::MacroDirective::DefInfo::getLocation(), clang::MacroDirective::DefInfo::getMacroInfo(), clang::SourceManager::isBeforeInTranslationUnit(), clang::SourceLocation::isInvalid(), clang::MacroInfo::isObjectLike(), clang::SourceLocation::isValid(), Loc, macro_begin(), macro_end(), and MacroDefinitionEquals().
Referenced by DiagnoseCallingConvCast(), diagnoseMissingConstinit(), clang::SemaObjC::DiagnoseOwningPropertyGetterSynthesis(), and getFallthroughAttrSpelling().
◆ getLeafModuleMacros() ◆ getLocalMacroDirective() ◆ getLocalMacroDirectiveHistory() ◆ getLocForEndOfToken()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.
Definition at line 2186 of file Preprocessor.h.
References clang::Lexer::getLocForEndOfToken(), and Loc.
Referenced by clang::Sema::CheckCompleteVariableDeclaration(), clang::Sema::DiagnoseCommaOperator(), EvaluateHasIncludeCommon(), GenerateNewArgTokens(), clang::Parser::getEndOfPreviousToken(), and clang::Parser::ParseConstraintLogicalAndExpression().
◆ getMacroAnnotations() ◆ getMacroDefinition() ◆ getMacroDefinitionAtLoc() ◆ getMacroInfo() [1/2] ◆ getMacroInfo() [2/2] ◆ getMaxTokens() unsigned clang::Preprocessor::getMaxTokens ( ) const inline ◆ getMaxTokensOverrideLoc() ◆ getModuleForLocation()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 882 of file PPDirectives.cpp.
References clang::LangOptions::CurrentModule, clang::ModuleMap::findModuleForHeader(), clang::SourceManager::getExpansionLoc(), clang::SourceManager::getFileEntryRefForID(), clang::SourceManager::getFileID(), getLangOpts(), clang::ModuleMap::KnownHeader::getModule(), clang::HeaderSearch::getModuleMap(), clang::SourceManager::isInMainFile(), Loc, and clang::HeaderSearch::lookupModule().
Referenced by getHeaderToIncludeForDiagnostics(), and LookupFile().
◆ getModuleImportLoc() ◆ getModuleLoader() ModuleLoader & clang::Preprocessor::getModuleLoader ( ) const inline ◆ getModuleMacro() ◆ getNamedModuleName() StringRef clang::Preprocessor::getNamedModuleName ( ) const inlineGet the named module name we're preprocessing.
Requires we're preprocessing a named module.
Definition at line 2409 of file Preprocessor.h.
◆ getNumDirectives() unsigned clang::Preprocessor::getNumDirectives ( ) const inline ◆ getPPCallbacks() PPCallbacks * clang::Preprocessor::getPPCallbacks ( ) const inline ◆ getPragmaARCCFCodeAuditedInfo() ◆ getPragmaAssumeNonNullLoc() SourceLocation clang::Preprocessor::getPragmaAssumeNonNullLoc ( ) const inlineThe location of the currently-active #pragma clang assume_nonnull begin.
Returns an invalid location if there is no such pragma active.
Definition at line 2018 of file Preprocessor.h.
Referenced by GetFullTypeForDeclarator().
◆ getPragmasEnabled() ◆ getPreambleConditionalStack() ◆ getPreambleRecordedPragmaAssumeNonNullLoc() SourceLocation clang::Preprocessor::getPreambleRecordedPragmaAssumeNonNullLoc ( ) const inlineGet the location of the recorded unterminated #pragma clang assume_nonnull begin in the preamble, if one exists.
Returns an invalid location if the premable did not end with such a pragma active or if there is no recorded preamble.
Definition at line 2033 of file Preprocessor.h.
◆ getPreambleSkipInfo() ◆ getPredefines() const std::string & clang::Preprocessor::getPredefines ( ) const inline ◆ getPredefinesFileID() FileID clang::Preprocessor::getPredefinesFileID ( ) const inline ◆ getPreprocessingRecord() ◆ getPreprocessorAllocator() llvm::BumpPtrAllocator & clang::Preprocessor::getPreprocessorAllocator ( ) inline ◆ getPreprocessorOpts() ◆ getRawToken() ◆ getSelectorTable() ◆ getSourceManager()Definition at line 1209 of file Preprocessor.h.
Referenced by clang::Sema::ActOnNumericConstant(), AddFunctionParameterChunks(), clang::ModuleDependencyCollector::attachToPreprocessor(), clang::TokenConcatenation::AvoidConcat(), clang::VerifyDiagnosticConsumer::BeginSourceFile(), clang::CharLiteralParser::CharLiteralParser(), checkConfigMacro(), clang::Lexer::Create_PragmaLexer(), clang::CompilerInstance::createASTContext(), createPreprocessingRecord(), clang::DoPrintPreprocessedInput(), clang::DoRewriteTest(), EnterSourceFile(), EvaluateDefined(), EvaluateValue(), clang::PrintDependencyDirectivesSourceMinimizerAction::ExecuteAction(), clang::DumpRawTokensAction::ExecuteAction(), FindLocsWithCommonFileID(), clang::PreprocessorLexer::getFileEntry(), GetFirstChar(), getHeaderToIncludeForDiagnostics(), getIssueHash(), getMacroDefinitionAtLoc(), GetMappedTokenLoc(), clang::ASTWriter::getRawSourceLocationEncoding(), clang::VerifyDiagnosticConsumer::HandleComment(), clang::TokenLexer::Init(), isExpandedFromConfigurationMacro(), IsPreviousCachedToken(), clang::TokenLexer::Lex(), LexRawTokensFromMainFile(), parseSimpleIntegerLiteral(), clang::PreprocessorLexer::PreprocessorLexer(), ReadLineMarkerFlags(), clang::MacroExpansionContext::registerForPreprocessor(), clang::RewriteIncludesInInput(), clang::RewriteMacrosInInput(), clang::CodeGen::CoverageMappingModuleGen::setUpCoverageCallbacks(), shouldIgnoreMacro(), SplitToken(), and clang::syntax::TokenCollector::TokenCollector().
◆ getSpelling() [1/4] std::string clang::Preprocessor::getSpelling ( const Token & Tok, bool * Invalid =nullptr
) const 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.
true
if an error occurs.
Definition at line 2090 of file Preprocessor.h.
References clang::Lexer::getSpelling(), and clang::Invalid.
◆ getSpelling() [2/4] unsigned clang::Preprocessor::getSpelling ( const Token & Tok, const char *& Buffer, bool * Invalid =nullptr
) const 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 2106 of file Preprocessor.h.
References clang::Lexer::getSpelling(), and clang::Invalid.
◆ getSpelling() [3/4] StringRef Preprocessor::getSpelling ( const Token & Tok, SmallVectorImpl< char > & Buffer, bool * Invalid =nullptr
) const ◆ getSpelling() [4/4]
Return the 'spelling' of the token at the given location; does not go up to the spelling location or down to the expansion location.
true
if an error occurs.
Definition at line 2076 of file Preprocessor.h.
References clang::Lexer::getSpelling().
Referenced by clang::Sema::ActOnCharacterConstant(), clang::Sema::ActOnNumericConstant(), buildMSAsmString(), clang::DoRewriteTest(), DumpToken(), dumpTokenInto(), EvaluateHasIncludeCommon(), EvaluateValue(), GetFirstChar(), GetLineValue(), getSpelling(), HandlePragmaDependency(), HandlePragmaIncludeAlias(), clang::MacroInfo::isIdenticalTo(), isMapModifier(), isMapType(), LexHeaderName(), LookUpIdentifierInfo(), parseOpenMPAllocateClauseModifiers(), clang::Parser::ParseOpenMPVarList(), ParsePragmaPushOrPopMacro(), parseSimpleIntegerLiteral(), PrintMacroDefinition(), PrintPreprocessedTokens(), clang::RewriteMacrosInInput(), and clang::MacroArgs::StringifyArgument().
◆ getSpellingOfSingleCharacterNumericConstant() uint8_t clang::Preprocessor::getSpellingOfSingleCharacterNumericConstant ( const Token & Tok, bool * Invalid =nullptr
) const inline ◆ GetSuppressIncludeNotFoundError() bool clang::Preprocessor::GetSuppressIncludeNotFoundError ( ) inline
Definition at line 1259 of file Preprocessor.h.
◆ getTargetInfo() const TargetInfo & clang::Preprocessor::getTargetInfo ( ) const inline ◆ getTokenCount() unsigned clang::Preprocessor::getTokenCount ( ) const inline ◆ getTotalMemory() size_t Preprocessor::getTotalMemory ( ) const ◆ getTUFPEvalMethod() ◆ hadModuleLoaderFatalFailure() bool clang::Preprocessor::hadModuleLoaderFatalFailure ( ) const inline ◆ HandleComment() ◆ HandleDirective() 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 1221 of file PPDirectives.cpp.
References clang::CodeCompletionHandler::CodeCompleteDirective(), Diag(), DiscardUntilEndOfDirective(), clang::PreprocessorLexer::getConditionalStackDepth(), getCurrentFileLexer(), clang::SourceManager::getFileID(), clang::MultipleIncludeOpt::getHasReadAnyTokensVal(), clang::Token::getIdentifierInfo(), clang::MultipleIncludeOpt::getImmediatelyAfterTopLevelIfndef(), getLangOpts(), clang::Token::getLocation(), clang::IdentifierInfo::getPPKeywordID(), getPredefinesFileID(), HandleSkippedDirectiveWhileUsingPCH(), LexUnexpandedToken(), clang::PreprocessorLexer::MIOpt, clang::PreprocessorLexer::ParsingPreprocessorDirective, clang::PIK_HashPragma, clang::MultipleIncludeOpt::resetImmediatelyAfterTopLevelIfndef(), clang::Result, setCodeCompletionReached(), and clang::MultipleIncludeOpt::SetReadToken().
◆ HandleEndOfFile()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 331 of file PPLexerChange.cpp.
References collectAllSubModulesWithUmbrellaHeader(), clang::FixItHint::CreateReplacement(), creatingPCHWithThroughHeader(), Diag(), E, clang::PPCallbacks::ExitFile, clang::MultipleIncludeOpt::GetControllingMacroAtEndOfFile(), getCurrentModule(), clang::MultipleIncludeOpt::GetDefinedLocation(), clang::MultipleIncludeOpt::GetDefinedMacro(), clang::SourceManager::getFileCharacteristic(), clang::PreprocessorLexer::getFileEntry(), clang::SourceManager::getFileEntryForID(), clang::PreprocessorLexer::getFileID(), clang::SourceManager::getIncludeLoc(), clang::PreprocessorLexer::getInitialNumSLocEntries(), getLangOpts(), clang::SourceManager::getLocForStartOfFile(), getMacroInfo(), clang::MultipleIncludeOpt::GetMacroLocation(), getPredefinesFileID(), clang::PreprocessorLexer::getSourceLocation(), isCodeCompletionEnabled(), isIncrementalProcessingEnabled(), isInPrimaryFile(), isMacroDefined(), isPCHThroughHeader(), isPPInSafeBufferOptOutRegion(), isRecordingPreamble(), clang::FileID::isValid(), clang::SourceLocation::isValid(), LeaveSubmodule(), Loc, clang::SourceManager::local_sloc_entry_size(), clang::PreprocessorLexer::MIOpt, recomputeCurLexerKind(), RemoveTopOfLexerStack(), clang::Result, clang::HeaderSearch::SetFileControllingMacro(), clang::SourceManager::setNumCreatedFIDsForFileID(), clang::TU_Complete, and TUKind.
Referenced by HandleEndOfTokenLexer().
◆ HandleEndOfTokenLexer() bool Preprocessor::HandleEndOfTokenLexer ( Token & Result ) ◆ HandleIdentifier() bool Preprocessor::HandleIdentifier ( Token & Identifier )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 773 of file Preprocessor.cpp.
References Diag(), clang::Token::DisableExpand, getIdentifierTable(), getLangOpts(), getMacroDefinition(), clang::IdentifierInfo::getName(), clang::IdentifierInfo::getTokenID(), HandlePoisonedIdentifier(), Identifier, clang::IdentifierInfo::isExtensionToken(), clang::IdentifierInfo::isFutureCompatKeyword(), clang::IdentifierInfo::isModulesImport(), isNextPPTokenLParen(), clang::IdentifierInfo::isOutOfDate(), clang::IdentifierInfo::isPoisoned(), clang::IdentifierInfo::setIsFutureCompatKeyword(), and clang::IdentifierInfo::setIsPoisoned().
Referenced by clang::TokenLexer::Lex().
◆ HandleMicrosoftCommentPaste() void Preprocessor::HandleMicrosoftCommentPaste ( Token & Tok ) ◆ HandlePoisonedIdentifier() void Preprocessor::HandlePoisonedIdentifier ( Token & Identifier ) ◆ HandlePragmaDependency() void Preprocessor::HandlePragmaDependency ( Token & DependencyTok )HandlePragmaDependency - Handle #pragma GCC dependency "foo" blah.
Definition at line 512 of file Pragma.cpp.
References Diag(), clang::File, Filename, getCurrentFileLexer(), clang::PreprocessorLexer::getFileEntry(), GetIncludeFilenameSpelling(), clang::Token::getLocation(), clang::FileEntryRef::getModificationTime(), getSpelling(), clang::Invalid, clang::Token::isNot(), Lex(), LexHeaderName(), and LookupFile().
◆ HandlePragmaHdrstop() void Preprocessor::HandlePragmaHdrstop ( Token & Tok )Definition at line 877 of file Pragma.cpp.
References creatingPCHWithPragmaHdrStop(), Diag(), clang::FileName, clang::Token::getLocation(), clang::Token::is(), clang::SourceManager::isInMainFile(), clang::Token::isNot(), Lex(), LexStringLiteral(), clang::Result, and usingPCHWithPragmaHdrStop().
Referenced by HandleSkippedDirectiveWhileUsingPCH().
◆ HandlePragmaIncludeAlias() void Preprocessor::HandlePragmaIncludeAlias ( Token & Tok ) ◆ HandlePragmaMark() void Preprocessor::HandlePragmaMark ( Token & MarkTok ) ◆ HandlePragmaModuleBuild() void Preprocessor::HandlePragmaModuleBuild ( Token & Tok )Definition at line 803 of file Pragma.cpp.
References clang::ModuleLoader::createModuleFromSource(), Diag(), DiscardUntilEndOfDirective(), clang::Token::getKind(), clang::Token::getLocation(), clang::IdentifierInfo::getName(), clang::Token::getRawIdentifier(), clang::Token::is(), clang::Token::isAtStartOfLine(), clang::Token::isNot(), LexModuleNameComponent(), LexUnexpandedToken(), and Loc.
◆ HandlePragmaOnce() void Preprocessor::HandlePragmaOnce ( Token & OnceTok ) ◆ HandlePragmaPoison() void Preprocessor::HandlePragmaPoison ( )HandlePragmaPoison - Handle #pragma GCC poison. PoisonTok is the 'poison'.
Definition at line 438 of file Pragma.cpp.
References Diag(), clang::Token::is(), clang::IdentifierInfo::isFromAST(), isMacroDefined(), clang::Token::isNot(), clang::IdentifierInfo::isPoisoned(), clang::PreprocessorLexer::LexingRawMode, LexUnexpandedToken(), LookUpIdentifierInfo(), clang::IdentifierInfo::setChangedSinceDeserialization(), and clang::IdentifierInfo::setIsPoisoned().
◆ HandlePragmaPopMacro() void Preprocessor::HandlePragmaPopMacro ( Token & PopMacroTok ) ◆ HandlePragmaPushMacro() void Preprocessor::HandlePragmaPushMacro ( Token & PushMacroTok ) ◆ HandlePragmaSystemHeader() void Preprocessor::HandlePragmaSystemHeader ( Token & SysHeaderTok )HandlePragmaSystemHeader - Implement #pragma GCC system_header.
We know that the whole directive has been parsed.
Definition at line 480 of file Pragma.cpp.
References clang::SourceManager::AddLineNote(), clang::SrcMgr::C_System, Diag(), getCurrentFileLexer(), clang::PreprocessorLexer::getFileEntry(), clang::PresumedLoc::getFilename(), clang::PresumedLoc::getLine(), clang::SourceManager::getLineTableFilenameID(), clang::Token::getLocation(), clang::SourceManager::getPresumedLoc(), isInPrimaryFile(), clang::PresumedLoc::isInvalid(), clang::HeaderSearch::MarkFileSystemHeader(), and clang::PPCallbacks::SystemHeaderPragma.
◆ HandleSkippedDirectiveWhileUsingPCH() void Preprocessor::HandleSkippedDirectiveWhileUsingPCH ( Token & Result, SourceLocation HashLoc )Process directives while skipping until the through header or #pragma hdrstop is found.
Process a directive while looking for the through header or a #pragma hdrstop.
The following directives are handled: #include (to check if it is the through header) #define (to warn about macros that don't match the PCH) #pragma (to check for pragma hdrstop). All other directives are completely discarded.
Definition at line 1196 of file PPDirectives.cpp.
References DiscardUntilEndOfDirective(), HandlePragmaHdrstop(), Lex(), and clang::Result.
Referenced by HandleDirective().
◆ hasRecordedPreamble() bool clang::Preprocessor::hasRecordedPreamble ( ) const inlineDefinition at line 2817 of file Preprocessor.h.
◆ IgnorePragmas() void Preprocessor::IgnorePragmas ( ) ◆ IncrementPasteCounter() void clang::Preprocessor::IncrementPasteCounter ( bool isFast ) inlineIncrement 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 2228 of file Preprocessor.h.
◆ Initialize() ◆ InitializeForModelFile() 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 217 of file Preprocessor.cpp.
◆ isAtEndOfMacroExpansion()Returns true if the given MacroID location points at the last token of the macro expansion.
Definition at line 2206 of file Preprocessor.h.
References clang::Lexer::isAtEndOfMacroExpansion().
◆ isAtStartOfMacroExpansion()Returns true if the given MacroID location points at the first token of the macro expansion.
Definition at line 2195 of file Preprocessor.h.
References clang::Lexer::isAtStartOfMacroExpansion().
◆ isBacktrackEnabled() bool clang::Preprocessor::isBacktrackEnabled ( ) const inline ◆ isCodeCompletionEnabled() bool clang::Preprocessor::isCodeCompletionEnabled ( ) const inline ◆ isCodeCompletionReached() bool clang::Preprocessor::isCodeCompletionReached ( ) const inline ◆ isCurrentLexer()Return true if we are lexing directly from the specified lexer.
Definition at line 1274 of file Preprocessor.h.
◆ isIncrementalProcessingEnabled() bool clang::Preprocessor::isIncrementalProcessingEnabled ( ) const inline ◆ isInImplementationUnit() bool clang::Preprocessor::isInImplementationUnit ( ) const inlineIf we are implementing an implementation module unit.
Note that the module implementation partition is not considered as an implementation unit.
Definition at line 2414 of file Preprocessor.h.
◆ isInImportingCXXNamedModules() bool clang::Preprocessor::isInImportingCXXNamedModules ( ) const inline ◆ isInNamedInterfaceUnit() bool clang::Preprocessor::isInNamedInterfaceUnit ( ) const inlineIf we are proprocessing a named interface unit.
Note that a module implementation partition is not considered as an named interface unit here although it is importable to ease the parsing.
Definition at line 2403 of file Preprocessor.h.
◆ isInNamedModule() bool clang::Preprocessor::isInNamedModule ( ) const inline ◆ isInPrimaryFile() bool Preprocessor::isInPrimaryFile ( ) const ◆ isMacroDefined() [1/2] ◆ isMacroDefined() [2/2] bool clang::Preprocessor::isMacroDefined ( StringRef Id ) inlineDefinition at line 1333 of file Preprocessor.h.
References clang::IdentifierTable::get(), Id, and isMacroDefined().
Referenced by AddOrdinaryNameResults(), clang::Sema::CheckPtrComparisonWithNullChar(), clang::SemaCodeCompletion::CodeCompleteObjCPassingType(), clang::Sema::DiagnoseSentinelCalls(), diagnoseXorMisusedAsPow(), DoEmitAvailabilityWarning(), HandleEndOfFile(), HandlePragmaPoison(), InsertOCLBuiltinDeclarationsFromTable(), isMacroDefined(), MaybeAddSentinel(), and clang::HeaderSearch::ShouldEnterIncludeFile().
◆ isMacroDefinedInLocalModule() ◆ isNextPPTokenLParen() bool Preprocessor::isNextPPTokenLParen ( )Determine whether the next preprocessor token to be lexed is a '('.
isNextPPTokenLParen - Determine whether the next preprocessor token to be lexed is a '('.
If so, consume the token and return true, if not, this method should have no observable side-effect on the lexed tokens.
Definition at line 424 of file PPMacroExpansion.cpp.
Referenced by HandleIdentifier(), and isReservedCXXAttributeName().
◆ isParsingIfOrElifDirective() bool clang::Preprocessor::isParsingIfOrElifDirective ( ) const inline ◆ isPCHThroughHeader() ◆ isPPInSafeBufferOptOutRegion() [1/2] bool Preprocessor::isPPInSafeBufferOptOutRegion ( ) ◆ isPPInSafeBufferOptOutRegion() [2/2]Definition at line 1581 of file Preprocessor.cpp.
◆ isPreprocessedOutput() bool clang::Preprocessor::isPreprocessedOutput ( ) const inlineReturns 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 1271 of file Preprocessor.h.
◆ IsPreviousCachedToken() bool Preprocessor::IsPreviousCachedToken ( const Token & Tok ) const ◆ isRecordingPreamble() bool clang::Preprocessor::isRecordingPreamble ( ) const inline ◆ isSafeBufferOptOut() ◆ isUnannotatedBacktrackEnabled() bool clang::Preprocessor::isUnannotatedBacktrackEnabled ( ) const inline ◆ LeaveSubmodule() Module * Preprocessor::LeaveSubmodule ( bool ForPragma ) ◆ Lex() void Preprocessor::Lex ( Token & Result )Lex the next token for this preprocessor.
Definition at line 866 of file Preprocessor.cpp.
References CheckPointStepSize, getIdentifierInfo(), getLangOpts(), clang::ModuleLoader::HadFatalFailure, clang::Token::IsReinjected, clang::Result, setCodeCompletionIdentifierInfo(), and setCodeCompletionTokenRange().
Referenced by CheckEndOfDirective(), CollectPpImportSuffix(), clang::Parser::ConsumeToken(), clang::DoPrintPreprocessedInput(), EvaluateFeatureLikeBuiltinMacro(), clang::PrintDependencyDirectivesSourceMinimizerAction::ExecuteAction(), clang::DumpTokensAction::ExecuteAction(), clang::PreprocessOnlyAction::ExecuteAction(), FinishLexStringLiteral(), FixDigraph(), clang::MacroArgs::getPreExpArgument(), HandleComment(), HandleMicrosoftCommentPaste(), HandlePragmaDependency(), HandlePragmaHdrstop(), HandlePragmaIncludeAlias(), HandleSkippedDirectiveWhileUsingPCH(), LexAfterModuleImport(), LexHeaderName(), clang::PreprocessorLexer::LexIncludeFilename(), LexNonComment(), LexStringLiteral(), LexTokensUntilEOF(), LexUnexpandedToken(), clang::IncrementalParser::Parse(), ParseAlignPragma(), ParseLoopHintValue(), ParsePragmaPushOrPopMacro(), parseSimpleIntegerLiteral(), PrintPreprocessedTokens(), ReadLineMarkerFlags(), clang::RewriteIncludesInInput(), clang::RewriteMacrosInInput(), clang::Parser::TryAnnotateTypeOrScopeToken(), and clang::Parser::TryConsumeToken().
◆ LexAfterModuleImport() bool Preprocessor::LexAfterModuleImport ( Token & Result )Lex a token following the 'import' contextual keyword.
pp-import: [C++20] import header-name pp-import-suffix[opt] ; import header-name-tokens pp-import-suffix[opt] ;
[ObjC] @ import module-name ; [Clang] import module-name ;
header-name-tokens: string-literal < [any sequence of preprocessing-tokens other than >] > module-name: module-name-qualifier[opt] identifier module-name-qualifier module-name-qualifier[opt] identifier .
We respond to a pp-import by importing macros from the named module.
Definition at line 1145 of file Preprocessor.cpp.
References CollectPpImportSuffix(), Diag(), getIdentifierInfo(), getLangOpts(), clang::ModuleLoader::HadFatalFailure, clang::Module::Hidden, isInImportingCXXNamedModules(), clang::SourceLocation::isMacroID(), Lex(), LexHeaderName(), clang::ModuleLoader::loadModule(), makeModuleVisible(), recomputeCurLexerKind(), clang::Result, clang::Token::setIdentifierInfo(), clang::Token::setKind(), clang::Token::setLength(), clang::Token::setLocation(), and clang::Token::startToken().
◆ LexEmbedParameters()Lex the parameters for an #embed directive, returns nullopt on error.
Definition at line 3647 of file PPDirectives.cpp.
References Diag(), DiscardUntilEndOfDirective(), clang::Token::getIdentifierInfo(), clang::Token::getKind(), clang::Token::getLocation(), clang::IdentifierInfo::getName(), clang::Token::is(), clang::Token::isNot(), clang::Token::isOneOf(), LexNonComment(), clang::Parameter, clang::Result, and toString().
◆ LexHeaderName() bool Preprocessor::LexHeaderName ( Token & FilenameTok, bool AllowMacroExpansion =true
)
Lex a token, forming a header-name token if possible.
Lex a header-name token (including one formed from header-name-tokens if AllowMacroExpansion
is true
).
true
, allow the header name to be formed by macro expansion (concatenating tokens as necessary if the first token is a '<').
true
if we reached EOD or EOF while looking for a > token in a concatenated header name and diagnosed it. false
otherwise.
Definition at line 1002 of file Preprocessor.cpp.
References CreateString(), Diag(), clang::Token::getLength(), clang::Token::getLocation(), getSpelling(), clang::Token::hasLeadingEmptyMacro(), clang::Token::hasLeadingSpace(), clang::Token::is(), clang::Token::isAtStartOfLine(), clang::Token::isNot(), clang::Token::isOneOf(), clang::Token::LeadingEmptyMacro, clang::Token::LeadingSpace, Lex(), clang::PreprocessorLexer::LexIncludeFilename(), memcpy(), setCodeCompletionReached(), clang::Token::setFlagValue(), clang::Token::setKind(), clang::Token::StartOfLine, and clang::Token::startToken().
Referenced by EvaluateHasIncludeCommon(), HandlePragmaDependency(), HandlePragmaIncludeAlias(), and LexAfterModuleImport().
◆ LexNonComment() void clang::Preprocessor::LexNonComment ( Token & Result ) inline ◆ LexOnOffSwitch() ◆ LexStringLiteral() bool clang::Preprocessor::LexStringLiteral ( Token & Result, std::string & String, const char * DiagnosticTag, bool AllowMacroExpansion ) inline ◆ LexTokensUntilEOF() void Preprocessor::LexTokensUntilEOF ( std::vector< Token > * Tokens =nullptr
) ◆ LexUnexpandedNonComment() void clang::Preprocessor::LexUnexpandedNonComment ( Token & Result ) inline ◆ LexUnexpandedToken() void clang::Preprocessor::LexUnexpandedToken ( Token & Result ) inline
Just like Lex, but disables macro expansion of identifier tokens.
Definition at line 1795 of file Preprocessor.h.
References Lex(), and clang::Result.
Referenced by CheckEndOfDirective(), DiscardUntilEndOfDirective(), EvaluateFeatureLikeBuiltinMacro(), FinishLexStringLiteral(), HandleDirective(), clang::PragmaNamespace::HandlePragma(), HandlePragmaModuleBuild(), HandlePragmaPoison(), LexModuleName(), LexModuleNameComponent(), LexOnOffSwitch(), LexStringLiteral(), and LexUnexpandedNonComment().
◆ LookAhead() ◆ LookupEmbedFile() ◆ LookupFile() OptionalFileEntryRef Preprocessor::LookupFile ( SourceLocation FilenameLoc, StringRef Filename, bool isAngled, ConstSearchDirIterator FromDir, const FileEntry * FromFile, ConstSearchDirIterator * CurDir, SmallVectorImpl< char > * SearchPath, SmallVectorImpl< char > * RelativePath, ModuleMap::KnownHeader * SuggestedModule, bool * IsMapped, bool * IsFrameworkFound, bool SkipCache =false
, bool OpenFile = true
, bool CacheFailures = true
)
Given a "foo" or <foo> reference, look up the indicated file.
Returns std::nullopt on failure. isAngled
indicates whether the file reference is for system #include's or not (i.e. using <> instead of "").
Definition at line 974 of file PPDirectives.cpp.
References Filename, clang::ModuleMap::getBuiltinDir(), getCurrentFileLexer(), getCurrentModule(), clang::FileEntryRef::getDir(), clang::FileEntryRef::getFileEntry(), clang::PreprocessorLexer::getFileEntry(), clang::SourceManager::getFileEntryRefForID(), clang::PreprocessorLexer::getFileID(), clang::SourceManager::getMainFileID(), getModuleForLocation(), clang::HeaderSearch::getModuleMap(), clang::FileManager::getOptionalDirectoryRef(), clang::Module::IsSystem, clang::HeaderSearch::LookupFile(), clang::HeaderSearch::LookupSubframeworkHeader(), and clang::ModuleMap::shouldImportRelativeToBuiltinIncludeDir().
Referenced by EnterMainSourceFile(), EvaluateHasIncludeCommon(), HandlePragmaDependency(), and ParseDirective().
◆ 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.
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 696 of file Preprocessor.cpp.
References clang::expandUCNs(), getIdentifierInfo(), getSpelling(), clang::IdentifierInfo::getTokenID(), and Identifier.
Referenced by HandlePragmaPoison(), LexRawTokensFromMainFile(), and ParsePragmaPushOrPopMacro().
◆ macro_begin() ◆ macro_end() ◆ macros() llvm::iterator_range< macro_iterator > clang::Preprocessor::macros ( bool IncludeExternalMacros =true
) const inline ◆ makeModuleVisible() ◆ markClangModuleAsAffecting() void clang::Preprocessor::markClangModuleAsAffecting ( Module * M ) inline ◆ markIncluded() ◆ markMacroAsUsed() void Preprocessor::markMacroAsUsed ( MacroInfo * MI ) ◆ MaybeHandlePoisonedIdentifier() void clang::Preprocessor::MaybeHandlePoisonedIdentifier ( Token & Identifier ) inline ◆ mightHavePendingAnnotationTokens() bool clang::Preprocessor::mightHavePendingAnnotationTokens ( ) inline
Determine whether it's possible for a future call to Lex to produce an annotation token created by a previous call to EnterAnnotationToken.
Definition at line 1928 of file Preprocessor.h.
◆ overrideMaxTokens() ◆ ParsePragmaPushOrPopMacro()ParsePragmaPushOrPopMacro - Handle parsing of pragma push_macro/pop_macro.
Return the IdentifierInfo* associated with the macro to push or pop.
Definition at line 568 of file Pragma.cpp.
References CreateString(), Diag(), clang::Token::getLocation(), getSpelling(), clang::Token::hasUDSuffix(), clang::Token::isNot(), Lex(), LookUpIdentifierInfo(), clang::Token::setKind(), and clang::Token::startToken().
Referenced by HandlePragmaPopMacro(), and HandlePragmaPushMacro().
◆ parseSimpleIntegerLiteral() bool Preprocessor::parseSimpleIntegerLiteral ( Token & Tok, uint64_t & Value ) ◆ PoisonSEHIdentifiers() void Preprocessor::PoisonSEHIdentifiers ( bool Poison =true
) ◆ PrintStats() void Preprocessor::PrintStats ( ) ◆ processPathForFileMacro() ◆ processPathToFileName() ◆ recomputeCurLexerKind() void Preprocessor::recomputeCurLexerKind ( ) ◆ removeCommentHandler() ◆ RemovePragmaHandler() [1/2] void clang::Preprocessor::RemovePragmaHandler ( PragmaHandler * Handler ) inline ◆ RemovePragmaHandler() [2/2] void Preprocessor::RemovePragmaHandler ( StringRef Namespace, PragmaHandler * Handler ) ◆ RemoveTopOfLexerStack() 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 621 of file PPLexerChange.cpp.
Referenced by clang::MacroArgs::getPreExpArgument(), and HandleEndOfFile().
◆ ReplaceLastTokenWithAnnotation() void clang::Preprocessor::ReplaceLastTokenWithAnnotation ( const Token & Tok ) inlineReplace 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 1916 of file Preprocessor.h.
References clang::Token::isAnnotation(), and isBacktrackEnabled().
◆ ReplacePreviousCachedToken() void Preprocessor::ReplacePreviousCachedToken ( ArrayRef< Token > NewToks )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 189 of file PPCaching.cpp.
◆ RevertCachedTokens() void clang::Preprocessor::RevertCachedTokens ( unsigned N ) inlineWhen 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 1845 of file Preprocessor.h.
References isBacktrackEnabled().
◆ SawDateOrTime() bool clang::Preprocessor::SawDateOrTime ( ) const inlineReturns true if the preprocessor has seen a use of DATE or TIME in the file so far.
Definition at line 2352 of file Preprocessor.h.
◆ serializeSafeBufferOptOutMap()\#pragma clang unsafe_buffer_usage begin/end
s of this translation unit.
Definition at line 1587 of file Preprocessor.cpp.
◆ setCodeCompletionHandler() ◆ setCodeCompletionIdentifierInfo() void clang::Preprocessor::setCodeCompletionIdentifierInfo ( IdentifierInfo * Filter ) inlineSet the code completion token for filtering purposes.
Definition at line 1588 of file Preprocessor.h.
Referenced by Lex().
◆ SetCodeCompletionPoint() ◆ setCodeCompletionReached() void clang::Preprocessor::setCodeCompletionReached ( ) inline ◆ setCodeCompletionTokenRange()Set the code completion token range for detecting replacement range later on.
Definition at line 1594 of file Preprocessor.h.
Referenced by Lex().
◆ SetCommentRetentionState() void clang::Preprocessor::SetCommentRetentionState ( bool KeepComments, bool KeepMacroComments ) inline ◆ setCounterValue() void clang::Preprocessor::setCounterValue ( unsigned V ) inline ◆ setCurrentFPEvalMethod() ◆ setDeserializedSafeBufferOptOutMap()PP_UNSAFE_BUFFER_USAGE
.
Preprocessor
has been updated; false Preprocessor
is same as itself before the call.
Definition at line 1606 of file Preprocessor.cpp.
References Begin.
◆ setDiagnostics() ◆ setEmptylineHandler() ◆ setExternalSource() ◆ setLoadedMacroDirective() ◆ SetMacroExpansionOnlyInDirectives() void clang::Preprocessor::SetMacroExpansionOnlyInDirectives ( ) inline ◆ setMainFileDir() ◆ SetPoisonReason() ◆ setPragmaARCCFCodeAuditedInfo()Set the location of the currently-active #pragma clang arc_cf_code_audited begin.
An invalid location ends the pragma.
Definition at line 2009 of file Preprocessor.h.
References Loc.
◆ setPragmaAssumeNonNullLoc() void clang::Preprocessor::setPragmaAssumeNonNullLoc ( SourceLocation Loc ) inlineSet the location of the currently-active #pragma clang assume_nonnull begin.
An invalid location ends the pragma.
Definition at line 2024 of file Preprocessor.h.
References Loc.
◆ setPragmasEnabled() void clang::Preprocessor::setPragmasEnabled ( bool Enabled ) inlineDefinition at line 1252 of file Preprocessor.h.
◆ setPreambleRecordedPragmaAssumeNonNullLoc() void clang::Preprocessor::setPreambleRecordedPragmaAssumeNonNullLoc ( SourceLocation Loc ) inlineRecord the location of the unterminated #pragma clang assume_nonnull begin in the preamble.
Definition at line 2039 of file Preprocessor.h.
References Loc.
◆ setPredefines() void clang::Preprocessor::setPredefines ( std::string P ) inline ◆ setPreprocessedOutput() void clang::Preprocessor::setPreprocessedOutput ( bool IsPreprocessedOutput ) inlineSets whether the preprocessor is responsible for producing output or if it is producing tokens to be consumed by Parse and Sema.
Definition at line 1265 of file Preprocessor.h.
◆ setPreprocessToken() void clang::Preprocessor::setPreprocessToken ( bool Preprocess ) inline ◆ setRecordedPreambleConditionalStack() ◆ setReplayablePreambleConditionalStack() ◆ setSkipMainFilePreamble() void clang::Preprocessor::setSkipMainFilePreamble ( unsigned Bytes, bool StartOfLine ) inline ◆ SetSuppressIncludeNotFoundError() void clang::Preprocessor::SetSuppressIncludeNotFoundError ( bool Suppress ) inline ◆ setTokenWatcher() void clang::Preprocessor::setTokenWatcher ( llvm::unique_function< void(const clang::Token &)> F ) inline ◆ setTUFPEvalMethod() ◆ SkipTokensWhileUsingPCH() void Preprocessor::SkipTokensWhileUsingPCH ( )Skip tokens until after the #include of the through header or until after a #pragma hdrstop.
Skip tokens until after the #include of the through header or until after a #pragma hdrstop is seen.
Tokens in the predefines file and the main file may be skipped. If the end of the predefines file is reached, skipping continues into the main file. If the end of the main file is reached, it's a fatal error.
Definition at line 639 of file Preprocessor.cpp.
References Diag(), getPredefinesFileID(), and clang::Token::is().
Referenced by EnterMainSourceFile().
◆ SplitToken() ◆ TypoCorrectToken() void clang::Preprocessor::TypoCorrectToken ( const Token & Tok ) inline ◆ usingPCHWithPragmaHdrStop() bool Preprocessor::usingPCHWithPragmaHdrStop ( ) ◆ usingPCHWithThroughHeader() bool Preprocessor::usingPCHWithThroughHeader ( ) ◆ ASTReader ◆ MacroArgs ◆ TokenLexer::ExpandFunctionArguments void TokenLexer::ExpandFunctionArguments ( ) friend ◆ VAOptDefinitionContext ◆ VariadicMacroScopeGuard ◆ LoadedRegions ◆ TUKindThe documentation for this class was generated from the following files:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4