@@ -89,7 +89,7 @@ TGLexer::TGLexer(SourceMgr &SM, ArrayRef<std::string> Macros) : SrcMgr(SM) {
8989 for (StringRef MacroName : Macros) {
9090 const char *End = lexMacroName (MacroName);
9191 if (End != MacroName.end ())
92- PrintFatalError (" Invalid macro name `" + MacroName +
92+ PrintFatalError (" invalid macro name `" + MacroName +
9393 " ` specified on command line" );
9494
9595 DefinedMacros.insert (MacroName);
@@ -188,7 +188,7 @@ tgtok::TokKind TGLexer::LexToken(bool FileOrLineStart) {
188188 return LexIdentifier ();
189189
190190 // Unknown character, emit an error.
191- return ReturnError (TokStart, " Unexpected character" );
191+ return ReturnError (TokStart, " unexpected character" );
192192 case EOF:
193193 // Lex next token, if we just left an include file.
194194 // Note that leaving an include file means that the next
@@ -231,7 +231,7 @@ tgtok::TokKind TGLexer::LexToken(bool FileOrLineStart) {
231231 ++CurPtr; // Eat third dot.
232232 return tgtok::dotdotdot;
233233 }
234- return ReturnError (TokStart, " Invalid '..' punctuation" );
234+ return ReturnError (TokStart, " invalid '..' punctuation" );
235235 }
236236 return tgtok::dot;
237237
@@ -255,7 +255,7 @@ tgtok::TokKind TGLexer::LexToken(bool FileOrLineStart) {
255255 if (SkipCComment ())
256256 return tgtok::Error;
257257 } else // Otherwise, this is an error.
258- return ReturnError (TokStart, " Unexpected character" );
258+ return ReturnError (TokStart, " unexpected character" );
259259 return LexToken (FileOrLineStart);
260260 case ' -' : case ' +' :
261261 case ' 0' : case ' 1' : case ' 2' : case ' 3' : case ' 4' : case ' 5' : case ' 6' :
@@ -313,10 +313,10 @@ tgtok::TokKind TGLexer::LexString() {
313313 while (*CurPtr != ' "' ) {
314314 // If we hit the end of the buffer, report an error.
315315 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" );
317317
318318 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" );
320320
321321 if (*CurPtr != ' \\ ' ) {
322322 CurStrVal += *CurPtr++;
@@ -346,7 +346,7 @@ tgtok::TokKind TGLexer::LexString() {
346346 // If we hit the end of the buffer, report an error.
347347 case ' \0 ' :
348348 if (CurPtr == CurBuf.end ())
349- return ReturnError (StrStart, " End of file in string literal" );
349+ return ReturnError (StrStart, " end of file in string literal" );
350350 [[fallthrough]];
351351 default :
352352 return ReturnError (CurPtr, " invalid escape in string literal" );
@@ -359,7 +359,7 @@ tgtok::TokKind TGLexer::LexString() {
359359
360360tgtok::TokKind TGLexer::LexVarName () {
361361 if (!isValidIDChar (CurPtr[0 ], /* First=*/ true ))
362- return ReturnError (TokStart, " Invalid variable name" );
362+ return ReturnError (TokStart, " invalid variable name" );
363363
364364 // Otherwise, we're ok, consume the rest of the characters.
365365 const char *VarNameStart = CurPtr++;
@@ -433,7 +433,7 @@ bool TGLexer::LexInclude() {
433433 tgtok::TokKind Tok = LexToken ();
434434 if (Tok == tgtok::Error) return true ;
435435 if (Tok != tgtok::StrVal) {
436- PrintError (getLoc (), " Expected filename after include" );
436+ PrintError (getLoc (), " expected filename after include" );
437437 return true ;
438438 }
439439
@@ -444,7 +444,7 @@ bool TGLexer::LexInclude() {
444444 CurBuffer = SrcMgr.AddIncludeFile (Filename, SMLoc::getFromPointer (CurPtr),
445445 IncludedFile);
446446 if (!CurBuffer) {
447- PrintError (getLoc (), " Could not find include file '" + Filename + " '" );
447+ PrintError (getLoc (), " could not find include file '" + Filename + " '" );
448448 return true ;
449449 }
450450
@@ -476,7 +476,7 @@ bool TGLexer::SkipCComment() {
476476 int CurChar = getNextChar ();
477477 switch (CurChar) {
478478 case EOF:
479- PrintError (TokStart, " Unterminated comment! " );
479+ PrintError (TokStart, " unterminated comment" );
480480 return true ;
481481 case ' *' :
482482 // End of the comment?
@@ -543,7 +543,7 @@ tgtok::TokKind TGLexer::LexNumber() {
543543
544544 // Requires at least one digit.
545545 if (CurPtr == NumStart)
546- return ReturnError (TokStart, " Invalid number" );
546+ return ReturnError (TokStart, " invalid number" );
547547
548548 errno = 0 ;
549549 if (IsMinus)
@@ -552,9 +552,9 @@ tgtok::TokKind TGLexer::LexNumber() {
552552 CurIntVal = strtoull (NumStart, nullptr , Base);
553553
554554 if (errno == EINVAL)
555- return ReturnError (TokStart, " Invalid number" );
555+ return ReturnError (TokStart, " invalid number" );
556556 if (errno == ERANGE)
557- return ReturnError (TokStart, " Number out of range" );
557+ return ReturnError (TokStart, " number out of range" );
558558
559559 return Base == 2 ? tgtok::BinaryIntVal : tgtok::IntVal;
560560}
@@ -580,13 +580,13 @@ tgtok::TokKind TGLexer::LexBracket() {
580580 }
581581 }
582582
583- return ReturnError (CodeStart - 2 , " Unterminated code block" );
583+ return ReturnError (CodeStart - 2 , " unterminated code block" );
584584}
585585
586586// / LexExclaim - Lex '!' and '![a-zA-Z]+'.
587587tgtok::TokKind TGLexer::LexExclaim () {
588588 if (!isAlpha (*CurPtr))
589- return ReturnError (CurPtr - 1 , " Invalid \" !operator\" " );
589+ return ReturnError (CurPtr - 1 , " invalid \" !operator\" " );
590590
591591 const char *Start = CurPtr++;
592592 while (isAlpha (*CurPtr))
@@ -648,7 +648,8 @@ tgtok::TokKind TGLexer::LexExclaim() {
648648 .Case (" repr" , tgtok::XRepr)
649649 .Default (tgtok::Error);
650650
651- return Kind != tgtok::Error ? Kind : ReturnError (Start-1 , " Unknown operator" );
651+ return Kind != tgtok::Error ? Kind
652+ : ReturnError (Start - 1 , " unknown operator" );
652653}
653654
654655bool TGLexer::prepExitInclude (bool IncludeStackMustBeEmpty) {
@@ -662,17 +663,17 @@ bool TGLexer::prepExitInclude(bool IncludeStackMustBeEmpty) {
662663
663664 // Pop the preprocessing controls from the include stack.
664665 if (PrepIncludeStack.empty ()) {
665- PrintFatalError (" Preprocessor include stack is empty" );
666+ PrintFatalError (" preprocessor include stack is empty" );
666667 }
667668
668669 PrepIncludeStack.pop_back ();
669670
670671 if (IncludeStackMustBeEmpty) {
671672 if (!PrepIncludeStack.empty ())
672- PrintFatalError (" Preprocessor include stack is not empty" );
673+ PrintFatalError (" preprocessor include stack is not empty" );
673674 } else {
674675 if (PrepIncludeStack.empty ())
675- PrintFatalError (" Preprocessor include stack is empty" );
676+ PrintFatalError (" preprocessor include stack is empty" );
676677 }
677678
678679 return true ;
@@ -732,7 +733,7 @@ bool TGLexer::prepEatPreprocessorDirective(tgtok::TokKind Kind) {
732733 return true ;
733734 }
734735
735- PrintFatalError (" Unsupported preprocessing token in "
736+ PrintFatalError (" unsupported preprocessing token in "
736737 " prepEatPreprocessorDirective()" );
737738 return false ;
738739}
@@ -748,7 +749,7 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
748749 StringRef MacroName = prepLexMacroName ();
749750 StringRef IfTokName = Kind == tgtok::Ifdef ? " #ifdef" : " #ifndef" ;
750751 if (MacroName.empty ())
751- return ReturnError (TokStart, " Expected macro name after " + IfTokName);
752+ return ReturnError (TokStart, " expected macro name after " + IfTokName);
752753
753754 bool MacroIsDefined = DefinedMacros.count (MacroName) != 0 ;
754755
@@ -763,7 +764,7 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
763764 {tgtok::Ifdef, MacroIsDefined, SMLoc::getFromPointer (TokStart)});
764765
765766 if (!prepSkipDirectiveEnd ())
766- return ReturnError (CurPtr, " Only comments are supported after " +
767+ return ReturnError (CurPtr, " only comments are supported after " +
767768 IfTokName + " NAME" );
768769
769770 // If we were not processing tokens before this #ifdef,
@@ -794,7 +795,7 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
794795
795796 if (IfdefEntry.Kind != tgtok::Ifdef) {
796797 PrintError (TokStart, " double #else" );
797- return ReturnError (IfdefEntry.SrcPos , " Previous #else is here" );
798+ return ReturnError (IfdefEntry.SrcPos , " previous #else is here" );
798799 }
799800
800801 // Replace the corresponding #ifdef's control with its negation
@@ -804,7 +805,7 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
804805 {Kind, !IfdefEntry.IsDefined , SMLoc::getFromPointer (TokStart)});
805806
806807 if (!prepSkipDirectiveEnd ())
807- return ReturnError (CurPtr, " Only comments are supported after #else" );
808+ return ReturnError (CurPtr, " only comments are supported after #else" );
808809
809810 // If we were processing tokens before this #else,
810811 // we have to start skipping lines until the matching #endif.
@@ -827,12 +828,12 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
827828
828829 if (IfdefOrElseEntry.Kind != tgtok::Ifdef &&
829830 IfdefOrElseEntry.Kind != tgtok::Else) {
830- PrintFatalError (" Invalid preprocessor control on the stack" );
831+ PrintFatalError (" invalid preprocessor control on the stack" );
831832 return tgtok::Error;
832833 }
833834
834835 if (!prepSkipDirectiveEnd ())
835- return ReturnError (CurPtr, " Only comments are supported after #endif" );
836+ return ReturnError (CurPtr, " only comments are supported after #endif" );
836837
837838 PrepIncludeStack.back ()->pop_back ();
838839
@@ -847,15 +848,15 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
847848 } else if (Kind == tgtok::Define) {
848849 StringRef MacroName = prepLexMacroName ();
849850 if (MacroName.empty ())
850- return ReturnError (TokStart, " Expected macro name after #define" );
851+ return ReturnError (TokStart, " expected macro name after #define" );
851852
852853 if (!DefinedMacros.insert (MacroName).second )
853854 PrintWarning (getLoc (),
854- " Duplicate definition of macro: " + Twine (MacroName));
855+ " duplicate definition of macro: " + Twine (MacroName));
855856
856857 if (!prepSkipDirectiveEnd ())
857858 return ReturnError (CurPtr,
858- " Only comments are supported after #define NAME" );
859+ " only comments are supported after #define NAME" );
859860
860861 if (!ReturnNextLiveToken) {
861862 PrintFatalError (" #define must be ignored during the lines skipping" );
@@ -865,13 +866,13 @@ tgtok::TokKind TGLexer::lexPreprocessor(tgtok::TokKind Kind,
865866 return LexToken ();
866867 }
867868
868- PrintFatalError (" Preprocessing directive is not supported" );
869+ PrintFatalError (" preprocessing directive is not supported" );
869870 return tgtok::Error;
870871}
871872
872873bool TGLexer::prepSkipRegion (bool MustNeverBeFalse) {
873874 if (!MustNeverBeFalse)
874- PrintFatalError (" Invalid recursion." );
875+ PrintFatalError (" invalid recursion." );
875876
876877 do {
877878 // Skip all symbols to the line end.
@@ -917,7 +918,7 @@ bool TGLexer::prepSkipRegion(bool MustNeverBeFalse) {
917918 // due to #else or #endif.
918919 if (prepIsProcessingEnabled ()) {
919920 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 "
921922 " preprocessing directive" );
922923 return false ;
923924 }
@@ -1032,7 +1033,7 @@ bool TGLexer::prepSkipDirectiveEnd() {
10321033 return false ;
10331034 } else {
10341035 TokStart = CurPtr;
1035- PrintError (CurPtr, " Unexpected character" );
1036+ PrintError (CurPtr, " unexpected character" );
10361037 return false ;
10371038 }
10381039
@@ -1067,8 +1068,8 @@ void TGLexer::prepReportPreprocessorStackError() {
10671068 " empty control stack" );
10681069
10691070 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" );
10721073
10731074 TokStart = CurPtr;
10741075}
0 commit comments