本文整理汇总了C++中SourceFile::shouldKeepSyntaxInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ SourceFile::shouldKeepSyntaxInfo方法的具体用法?C++ SourceFile::shouldKeepSyntaxInfo怎么用?C++ SourceFile::shouldKeepSyntaxInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SourceFile
的用法示例。
在下文中一共展示了SourceFile::shouldKeepSyntaxInfo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TokenRecorder
Parser::Parser(std::unique_ptr<Lexer> Lex, SourceFile &SF,
SILParserTUStateBase *SIL,
PersistentParserState *PersistentState)
: SourceMgr(SF.getASTContext().SourceMgr),
Diags(SF.getASTContext().Diags),
SF(SF),
L(Lex.release()),
SIL(SIL),
CurDeclContext(&SF),
Context(SF.getASTContext()),
TokReceiver(SF.shouldKeepSyntaxInfo() ?
new TokenRecorder(SF) :
new ConsumeTokenReceiver()),
SyntaxContext(new SyntaxParsingContext(SyntaxContext, SF, Diags, SourceMgr,
L->getBufferID())) {
State = PersistentState;
if (!State) {
OwnedState.reset(new PersistentParserState());
State = OwnedState.get();
}
// Set the token to a sentinel so that we know the lexer isn't primed yet.
// This cannot be tok::unknown, since that is a token the lexer could produce.
Tok.setKind(tok::NUM_TOKENS);
auto ParserPos = State->takeParserPosition();
if (ParserPos.isValid() &&
L->isStateForCurrentBuffer(ParserPos.LS)) {
restoreParserPosition(ParserPos);
InPoundLineEnvironment = State->InPoundLineEnvironment;
}
}
示例2: RootDataOrParent
SyntaxParsingContext::SyntaxParsingContext(SyntaxParsingContext *&CtxtHolder,
SourceFile &SF,
DiagnosticEngine &Diags,
SourceManager &SourceMgr,
unsigned BufferID)
: RootDataOrParent(new RootContextData(SF, Diags, SourceMgr, BufferID)),
CtxtHolder(CtxtHolder), Storage(getRootData().Storage), Offset(0),
Mode(AccumulationMode::Root), Enabled(SF.shouldKeepSyntaxInfo()) {
CtxtHolder = this;
}
示例3: Parser
Parser::Parser(unsigned BufferID, SourceFile &SF, SILParserTUStateBase *SIL,
PersistentParserState *PersistentState)
: Parser(
std::unique_ptr<Lexer>(new Lexer(
SF.getASTContext().LangOpts, SF.getASTContext().SourceMgr,
BufferID, &SF.getASTContext().Diags,
/*InSILMode=*/SIL != nullptr,
SF.getASTContext().LangOpts.AttachCommentsToDecls
? CommentRetentionMode::AttachToNextToken
: CommentRetentionMode::None,
SF.shouldKeepSyntaxInfo()
? TriviaRetentionMode::WithTrivia
: TriviaRetentionMode::WithoutTrivia)),
SF, SIL, PersistentState) {}