@@ -2484,8 +2484,7 @@ bool Lexer::LexCharConstant(Token &Result, const char *CurPtr,
2484
2484
// / Update BufferPtr to point to the next non-whitespace character and return.
2485
2485
// /
2486
2486
// / This method forms a token and returns true if KeepWhitespaceMode is enabled.
2487
- bool Lexer::SkipWhitespace (Token &Result, const char *CurPtr,
2488
- bool &TokAtPhysicalStartOfLine) {
2487
+ bool Lexer::SkipWhitespace (Token &Result, const char *CurPtr) {
2489
2488
// Whitespace - Skip it, then return the token after the whitespace.
2490
2489
bool SawNewline = isVerticalWhitespace (CurPtr[-1 ]);
2491
2490
@@ -2541,7 +2540,7 @@ bool Lexer::SkipWhitespace(Token &Result, const char *CurPtr,
2541
2540
Result.setFlagValue (Token::LeadingSpace, HasLeadingSpace);
2542
2541
if (SawNewline) {
2543
2542
Result.setFlag (Token::StartOfLine);
2544
- TokAtPhysicalStartOfLine = true ;
2543
+ IsCurrentLexingTokAtPhysicalStartOfLine = true ;
2545
2544
2546
2545
if (NewLinePtr && lastNewLine && NewLinePtr != lastNewLine && PP) {
2547
2546
if (auto *Handler = PP->getEmptylineHandler ())
@@ -2560,8 +2559,7 @@ bool Lexer::SkipWhitespace(Token &Result, const char *CurPtr,
2560
2559
// /
2561
2560
// / If we're in KeepCommentMode or any CommentHandler has inserted
2562
2561
// / some tokens, this will store the first token and return true.
2563
- bool Lexer::SkipLineComment (Token &Result, const char *CurPtr,
2564
- bool &TokAtPhysicalStartOfLine) {
2562
+ bool Lexer::SkipLineComment (Token &Result, const char *CurPtr) {
2565
2563
// If Line comments aren't explicitly enabled for this language, emit an
2566
2564
// extension warning.
2567
2565
if (!LineComment) {
@@ -2717,7 +2715,7 @@ bool Lexer::SkipLineComment(Token &Result, const char *CurPtr,
2717
2715
2718
2716
// The next returned token is at the start of the line.
2719
2717
Result.setFlag (Token::StartOfLine);
2720
- TokAtPhysicalStartOfLine = true ;
2718
+ IsCurrentLexingTokAtPhysicalStartOfLine = true ;
2721
2719
// No leading whitespace seen so far.
2722
2720
Result.clearFlag (Token::LeadingSpace);
2723
2721
BufferPtr = CurPtr;
@@ -2842,8 +2840,7 @@ static bool isEndOfBlockCommentWithEscapedNewLine(const char *CurPtr, Lexer *L,
2842
2840
// /
2843
2841
// / If we're in KeepCommentMode or any CommentHandler has inserted
2844
2842
// / some tokens, this will store the first token and return true.
2845
- bool Lexer::SkipBlockComment (Token &Result, const char *CurPtr,
2846
- bool &TokAtPhysicalStartOfLine) {
2843
+ bool Lexer::SkipBlockComment (Token &Result, const char *CurPtr) {
2847
2844
// Scan one character past where we should, looking for a '/' character. Once
2848
2845
// we find it, check to see if it was preceded by a *. This common
2849
2846
// optimization helps people who like to put a lot of * characters in their
@@ -3046,7 +3043,7 @@ bool Lexer::SkipBlockComment(Token &Result, const char *CurPtr,
3046
3043
// efficiently now. This is safe even in KeepWhitespaceMode because we would
3047
3044
// have already returned above with the comment as a token.
3048
3045
if (isHorizontalWhitespace (*CurPtr)) {
3049
- SkipWhitespace (Result, CurPtr+ 1 , TokAtPhysicalStartOfLine );
3046
+ SkipWhitespace (Result, CurPtr + 1 );
3050
3047
return false ;
3051
3048
}
3052
3049
@@ -3698,11 +3695,11 @@ bool Lexer::Lex(Token &Result) {
3698
3695
HasLeadingEmptyMacro = false ;
3699
3696
}
3700
3697
3701
- bool atPhysicalStartOfLine = IsAtPhysicalStartOfLine;
3698
+ IsCurrentLexingTokAtPhysicalStartOfLine = IsAtPhysicalStartOfLine;
3702
3699
IsAtPhysicalStartOfLine = false ;
3703
3700
bool isRawLex = isLexingRawMode ();
3704
3701
(void ) isRawLex;
3705
- bool returnedToken = LexTokenInternal (Result, atPhysicalStartOfLine );
3702
+ bool returnedToken = LexTokenInternal (Result);
3706
3703
// (After the LexTokenInternal call, the lexer might be destroyed.)
3707
3704
assert ((returnedToken || !isRawLex) && " Raw lex must succeed" );
3708
3705
return returnedToken;
@@ -3713,7 +3710,7 @@ bool Lexer::Lex(Token &Result) {
3713
3710
// / has a null character at the end of the file. This returns a preprocessing
3714
3711
// / token, not a normal token, as such, it is an internal interface. It assumes
3715
3712
// / that the Flags of result have been cleared before calling this.
3716
- bool Lexer::LexTokenInternal (Token &Result, bool TokAtPhysicalStartOfLine ) {
3713
+ bool Lexer::LexTokenInternal (Token &Result) {
3717
3714
LexStart:
3718
3715
assert (!Result.needsCleaning () && " Result needs cleaning" );
3719
3716
assert (!Result.hasPtrData () && " Result has not been reset" );
@@ -3766,7 +3763,7 @@ bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) {
3766
3763
if (!isLexingRawMode ())
3767
3764
Diag (CurPtr-1 , diag::null_in_file);
3768
3765
Result.setFlag (Token::LeadingSpace);
3769
- if (SkipWhitespace (Result, CurPtr, TokAtPhysicalStartOfLine ))
3766
+ if (SkipWhitespace (Result, CurPtr))
3770
3767
return true ; // KeepWhitespaceMode
3771
3768
3772
3769
// We know the lexer hasn't changed, so just try again with this lexer.
@@ -3812,7 +3809,7 @@ bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) {
3812
3809
// No leading whitespace seen so far.
3813
3810
Result.clearFlag (Token::LeadingSpace);
3814
3811
3815
- if (SkipWhitespace (Result, CurPtr, TokAtPhysicalStartOfLine ))
3812
+ if (SkipWhitespace (Result, CurPtr))
3816
3813
return true ; // KeepWhitespaceMode
3817
3814
3818
3815
// We only saw whitespace, so just try again with this lexer.
@@ -3824,7 +3821,7 @@ bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) {
3824
3821
case ' \v ' :
3825
3822
SkipHorizontalWhitespace:
3826
3823
Result.setFlag (Token::LeadingSpace);
3827
- if (SkipWhitespace (Result, CurPtr, TokAtPhysicalStartOfLine ))
3824
+ if (SkipWhitespace (Result, CurPtr))
3828
3825
return true ; // KeepWhitespaceMode
3829
3826
3830
3827
SkipIgnoredUnits:
@@ -3834,11 +3831,11 @@ bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) {
3834
3831
// too (without going through the big switch stmt).
3835
3832
if (CurPtr[0 ] == ' /' && CurPtr[1 ] == ' /' && !inKeepCommentMode () &&
3836
3833
LineComment && (LangOpts.CPlusPlus || !LangOpts.TraditionalCPP )) {
3837
- if (SkipLineComment (Result, CurPtr+ 2 , TokAtPhysicalStartOfLine ))
3834
+ if (SkipLineComment (Result, CurPtr + 2 ))
3838
3835
return true ; // There is a token to return.
3839
3836
goto SkipIgnoredUnits;
3840
3837
} else if (CurPtr[0 ] == ' /' && CurPtr[1 ] == ' *' && !inKeepCommentMode ()) {
3841
- if (SkipBlockComment (Result, CurPtr+ 2 , TokAtPhysicalStartOfLine ))
3838
+ if (SkipBlockComment (Result, CurPtr + 2 ))
3842
3839
return true ; // There is a token to return.
3843
3840
goto SkipIgnoredUnits;
3844
3841
} else if (isHorizontalWhitespace (*CurPtr)) {
@@ -4150,8 +4147,7 @@ bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) {
4150
4147
TreatAsComment = getCharAndSize (CurPtr+SizeTmp, SizeTmp2) != ' *' ;
4151
4148
4152
4149
if (TreatAsComment) {
4153
- if (SkipLineComment (Result, ConsumeChar (CurPtr, SizeTmp, Result),
4154
- TokAtPhysicalStartOfLine))
4150
+ if (SkipLineComment (Result, ConsumeChar (CurPtr, SizeTmp, Result)))
4155
4151
return true ; // There is a token to return.
4156
4152
4157
4153
// It is common for the tokens immediately after a // comment to be
@@ -4162,8 +4158,7 @@ bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) {
4162
4158
}
4163
4159
4164
4160
if (Char == ' *' ) { // /**/ comment.
4165
- if (SkipBlockComment (Result, ConsumeChar (CurPtr, SizeTmp, Result),
4166
- TokAtPhysicalStartOfLine))
4161
+ if (SkipBlockComment (Result, ConsumeChar (CurPtr, SizeTmp, Result)))
4167
4162
return true ; // There is a token to return.
4168
4163
4169
4164
// We only saw whitespace, so just try again with this lexer.
@@ -4203,7 +4198,8 @@ bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) {
4203
4198
// it's actually the start of a preprocessing directive. Callback to
4204
4199
// the preprocessor to handle it.
4205
4200
// TODO: -fpreprocessed mode??
4206
- if (TokAtPhysicalStartOfLine && !LexingRawMode && !Is_PragmaLexer)
4201
+ if (IsCurrentLexingTokAtPhysicalStartOfLine && !LexingRawMode &&
4202
+ !Is_PragmaLexer)
4207
4203
goto HandleDirective;
4208
4204
4209
4205
Kind = tok::hash;
@@ -4392,7 +4388,8 @@ bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) {
4392
4388
// it's actually the start of a preprocessing directive. Callback to
4393
4389
// the preprocessor to handle it.
4394
4390
// TODO: -fpreprocessed mode??
4395
- if (TokAtPhysicalStartOfLine && !LexingRawMode && !Is_PragmaLexer)
4391
+ if (IsCurrentLexingTokAtPhysicalStartOfLine && !LexingRawMode &&
4392
+ !Is_PragmaLexer)
4396
4393
goto HandleDirective;
4397
4394
4398
4395
Kind = tok::hash;
@@ -4412,7 +4409,7 @@ bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) {
4412
4409
if (!LangOpts.AsmPreprocessor ) {
4413
4410
if (uint32_t CodePoint = tryReadUCN (CurPtr, BufferPtr, &Result)) {
4414
4411
if (CheckUnicodeWhitespace (Result, CodePoint, CurPtr)) {
4415
- if (SkipWhitespace (Result, CurPtr, TokAtPhysicalStartOfLine ))
4412
+ if (SkipWhitespace (Result, CurPtr))
4416
4413
return true ; // KeepWhitespaceMode
4417
4414
4418
4415
// We only saw whitespace, so just try again with this lexer.
@@ -4445,7 +4442,7 @@ bool Lexer::LexTokenInternal(Token &Result, bool TokAtPhysicalStartOfLine) {
4445
4442
llvm::strictConversion);
4446
4443
if (Status == llvm::conversionOK) {
4447
4444
if (CheckUnicodeWhitespace (Result, CodePoint, CurPtr)) {
4448
- if (SkipWhitespace (Result, CurPtr, TokAtPhysicalStartOfLine ))
4445
+ if (SkipWhitespace (Result, CurPtr))
4449
4446
return true ; // KeepWhitespaceMode
4450
4447
4451
4448
// We only saw whitespace, so just try again with this lexer.
0 commit comments