comparison tools/clang/lib/Parse/ParseStmt.cpp @ 51:c8f628ba8e9a

fix a incorrect if statement which causes incorrect goto parsing
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Tue, 14 Jan 2014 16:55:06 +0900
parents bd668f746740
children bdef5c940791
comparison
equal deleted inserted replaced
50:bd668f746740 51:c8f628ba8e9a
258 case tok::kw_for: // C99 6.8.5.3: for-statement 258 case tok::kw_for: // C99 6.8.5.3: for-statement
259 return ParseForStatement(TrailingElseLoc); 259 return ParseForStatement(TrailingElseLoc);
260 260
261 case tok::kw_goto: // C99 6.8.6.1: goto-statement 261 case tok::kw_goto: // C99 6.8.6.1: goto-statement
262 #ifndef noCbC 262 #ifndef noCbC
263 if (!(NextToken().is(tok::identifier) && PP.LookAhead(1).is(tok::colon)) && 263 if (!(NextToken().is(tok::identifier) && PP.LookAhead(1).is(tok::semi)) && // C: 'goto' identifier ';'
264 NextToken().isNot(tok::star)) { // CbC: goto codesegment statement 264 NextToken().isNot(tok::star)) { // C: 'goto' '*' expression ';'
265 SemiError = "goto code segment"; 265 SemiError = "goto code segment";
266 return ParseCbCGotoStatement(Attrs, Stmts); 266 return ParseCbCGotoStatement(Attrs, Stmts); // CbC: goto codesegment statement
267 } 267 }
268 #endif 268 #endif
269 Res = ParseGotoStatement(); 269 Res = ParseGotoStatement();
270 SemiError = "goto"; 270 SemiError = "goto";
271 break; 271 break;