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

Chris Lattner clattner at apple.com
Sat Oct 27 12:49:40 PDT 2012


On Oct 25, 2012, at 10:52 PM, Bas van den Berg <b.van.den.berg.nl at gmail.com> wrote:

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

LGTM, committed in r166891, thanks!

-Chris

> 
> 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
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list