[llvm] r327158 - TableGen: Remove space at EOL in TGLexer.{h,cpp}

Nicolai Haehnle via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 9 10:32:04 PST 2018


Author: nha
Date: Fri Mar  9 10:32:04 2018
New Revision: 327158

URL: http://llvm.org/viewvc/llvm-project?rev=327158&view=rev
Log:
TableGen: Remove space at EOL in TGLexer.{h,cpp}

Change-Id: Ica5f39470174e85f173d3b6db95789033f75ce17

Modified:
    llvm/trunk/lib/TableGen/TGLexer.cpp
    llvm/trunk/lib/TableGen/TGLexer.h

Modified: llvm/trunk/lib/TableGen/TGLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGLexer.cpp?rev=327158&r1=327157&r2=327158&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/TGLexer.cpp (original)
+++ llvm/trunk/lib/TableGen/TGLexer.cpp Fri Mar  9 10:32:04 2018
@@ -56,7 +56,7 @@ int TGLexer::getNextChar() {
     // a random nul in the file.  Disambiguate that here.
     if (CurPtr-1 != CurBuf.end())
       return 0;  // Just whitespace.
-    
+
     // If this is the end of an included file, pop the parent file off the
     // include stack.
     SMLoc ParentIncludeLoc = SrcMgr.getParentIncludeLoc(CurBuffer);
@@ -66,9 +66,9 @@ int TGLexer::getNextChar() {
       CurPtr = ParentIncludeLoc.getPointer();
       return getNextChar();
     }
-    
+
     // Otherwise, return end of file.
-    --CurPtr;  // Another call to lex will return EOF again.  
+    --CurPtr;  // Another call to lex will return EOF again.
     return EOF;
   }
   case '\n':
@@ -80,7 +80,7 @@ int TGLexer::getNextChar() {
         *CurPtr != CurChar)
       ++CurPtr;  // Eat the two char newline sequence.
     return '\n';
-  }  
+  }
 }
 
 int TGLexer::peekNextChar(int Index) {
@@ -115,7 +115,7 @@ tgtok::TokKind TGLexer::LexToken() {
   case '=': return tgtok::equal;
   case '?': return tgtok::question;
   case '#': return tgtok::paste;
-      
+
   case 0:
   case ' ':
   case '\t':
@@ -154,7 +154,7 @@ tgtok::TokKind TGLexer::LexToken() {
         switch (NextNextChar) {
         default:
           break;
-        case '0': case '1': 
+        case '0': case '1':
           if (NextChar == 'b')
             return LexNumber();
           LLVM_FALLTHROUGH;
@@ -184,24 +184,24 @@ tgtok::TokKind TGLexer::LexToken() {
 /// LexString - Lex "[^"]*"
 tgtok::TokKind TGLexer::LexString() {
   const char *StrStart = CurPtr;
-  
+
   CurStrVal = "";
-  
+
   while (*CurPtr != '"') {
     // If we hit the end of the buffer, report an error.
     if (*CurPtr == 0 && CurPtr == CurBuf.end())
       return ReturnError(StrStart, "End of file in string literal");
-    
+
     if (*CurPtr == '\n' || *CurPtr == '\r')
       return ReturnError(StrStart, "End of line in string literal");
-    
+
     if (*CurPtr != '\\') {
       CurStrVal += *CurPtr++;
       continue;
     }
 
     ++CurPtr;
-    
+
     switch (*CurPtr) {
     case '\\': case '\'': case '"':
       // These turn into their literal character.
@@ -215,7 +215,7 @@ tgtok::TokKind TGLexer::LexString() {
       CurStrVal += '\n';
       ++CurPtr;
       break;
-        
+
     case '\n':
     case '\r':
       return ReturnError(CurPtr, "escaped newlines not supported in tblgen");
@@ -229,7 +229,7 @@ tgtok::TokKind TGLexer::LexString() {
       return ReturnError(CurPtr, "invalid escape in string literal");
     }
   }
-  
+
   ++CurPtr;
   return tgtok::StrVal;
 }
@@ -237,10 +237,10 @@ tgtok::TokKind TGLexer::LexString() {
 tgtok::TokKind TGLexer::LexVarName() {
   if (!isalpha(CurPtr[0]) && CurPtr[0] != '_')
     return ReturnError(TokStart, "Invalid variable name");
-  
+
   // Otherwise, we're ok, consume the rest of the characters.
   const char *VarNameStart = CurPtr++;
-  
+
   while (isalpha(*CurPtr) || isdigit(*CurPtr) || *CurPtr == '_')
     ++CurPtr;
 
@@ -309,7 +309,7 @@ bool TGLexer::LexInclude() {
     PrintError(getLoc(), "Could not find include file '" + Filename + "'");
     return true;
   }
-  
+
   DependenciesMapTy::const_iterator Found = Dependencies.find(IncludedFile);
   if (Found != Dependencies.end()) {
     PrintError(getLoc(),
@@ -348,7 +348,7 @@ void TGLexer::SkipBCPLComment() {
 bool TGLexer::SkipCComment() {
   ++CurPtr;  // skip the star.
   unsigned CommentDepth = 1;
-  
+
   while (true) {
     int CurChar = getNextChar();
     switch (CurChar) {
@@ -358,7 +358,7 @@ bool TGLexer::SkipCComment() {
     case '*':
       // End of the comment?
       if (CurPtr[0] != '/') break;
-      
+
       ++CurPtr;   // End the */.
       if (--CommentDepth == 0)
         return false;
@@ -384,7 +384,7 @@ tgtok::TokKind TGLexer::LexNumber() {
       const char *NumStart = CurPtr;
       while (isxdigit(CurPtr[0]))
         ++CurPtr;
-      
+
       // Requires at least one hex digit.
       if (CurPtr == NumStart)
         return ReturnError(TokStart, "Invalid hexadecimal number");
@@ -423,7 +423,7 @@ tgtok::TokKind TGLexer::LexNumber() {
     else if (CurPtr[-1] == '+')
       return tgtok::plus;
   }
-  
+
   while (isdigit(CurPtr[0]))
     ++CurPtr;
   CurIntVal = strtoll(TokStart, nullptr, 10);
@@ -440,9 +440,9 @@ tgtok::TokKind TGLexer::LexBracket() {
   while (true) {
     int Char = getNextChar();
     if (Char == EOF) break;
-    
+
     if (Char != '}') continue;
-    
+
     Char = getNextChar();
     if (Char == EOF) break;
     if (Char == ']') {
@@ -450,7 +450,7 @@ tgtok::TokKind TGLexer::LexBracket() {
       return tgtok::CodeFragment;
     }
   }
-  
+
   return ReturnError(CodeStart-2, "Unterminated Code Block");
 }
 
@@ -458,11 +458,11 @@ tgtok::TokKind TGLexer::LexBracket() {
 tgtok::TokKind TGLexer::LexExclaim() {
   if (!isalpha(*CurPtr))
     return ReturnError(CurPtr - 1, "Invalid \"!operator\"");
-  
+
   const char *Start = CurPtr++;
   while (isalpha(*CurPtr))
     ++CurPtr;
-  
+
   // Check to see which operator this is.
   tgtok::TokKind Kind =
     StringSwitch<tgtok::TokKind>(StringRef(Start, CurPtr - Start))

Modified: llvm/trunk/lib/TableGen/TGLexer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGLexer.h?rev=327158&r1=327157&r2=327158&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/TGLexer.h (original)
+++ llvm/trunk/lib/TableGen/TGLexer.h Fri Mar  9 10:32:04 2018
@@ -30,7 +30,7 @@ namespace tgtok {
   enum TokKind {
     // Markers
     Eof, Error,
-    
+
     // Tokens with no info.
     minus, plus,        // - +
     l_square, r_square, // [ ]
@@ -56,7 +56,7 @@ namespace tgtok {
     // Binary constant.  Note that these are sized according to the number of
     // bits given.
     BinaryIntVal,
-    
+
     // String valued tokens.
     Id, StrVal, VarName, CodeFragment
   };
@@ -65,7 +65,7 @@ namespace tgtok {
 /// TGLexer - TableGen Lexer class.
 class TGLexer {
   SourceMgr &SrcMgr;
-  
+
   const char *CurPtr;
   StringRef CurBuf;
 
@@ -95,11 +95,11 @@ public:
   const DependenciesMapTy &getDependencies() const {
     return Dependencies;
   }
-  
+
   tgtok::TokKind getCode() const { return CurCode; }
 
   const std::string &getCurStrVal() const {
-    assert((CurCode == tgtok::Id || CurCode == tgtok::StrVal || 
+    assert((CurCode == tgtok::Id || CurCode == tgtok::StrVal ||
             CurCode == tgtok::VarName || CurCode == tgtok::CodeFragment) &&
            "This token doesn't have a string value");
     return CurStrVal;
@@ -115,13 +115,13 @@ public:
   }
 
   SMLoc getLoc() const;
-  
+
 private:
   /// LexToken - Read the next token and return its code.
   tgtok::TokKind LexToken();
-  
+
   tgtok::TokKind ReturnError(const char *Loc, const Twine &Msg);
-  
+
   int getNextChar();
   int peekNextChar(int Index);
   void SkipBCPLComment();
@@ -134,7 +134,7 @@ private:
   tgtok::TokKind LexBracket();
   tgtok::TokKind LexExclaim();
 };
-  
+
 } // end namespace llvm
 
 #endif




More information about the llvm-commits mailing list