Home | History | Annotate | Download | only in Sema

Lines Matching refs:Declarator

37 /// isOmittedBlockReturnType - Return true if this declarator is missing a
39 static bool isOmittedBlockReturnType(const Declarator &D) {
40 if (D.getContext() != Declarator::BlockLiteralContext ||
116 /// The declarator being processed.
117 Declarator &declarator;
119 /// The index of the declarator chunk we're currently processing.
138 TypeProcessingState(Sema &sema, Declarator &declarator)
139 : sema(sema), declarator(declarator),
140 chunkIndex(declarator.getNumTypeObjects()),
147 Declarator &getDeclarator() const {
148 return declarator;
156 assert(idx <= declarator.getNumTypeObjects());
161 assert(chunkIndex <= declarator.getNumTypeObjects());
162 if (chunkIndex == declarator.getNumTypeObjects())
164 return declarator.getTypeObject(chunkIndex).getAttrListRef();
187 /// declarator worked out to the given type.
203 return const_cast<DeclSpec&>(declarator.getDeclSpec());
294 /// declaration *other* than on the declarator itself (for which, use
301 Declarator &declarator = state.getDeclarator();
303 DeclaratorChunk &chunk = declarator.getTypeObject(i-1);
328 /// declarator.
333 Declarator &declarator = state.getDeclarator();
339 for (unsigned i = 0, e = declarator.getNumTypeObjects(); i != e; ++i) {
340 DeclaratorChunk &chunk = declarator.getTypeObject(i);
361 // anything in the declarator.
368 moveAttrFromListToList(attr, declarator.getAttrListRef(),
369 declarator.getMutableDeclSpec().getAttributes().getListRef());
377 moveAttrFromListToList(attr, declarator.getAttrListRef(),
378 declarator.getTypeObject(innermost).getAttrListRef());
383 spliceAttrOutOfList(attr, declarator.getAttrListRef());
388 /// *other* than on the declarator itself or in the decl spec. Given
394 Declarator &declarator = state.getDeclarator();
399 DeclaratorChunk &chunk = declarator.getTypeObject(i-1);
427 Declarator &declarator = state.getDeclarator();
430 for (unsigned i = 0, e = declarator.getNumTypeObjects(); i != e; ++i) {
431 DeclaratorChunk &chunk = declarator.getTypeObject(i);
460 // If that failed, diagnose the bad attribute when the declarator is
465 /// A function type attribute was written on the declarator. Try to
471 Declarator &declarator = state.getDeclarator();
475 declarator.getAttrListRef(),
479 // If that failed, diagnose the bad attribute when the declarator is
481 spliceAttrOutOfList(attr, declarator.getAttrListRef());
485 /// \brief Given that there are attributes written on the declarator
487 /// declarator chunk.
496 // Collect all the type attributes from the declarator itself.
497 assert(state.getDeclarator().getAttributes() && "declarator has no attrs!");
523 /// Add a synthetic '()' to a block-literal declarator if it is
527 Declarator &declarator = state.getDeclarator();
529 // First, check whether the declarator would produce a function,
531 if (declarator.isFunctionDeclarator()) {
532 // If so, make that declarator a prototyped declarator.
533 declarator.getFunctionTypeInfo().hasPrototype = true;
539 // block signature declarator is always an abstract-declarator, and
543 if (!declarator.getNumTypeObjects() && declSpecType->isFunctionType())
551 // Otherwise, we need to fake up a function declarator.
552 SourceLocation loc = declarator.getLocStart();
554 // ...and *prepend* it to the declarator.
555 declarator.AddInnermostTypeInfo(DeclaratorChunk::getFunction(
566 declarator));
570 assert(state.getCurrentChunkIndex() == declarator.getNumTypeObjects() - 1);
571 state.setCurrentChunkIndex(declarator.getNumTypeObjects());
576 /// \param D the declarator containing the declaration specifier.
584 Declarator &declarator = state.getDeclarator();
585 const DeclSpec &DS = declarator.getDeclSpec();
586 SourceLocation DeclLoc = declarator.getIdentifierLoc();
647 if (declarator.getContext() == Declarator::LambdaExprContext ||
648 isOmittedBlockReturnType(declarator)) {
682 declarator.setInvalidType(true);
740 declarator.setInvalidType(true);
749 declarator.setInvalidType(true);
759 declarator.setInvalidType(true);
784 declarator.setInvalidType(true);
812 declarator.setInvalidType(true);
836 declarator.setInvalidType(true);
847 declarator.setInvalidType(true);
859 declarator.setInvalidType(true);
879 declarator.setInvalidType(true);
885 declarator.setInvalidType(true);
910 // function declarator if necessary.
911 if (declarator.getContext() == Declarator::BlockLiteralContext)
1186 // A declarator that specifies the type "reference to cv void"
1633 Declarator &declarator = state.getDeclarator();
1637 // Check whether the declarator has the expected form. We walk
1642 for (unsigned i = 0, e = declarator.getNumTypeObjects(); i != e; ++i) {
1644 DeclaratorChunk &chunk = declarator.getTypeObject(chunkIndex);
1708 DeclaratorChunk &chunk = declarator.getTypeObject(outermostPointerIndex);
1775 Declarator &D = state.getDeclarator();
1792 // Owned declaration is embedded in declarator.
1817 // In C++11, a function declarator using 'auto' must have a trailing return
1825 case Declarator::KNRTypeListContext:
1827 case Declarator::LambdaExprContext:
1829 case Declarator::ObjCParameterContext:
1830 case Declarator::ObjCResultContext:
1831 case Declarator::PrototypeContext:
1834 case Declarator::MemberContext:
1844 case Declarator::CXXCatchContext:
1845 case Declarator::ObjCCatchContext:
1848 case Declarator::TemplateParamContext:
1851 case Declarator::BlockLiteralContext:
1854 case Declarator::TemplateTypeArgContext:
1857 case Declarator::AliasDeclContext:
1858 case Declarator::AliasTemplateContext:
1861 case Declarator::TrailingReturnContext:
1864 case Declarator::TypeNameContext:
1867 case Declarator::FileContext:
1868 case Declarator::BlockContext:
1869 case Declarator::ForContext:
1870 case Declarator::ConditionContext:
1871 case Declarator::CXXNewContext:
1878 // In Objective-C it is an error to use 'auto' on a function declarator.
1882 // C++11 [dcl.spec.auto]p2: 'auto' is always fine if the declarator
1884 // level. Check all declarator chunks (outermost first) anyway, to give
1917 case Declarator::TrailingReturnContext:
1922 case Declarator::FileContext:
1923 case Declarator::MemberContext:
1924 case Declarator::BlockContext:
1925 case Declarator::ForContext:
1926 case Declarator::BlockLiteralContext:
1927 case Declarator::LambdaExprContext:
1932 case Declarator::AliasDeclContext:
1934 case Declarator::AliasTemplateContext:
1939 case Declarator::TypeNameContext:
1940 case Declarator::TemplateParamContext:
1941 case Declarator::CXXNewContext:
1942 case Declarator::CXXCatchContext:
1943 case Declarator::ObjCCatchContext:
1944 case Declarator::TemplateTypeArgContext:
1949 case Declarator::PrototypeContext:
1950 case Declarator::ObjCParameterContext:
1951 case Declarator::ObjCResultContext:
1952 case Declarator::KNRTypeListContext:
1959 case Declarator::ConditionContext:
1997 /// can be contained within the declarator chunk DeclType, and produce an
2037 Declarator &D = state.getDeclarator();
2060 D.getContext() == Declarator::AliasDeclContext ||
2061 D.getContext() == Declarator::AliasTemplateContext;
2156 // If the function declarator has a prototype (i.e. it is not () and
2180 } else if (D.getContext() != Declarator::LambdaExprContext &&
2202 D.getContext() == Declarator::BlockLiteralContext)
2259 << (D.getContext() == Declarator::AliasDeclContext ||
2260 D.getContext() == Declarator::AliasTemplateContext);
2469 // See if there are any attributes on this declarator chunk.
2488 FreeFunction = ((D.getContext() != Declarator::MemberContext &&
2489 D.getContext() != Declarator::LambdaExprContext) ||
2524 D.getContext() != Declarator::TemplateTypeArgContext) {
2565 // Apply any undistributed attributes from the declarator.
2580 // If there was an ellipsis in the declarator, the declaration declares a
2584 // A declarator-id or abstract-declarator containing an ellipsis shall
2588 case Declarator::PrototypeContext:
2592 // of the declarator-id of the function parameter pack shall contain
2608 case Declarator::TemplateParamContext:
2626 case Declarator::FileContext:
2627 case Declarator::KNRTypeListContext:
2628 case Declarator::ObjCParameterContext: // FIXME: special diagnostic here?
2629 case Declarator::ObjCResultContext: // FIXME: special diagnostic here?
2630 case Declarator::TypeNameContext:
2631 case Declarator::CXXNewContext:
2632 case Declarator::AliasDeclContext:
2633 case Declarator::AliasTemplateContext:
2634 case Declarator::MemberContext:
2635 case Declarator::BlockContext:
2636 case Declarator::ForContext:
2637 case Declarator::ConditionContext:
2638 case Declarator::CXXCatchContext:
2639 case Declarator::ObjCCatchContext:
2640 case Declarator::BlockLiteralContext:
2641 case Declarator::LambdaExprContext:
2642 case Declarator::TrailingReturnContext:
2643 case Declarator::TemplateTypeArgContext:
2661 /// declarator to Type instances.
2665 TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
2666 // Determine the type of the declarator. Not all forms of declarator
2697 Declarator &D = state.getDeclarator();
2733 Declarator &D = state.getDeclarator();
2779 TypeSourceInfo *Sema::GetTypeForDeclaratorCast(Declarator &D, QualType FromTy) {
2907 // If we got no declarator info from previous Sema routines,
3123 llvm_unreachable("unsupported TypeLoc kind in declarator!");
3137 Sema::GetTypeSourceInfoForDeclarator(Declarator &D, QualType T,
3192 TypeResult Sema::ActOnTypeName(Scope *S, Declarator &D) {
3202 // Make sure there are no unused decl attributes on the declarator.
3205 if (D.getContext() != Declarator::ObjCParameterContext)