Lines Matching +full:class +full:- +full:dg

1 //===--- ParseExprCXX.cpp - C++ Expression Parsing ------------------------===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
11 //===----------------------------------------------------------------------===//
74 ColonToken.setLocation(ColonToken.getLocation().getLocWithOffset(-1)); in FixDigraph()
110 /// Parse global scope or nested-name-specifier if present.
112 /// Parses a C++ global scope specifier ('::') or nested-name-specifier (which
116 /// '::'[opt] nested-name-specifier
119 /// nested-name-specifier:
120 /// type-name '::'
121 /// namespace-name '::'
122 /// nested-name-specifier identifier '::'
123 /// nested-name-specifier 'template'[opt] simple-template-id '::'
127 /// nested-name-specifier (or empty)
129 /// \param ObjectType if this nested-name-specifier is being parsed following
130 /// the "." or "->" of a member access expression, this parameter provides the
133 /// \param ObjectHadErrors if this unqualified-id occurs within a member access
138 /// the nested-name-specifier after parsing it.
140 /// \param MayBePseudoDestructor When non-NULL, points to a flag that
141 /// indicates whether this nested-name-specifier may be part of a
142 /// pseudo-destructor name. In this case, the flag will be set false
145 /// the last component of the nested-name-specifier is not parsed as
148 /// \param IsTypename If \c true, this nested-name-specifier is known to be
151 /// \param LastII When non-NULL, points to an IdentifierInfo* that will be
153 /// nested-name-specifier, if any.
190 // ::new and ::delete aren't nested-name-specifiers. in ParseOptionalCXXScopeSpecifier()
200 // '::' - Global scope qualifier. in ParseOptionalCXXScopeSpecifier()
226 // nested-name-specifier. in ParseOptionalCXXScopeSpecifier()
273 // Code completion for a nested-name-specifier, where the code in ParseOptionalCXXScopeSpecifier()
287 // If the qualified-id has the form in ParseOptionalCXXScopeSpecifier()
289 // ::class-name-or-namespace-name::... in ParseOptionalCXXScopeSpecifier()
291 // the class-name-or-namespace-name is looked up in global scope as a in ParseOptionalCXXScopeSpecifier()
292 // class-name or namespace-name. in ParseOptionalCXXScopeSpecifier()
295 // seen a leading '::' or part of a nested-name-specifier. in ParseOptionalCXXScopeSpecifier()
299 // nested-name-specifier: in ParseOptionalCXXScopeSpecifier()
300 // nested-name-specifier 'template'[opt] simple-template-id '::' in ParseOptionalCXXScopeSpecifier()
306 // nested-name-specifier, since they aren't allowed to start with in ParseOptionalCXXScopeSpecifier()
320 // We don't need to actually parse the unqualified-id in this case, in ParseOptionalCXXScopeSpecifier()
321 // because a simple-template-id cannot start with 'operator', but in ParseOptionalCXXScopeSpecifier()
323 // we already annotated the template-id. in ParseOptionalCXXScopeSpecifier()
343 // If the next token is not '<', we have a qualified-id that refers in ParseOptionalCXXScopeSpecifier()
345 // template-id. in ParseOptionalCXXScopeSpecifier()
351 // Commit to parsing the template-id. in ParseOptionalCXXScopeSpecifier()
367 // template-id '::' in ParseOptionalCXXScopeSpecifier()
369 // So we need to check whether the template-id is a simple-template-id of in ParseOptionalCXXScopeSpecifier()
371 // convert it into a type within the nested-name-specifier. in ParseOptionalCXXScopeSpecifier()
379 *LastII = TemplateId->Name; in ParseOptionalCXXScopeSpecifier()
381 // Consume the template-id token. in ParseOptionalCXXScopeSpecifier()
389 ASTTemplateArgsPtr TemplateArgsPtr(TemplateId->getTemplateArgs(), in ParseOptionalCXXScopeSpecifier()
390 TemplateId->NumArgs); in ParseOptionalCXXScopeSpecifier()
392 if (TemplateId->isInvalid() || in ParseOptionalCXXScopeSpecifier()
395 TemplateId->TemplateKWLoc, in ParseOptionalCXXScopeSpecifier()
396 TemplateId->Template, in ParseOptionalCXXScopeSpecifier()
397 TemplateId->TemplateNameLoc, in ParseOptionalCXXScopeSpecifier()
398 TemplateId->LAngleLoc, in ParseOptionalCXXScopeSpecifier()
400 TemplateId->RAngleLoc, in ParseOptionalCXXScopeSpecifier()
405 : TemplateId->TemplateNameLoc; in ParseOptionalCXXScopeSpecifier()
418 << Tok.getIdentifierInfo()->getName() << 0; in ParseOptionalCXXScopeSpecifier()
426 // The rest of the nested-name-specifier possibilities start with in ParseOptionalCXXScopeSpecifier()
433 // nested-name-specifier: in ParseOptionalCXXScopeSpecifier()
434 // type-name '::' in ParseOptionalCXXScopeSpecifier()
435 // namespace-name '::' in ParseOptionalCXXScopeSpecifier()
436 // nested-name-specifier identifier '::' in ParseOptionalCXXScopeSpecifier()
493 // as the name in a nested-name-specifier. in ParseOptionalCXXScopeSpecifier()
523 // nested-name-specifier: in ParseOptionalCXXScopeSpecifier()
524 // type-name '<' in ParseOptionalCXXScopeSpecifier()
538 // If lookup didn't find anything, we treat the name as a template-name in ParseOptionalCXXScopeSpecifier()
541 // have something that looks like a template-argument-list next. in ParseOptionalCXXScopeSpecifier()
547 // with a template-id annotation. We do not permit the in ParseOptionalCXXScopeSpecifier()
548 // template-id to be translated into a type annotation, in ParseOptionalCXXScopeSpecifier()
549 // because some clients (e.g., the parsing of class template in ParseOptionalCXXScopeSpecifier()
550 // specializations) still want to see the original template-id in ParseOptionalCXXScopeSpecifier()
552 // type-constraint). in ParseOptionalCXXScopeSpecifier()
592 // nested-name-specifier, so we're done. in ParseOptionalCXXScopeSpecifier()
596 // Even if we didn't see any pieces of a nested-name-specifier, we in ParseOptionalCXXScopeSpecifier()
598 // indicates a potential pseudo-destructor. in ParseOptionalCXXScopeSpecifier()
610 // We may have already annotated this id-expression. in tryParseCXXIdExpression()
624 // followed by a postfix-expression suffix. in tryParseCXXIdExpression()
635 "undeclared non-type annotation should be unqualified"); in tryParseCXXIdExpression()
654 // followed by a postfix-expression suffix. in tryParseCXXIdExpression()
697 /// ParseCXXIdExpression - Handle id-expression.
699 /// id-expression:
700 /// unqualified-id
701 /// qualified-id
703 /// qualified-id:
704 /// '::'[opt] nested-name-specifier 'template'[opt] unqualified-id
706 /// '::' operator-function-id
707 /// '::' template-id
709 /// NOTE: The standard specifies that, for qualified-id, the parser does not
712 /// '::' conversion-function-id
713 /// '::' '~' class-name
717 /// class C {};
727 /// qualified-id:
728 /// '::'[opt] nested-name-specifier 'template'[opt] unqualified-id
729 /// '::' unqualified-id
734 /// The isAddressOfOperand parameter indicates that this id-expression is a
735 /// direct operand of the address-of operator. This is, besides member contexts,
736 /// the only place where a qualified-id naming a non-static class member may
740 // qualified-id: in ParseCXXIdExpression()
741 // '::'[opt] nested-name-specifier 'template'[opt] unqualified-id in ParseCXXIdExpression()
742 // '::' unqualified-id in ParseCXXIdExpression()
763 /// ParseLambdaExpression - Parse a C++11 lambda expression.
765 /// lambda-expression:
766 /// lambda-introducer lambda-declarator compound-statement
767 /// lambda-introducer '<' template-parameter-list '>'
768 /// requires-clause[opt] lambda-declarator compound-statement
770 /// lambda-introducer:
771 /// '[' lambda-capture[opt] ']'
773 /// lambda-capture:
774 /// capture-default
775 /// capture-list
776 /// capture-default ',' capture-list
778 /// capture-default:
782 /// capture-list:
784 /// capture-list ',' capture
787 /// simple-capture
788 /// init-capture [C++1y]
790 /// simple-capture:
795 /// init-capture: [C++1y]
799 /// lambda-declarator:
800 /// lambda-specifiers [C++23]
801 /// '(' parameter-declaration-clause ')' lambda-specifiers
802 /// requires-clause[opt]
804 /// lambda-specifiers:
805 /// decl-specifier-seq[opt] noexcept-specifier[opt]
806 /// attribute-specifier-seq[opt] trailing-return-type[opt]
809 // Parse lambda-introducer. in ParseLambdaExpression()
850 // Here, we're stuck: lambda introducers and Objective-C message sends are in TryParseLambdaExpression()
852 // lambda, and [a,b,c,d,e,f,g h] is a Objective-C message send. Instead of in TryParseLambdaExpression()
870 // Didn't fully parse the lambda-introducer, try again with a in TryParseLambdaExpression()
871 // non-tentative parse. in TryParseLambdaExpression()
880 // Not a lambda-introducer, might be a message send. in TryParseLambdaExpression()
891 /// contents of the lambda-introducer.
892 /// \param Tentative If non-null, we are disambiguating between a
893 /// lambda-introducer and some other construct. In this mode, we do not
895 /// we're sure that this is a lambda-expression.
922 // Perform some irreversible action if this is a non-tentative parse; in ParseLambdaIntroducer()
931 // Parse capture-default. in ParseLambdaIntroducer()
953 // in Objective-C, where this is Almost Surely meant to be a message in ParseLambdaIntroducer()
974 // If we're in Objective-C++ and we have a bare '[', then this is more in ParseLambdaIntroducer()
1012 // We have a lone "&" or "=" which is either a misplaced capture-default in ParseLambdaIntroducer()
1014 // capture missing. Both are an error but a misplaced capture-default in ParseLambdaIntroducer()
1072 // Each lambda init-capture forms its own full expression, which clears in ParseLambdaIntroducer()
1096 // determine whether this is an Obj-C message send's receiver, a in ParseLambdaIntroducer()
1097 // C99 designator, or a lambda init-capture. in ParseLambdaIntroducer()
1101 // in either case: both the RHS of an init-capture and the RHS of an in ParseLambdaIntroducer()
1102 // assignment expression are parsed as an initializer-clause, and in in ParseLambdaIntroducer()
1110 // classify this as an Obj-C message send.) in ParseLambdaIntroducer()
1137 // Check if this is a message send before we act on a possible init-capture. in ParseLambdaIntroducer()
1149 // The '...' should appear before the identifier in an init-capture, and in ParseLambdaIntroducer()
1202 // Process the init-capture initializers now rather than delaying until we in ParseLambdaIntroducer()
1203 // form the lambda-expression so that they can be handled in the context in ParseLambdaIntroducer()
1204 // enclosing the lambda-expression, rather than in the context of the in ParseLambdaIntroducer()
1205 // lambda-expression itself. in ParseLambdaIntroducer()
1214 // This performs any lvalue-to-rvalue conversions if necessary, which in ParseLambdaIntroducer()
1215 // can affect what gets captured in the containing decl-context. in ParseLambdaIntroducer()
1243 // Consume constexpr-opt mutable-opt in any sequence, and set the DeclEndLoc in tryConsumeLambdaSpecifierToken()
1333 // The lambda-specifier-seq shall not contain both mutable and static. in DiagnoseStaticSpecifierRestrictions()
1334 // If the lambda-specifier-seq contains static, there shall be no in DiagnoseStaticSpecifierRestrictions()
1335 // lambda-capture. in DiagnoseStaticSpecifierRestrictions()
1343 /// ParseLambdaExpressionAfterIntroducer - Parse the rest of a lambda
1355 // Parse lambda-declarator[opt]. in ParseLambdaExpressionAfterIntroducer()
1409 // We increase the template depth before recursing into a requires-clause. in ParseLambdaExpressionAfterIntroducer()
1457 // Parse parameter-declaration-clause. in ParseLambdaExpressionAfterIntroducer()
1503 // GNU-style attributes must be parsed before the mutable specifier to in ParseLambdaExpressionAfterIntroducer()
1504 // be compatible with GCC. MSVC-style attributes must be parsed before in ParseLambdaExpressionAfterIntroducer()
1507 // Parse mutable-opt and/or constexpr-opt or consteval-opt, and update in ParseLambdaExpressionAfterIntroducer()
1529 // Parse exception-specification[opt]. in ParseLambdaExpressionAfterIntroducer()
1544 // Parse attribute-specifier[opt]. in ParseLambdaExpressionAfterIntroducer()
1557 // Parse trailing-return-type[opt]. in ParseLambdaExpressionAfterIntroducer()
1584 // We have called ActOnLambdaClosureQualifiers for parentheses-less cases in ParseLambdaExpressionAfterIntroducer()
1601 << A.getAttrName()->getName(); in ParseLambdaExpressionAfterIntroducer()
1606 // FIXME: Rename BlockScope -> ClosureScope if we decide to continue using in ParseLambdaExpressionAfterIntroducer()
1614 // Parse compound-statement. in ParseLambdaExpressionAfterIntroducer()
1634 /// ParseCXXCasts - This handles the various ways to cast expressions to another
1637 /// postfix-expression: [C++ 5.2p1]
1638 /// 'dynamic_cast' '<' type-name '>' '(' expression ')'
1639 /// 'static_cast' '<' type-name '>' '(' expression ')'
1640 /// 'reinterpret_cast' '<' type-name '>' '(' expression ')'
1641 /// 'const_cast' '<' type-name '>' '(' expression ')'
1644 /// 'addrspace_cast' '<' type-name '>' '(' expression ')'
1672 // Parse the common declaration-specifiers piece. in ParseCXXCasts()
1677 // Parse the abstract-declarator, if present. in ParseCXXCasts()
1707 /// ParseCXXTypeid - This handles the C++ typeid expression.
1709 /// postfix-expression: [C++ 5.2p1]
1711 /// 'typeid' '(' type-id ')'
1729 // polymorphic class type [...] The expression is an unevaluated in ParseCXXTypeid()
1733 // polymorphic class type until after we've parsed the expression; we in ParseCXXTypeid()
1738 // have a type-id, because the tentative parse logic will try to resolve in ParseCXXTypeid()
1775 /// ParseCXXUuidof - This handles the Microsoft C++ __uuidof expression.
1778 /// '__uuidof' '(' type-id ')'
1824 /// Parse a C++ pseudo-destructor expression after the base,
1825 /// . or -> operator, and nested-name-specifier have already been
1828 /// postfix-expression: [C++2a expr.post]
1829 /// postfix-expression . template[opt] id-expression
1830 /// postfix-expression -> template[opt] id-expression
1832 /// id-expression:
1833 /// qualified-id
1834 /// unqualified-id
1836 /// qualified-id:
1837 /// nested-name-specifier template[opt] unqualified-id
1839 /// nested-name-specifier:
1840 /// type-name ::
1841 /// decltype-specifier :: FIXME: not implemented, but probably only
1843 /// nested-name-specifier identifier ::
1844 /// nested-name-specifier template[opt] simple-template-id ::
1847 /// unqualified-id:
1848 /// ~ type-name
1849 /// ~ decltype-specifier
1852 /// ... where the all but the last component of the nested-name-specifier
1853 /// has already been parsed, and the base expression is not of a non-dependent
1854 /// class type.
1860 // If the last component of the (optional) nested-name-specifier is in ParseCXXPseudoDestructor()
1861 // template[opt] simple-template-id, it has already been annotated. in ParseCXXPseudoDestructor()
1872 if (TemplateId->isInvalid()) in ParseCXXPseudoDestructor()
1901 // pack-index-specifier in ParseCXXPseudoDestructor()
1916 // If there is a '<', the second type name is a template-id. Parse in ParseCXXPseudoDestructor()
1921 // void f(auto *p) { p->~X<int>(); } in ParseCXXPseudoDestructor()
1926 SS, ObjectType, Base && Base->containsErrors(), SourceLocation(), in ParseCXXPseudoDestructor()
1936 /// ParseCXXBoolLiteral - This handles the C++ Boolean literals.
1938 /// boolean-literal: [C++ 2.13.5]
1946 /// ParseThrowExpression - This handles the C++ throw expression.
1948 /// throw-expression: [C++ 15]
1949 /// 'throw' assignment-expression[opt]
1954 // If the current token isn't the start of an assignment-expression, in ParseThrowExpression()
1975 /// co_yield-expression:
1976 /// 'co_yield' assignment-expression[opt]
1988 /// ParseCXXThis - This handles the C++ 'this' pointer.
1990 /// C++ 9.3.2: In the body of a non-static member function, the keyword this is
1991 /// a non-lvalue expression whose value is the address of the object for which
1999 /// ParseCXXTypeConstructExpression - Parse construction of a specified type.
2000 /// Can be interpreted either as function-style casting ("int(x)")
2001 /// or class type construction ("ClassType(x,y,z)")
2002 /// or creation of a value-initialized type ("int()").
2005 /// postfix-expression: [C++ 5.2p1]
2006 /// simple-type-specifier '(' expression-list[opt] ')'
2007 /// [C++0x] simple-type-specifier braced-init-list
2008 /// typename-specifier '(' expression-list[opt] ')'
2009 /// [C++0x] typename-specifier braced-init-list
2011 /// In C++1z onwards, the type specifier can also be a template-name.
2029 TypeRep, InitList->getBeginLoc(), MultiExprArg(&InitList, 1), in ParseCXXTypeConstructExpression()
2030 InitList->getEndLoc(), /*ListInitialization=*/true); in ParseCXXTypeConstructExpression()
2044 TypeRep.get()->getCanonicalTypeInternal(), DS.getEndLoc(), in ParseCXXTypeConstructExpression()
2082 DeclGroupPtrTy DG; in ParseAliasDeclarationInInitStatement() local
2085 DG = ParseUsingDeclaration(Context, {}, DeclStart, DeclEnd, Attrs, AS_none); in ParseAliasDeclarationInInitStatement()
2086 if (!DG) in ParseAliasDeclarationInInitStatement()
2087 return DG; in ParseAliasDeclarationInInitStatement()
2094 return DG; in ParseAliasDeclarationInInitStatement()
2097 /// ParseCXXCondition - if/switch/while condition expression.
2101 /// type-specifier-seq declarator '=' assignment-expression
2102 /// [C++11] type-specifier-seq declarator '=' initializer-clause
2103 /// [C++11] type-specifier-seq declarator braced-init-list
2104 /// [Clang] type-specifier-seq ref-qualifier[opt] '[' identifier-list ']'
2105 /// brace-or-equal-initializer
2106 /// [GNU] type-specifier-seq declarator simple-asm-expr[opt] attributes[opt]
2107 /// '=' assignment-expression
2110 /// optional init-statement. This function will parse that too.
2112 /// \param InitStmt If non-null, an init-statement is permitted, and if present
2121 /// \param FRI If non-null, a for range declaration is permitted, and if
2137 S->AddFlags(Scope::BreakScope | Scope::ContinueScope); in ParseCXXCondition()
2138 S->setIsConditionVarScope(IsConditionVariable); in ParseCXXCondition()
2143 S->setIsConditionVarScope(false); in ParseCXXCondition()
2208 DeclGroupPtrTy DG; in ParseCXXCondition() local
2211 DG = ParseAliasDeclarationInInitStatement( in ParseCXXCondition()
2215 DG = ParseSimpleDeclaration(DeclaratorContext::SelectionInit, DeclEnd, in ParseCXXCondition()
2218 *InitStmt = Actions.ActOnDeclStmt(DG, DeclStart, DeclEnd); in ParseCXXCondition()
2223 // This is 'for (init-stmt; for-range-decl : range-expr)'. in ParseCXXCondition()
2229 DeclGroupPtrTy DG = ParseSimpleDeclaration( in ParseCXXCondition() local
2231 FRI->LoopVar = Actions.ActOnDeclStmt(DG, DeclStart, Tok.getLocation()); in ParseCXXCondition()
2243 // type-specifier-seq in ParseCXXCondition()
2251 // simple-asm-expr[opt] in ParseCXXCondition()
2266 // Type-check the declaration itself. in ParseCXXCondition()
2273 // '=' assignment-expression in ParseCXXCondition()
2292 Diag(DeclOut->getLocation(), in ParseCXXCondition()
2296 Diag(DeclOut->getLocation(), diag::err_expected_init_in_condition); in ParseCXXCondition()
2308 /// ParseCXXSimpleTypeSpecifier - [C++ 7.1.5.2] Simple type specifiers.
2310 /// simple-type-specifier.
2312 /// simple-type-specifier:
2313 /// '::'[opt] nested-name-specifier[opt] type-name
2314 /// '::'[opt] nested-name-specifier 'template' simple-template-id [TODO]
2326 /// [GNU] typeof-specifier
2329 /// type-name:
2330 /// class-name
2331 /// enum-name
2332 /// typedef-name
2347 llvm_unreachable("Not a simple-type-specifier token!"); in ParseCXXSimpleTypeSpecifier()
2349 // type-name in ParseCXXSimpleTypeSpecifier()
2480 /// ParseCXXTypeSpecifierSeq - Parse a C++ type-specifier-seq (C++
2481 /// [dcl.name]), which is a non-empty sequence of type-specifiers,
2483 /// by parsing the type-specifier-seq, because these sequences are
2485 /// emits diagnostics if this is not a type-specifier-seq, false
2488 /// type-specifier-seq: [C++ 8.1]
2489 /// type-specifier type-specifier-seq[opt]
2498 /// Finish parsing a C++ unqualified-id that is a template-id of
2502 /// operator-function-id is parsed by \c ParseUnqualifiedId() to determine
2503 /// whether the unqualified-id is actually a template-id. This routine will
2504 /// then parse the template arguments and form the appropriate template-id to
2507 /// \param SS the nested-name-specifier that precedes this template-id, if
2508 /// we're actually parsing a qualified-id.
2510 /// \param ObjectType if this unqualified-id occurs within a member access
2513 /// \param ObjectHadErrors this unqualified-id occurs within a member access
2517 /// identifier that may be a template-name.
2519 /// \param NameLoc the location of the class-name in a constructor or
2523 /// nested-name-specifier.
2525 /// \param Id as input, describes the template-name or operator-function-id
2527 /// will be updated with the template-id.
2537 assert(Tok.is(tok::less) && "Expected '<' to finish parsing a template-id"); in ParseUnqualifiedIdTemplateId()
2546 // We defer the injected-class-name checks until we've found whether in ParseUnqualifiedIdTemplateId()
2547 // this template-id is used to form a nested-name-specifier or not. in ParseUnqualifiedIdTemplateId()
2558 // name, double-check that makes sense syntactically before committing in ParseUnqualifiedIdTemplateId()
2569 // We have something like t->getAs<T>(), where getAs is a in ParseUnqualifiedIdTemplateId()
2575 Name = std::string(Id.Identifier->getName()); in ParseUnqualifiedIdTemplateId()
2581 Name += Id.Identifier->getName(); in ParseUnqualifiedIdTemplateId()
2643 // If this is a non-template, we already issued a diagnostic. in ParseUnqualifiedIdTemplateId()
2650 // Form a parsed representation of the template-id to be stored in the in ParseUnqualifiedIdTemplateId()
2688 /// Parse an operator-function-id or conversion-function-id as part
2689 /// of a C++ unqualified-id.
2691 /// This routine is responsible only for parsing the operator-function-id or
2692 /// conversion-function-id; it does not handle template arguments in any way.
2695 /// operator-function-id: [C++ 13.5]
2700 /// + - * / % ^ & | ~
2701 /// ! = < > += -= *= /= %=
2703 /// <= >= && || ++ -- , ->* ->
2706 /// conversion-function-id: [C++ 12.3.2]
2707 /// operator conversion-type-id
2709 /// conversion-type-id:
2710 /// type-specifier-seq conversion-declarator[opt]
2712 /// conversion-declarator:
2713 /// ptr-operator conversion-declarator[opt]
2716 /// \param SS The nested-name-specifier that preceded this unqualified-id. If
2717 /// non-empty, then we are parsing the unqualified-id of a qualified-id.
2720 /// nested-name-specifier.
2722 /// \param ObjectType if this unqualified-id occurs within a member access
2725 /// \param Result on a successful parse, contains the parsed unqualified-id.
2814 // We have parsed an operator-function-id. in ParseUnqualifiedIdOperator()
2819 // Parse a literal-operator-id. in ParseUnqualifiedIdOperator()
2821 // literal-operator-id: C++11 [over.literal] in ParseUnqualifiedIdOperator()
2822 // operator string-literal identifier in ParseUnqualifiedIdOperator()
2823 // operator user-defined-string-literal in ParseUnqualifiedIdOperator()
2838 // The string-literal or user-defined-string-literal in a in ParseUnqualifiedIdOperator()
2839 // literal-operator-id shall have no encoding-prefix [...]. in ParseUnqualifiedIdOperator()
2852 // or a ud-suffix from the string literal. in ParseUnqualifiedIdOperator()
2874 // The string-literal or user-defined-string-literal in a in ParseUnqualifiedIdOperator()
2875 // literal-operator-id shall [...] contain no characters in ParseUnqualifiedIdOperator()
2882 // This isn't a valid literal-operator-id, but we think we know in ParseUnqualifiedIdOperator()
2886 Str += II->getName(); in ParseUnqualifiedIdOperator()
2896 // Parse a conversion-function-id. in ParseUnqualifiedIdOperator()
2898 // conversion-function-id: [C++ 12.3.2] in ParseUnqualifiedIdOperator()
2899 // operator conversion-type-id in ParseUnqualifiedIdOperator()
2901 // conversion-type-id: in ParseUnqualifiedIdOperator()
2902 // type-specifier-seq conversion-declarator[opt] in ParseUnqualifiedIdOperator()
2904 // conversion-declarator: in ParseUnqualifiedIdOperator()
2905 // ptr-operator conversion-declarator[opt] in ParseUnqualifiedIdOperator()
2907 // Parse the type-specifier-seq. in ParseUnqualifiedIdOperator()
2913 // Parse the conversion-declarator, which is merely a sequence of in ParseUnqualifiedIdOperator()
2914 // ptr-operators. in ParseUnqualifiedIdOperator()
2924 // Note that this is a conversion-function-id. in ParseUnqualifiedIdOperator()
2930 /// Parse a C++ unqualified-id (or a C identifier), which describes the
2934 /// unqualified-id: [C++ expr.prim.general]
2936 /// operator-function-id
2937 /// conversion-function-id
2938 /// [C++0x] literal-operator-id [TODO]
2939 /// ~ class-name
2940 /// template-id
2944 /// \param SS The nested-name-specifier that preceded this unqualified-id. If
2945 /// non-empty, then we are parsing the unqualified-id of a qualified-id.
2947 /// \param ObjectType if this unqualified-id occurs within a member access
2950 /// \param ObjectHadErrors if this unqualified-id occurs within a member access
2955 /// nested-name-specifier.
2963 /// \param Result on a successful parse, contains the parsed unqualified-id.
2976 // Handle 'A::template B'. This is for template-ids which have not in ParseUnqualifiedId()
2990 // unqualified-id: in ParseUnqualifiedId()
2992 // template-id (when it hasn't already been annotated) in ParseUnqualifiedId()
3019 // We have parsed a template-name naming a deduction guide. in ParseUnqualifiedId()
3044 // argument list or refer to a class template or an alias template. in ParseUnqualifiedId()
3053 // unqualified-id: in ParseUnqualifiedId()
3054 // template-id (already parsed and annotated) in ParseUnqualifiedId()
3058 // FIXME: Consider passing invalid template-ids on to callers; they may in ParseUnqualifiedId()
3060 if (TemplateId->isInvalid()) { in ParseUnqualifiedId()
3065 // If the template-name names the current class, then this is a constructor in ParseUnqualifiedId()
3066 if (AllowConstructorName && TemplateId->Name && in ParseUnqualifiedId()
3067 Actions.isCurrentClassName(*TemplateId->Name, getCurScope(), &SS)) { in ParseUnqualifiedId()
3069 // C++ [class.qual]p2 specifies that a qualified template-name in ParseUnqualifiedId()
3073 Diag(TemplateId->TemplateNameLoc, in ParseUnqualifiedId()
3075 << TemplateId->Name in ParseUnqualifiedId()
3077 SourceRange(TemplateId->LAngleLoc, TemplateId->RAngleLoc)); in ParseUnqualifiedId()
3079 *TemplateId->Name, TemplateId->TemplateNameLoc, getCurScope(), SS, in ParseUnqualifiedId()
3083 Result.setConstructorName(Ty, TemplateId->TemplateNameLoc, in ParseUnqualifiedId()
3084 TemplateId->RAngleLoc); in ParseUnqualifiedId()
3094 // We have already parsed a template-id; consume the annotation token as in ParseUnqualifiedId()
3095 // our unqualified-id. in ParseUnqualifiedId()
3097 SourceLocation TemplateLoc = TemplateId->TemplateKWLoc; in ParseUnqualifiedId()
3109 // unqualified-id: in ParseUnqualifiedId()
3110 // operator-function-id in ParseUnqualifiedId()
3111 // conversion-function-id in ParseUnqualifiedId()
3116 // If we have an operator-function-id or a literal-operator-id and the next in ParseUnqualifiedId()
3119 // template-id: in ParseUnqualifiedId()
3120 // operator-function-id < template-argument-list[opt] > in ParseUnqualifiedId()
3142 // There is an ambiguity in the unary-expression ~X(), where X is a in ParseUnqualifiedId()
3143 // class-name. The ambiguity is resolved in favor of treating ~ as a in ParseUnqualifiedId()
3151 // A name prefixed by the keyword template shall be a template-id [...] in ParseUnqualifiedId()
3153 // A template-id cannot begin with a '~' token. This would never work in ParseUnqualifiedId()
3159 // a pseudo-destructor name). in ParseUnqualifiedId()
3176 // Parse the class-name. in ParseUnqualifiedId()
3215 // Parse the class-name (or template-name in a simple-template-id). in ParseUnqualifiedId()
3244 << Tok.getIdentifierInfo()->getName() << 0; in ParseUnqualifiedId()
3254 /// ParseCXXNewExpression - Parse a C++ new-expression. New is used to allocate
3261 /// new-expression:
3262 /// '::'[opt] 'new' new-placement[opt] new-type-id
3263 /// new-initializer[opt]
3264 /// '::'[opt] 'new' new-placement[opt] '(' type-id ')'
3265 /// new-initializer[opt]
3267 /// new-placement:
3268 /// '(' expression-list ')'
3270 /// new-type-id:
3271 /// type-specifier-seq new-declarator[opt]
3272 /// [GNU] attributes type-specifier-seq new-declarator[opt]
3274 /// new-declarator:
3275 /// ptr-operator new-declarator[opt]
3276 /// direct-new-declarator
3278 /// new-initializer:
3279 /// '(' expression-list[opt] ')'
3280 /// [C++0x] braced-init-list
3287 // A '(' now can be a new-placement or the '(' wrapping the type-id in the in ParseCXXNewExpression()
3288 // second form of new-expression. It can't be a new-type-id. in ParseCXXNewExpression()
3341 // A new-type-id is a simplified type-id, where essentially the in ParseCXXNewExpression()
3342 // direct-declarator is replaced by a direct-new-declarator. in ParseCXXNewExpression()
3375 TypeRep.get()->getCanonicalTypeInternal(), in ParseCXXNewExpression()
3414 /// ParseDirectNewDeclarator - Parses a direct-new-declarator. Intended to be
3417 /// direct-new-declarator:
3419 /// direct-new-declarator '[' constant-expression ']'
3425 // An array-size expression can't start with a lambda. in ParseDirectNewDeclarator()
3459 /// ParseExpressionListOrTypeId - Parse either an expression-list or a type-id.
3462 /// new-expression:
3463 /// '::'[opt] 'new' new-placement[opt] '(' type-id ')'
3464 /// new-initializer[opt]
3466 /// new-placement:
3467 /// '(' expression-list ')'
3484 /// ParseCXXDeleteExpression - Parse a C++ delete-expression. Delete is used
3492 /// delete-expression:
3493 /// '::'[opt] 'delete' cast-expression
3494 /// '::'[opt] 'delete' '[' ']' cast-expression
3506 // [Footnote: A lambda expression with a lambda-introducer that consists in ParseCXXDeleteExpression()
3548 // Warn that the non-capturing lambda isn't surrounded by parentheses in ParseCXXDeleteExpression()
3578 /// ParseRequiresExpression - Parse a C++2a requires-expression.
3580 /// A requires-expression provides a concise way to express requirements on
3584 /// requires-expression:
3585 /// 'requires' requirement-parameter-list[opt] requirement-body
3587 /// requirement-parameter-list:
3588 /// '(' parameter-declaration-clause[opt] ')'
3590 /// requirement-body:
3591 /// '{' requirement-seq '}'
3593 /// requirement-seq:
3595 /// requirement-seq requirement
3598 /// simple-requirement
3599 /// type-requirement
3600 /// compound-requirement
3601 /// nested-requirement
3636 // Expressions appearing within a requirement-body are unevaluated operands. in ParseRequiresExpression()
3642 // Dependent diagnostics are attached to this Decl and non-depenedent in ParseRequiresExpression()
3650 // requirement-body: in ParseRequiresExpression()
3651 // { requirement-seq } in ParseRequiresExpression()
3652 // requirement-seq: in ParseRequiresExpression()
3654 // requirement-seq requirement in ParseRequiresExpression()
3663 // compound-requirement: in ParseRequiresExpression()
3665 // return-type-requirement[opt] ';' in ParseRequiresExpression()
3666 // return-type-requirement: in ParseRequiresExpression()
3667 // trailing-return-type in ParseRequiresExpression()
3668 // '->' cv-qualifier-seq[opt] constrained-parameter in ParseRequiresExpression()
3669 // cv-qualifier-seq[opt] abstract-declarator[opt] in ParseRequiresExpression()
3694 << FixItHint::CreateInsertion(Tok.getLocation(), "->"); in ParseRequiresExpression()
3695 // Try to parse a 'type-constraint' in ParseRequiresExpression()
3749 Depth--; in ParseRequiresExpression()
3755 // - OR - in ParseRequiresExpression()
3761 // ^ - a requires expression as a in ParseRequiresExpression()
3762 // simple-requirement. in ParseRequiresExpression()
3772 // nested-requirement: in ParseRequiresExpression()
3773 // 'requires' constraint-expression ';' in ParseRequiresExpression()
3823 if (TemplateId->isInvalid()) in ParseRequiresExpression()
3838 // simple-requirement: in ParseRequiresExpression()
3926 /// Parse the built-in type-trait pseudo-functions that allow
3929 /// primary-expression:
3930 /// unary-type-trait '(' type-id ')'
3931 /// binary-type-trait '(' type-id ',' type-id ')'
3932 /// type-trait '(' type-id-seq ')'
3934 /// type-id-seq:
3935 /// type-id ...[opt] type-id-seq[opt]
3979 /// ParseArrayTypeTrait - Parse the built-in array type-trait
3980 /// pseudo-functions.
3982 /// primary-expression:
3983 /// [Embarcadero] '__array_rank' '(' type-id ')'
3984 /// [Embarcadero] '__array_extent' '(' type-id ',' expression ')'
4027 /// ParseExpressionTrait - Parse built-in expression-trait
4028 /// pseudo-functions like __is_lvalue_expr( xxx ).
4030 /// primary-expression:
4031 /// [Embarcadero] expression-trait '(' expression ')'
4050 /// ParseCXXAmbiguousParenExpression - We have parsed the left paren of a
4051 /// parenthesized ambiguous type-id. This uses tentative parsing to disambiguate
4060 assert(isTypeIdInParens() && "Not a type-id!"); in ParseCXXAmbiguousParenExpression()
4067 // (T())x; - type-id in ParseCXXAmbiguousParenExpression()
4068 // (T())*x; - type-id in ParseCXXAmbiguousParenExpression()
4069 // (T())/x; - expression in ParseCXXAmbiguousParenExpression()
4070 // (T()); - expression in ParseCXXAmbiguousParenExpression()
4074 // type-id, it is not useful for determining the context past the parens. in ParseCXXAmbiguousParenExpression()
4081 // parsing a cast-expression), and then we re-introduce the cached tokens in ParseCXXAmbiguousParenExpression()
4102 // Try parsing the cast-expression that may follow. in ParseCXXAmbiguousParenExpression()
4103 // If it is not a cast-expression, NotCastExpr will be true and no token in ParseCXXAmbiguousParenExpression()
4109 // type-id has priority. in ParseCXXAmbiguousParenExpression()
4113 // If we parsed a cast-expression, it's really a type-id, otherwise it's in ParseCXXAmbiguousParenExpression()
4128 // Re-enter the stored parenthesized tokens into the token stream, so we may in ParseCXXAmbiguousParenExpression()
4166 // We parsed '(' type-id ')' and the thing after it wasn't a '{'. in ParseCXXAmbiguousParenExpression()
4180 // Not a compound literal, and not followed by a cast-expression. in ParseCXXAmbiguousParenExpression()
4213 // Parse the common declaration-specifiers piece. in ParseBuiltinBitCast()
4217 // Parse the abstract-declarator, if present. in ParseBuiltinBitCast()