@@ -89,7 +89,7 @@ TGLexer::TGLexer(SourceMgr &SM, ArrayRef<std::string> Macros) : SrcMgr(SM) {
89
89
for (StringRef MacroName : Macros) {
90
90
const char *End = lexMacroName (MacroName);
91
91
if (End != MacroName.end ())
92
- PrintFatalError (" Invalid macro name `" + MacroName +
92
+ PrintFatalError (" invalid macro name `" + MacroName +
93
93
" ` specified on command line" );
94
94
95
95
DefinedMacros.insert (MacroName);
@@ -188,7 +188,7 @@ tgtok::TokKind TGLexer::LexToken(bool FileOrLineStart) {
188
188
return LexIdentifier ();
189
189
190
190
// Unknown character, emit an error.
191
- return ReturnError (TokStart, " Unexpected character" );
191
+ return ReturnError (TokStart, " unexpected character" );
192
192
case EOF:
193
193
// Lex next token, if we just left an include file.
194
194
// Note that leaving an include file means that the next
@@ -231,7 +231,7 @@ tgtok::TokKind TGLexer::LexToken(bool FileOrLineStart) {
231
231
++CurPtr; // Eat third dot.
232
232
return tgtok::dotdotdot;
233
233
}
234
- return ReturnError (TokStart, " Invalid '..' punctuation" );
234
+ return ReturnError (TokStart, " invalid '..' punctuation" );
235
235
}
236
236
return tgtok::dot;
237
237
@@ -255,7 +255,7 @@ tgtok::TokKind TGLexer::LexToken(bool FileOrLineStart) {
255
255
if (SkipCComment ())
256
256
return tgtok::Error;
257
257
} else // Otherwise, this is an error.
258
- return ReturnError (TokStart, " Unexpected character" );
258
+ return ReturnError (TokStart, " unexpected character" );
259
259
return LexToken (FileOrLineStart);
260
260
case ' -' : case ' +' :
261
261
case ' 0' : case ' 1' : case ' 2' : case ' 3' : case ' 4' : case ' 5' : case ' 6' :
@@ -313,10 +313,10 @@ tgtok::TokKind TGLexer::LexString() {
313
313
while (*CurPtr != ' "' ) {
314
314
// If we hit the end of the buffer, report an error.
315
315
if (*CurPtr == 0 && CurPtr == CurBuf.end ())
316
- return ReturnError (StrStart, " End of file in string literal" );
316
+ return ReturnError (StrStart, " end of file in string literal" );
317
317
318
318
if (*CurPtr == ' \n ' || *CurPtr == ' \r ' )
319
- return ReturnError (StrStart, " End of line in string literal" );
319
+ return ReturnError (StrStart, " end of line in string literal" );
320
320
321
321
if (*CurPtr != ' \\ ' ) {
322
322
CurStrVal += *CurPtr++;
@@ -346,7 +346,7 @@ tgtok::TokKind TGLexer::LexString() {
346
346
// If we hit the end of the buffer, report an error.
347
347
case ' \0 ' :
348
348
if (CurPtr == CurBuf.end ())
349
- return ReturnError (StrStart, " End of file in string literal" );
349
+ return ReturnError (StrStart, " end of file in string literal" );
350
350
[[fallthrough]];
351
351
default :
352
352
return ReturnError (CurPtr, " invalid escape in string literal" );
@@ -359,7 +359,7 @@ tgtok::TokKind TGLexer::LexString() {
359
359
360
360
tgtok::TokKind TGLexer::LexVarName () {
361
361
if (!isValidIDChar (CurPtr[0 ], /* First=*/ true ))
362
- return ReturnError (TokStart, " Invalid variable name" );
362
+ return ReturnError (TokStart, " invalid variable name" );
363
363
364
364
// Otherwise, we're ok, consume the rest of the characters.
365
365
const char *VarNameStart = CurPtr++;
@@ -433,7 +433,7 @@ bool TGLexer::LexInclude() {
433
433
tgtok::TokKind Tok = LexToken ();
434
434
if (Tok == tgtok::Error) return true ;
435
435
if (Tok != tgtok::StrVal) {
436
- PrintError (getLoc (), " Expected filename after include" );
436
+ PrintError (getLoc (), " expected filename after include" );
437
437
return true ;
438
438
}
439
439
@@ -444,7 +444,7 @@ bool TGLexer::LexInclude() {
444
444
CurBuffer = SrcMgr.AddIncludeFile (Filename, SMLoc::getFromPointer (CurPtr),
445
445
IncludedFile);
446
446
if (!CurBuffer) {
447
- PrintError (getLoc (), " Could not find include file '" + Filename + " '" );
447
+ PrintError (getLoc (), " could not find include file '" + Filename + " '" );
448
448
return true ;
449
449
}
450
450
@@ -476,7 +476,7 @@ bool TGLexer::SkipCComment() {
476
476
int CurChar = getNextChar ();
477
477
switch (CurChar) {
478
478
case EOF:
479
- PrintError (TokStart, " Unterminated comment! " );
479
+ PrintError (TokStart, " unterminated comment" );
480
480
return true ;
481
481
case ' *' :
482
482
// End of the comment?
@@ -543,7 +543,7 @@ tgtok::TokKind TGLexer::LexNumber() {
543
543
544
544
// Requires at least one digit.
545
545
if (CurPtr == NumStart)
546
- return ReturnError (TokStart, " Invalid number" );
546
+ return ReturnError (TokStart, " invalid number" );
547
547
548
548
errno = 0 ;
549
549
if (IsMinus)
@@ -552,9 +552,9 @@ tgtok::TokKind TGLexer::LexNumber() {
552
552
CurIntVal = strtoull (NumStart, nullptr , Base);
553
553
554
554
if (errno == EINVAL)
555
- return ReturnError (TokStart, " Invalid number" );
555
+ return ReturnError (TokStart, " invalid number" );
556
556
if (errno == ERANGE)
557
- return ReturnError (TokStart, " Number out of range" );
557
+ return ReturnError (TokStart, " number out of range" );
558
558
559
559
return Base == 2 ? tgtok::BinaryIntVal : tgtok::IntVal;
560
560
}
@@ -580,13 +580,13 @@ tgtok::TokKind TGLexer::LexBracket() {
580
580
}
581
581
}
582
582
583
- return ReturnError (CodeStart - 2 , " Unterminated code block" );
583
+ return ReturnError (CodeStart - 2 , " unterminated code block" );
584
584
}
585
585
586
586
// / LexExclaim - Lex '!' and '![a-zA-Z]+'.
587
587
tgtok::TokKind TGLexer::LexExclaim () {
588
588
if (!isAlpha (*CurPtr))
589
- return ReturnError (CurPtr - 1 , " Invalid \" !operator\" " );
589
+ return ReturnError (CurPtr - 1 , " invalid \" !operator\" " );
590
590
591
591
const char *Start = CurPtr++;
592
592
while (isAlpha (*CurPtr))
@@ -648,7 +648,8 @@ tgtok::TokKind TGLexer::LexExclaim() {
648
648
.Case (" repr" , tgtok::XRepr)
649
649
.Default (tgtok::Error);
650
650
651
- return Kind != tgtok::Error ? Kind : ReturnError (Start-1 , " Unknown operator" );
651
+ return Kind != tgtok::Error ? Kind
652
+ : ReturnError (Start - 1 , " unknown operator" );
652
653
}
653
654
654
655
bool TGLexer::prepExitInclude (bool IncludeStackMustBeEmpty) {
@@ -662,17 +663,17 @@ bool TGLexer::prepExitInclude(bool IncludeStackMustBeEmpty) {
662
663
663
664
// Pop the preprocessing controls from the include stack.
664
665
if (PrepIncludeStack.empty ()) {
665
- PrintFatalError (" Preprocessor include stack is empty" );
666
+ PrintFatalError (" preprocessor include stack is empty" );
666
667
}
667
668
668
669
PrepIncludeStack.pop_back ();
669
670
670
671
if (IncludeStackMustBeEmpty) {
671
672
if (!PrepIncludeStack.empty ())
672
- PrintFatalError (" Preprocessor include stack is not empty" );
673
+ PrintFatalError (" preprocessor include stack is not empty" );
673
674
} else {
674
675
if (PrepIncludeStack.empty ())
675
- PrintFatalError (" Preprocessor include stack is empty" );
676
+ PrintFatalError (" preprocessor include stack is empty" );
676
677
}
677
678
678
679
return true ;
@@ -732,7 +733,7 @@ bool TGLexer::prepEatPreprocessorDirective(tgtok::TokKind Kind) {
732
733
return true ;
733
734
}
734
735
735
- PrintFatalError (" Unsupported preprocessing token in "
736
+ PrintFatalError (" unsupported preprocessing token in "
736
737
" prepEatPreprocessorDirective()" );
737
738
return false ;
738
739
}
@@ -748,7 +749,7 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
748
749
StringRef MacroName = prepLexMacroName ();
749
750
StringRef IfTokName = Kind == tgtok::Ifdef ? " #ifdef" : " #ifndef" ;
750
751
if (MacroName.empty ())
751
- return ReturnError (TokStart, " Expected macro name after " + IfTokName);
752
+ return ReturnError (TokStart, " expected macro name after " + IfTokName);
752
753
753
754
bool MacroIsDefined = DefinedMacros.count (MacroName) != 0 ;
754
755
@@ -763,7 +764,7 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
763
764
{tgtok::Ifdef, MacroIsDefined, SMLoc::getFromPointer (TokStart)});
764
765
765
766
if (!prepSkipDirectiveEnd ())
766
- return ReturnError (CurPtr, " Only comments are supported after " +
767
+ return ReturnError (CurPtr, " only comments are supported after " +
767
768
IfTokName + " NAME" );
768
769
769
770
// If we were not processing tokens before this #ifdef,
@@ -794,7 +795,7 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
794
795
795
796
if (IfdefEntry.Kind != tgtok::Ifdef) {
796
797
PrintError (TokStart, " double #else" );
797
- return ReturnError (IfdefEntry.SrcPos , " Previous #else is here" );
798
+ return ReturnError (IfdefEntry.SrcPos , " previous #else is here" );
798
799
}
799
800
800
801
// Replace the corresponding #ifdef's control with its negation
@@ -804,7 +805,7 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
804
805
{Kind, !IfdefEntry.IsDefined , SMLoc::getFromPointer (TokStart)});
805
806
806
807
if (!prepSkipDirectiveEnd ())
807
- return ReturnError (CurPtr, " Only comments are supported after #else" );
808
+ return ReturnError (CurPtr, " only comments are supported after #else" );
808
809
809
810
// If we were processing tokens before this #else,
810
811
// we have to start skipping lines until the matching #endif.
@@ -827,12 +828,12 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
827
828
828
829
if (IfdefOrElseEntry.Kind != tgtok::Ifdef &&
829
830
IfdefOrElseEntry.Kind != tgtok::Else) {
830
- PrintFatalError (" Invalid preprocessor control on the stack" );
831
+ PrintFatalError (" invalid preprocessor control on the stack" );
831
832
return tgtok::Error;
832
833
}
833
834
834
835
if (!prepSkipDirectiveEnd ())
835
- return ReturnError (CurPtr, " Only comments are supported after #endif" );
836
+ return ReturnError (CurPtr, " only comments are supported after #endif" );
836
837
837
838
PrepIncludeStack.back ()->pop_back ();
838
839
@@ -847,15 +848,15 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
847
848
} else if (Kind == tgtok::Define) {
848
849
StringRef MacroName = prepLexMacroName ();
849
850
if (MacroName.empty ())
850
- return ReturnError (TokStart, " Expected macro name after #define" );
851
+ return ReturnError (TokStart, " expected macro name after #define" );
851
852
852
853
if (!DefinedMacros.insert (MacroName).second )
853
854
PrintWarning (getLoc (),
854
- " Duplicate definition of macro: " + Twine (MacroName));
855
+ " duplicate definition of macro: " + Twine (MacroName));
855
856
856
857
if (!prepSkipDirectiveEnd ())
857
858
return ReturnError (CurPtr,
858
- " Only comments are supported after #define NAME" );
859
+ " only comments are supported after #define NAME" );
859
860
860
861
if (!ReturnNextLiveToken) {
861
862
PrintFatalError (" #define must be ignored during the lines skipping" );
@@ -865,13 +866,13 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
865
866
return LexToken ();
866
867
}
867
868
868
- PrintFatalError (" Preprocessing directive is not supported" );
869
+ PrintFatalError (" preprocessing directive is not supported" );
869
870
return tgtok::Error;
870
871
}
871
872
872
873
bool TGLexer::prepSkipRegion (bool MustNeverBeFalse) {
873
874
if (!MustNeverBeFalse)
874
- PrintFatalError (" Invalid recursion." );
875
+ PrintFatalError (" invalid recursion." );
875
876
876
877
do {
877
878
// Skip all symbols to the line end.
@@ -917,7 +918,7 @@ bool TGLexer::prepSkipRegion(bool MustNeverBeFalse) {
917
918
// due to #else or #endif.
918
919
if (prepIsProcessingEnabled ()) {
919
920
if (Kind != tgtok::Else && Kind != tgtok::Endif) {
920
- PrintFatalError (" Tokens processing was enabled by an unexpected "
921
+ PrintFatalError (" tokens processing was enabled by an unexpected "
921
922
" preprocessing directive" );
922
923
return false ;
923
924
}
@@ -1032,7 +1033,7 @@ bool TGLexer::prepSkipDirectiveEnd() {
1032
1033
return false ;
1033
1034
} else {
1034
1035
TokStart = CurPtr;
1035
- PrintError (CurPtr, " Unexpected character" );
1036
+ PrintError (CurPtr, " unexpected character" );
1036
1037
return false ;
1037
1038
}
1038
1039
@@ -1067,8 +1068,8 @@ void TGLexer::prepReportPreprocessorStackError() {
1067
1068
" empty control stack" );
1068
1069
1069
1070
auto &PrepControl = PrepIncludeStack.back ()->back ();
1070
- PrintError (CurBuf.end (), " Reached EOF without matching #endif" );
1071
- PrintError (PrepControl.SrcPos , " The latest preprocessor control is here" );
1071
+ PrintError (CurBuf.end (), " reached EOF without matching #endif" );
1072
+ PrintError (PrepControl.SrcPos , " the latest preprocessor control is here" );
1072
1073
1073
1074
TokStart = CurPtr;
1074
1075
}
0 commit comments