[cfe-commits] r59687 - /cfe/trunk/lib/Lex/PTHLexer.cpp

Ted Kremenek kremenek at apple.com
Wed Nov 19 17:16:50 PST 2008


Author: kremenek
Date: Wed Nov 19 19:16:50 2008
New Revision: 59687

URL: http://llvm.org/viewvc/llvm-project?rev=59687&view=rev
Log:
Add (untested) implementation of PTHLexer::isNextPPTokenLParen() and PTHLexer::DiscardToEndOfLine().

Modified:
    cfe/trunk/lib/Lex/PTHLexer.cpp

Modified: cfe/trunk/lib/Lex/PTHLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PTHLexer.cpp?rev=59687&r1=59686&r2=59687&view=diff

==============================================================================
--- cfe/trunk/lib/Lex/PTHLexer.cpp (original)
+++ cfe/trunk/lib/Lex/PTHLexer.cpp Wed Nov 19 19:16:50 2008
@@ -80,11 +80,21 @@
 void PTHLexer::DiscardToEndOfLine() {
   assert(ParsingPreprocessorDirective && ParsingFilename == false &&
          "Must be in a preprocessing directive!");
-  assert (0 && "Not implemented.");
+
+  // Already at end-of-file?
+  if (CurToken == NumTokens)
+    return;
+
+  // Find the first token that is not the start of the *current* line.
+  for ( ++CurToken; CurToken != NumTokens ; ++CurToken )
+    if (Tokens[CurToken].isAtStartOfLine())
+      return;
 }
 
-unsigned PTHLexer::isNextPPTokenLParen() {
-  assert (0 && "Not implemented.");
-  return 0;
+unsigned PTHLexer::isNextPPTokenLParen() {  
+  if (CurToken == NumTokens)
+    return 2;
+  
+  return Tokens[CurToken].is(tok::l_paren);
 }
 





More information about the cfe-commits mailing list