[cfe-commits] [PATCH] FIX initialization of Tok in Parser

Bas van den Berg b.van.den.berg.nl at gmail.com
Thu Oct 25 22:52:15 PDT 2012


Currently the initial value of Tok is dependent an the stack contents
and could cause the Parser to crash on the first ConsumeToken().

Signed-off-by: Bas van den Berg <b.van.den.berg.nl at gmail.com>
---
 lib/Parse/Parser.cpp |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 99c3636..5f57a83 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -52,6 +52,7 @@ Parser::Parser(Preprocessor &pp, Sema &actions, bool SkipFunctionBodies)
     GreaterThanIsOperator(true), ColonIsSacred(false), 
     InMessageExpression(false), TemplateParameterDepth(0),
     ParsingInObjCContainer(false), SkipFunctionBodies(SkipFunctionBodies) {
+  Tok.startToken();
   Tok.setKind(tok::eof);
   Actions.CurScope = 0;
   NumCachedScopes = 0;
-- 
1.7.0.4




More information about the cfe-commits mailing list