]> granicus.if.org Git - clang/commitdiff
Remove an unnecessary check for FormatTok not being null.
authorAlexander Kornienko <alexfh@google.com>
Thu, 13 Mar 2014 13:59:48 +0000 (13:59 +0000)
committerAlexander Kornienko <alexfh@google.com>
Thu, 13 Mar 2014 13:59:48 +0000 (13:59 +0000)
Summary:
This check hints clang analyzer, that FormatTok may be null, and it
reports a null pointer dereference error:
http://buildd-clang.debian.net/scan-build/report-827c64.html#Path28

Reviewers: djasper

Reviewed By: djasper

CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D3040

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203800 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/UnwrappedLineParser.cpp

index a3087ed98454208f4dedde071adcc767fd552107..f513b887bc07b6dbb398c7a2ed4274856520f5a7 100644 (file)
@@ -770,7 +770,7 @@ bool UnwrappedLineParser::tryToParseLambda() {
   if (!tryToParseLambdaIntroducer())
     return false;
 
-  while (FormatTok && FormatTok->isNot(tok::l_brace)) {
+  while (FormatTok->isNot(tok::l_brace)) {
     if (FormatTok->isSimpleTypeSpecifier()) {
       nextToken();
       continue;
@@ -1369,6 +1369,7 @@ void UnwrappedLineParser::readToken() {
   bool CommentsInCurrentLine = true;
   do {
     FormatTok = Tokens->getNextToken();
+    assert(FormatTok);
     while (!Line->InPPDirective && FormatTok->Tok.is(tok::hash) &&
            (FormatTok->HasUnescapedNewline || FormatTok->IsFirst)) {
       // If there is an unfinished unwrapped line, we flush the preprocessor