[cfe-commits] r160133 - /cfe/trunk/include/clang/AST/CommentLexer.h

Dmitri Gribenko gribozavr at gmail.com
Thu Jul 12 09:34:32 PDT 2012


Author: gribozavr
Date: Thu Jul 12 11:34:32 2012
New Revision: 160133

URL: http://llvm.org/viewvc/llvm-project?rev=160133&view=rev
Log:
Always initialize variable.  If opening quote is the last character in comment, we will be using an uninitialized value.  There is already a test for that in unittests/AST/CommentLexer.cpp, but it seems like we were lucky with the value that got loaded into the variable so the test passed.

Modified:
    cfe/trunk/include/clang/AST/CommentLexer.h

Modified: cfe/trunk/include/clang/AST/CommentLexer.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentLexer.h?rev=160133&r1=160132&r2=160133&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/CommentLexer.h (original)
+++ cfe/trunk/include/clang/AST/CommentLexer.h Thu Jul 12 11:34:32 2012
@@ -509,7 +509,7 @@
       } else
         Error = true;
     }
-    char C;
+    char C = '\0';
     while (!Error && !isEnd()) {
       C = peek();
       WordText.push_back(C);





More information about the cfe-commits mailing list