[cfe-commits] r38543 - in /cfe/cfe/trunk: Lex/Lexer.cpp include/clang/Lex/Lexer.h

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:22:24 PDT 2007


Author: sabre
Date: Wed Jul 11 11:22:23 2007
New Revision: 38543

URL: http://llvm.org/viewvc/llvm-project?rev=38543&view=rev
Log:
Make a method a static function

Modified:
    cfe/cfe/trunk/Lex/Lexer.cpp
    cfe/cfe/trunk/include/clang/Lex/Lexer.h

Modified: cfe/cfe/trunk/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Lex/Lexer.cpp?rev=38543&r1=38542&r2=38543&view=diff

==============================================================================
--- cfe/cfe/trunk/Lex/Lexer.cpp (original)
+++ cfe/cfe/trunk/Lex/Lexer.cpp Wed Jul 11 11:22:23 2007
@@ -771,7 +771,8 @@
 /// isBlockCommentEndOfEscapedNewLine - Return true if the specified newline
 /// character (either \n or \r) is part of an escaped newline sequence.  Issue a
 /// diagnostic if so.  We know that the is inside of a block comment.
-bool Lexer::isEndOfBlockCommentWithEscapedNewLine(const char *CurPtr) {
+static bool isEndOfBlockCommentWithEscapedNewLine(const char *CurPtr, 
+                                                  Lexer *L) {
   assert(CurPtr[0] == '\n' || CurPtr[0] == '\r');
   
   // Back up off the newline.
@@ -808,18 +809,18 @@
 
     // If no trigraphs are enabled, warn that we ignored this trigraph and
     // ignore this * character.
-    if (!Features.Trigraphs) {
-      Diag(CurPtr, diag::trigraph_ignored_block_comment);
+    if (!L->getFeatures().Trigraphs) {
+      L->Diag(CurPtr, diag::trigraph_ignored_block_comment);
       return false;
     }
-    Diag(CurPtr, diag::trigraph_ends_block_comment);
+    L->Diag(CurPtr, diag::trigraph_ends_block_comment);
   }
   
   // Warn about having an escaped newline between the */ characters.
-  Diag(CurPtr, diag::escaped_newline_block_comment_end);
+  L->Diag(CurPtr, diag::escaped_newline_block_comment_end);
   
   // If there was space between the backslash and newline, warn about it.
-  if (HasSpace) Diag(CurPtr, diag::backslash_newline_space);
+  if (HasSpace) L->Diag(CurPtr, diag::backslash_newline_space);
   
   return true;
 }
@@ -854,7 +855,7 @@
         break;
       
       if ((CurPtr[-2] == '\n' || CurPtr[-2] == '\r')) {
-        if (isEndOfBlockCommentWithEscapedNewLine(CurPtr-2)) {
+        if (isEndOfBlockCommentWithEscapedNewLine(CurPtr-2, this)) {
           // We found the final */, though it had an escaped newline between the
           // * and /.  We're done!
           break;

Modified: cfe/cfe/trunk/include/clang/Lex/Lexer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Lex/Lexer.h?rev=38543&r1=38542&r2=38543&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/Lex/Lexer.h (original)
+++ cfe/cfe/trunk/include/clang/Lex/Lexer.h Wed Jul 11 11:22:23 2007
@@ -388,9 +388,6 @@
   //===--------------------------------------------------------------------===//
   // Other lexer functions.
   
-  // Part of block comment parsing.
-  bool isEndOfBlockCommentWithEscapedNewLine(const char *CurPtr);
-  
   // Helper functions to lex the remainder of a token of the specific type.
   void LexIdentifier         (LexerToken &Result, const char *CurPtr);
   void LexNumericConstant    (LexerToken &Result, const char *CurPtr);





More information about the cfe-commits mailing list