Parser.h (207619) | Parser.h (208600) |
---|---|
1//===--- Parser.h - C Language Parser ---------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 96 unchanged lines hidden (view full) --- 105 /// comparison. 106 IdentifierInfo *Ident_super; 107 /// Ident_vector and Ident_pixel - cached IdentifierInfo's for 108 /// "vector" and "pixel" fast comparison. Only present if 109 /// AltiVec enabled. 110 IdentifierInfo *Ident_vector; 111 IdentifierInfo *Ident_pixel; 112 | 1//===--- Parser.h - C Language Parser ---------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 96 unchanged lines hidden (view full) --- 105 /// comparison. 106 IdentifierInfo *Ident_super; 107 /// Ident_vector and Ident_pixel - cached IdentifierInfo's for 108 /// "vector" and "pixel" fast comparison. Only present if 109 /// AltiVec enabled. 110 IdentifierInfo *Ident_vector; 111 IdentifierInfo *Ident_pixel; 112 |
113 llvm::OwningPtr<PragmaHandler> OptionsHandler; |
|
113 llvm::OwningPtr<PragmaHandler> PackHandler; 114 llvm::OwningPtr<PragmaHandler> UnusedHandler; 115 llvm::OwningPtr<PragmaHandler> WeakHandler; 116 117 /// Whether the '>' token acts as an operator or not. This will be 118 /// true except when we are parsing an expression within a C++ 119 /// template argument list, where the '>' closes the template 120 /// argument list. --- 108 unchanged lines hidden (view full) --- 229 /// ConsumeToken - Consume the current 'peek token' and lex the next one. 230 /// This does not work with all kinds of tokens: strings and specific other 231 /// tokens must be consumed with custom methods below. This returns the 232 /// location of the consumed token. 233 SourceLocation ConsumeToken() { 234 assert(!isTokenStringLiteral() && !isTokenParen() && !isTokenBracket() && 235 !isTokenBrace() && 236 "Should consume special tokens with Consume*Token"); | 114 llvm::OwningPtr<PragmaHandler> PackHandler; 115 llvm::OwningPtr<PragmaHandler> UnusedHandler; 116 llvm::OwningPtr<PragmaHandler> WeakHandler; 117 118 /// Whether the '>' token acts as an operator or not. This will be 119 /// true except when we are parsing an expression within a C++ 120 /// template argument list, where the '>' closes the template 121 /// argument list. --- 108 unchanged lines hidden (view full) --- 230 /// ConsumeToken - Consume the current 'peek token' and lex the next one. 231 /// This does not work with all kinds of tokens: strings and specific other 232 /// tokens must be consumed with custom methods below. This returns the 233 /// location of the consumed token. 234 SourceLocation ConsumeToken() { 235 assert(!isTokenStringLiteral() && !isTokenParen() && !isTokenBracket() && 236 !isTokenBrace() && 237 "Should consume special tokens with Consume*Token"); |
238 if (Tok.is(tok::code_completion)) { 239 CodeCompletionRecovery(); 240 return ConsumeCodeCompletionToken(); 241 } 242 |
|
237 PrevTokLocation = Tok.getLocation(); 238 PP.Lex(Tok); 239 return PrevTokLocation; 240 } 241 242 /// ConsumeAnyToken - Dispatch to the right Consume* method based on the 243 /// current token type. This should only be used in cases where the type of 244 /// the token really isn't known, e.g. in error recovery. --- 58 unchanged lines hidden (view full) --- 303 SourceLocation ConsumeStringToken() { 304 assert(isTokenStringLiteral() && 305 "Should only consume string literals with this method"); 306 PrevTokLocation = Tok.getLocation(); 307 PP.Lex(Tok); 308 return PrevTokLocation; 309 } 310 | 243 PrevTokLocation = Tok.getLocation(); 244 PP.Lex(Tok); 245 return PrevTokLocation; 246 } 247 248 /// ConsumeAnyToken - Dispatch to the right Consume* method based on the 249 /// current token type. This should only be used in cases where the type of 250 /// the token really isn't known, e.g. in error recovery. --- 58 unchanged lines hidden (view full) --- 309 SourceLocation ConsumeStringToken() { 310 assert(isTokenStringLiteral() && 311 "Should only consume string literals with this method"); 312 PrevTokLocation = Tok.getLocation(); 313 PP.Lex(Tok); 314 return PrevTokLocation; 315 } 316 |
317 /// \brief Consume the current code-completion token. 318 /// 319 /// This routine should be called to consume the code-completion token once 320 /// a code-completion action has already been invoked. 321 SourceLocation ConsumeCodeCompletionToken() { 322 assert(Tok.is(tok::code_completion)); 323 PrevTokLocation = Tok.getLocation(); 324 PP.Lex(Tok); 325 return PrevTokLocation; 326 } 327 328 ///\ brief When we are consuming a code-completion token within having 329 /// matched specific position in the grammar, provide code-completion results 330 /// based on context. 331 void CodeCompletionRecovery(); 332 |
|
311 /// GetLookAheadToken - This peeks ahead N tokens and returns that token 312 /// without consuming any tokens. LookAhead(0) returns 'Tok', LookAhead(1) 313 /// returns the token after Tok, etc. 314 /// 315 /// Note that this differs from the Preprocessor's LookAhead method, because 316 /// the Parser always has one token lexed that the preprocessor doesn't. 317 /// 318 const Token &GetLookAheadToken(unsigned N) { --- 680 unchanged lines hidden (view full) --- 999 bool ParseExpressionListOrTypeId(ExprListTy &Exprs, Declarator &D); 1000 void ParseDirectNewDeclarator(Declarator &D); 1001 OwningExprResult ParseCXXNewExpression(bool UseGlobal, SourceLocation Start); 1002 OwningExprResult ParseCXXDeleteExpression(bool UseGlobal, 1003 SourceLocation Start); 1004 1005 //===--------------------------------------------------------------------===// 1006 // C++ if/switch/while condition expression. | 333 /// GetLookAheadToken - This peeks ahead N tokens and returns that token 334 /// without consuming any tokens. LookAhead(0) returns 'Tok', LookAhead(1) 335 /// returns the token after Tok, etc. 336 /// 337 /// Note that this differs from the Preprocessor's LookAhead method, because 338 /// the Parser always has one token lexed that the preprocessor doesn't. 339 /// 340 const Token &GetLookAheadToken(unsigned N) { --- 680 unchanged lines hidden (view full) --- 1021 bool ParseExpressionListOrTypeId(ExprListTy &Exprs, Declarator &D); 1022 void ParseDirectNewDeclarator(Declarator &D); 1023 OwningExprResult ParseCXXNewExpression(bool UseGlobal, SourceLocation Start); 1024 OwningExprResult ParseCXXDeleteExpression(bool UseGlobal, 1025 SourceLocation Start); 1026 1027 //===--------------------------------------------------------------------===// 1028 // C++ if/switch/while condition expression. |
1007 bool ParseCXXCondition(OwningExprResult &ExprResult, DeclPtrTy &DeclResult); | 1029 bool ParseCXXCondition(OwningExprResult &ExprResult, DeclPtrTy &DeclResult, 1030 SourceLocation Loc, bool ConvertToBoolean); |
1008 1009 //===--------------------------------------------------------------------===// 1010 // C++ types 1011 1012 //===--------------------------------------------------------------------===// 1013 // C99 6.7.8: Initialization. 1014 1015 /// ParseInitializer --- 39 unchanged lines hidden (view full) --- 1055 OwningStmtResult ParseStatementOrDeclaration(bool OnlyStatement = false); 1056 OwningStmtResult ParseLabeledStatement(AttributeList *Attr); 1057 OwningStmtResult ParseCaseStatement(AttributeList *Attr); 1058 OwningStmtResult ParseDefaultStatement(AttributeList *Attr); 1059 OwningStmtResult ParseCompoundStatement(AttributeList *Attr, 1060 bool isStmtExpr = false); 1061 OwningStmtResult ParseCompoundStatementBody(bool isStmtExpr = false); 1062 bool ParseParenExprOrCondition(OwningExprResult &ExprResult, | 1031 1032 //===--------------------------------------------------------------------===// 1033 // C++ types 1034 1035 //===--------------------------------------------------------------------===// 1036 // C99 6.7.8: Initialization. 1037 1038 /// ParseInitializer --- 39 unchanged lines hidden (view full) --- 1078 OwningStmtResult ParseStatementOrDeclaration(bool OnlyStatement = false); 1079 OwningStmtResult ParseLabeledStatement(AttributeList *Attr); 1080 OwningStmtResult ParseCaseStatement(AttributeList *Attr); 1081 OwningStmtResult ParseDefaultStatement(AttributeList *Attr); 1082 OwningStmtResult ParseCompoundStatement(AttributeList *Attr, 1083 bool isStmtExpr = false); 1084 OwningStmtResult ParseCompoundStatementBody(bool isStmtExpr = false); 1085 bool ParseParenExprOrCondition(OwningExprResult &ExprResult, |
1063 DeclPtrTy &DeclResult); | 1086 DeclPtrTy &DeclResult, 1087 SourceLocation Loc, 1088 bool ConvertToBoolean); |
1064 OwningStmtResult ParseIfStatement(AttributeList *Attr); 1065 OwningStmtResult ParseSwitchStatement(AttributeList *Attr); 1066 OwningStmtResult ParseWhileStatement(AttributeList *Attr); 1067 OwningStmtResult ParseDoStatement(AttributeList *Attr); 1068 OwningStmtResult ParseForStatement(AttributeList *Attr); 1069 OwningStmtResult ParseGotoStatement(AttributeList *Attr); 1070 OwningStmtResult ParseContinueStatement(AttributeList *Attr); 1071 OwningStmtResult ParseBreakStatement(AttributeList *Attr); --- 271 unchanged lines hidden (view full) --- 1343 void ParseTypeQualifierListOpt(DeclSpec &DS, bool GNUAttributesAllowed = true, 1344 bool CXX0XAttributesAllowed = true); 1345 void ParseDirectDeclarator(Declarator &D); 1346 void ParseParenDeclarator(Declarator &D); 1347 void ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, 1348 AttributeList *AttrList = 0, 1349 bool RequiresArg = false); 1350 void ParseFunctionDeclaratorIdentifierList(SourceLocation LParenLoc, | 1089 OwningStmtResult ParseIfStatement(AttributeList *Attr); 1090 OwningStmtResult ParseSwitchStatement(AttributeList *Attr); 1091 OwningStmtResult ParseWhileStatement(AttributeList *Attr); 1092 OwningStmtResult ParseDoStatement(AttributeList *Attr); 1093 OwningStmtResult ParseForStatement(AttributeList *Attr); 1094 OwningStmtResult ParseGotoStatement(AttributeList *Attr); 1095 OwningStmtResult ParseContinueStatement(AttributeList *Attr); 1096 OwningStmtResult ParseBreakStatement(AttributeList *Attr); --- 271 unchanged lines hidden (view full) --- 1368 void ParseTypeQualifierListOpt(DeclSpec &DS, bool GNUAttributesAllowed = true, 1369 bool CXX0XAttributesAllowed = true); 1370 void ParseDirectDeclarator(Declarator &D); 1371 void ParseParenDeclarator(Declarator &D); 1372 void ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D, 1373 AttributeList *AttrList = 0, 1374 bool RequiresArg = false); 1375 void ParseFunctionDeclaratorIdentifierList(SourceLocation LParenLoc, |
1376 IdentifierInfo *FirstIdent, 1377 SourceLocation FirstIdentLoc, |
|
1351 Declarator &D); 1352 void ParseBracketDeclarator(Declarator &D); 1353 1354 //===--------------------------------------------------------------------===// 1355 // C++ 7: Declarations [dcl.dcl] 1356 1357 bool isCXX0XAttributeSpecifier(bool FullLookahead = false, 1358 tok::TokenKind *After = 0); --- 39 unchanged lines hidden (view full) --- 1398 AccessSpecifier getAccessSpecifierIfPresent() const; 1399 1400 bool ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS, 1401 IdentifierInfo *Name, 1402 SourceLocation NameLoc, 1403 bool EnteringContext, 1404 TypeTy *ObjectType, 1405 UnqualifiedId &Id, | 1378 Declarator &D); 1379 void ParseBracketDeclarator(Declarator &D); 1380 1381 //===--------------------------------------------------------------------===// 1382 // C++ 7: Declarations [dcl.dcl] 1383 1384 bool isCXX0XAttributeSpecifier(bool FullLookahead = false, 1385 tok::TokenKind *After = 0); --- 39 unchanged lines hidden (view full) --- 1425 AccessSpecifier getAccessSpecifierIfPresent() const; 1426 1427 bool ParseUnqualifiedIdTemplateId(CXXScopeSpec &SS, 1428 IdentifierInfo *Name, 1429 SourceLocation NameLoc, 1430 bool EnteringContext, 1431 TypeTy *ObjectType, 1432 UnqualifiedId &Id, |
1406 bool AssumeTemplateId = false); | 1433 bool AssumeTemplateId, 1434 SourceLocation TemplateKWLoc); |
1407 bool ParseUnqualifiedIdOperator(CXXScopeSpec &SS, bool EnteringContext, 1408 TypeTy *ObjectType, 1409 UnqualifiedId &Result); 1410 bool ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext, 1411 bool AllowDestructorName, 1412 bool AllowConstructorName, 1413 TypeTy *ObjectType, 1414 UnqualifiedId &Result); --- 37 unchanged lines hidden (view full) --- 1452 SourceLocation &RAngleLoc); 1453 1454 bool AnnotateTemplateIdToken(TemplateTy Template, TemplateNameKind TNK, 1455 const CXXScopeSpec *SS, 1456 UnqualifiedId &TemplateName, 1457 SourceLocation TemplateKWLoc = SourceLocation(), 1458 bool AllowTypeAnnotation = true); 1459 void AnnotateTemplateIdTokenAsType(const CXXScopeSpec *SS = 0); | 1435 bool ParseUnqualifiedIdOperator(CXXScopeSpec &SS, bool EnteringContext, 1436 TypeTy *ObjectType, 1437 UnqualifiedId &Result); 1438 bool ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext, 1439 bool AllowDestructorName, 1440 bool AllowConstructorName, 1441 TypeTy *ObjectType, 1442 UnqualifiedId &Result); --- 37 unchanged lines hidden (view full) --- 1480 SourceLocation &RAngleLoc); 1481 1482 bool AnnotateTemplateIdToken(TemplateTy Template, TemplateNameKind TNK, 1483 const CXXScopeSpec *SS, 1484 UnqualifiedId &TemplateName, 1485 SourceLocation TemplateKWLoc = SourceLocation(), 1486 bool AllowTypeAnnotation = true); 1487 void AnnotateTemplateIdTokenAsType(const CXXScopeSpec *SS = 0); |
1488 bool IsTemplateArgumentList(unsigned Skip = 0); |
|
1460 bool ParseTemplateArgumentList(TemplateArgList &TemplateArgs); 1461 ParsedTemplateArgument ParseTemplateTemplateArgument(); 1462 ParsedTemplateArgument ParseTemplateArgument(); 1463 DeclPtrTy ParseExplicitInstantiation(SourceLocation ExternLoc, 1464 SourceLocation TemplateLoc, 1465 SourceLocation &DeclEnd); 1466 1467 //===--------------------------------------------------------------------===// 1468 // GNU G++: Type Traits [Type-Traits.html in the GCC manual] 1469 OwningExprResult ParseUnaryTypeTrait(); 1470}; 1471 1472} // end namespace clang 1473 1474#endif | 1489 bool ParseTemplateArgumentList(TemplateArgList &TemplateArgs); 1490 ParsedTemplateArgument ParseTemplateTemplateArgument(); 1491 ParsedTemplateArgument ParseTemplateArgument(); 1492 DeclPtrTy ParseExplicitInstantiation(SourceLocation ExternLoc, 1493 SourceLocation TemplateLoc, 1494 SourceLocation &DeclEnd); 1495 1496 //===--------------------------------------------------------------------===// 1497 // GNU G++: Type Traits [Type-Traits.html in the GCC manual] 1498 OwningExprResult ParseUnaryTypeTrait(); 1499}; 1500 1501} // end namespace clang 1502 1503#endif |