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 ||
118 /// The declarator being processed.
119 Declarator &declarator;
121 /// The index of the declarator chunk we're currently processing.
140 TypeProcessingState(Sema &sema, Declarator &declarator)
141 : sema(sema), declarator(declarator),
142 chunkIndex(declarator.getNumTypeObjects()),
149 Declarator &getDeclarator() const {
150 return declarator;
154 return chunkIndex == declarator.getNumTypeObjects();
162 assert(idx <= declarator.getNumTypeObjects());
169 return declarator.getTypeObject(chunkIndex).getAttrListRef();
192 /// declarator worked out to the given type.
208 return const_cast<DeclSpec&>(declarator.getDeclSpec());
308 /// Given the index of a declarator chunk, check whether that chunk
314 static DeclaratorChunk *maybeMovePastReturnType(Declarator &declarator,
316 assert(i <= declarator.getNumTypeObjects());
320 // First, look inwards past parens for a function declarator.
322 DeclaratorChunk &fnChunk = declarator.getTypeObject(i-1);
335 // If we do find a function declarator, scan inwards from that,
336 // looking for a block-pointer declarator.
339 DeclaratorChunk &blockChunk = declarator.getTypeObject(i-1);
352 llvm_unreachable("bad declarator chunk kind");
358 llvm_unreachable("bad declarator chunk kind");
369 /// declaration *other* than on the declarator itself (for which, use
376 Declarator &declarator = state.getDeclarator();
378 // Move it to the outermost normal or block pointer declarator.
380 DeclaratorChunk &chunk = declarator.getTypeObject(i-1);
389 destChunk = maybeMovePastReturnType(declarator, i - 1);
405 if (DeclaratorChunk *dest = maybeMovePastReturnType(declarator, i)) {
425 /// declarator.
430 Declarator &declarator = state.getDeclarator();
436 for (unsigned i = 0, e = declarator.getNumTypeObjects(); i != e; ++i) {
437 DeclaratorChunk &chunk = declarator.getTypeObject(i);
458 // anything in the declarator.
465 moveAttrFromListToList(attr, declarator.getAttrListRef(),
466 declarator.getMutableDeclSpec().getAttributes().getListRef());
474 moveAttrFromListToList(attr, declarator.getAttrListRef(),
475 declarator.getTypeObject(innermost).getAttrListRef());
480 spliceAttrOutOfList(attr, declarator.getAttrListRef());
485 /// *other* than on the declarator itself or in the decl spec. Given
491 Declarator &declarator = state.getDeclarator();
496 DeclaratorChunk &chunk = declarator.getTypeObject(i-1);
524 Declarator &declarator = state.getDeclarator();
527 for (unsigned i = 0, e = declarator.getNumTypeObjects(); i != e; ++i) {
528 DeclaratorChunk &chunk = declarator.getTypeObject(i);
566 // If that failed, diagnose the bad attribute when the declarator is
571 /// A function type attribute was written on the declarator. Try to
577 Declarator &declarator = state.getDeclarator();
581 declarator.getAttrListRef(),
585 // If that failed, diagnose the bad attribute when the declarator is
587 spliceAttrOutOfList(attr, declarator.getAttrListRef());
591 /// \brief Given that there are attributes written on the declarator
593 /// declarator chunk.
602 // Collect all the type attributes from the declarator itself.
603 assert(state.getDeclarator().getAttributes() && "declarator has no attrs!");
634 /// Add a synthetic '()' to a block-literal declarator if it is
638 Declarator &declarator = state.getDeclarator();
640 // First, check whether the declarator would produce a function,
642 if (declarator.isFunctionDeclarator()) {
643 // If so, make that declarator a prototyped declarator.
644 declarator.getFunctionTypeInfo().hasPrototype = true;
650 // block signature declarator is always an abstract-declarator, and
654 if (!declarator.getNumTypeObjects() && declSpecType->isFunctionType())
662 // Otherwise, we need to fake up a function declarator.
663 SourceLocation loc = declarator.getLocStart();
665 // ...and *prepend* it to the declarator.
667 declarator.AddInnermostTypeInfo(DeclaratorChunk::getFunction(
687 loc, loc, declarator));
691 assert(state.getCurrentChunkIndex() == declarator.getNumTypeObjects() - 1);
692 state.setCurrentChunkIndex(declarator.getNumTypeObjects());
697 /// \param state Specifies the declarator containing the declaration specifier
706 Declarator &declarator = state.getDeclarator();
707 const DeclSpec &DS = declarator.getDeclSpec();
708 SourceLocation DeclLoc = declarator.getIdentifierLoc();
769 if (declarator.getContext() == Declarator::LambdaExprContext ||
770 isOmittedBlockReturnType(declarator)) {
804 declarator.setInvalidType(true);
872 declarator.setInvalidType(true);
881 declarator.setInvalidType(true);
892 declarator.setInvalidType(true);
917 declarator.setInvalidType(true);
945 declarator.setInvalidType(true);
969 declarator.setInvalidType(true);
980 declarator.setInvalidType(true);
992 declarator.setInvalidType(true);
1012 declarator.setInvalidType(true);
1050 declarator.setInvalidType(true);
1075 // function declarator if necessary.
1076 if (declarator.getContext() == Declarator::BlockLiteralContext)
1351 // A declarator that specifies the type "reference to cv void"
1782 Declarator &declarator = state.getDeclarator();
1786 // Check whether the declarator
1791 for (unsigned i = 0, e = declarator.getNumTypeObjects(); i != e; ++i) {
1793 DeclaratorChunk &chunk = declarator.getTypeObject(chunkIndex);
1857 DeclaratorChunk &chunk = declarator.getTypeObject(outermostPointerIndex);
1924 Declarator &D = state.getDeclarator();
1941 // Owned declaration is embedded in declarator.
1968 // In C++11, a function declarator using 'auto' must have a trailing return
1976 case Declarator::KNRTypeListContext:
1978 case Declarator::LambdaExprContext:
1980 case Declarator::ObjCParameterContext:
1981 case Declarator::ObjCResultContext:
1982 case Declarator::PrototypeContext:
1985 case Declarator::MemberContext:
1996 case Declarator::CXXCatchContext:
1997 case Declarator::ObjCCatchContext:
2000 case Declarator::TemplateParamContext:
2003 case Declarator::BlockLiteralContext:
2006 case Declarator::TemplateTypeArgContext:
2009 case Declarator::AliasDeclContext:
2010 case Declarator::AliasTemplateContext:
2013 case Declarator::TrailingReturnContext:
2016 case Declarator::TypeNameContext:
2019 case Declarator::FileContext:
2020 case Declarator::BlockContext:
2021 case Declarator::ForContext:
2022 case Declarator::ConditionContext:
2023 case Declarator::CXXNewContext:
2030 // In Objective-C it is an error to use 'auto' on a function declarator.
2034 // C++11 [dcl.spec.auto]p2: 'auto' is always fine if the declarator
2036 // level. Check all declarator chunks (outermost first) anyway, to give
2069 case Declarator::TrailingReturnContext:
2074 case Declarator::FileContext:
2075 case Declarator::MemberContext:
2076 case Declarator::BlockContext:
2077 case Declarator::ForContext:
2078 case Declarator::BlockLiteralContext:
2079 case Declarator::LambdaExprContext:
2084 case Declarator::AliasDeclContext:
2086 case Declarator::AliasTemplateContext:
2092 case Declarator::TypeNameContext:
2093 case Declarator::TemplateParamContext:
2094 case Declarator::CXXNewContext:
2095 case Declarator::CXXCatchContext:
2096 case Declarator::ObjCCatchContext:
2097 case Declarator::TemplateTypeArgContext:
2103 case Declarator::PrototypeContext:
2104 case Declarator::ObjCParameterContext:
2105 case Declarator::ObjCResultContext:
2106 case Declarator::KNRTypeListContext:
2114 case Declarator::ConditionContext:
2153 /// can be contained within the declarator chunk DeclType, and produce an
2189 /// declarator and a C++ direct-initializer.
2190 static void warnAboutAmbiguousFunction(Sema &S, Declarator &D,
2207 // Only warn if this declarator is declaring a function at block scope, and
2218 if (D.getContext() == Declarator::ConditionContext)
2289 Declarator &D = state.getDeclarator();
2302 D.getContext() == Declarator::AliasDeclContext ||
2303 D.getContext() == Declarator::AliasTemplateContext;
2399 D.getContext() == Declarator::KNRTypeListContext)) {
2413 // Walk outwards along the declarator chunks.
2443 // If the function declarator has a prototype (i.e. it is not () and
2467 } else if (D.getContext() != Declarator::LambdaExprContext &&
2491 D.getContext() == Declarator::BlockLiteralContext)
2592 << (D.getContext() == Declarator::AliasDeclContext ||
2593 D.getContext() == Declarator::AliasTemplateContext);
2811 // See if there are any attributes on this declarator chunk.
2830 FreeFunction = ((D.getContext() != Declarator::MemberContext &&
2831 D.getContext() != Declarator::LambdaExprContext) ||
2851 D.getContext() != Declarator::TemplateTypeArgContext) {
2899 // Apply any undistributed attributes from the declarator.
2914 // If there was an ellipsis in the declarator, the declaration declares a
2918 // A declarator-id or abstract-declarator containing an ellipsis shall
2922 case Declarator::PrototypeContext:
2926 // of the declarator-id of the function parameter pack shall contain
2942 case Declarator::TemplateParamContext:
2960 case Declarator::FileContext:
2961 case Declarator::KNRTypeListContext:
2962 case Declarator::ObjCParameterContext: // FIXME: special diagnostic here?
2963 case Declarator::ObjCResultContext: // FIXME: special diagnostic here?
2964 case Declarator::TypeNameContext:
2965 case Declarator::CXXNewContext:
2966 case Declarator::AliasDeclContext:
2967 case Declarator::AliasTemplateContext:
2968 case Declarator::MemberContext:
2969 case Declarator::BlockContext:
2970 case Declarator::ForContext:
2971 case Declarator::ConditionContext:
2972 case Declarator::CXXCatchContext:
2973 case Declarator::ObjCCatchContext:
2974 case Declarator::BlockLiteralContext:
2975 case Declarator::LambdaExprContext:
2976 case Declarator::TrailingReturnContext:
2977 case Declarator::TemplateTypeArgContext:
2995 /// declarator to Type instances.
2999 TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
3000 // Determine the type of the declarator. Not all forms of declarator
3031 Declarator &D = state.getDeclarator();
3066 Declarator &D = state.getDeclarator();
3112 TypeSourceInfo *Sema::GetTypeForDeclaratorCast(Declarator &D, QualType FromTy) {
3248 // If we got no declarator info from previous Sema routines,
3466 llvm_unreachable("unsupported TypeLoc kind in declarator!");
3480 Sema::GetTypeSourceInfoForDeclarator(Declarator &D, QualType T,
3534 TypeResult Sema::ActOnTypeName(Scope *S, Declarator &D) {
3544 // Make sure there are no unused decl attributes on the declarator.
3549 if (D.getContext() != Declarator::ObjCParameterContext &&
3550 D.getContext() != Declarator::AliasDeclContext &&
3551 D.getContext() != Declarator::AliasTemplateContext)
3690 Declarator &D = state.getDeclarator();
4346 declarator chunk must appertain to a type.