]> granicus.if.org Git - clang/commitdiff
Add (untested) implementation of PTHLexer::isNextPPTokenLParen() and PTHLexer::Discar...
authorTed Kremenek <kremenek@apple.com>
Thu, 20 Nov 2008 01:16:50 +0000 (01:16 +0000)
committerTed Kremenek <kremenek@apple.com>
Thu, 20 Nov 2008 01:16:50 +0000 (01:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59687 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/PTHLexer.cpp

index e9d6d4794f9dc2ce87aeb900658a4da5ba978402..5adcd9f6a1427a8c0ab18d44b7ab07c3fac7ce85 100644 (file)
@@ -80,11 +80,21 @@ void PTHLexer::setEOF(Token& Tok) {
 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);
 }