clang 10.0.0git

Classes | Namespaces | Functions
ParseObjc.cpp File Reference
`#include "clang/Parse/Parser.h"`
`#include "clang/AST/ASTContext.h"`
`#include "clang/AST/PrettyDeclStackTrace.h"`
`#include "clang/Basic/CharInfo.h"`
`#include "clang/Parse/ParseDiagnostic.h"`
`#include "clang/Parse/RAIIObjectsForParser.h"`
`#include "clang/Sema/DeclSpec.h"`
`#include "clang/Sema/Scope.h"`
`#include "llvm/ADT/SmallVector.h"`
`#include "llvm/ADT/StringExtras.h"`
Include dependency graph for ParseObjc.cpp:

Go to the source code of this file.

## Classes
class | clang::Parser::ObjCTypeParamListScope
| Class to handle popping type parameters when leaving the scope. More...

## Namespaces
| OBJC2
| objc-class-instance-variables: '{' objc-instance-variable-decl-list[opt] '}'

## Functions
static void | addContextSensitiveTypeNullability (Parser &P, Declarator &D, NullabilityKind nullability, SourceLocation nullabilityLoc, bool &addedToDeclSpec)
| Add an attribute for a context-sensitive type nullability to the given declarator. More...
static void | diagnoseRedundantPropertyNullability (Parser &P, ObjCDeclSpec &DS, NullabilityKind nullability, SourceLocation nullabilityLoc)
| Diagnose redundant or conflicting nullability information. More...
static void | takeDeclAttributes (ParsedAttributesView &attrs, ParsedAttributesView &from)
| Take all the decl attributes out of the given list and add them to the given attribute set. More...
static void | takeDeclAttributes (ParsedAttributes &attrs, Declarator &D)
| takeDeclAttributes - Take all the decl attributes from the given declarator and add them to the given list. More...

## Function Documentation

## ◆ addContextSensitiveTypeNullability()

static void addContextSensitiveTypeNullability | ( | Parser & | P,
|  | Declarator & | D,
|  | NullabilityKind | nullability,
|  | SourceLocation | nullabilityLoc,
|  | bool & | addedToDeclSpec
| ) |  |
| static

Add an attribute for a context-sensitive type nullability to the given declarator.

Definition at line 371 of file ParseObjc.cpp.

References clang::ParsedAttributesView::addAtEnd(), clang::AttributeCommonInfo::AS_ContextSensitiveKeyword, clang::SelectorTable::constructSetterSelector(), clang::Parser::ConsumeToken(), clang::Contravariant, clang::Covariant, clang::FixItHint::CreateInsertion(), clang::Parser::Diag(), clang::ObjCDeclSpec::DQ_PR_nullability, clang::FileContext, clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Declarator::getAttributePool(), clang::DeclSpec::getAttributes(), clang::DeclaratorChunk::getAttrs(), clang::Decl::getBeginLoc(), clang::Parser::getCurScope(), clang::ObjCDeclSpec::getGetterName(), clang::Declarator::getMutableDeclSpec(), clang::ObjCDeclSpec::getNullability(), clang::Parser::getNullabilityKeyword(), clang::ObjCDeclSpec::getNullabilityLoc(), clang::Declarator::getNumTypeObjects(), clang::ParsedAttributes::getPool(), clang::ObjCDeclSpec::getPropertyAttributes(), clang::ObjCDeclSpec::getSetterName(), clang::Declarator::getTypeObject(), clang::Invariant, clang::format::FormatToken::is(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::format::FormatToken::isNot(), clang::format::FormatToken::isObjCAtKeyword(), clang::format::FormatToken::isOneOf(), clang::ActionResult< PtrTy, CompressInvalid >::isUsable(), clang::Parser::ParseTypeName(), clang::Sema::PCC_ObjCImplementation, clang::Sema::PCC_ObjCInterface, clang::Property, clang::SourceRange::setBegin(), clang::SourceRange::setEnd(), clang::Parser::SkipUntil(), clang::Parser::StopAtSemi, clang::Parser::StopBeforeMatch, and clang::Parser::TryConsumeToken().

Referenced by takeDeclAttributes().

## ◆ diagnoseRedundantPropertyNullability()

static void diagnoseRedundantPropertyNullability | ( | Parser & | P,
|  | ObjCDeclSpec & | DS,
|  | NullabilityKind | nullability,
|  | SourceLocation | nullabilityLoc
| ) |  |
| static

Diagnose redundant or conflicting nullability information.

Definition at line 799 of file ParseObjc.cpp.

References clang::Parser::ConsumeToken(), clang::Parser::Diag(), clang::ObjCDeclSpec::DQ_PR_assign, clang::ObjCDeclSpec::DQ_PR_atomic, clang::ObjCDeclSpec::DQ_PR_class, clang::ObjCDeclSpec::DQ_PR_copy, clang::ObjCDeclSpec::DQ_PR_direct, clang::ObjCDeclSpec::DQ_PR_getter, clang::ObjCDeclSpec::DQ_PR_nonatomic, clang::ObjCDeclSpec::DQ_PR_null_resettable, clang::ObjCDeclSpec::DQ_PR_nullability, clang::ObjCDeclSpec::DQ_PR_readonly, clang::ObjCDeclSpec::DQ_PR_readwrite, clang::ObjCDeclSpec::DQ_PR_retain, clang::ObjCDeclSpec::DQ_PR_setter, clang::ObjCDeclSpec::DQ_PR_strong, clang::ObjCDeclSpec::DQ_PR_unsafe_unretained, clang::ObjCDeclSpec::DQ_PR_weak, clang::Parser::getCurScope(), clang::Parser::getLangOpts(), clang::IdentifierInfo::getNameStart(), clang::ObjCDeclSpec::getNullability(), clang::ObjCDeclSpec::getNullabilityLoc(), clang::ObjCDeclSpec::getPropertyAttributes(), clang::format::FormatToken::is(), clang::isLetter(), clang::format::FormatToken::isNot(), clang::format::FormatToken::isOneOf(), clang::IdentifierInfo::isStr(), clang::NonNull, clang::Nullable, clang::ObjC, clang::ObjCDeclSpec::setGetterName(), clang::ObjCDeclSpec::setNullability(), clang::ObjCDeclSpec::setPropertyAttributes(), clang::ObjCDeclSpec::setSetterName(), clang::Parser::SkipUntil(), clang::Parser::StopAtSemi, and clang::Unspecified.

## ◆ takeDeclAttributes() [1/2]

static void takeDeclAttributes | ( | ParsedAttributesView & | attrs,
|  | ParsedAttributesView & | from
| ) |  |
| static

Take all the decl attributes out of the given list and add them to the given attribute set.

Definition at line 1207 of file ParseObjc.cpp.

References clang::ParsedAttributesView::addAtEnd(), and clang::ParsedAttributesView::remove().

Referenced by takeDeclAttributes().

## ◆ takeDeclAttributes() [2/2]

static void takeDeclAttributes | ( | ParsedAttributes & | attrs,
|  | Declarator & | D
| ) |  |
| static

takeDeclAttributes - Take all the decl attributes from the given declarator and add them to the given list.

Definition at line 1219 of file ParseObjc.cpp.

References clang::Type::acceptsObjCTypeParams(), addContextSensitiveTypeNullability(), clang::Sema::ObjCArgInfo::ArgAttrs, clang::AS_none, clang::Scope::AtCatchScope, clang::DeclGroupRef::begin(), clang::Scope::ClassScope, ColonLoc, clang::prec::Comma, clang::ParsingDeclRAIIObject::complete(), clang::Scope::CompoundStmtScope, clang::BalancedDelimiterTracker::consumeClose(), clang::BalancedDelimiterTracker::consumeOpen(), clang::Parser::ConsumeToken(), clang::CPlusPlus, clang::CR_ObjCAtFinally, clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateRemoval(), clang::FixItHint::CreateReplacement(), clang::Scope::DeclScope, clang::Sema::ObjCArgInfo::DeclSpec, clang::Parser::Diag(), clang::ObjCDeclSpec::DQ_CSNullability, clang::DeclGroupRef::end(), clang::comments::tok::eof, clang::ExprError(), clang::Scope::FunctionDeclarationScope, clang::Scope::FunctionPrototypeScope, clang::OpaquePtr< PtrTy >::get(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::DeclSpec::getAttributePool(), clang::Declarator::getAttributePool(), clang::DeclSpec::getAttributes(), clang::Declarator::getAttributes(), clang::DeclaratorChunk::getAttrs(), clang::SourceRange::getBegin(), clang::BalancedDelimiterTracker::getCloseLocation(), clang::Parser::getCurScope(), clang::Declarator::getDeclSpec(), clang::OpaquePtr< QualType >::getFromOpaquePtr(), clang::Declarator::getIdentifier(), clang::Token::getIdentifierInfo(), clang::Declarator::getIdentifierLoc(), clang::Parser::getLangOpts(), clang::Token::getLocation(), clang::Declarator::getMutableDeclSpec(), clang::ObjCDeclSpec::getNullability(), clang::ObjCDeclSpec::getNullabilityLoc(), clang::Declarator::getNumTypeObjects(), clang::ObjCDeclSpec::getObjCDeclQualifier(), clang::BalancedDelimiterTracker::getOpenLocation(), clang::ParsedAttributes::getPool(), clang::Parser::getTargetInfo(), clang::TargetInfo::getTriple(), clang::Parser::getTypeAnnotation(), clang::Declarator::getTypeObject(), clang::Token::is(), clang::format::FormatToken::is(), clang::Scope::isInObjcMethodScope(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::Declarator::isInvalidType(), clang::Token::isNot(), clang::format::FormatToken::isNot(), clang::QualType::isNull(), clang::Token::isObjCAtKeyword(), clang::format::FormatToken::isObjCAtKeyword(), clang::Token::isOneOf(), clang::format::FormatToken::isOneOf(), clang::IdentifierInfo::isStr(), clang::ActionResult< PtrTy, CompressInvalid >::isUsable(), clang::SourceLocation::isValid(), clang::Sema::ObjCArgInfo::Name, clang::Sema::ObjCArgInfo::NameLoc, clang::Parser::NextToken(), clang::ParsingDeclRAIIObject::NoParent, clang::ObjC, clang::OBJC_PR_query_class, clang::OBJC_PR_query_unknown, clang::ObjCCatchContext, clang::Parser::ObjCDeclContextSwitch, clang::ObjCParameterContext, clang::ObjCResultContext, clang::Sema::OCK_Implementation, P, clang::Parser::ParseExpression(), clang::Parser::ParseTypeName(), clang::Sema::PCC_ObjCInstanceVariableList, clang::Sema::PCC_Type, clang::PrototypeContext, clang::Result, clang::DeclSpec::setObjCQualifiers(), clang::DeclSpec::SetTypeSpecType(), clang::Parser::SkipUntil(), clang::StmtError(), clang::Parser::StopAtSemi, clang::Parser::StopBeforeMatch, clang::AttributePool::takeAllFrom(), takeDeclAttributes(), clang::Parser::TryAnnotateTypeOrScopeToken(), clang::Parser::TryConsumeToken(), clang::TST_typename, clang::Sema::ObjCArgInfo::Type, and clang::TypeNameContext.