clang 8.0.0

Macros | Enumerations | Functions
SemaType.cpp File Reference
`#include "TypeLocBuilder.h"`
`#include "clang/AST/ASTConsumer.h"`
`#include "clang/AST/ASTContext.h"`
`#include "clang/AST/ASTMutationListener.h"`
`#include "clang/AST/ASTStructuralEquivalence.h"`
`#include "clang/AST/CXXInheritance.h"`
`#include "clang/AST/DeclObjC.h"`
`#include "clang/AST/DeclTemplate.h"`
`#include "clang/AST/Expr.h"`
`#include "clang/AST/TypeLoc.h"`
`#include "clang/AST/TypeLocVisitor.h"`
`#include "clang/Basic/PartialDiagnostic.h"`
`#include "clang/Basic/TargetInfo.h"`
`#include "clang/Lex/Preprocessor.h"`
`#include "clang/Sema/DeclSpec.h"`
`#include "clang/Sema/DelayedDiagnostic.h"`
`#include "clang/Sema/Lookup.h"`
`#include "clang/Sema/ScopeInfo.h"`
`#include "clang/Sema/SemaInternal.h"`
`#include "clang/Sema/Template.h"`
`#include "clang/Sema/TemplateInstCallback.h"`
`#include "llvm/ADT/SmallPtrSet.h"`
`#include "llvm/ADT/SmallString.h"`
`#include "llvm/ADT/StringSwitch.h"`
`#include "llvm/Support/ErrorHandling.h"`
`#include "clang/Basic/OpenCLImageTypes.def"`
Include dependency graph for SemaType.cpp:

Go to the source code of this file.

## Macros
#define | OBJC_POINTER_TYPE_ATTRS_CASELIST
#define | CALLING_CONV_ATTRS_CASELIST
#define | FUNCTION_TYPE_ATTRS_CASELIST
#define | MS_TYPE_ATTRS_CASELIST
#define | NULLABILITY_TYPE_ATTRS_CASELIST
#define | GENERIC_IMAGE_TYPE(ImgType, Id)
#define | IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix)

## Enumerations
enum | TypeDiagSelector { TDS_Function, TDS_Pointer, TDS_ObjCObjOrBlock }
enum | TypeAttrLocation { TAL_DeclSpec, TAL_DeclChunk, TAL_DeclName }
| The location of a type attribute. More...
enum | QualifiedFunctionKind
| Kinds of declarator that cannot contain a qualified function type. More...
enum | SimplePointerKind
| A simple notion of pointer kinds, which matches up with the various pointer declarators. More...
enum | PointerDeclaratorKind
| Describes the kind of a pointer a declarator describes. More...
enum | PointerWrappingDeclaratorKind
| Describes a declarator chunk wrapping a pointer that marks inference as unexpected. More...

## Functions
static bool | isOmittedBlockReturnType (const Declarator &D)
| isOmittedBlockReturnType - Return true if this declarator is missing a return type because this is a omitted return type on a block literal. More...
static void | diagnoseBadTypeAttribute (Sema &S, const ParsedAttr &attr, QualType type)
| diagnoseBadTypeAttribute - Diagnoses a type attribute which doesn't apply to the given type. More...
static void | moveAttrFromListToList (ParsedAttr &attr, ParsedAttributesView &fromList, ParsedAttributesView &toList)
static void | processTypeAttrs (TypeProcessingState &state, QualType &type, TypeAttrLocation TAL, ParsedAttributesView &attrs)
static bool | handleFunctionTypeAttr (TypeProcessingState &state, ParsedAttr &attr, QualType &type)
| Process an individual function attribute. More...
static bool | handleMSPointerTypeQualifierAttr (TypeProcessingState &state, ParsedAttr &attr, QualType &type)
static bool | handleObjCGCTypeAttr (TypeProcessingState &state, ParsedAttr &attr, QualType &type)
| handleObjCGCTypeAttr - Process the attribute((objc_gc)) type attribute on the specified type. More...
static bool | handleObjCOwnershipTypeAttr (TypeProcessingState &state, ParsedAttr &attr, QualType &type)
| handleObjCOwnershipTypeAttr - Process an objc_ownership attribute on the specified type. More...
static bool | handleObjCPointerTypeAttr (TypeProcessingState &state, ParsedAttr &attr, QualType &type)
static DeclaratorChunk * | maybeMovePastReturnType (Declarator &declarator, unsigned i, bool onlyBlockPointers)
| Given the index of a declarator chunk, check whether that chunk directly specifies the return type of a function and, if so, find an appropriate place for it. More...
static void | distributeObjCPointerTypeAttr (TypeProcessingState &state, ParsedAttr &attr, QualType type)
| Given that an objc_gc attribute was written somewhere on a declaration other than on the declarator itself (for which, use distributeObjCPointerTypeAttrFromDeclarator), and given that it didn't apply in whatever position it was written in, try to move it to a more appropriate position. More...
static void | distributeObjCPointerTypeAttrFromDeclarator (TypeProcessingState &state, ParsedAttr &attr, QualType &declSpecType)
| Distribute an objc_gc type attribute that was written on the declarator. More...
static void | distributeFunctionTypeAttr (TypeProcessingState &state, ParsedAttr &attr, QualType type)
| A function type attribute was written somewhere in a declaration other than on the declarator itself or in the decl spec. More...
static bool | distributeFunctionTypeAttrToInnermost (TypeProcessingState &state, ParsedAttr &attr, ParsedAttributesView &attrList, QualType &declSpecType)
| Try to distribute a function type attribute to the innermost function chunk or type. More...
static void | distributeFunctionTypeAttrFromDeclSpec (TypeProcessingState &state, ParsedAttr &attr, QualType &declSpecType)
| A function type attribute was written in the decl spec. More...
static void | distributeFunctionTypeAttrFromDeclarator (TypeProcessingState &state, ParsedAttr &attr, QualType &declSpecType)
| A function type attribute was written on the declarator. More...
static void | distributeTypeAttrsFromDeclarator (TypeProcessingState &state, QualType &declSpecType)
| Given that there are attributes written on the declarator itself, try to distribute any type attributes to the appropriate declarator chunk. More...
static void | maybeSynthesizeBlockSignature (TypeProcessingState &state, QualType declSpecType)
| Add a synthetic '()' to a block-literal declarator if it is required, given the return type. More...
static void | diagnoseAndRemoveTypeQualifiers (Sema &S, const DeclSpec &DS, unsigned &TypeQuals, QualType TypeSoFar, unsigned RemoveTQs, unsigned DiagID)
static bool | checkOmittedBlockReturnType (Sema &S, Declarator &declarator, QualType Result)
| Return true if this is omitted block return type. More...
static QualType | applyObjCTypeArgs (Sema &S, SourceLocation loc, QualType type, ArrayRef< TypeSourceInfo *> typeArgs, SourceRange typeArgsRange, bool failOnError=false)
| Apply Objective-C type arguments to the given type. More...
static OpenCLAccessAttr::Spelling | getImageAccess (const ParsedAttributesView &Attrs)
static QualType | ConvertDeclSpecToType (TypeProcessingState &state)
| Convert the specified declspec to the appropriate type object. More...
static std::string | getPrintableNameForEntity (DeclarationName Entity)
static QualType | inferARCLifetimeForPointee (Sema &S, QualType type, SourceLocation loc, bool isReference)
| Given that we're building a pointer or reference to the given. More...
static std::string | getFunctionQualifiersAsString (const FunctionProtoType *FnTy)
static bool | checkQualifiedFunction (Sema &S, QualType T, SourceLocation Loc, QualifiedFunctionKind QFK)
| Check whether the type T is a qualified function type, and if it is, diagnose that it cannot be contained within the given kind of declarator. More...
static bool | isArraySizeVLA (Sema &S, Expr *ArraySize, llvm::APSInt &SizeVal)
| Check whether the specified array size makes the array type a VLA. More...
static void | checkExtParameterInfos (Sema &S, ArrayRef< QualType > paramTypes, const FunctionProtoType::ExtProtoInfo &EPI, llvm::function_ref< SourceLocation(unsigned)> getParamLoc)
| Check the extended parameter information. More...
static void | transferARCOwnershipToDeclaratorChunk (TypeProcessingState &state, Qualifiers::ObjCLifetime ownership, unsigned chunkIndex)
static void | inferARCWriteback (TypeProcessingState &state, QualType &declSpecType)
| Given that this is the declaration of a parameter under ARC, attempt to infer attributes and such for pointer-to-whatever types. More...
static void | diagnoseRedundantReturnTypeQualifiers (Sema &S, QualType RetTy, Declarator &D, unsigned FunctionChunkIndex)
static QualType | GetDeclSpecTypeForDeclarator (TypeProcessingState &state, TypeSourceInfo *&ReturnTypeInfo)
static void | warnAboutAmbiguousFunction (Sema &S, Declarator &D, DeclaratorChunk &DeclType, QualType RT)
| Produce an appropriate diagnostic for an ambiguity between a function declarator and a C++ direct-initializer. More...
static void | warnAboutRedundantParens (Sema &S, Declarator &D, QualType T)
| Produce an appropriate diagnostic for a declarator with top-level parentheses. More...
static CallingConv | getCCForDeclaratorChunk (Sema &S, Declarator &D, const ParsedAttributesView &AttrList, const DeclaratorChunk::FunctionTypeInfo &FTI, unsigned ChunkIndex)
| Helper for figuring out the default CC for a function declarator type. More...
static bool | hasNullabilityAttr (const ParsedAttributesView &attrs)
| Check whether there is a nullability attribute of any kind in the given attribute list. More...
static PointerDeclaratorKind | classifyPointerDeclarator (Sema &S, QualType type, Declarator &declarator, PointerWrappingDeclaratorKind &wrappingKind)
| Classify the given declarator, whose type-specified is `type`, based on what kind of pointer it refers to. More...
static FileID | getNullabilityCompletenessCheckFileID (Sema &S, SourceLocation loc)
static void | fixItNullability (Sema &S, DiagnosticBuilder &Diag, SourceLocation PointerLoc, NullabilityKind Nullability)
| Creates a fix-it to insert a C-style nullability keyword at `pointerLoc`, taking into account whitespace before and after. More...
static void | emitNullabilityConsistencyWarning (Sema &S, SimplePointerKind PointerKind, SourceLocation PointerLoc, SourceLocation PointerEndLoc)
static void | checkNullabilityConsistency (Sema &S, SimplePointerKind pointerKind, SourceLocation pointerLoc, SourceLocation pointerEndLoc=SourceLocation())
| Complains about missing nullability if the file containing `pointerLoc` has other uses of nullability (either the keywords or the `assume_nonnull` pragma). More...
static void | recordNullabilitySeen (Sema &S, SourceLocation loc)
| Marks that a nullability feature has been used in the file containing `loc`. More...
static bool | hasOuterPointerLikeChunk (const Declarator &D, unsigned endIndex)
| Returns true if any of the declarator chunks before `endIndex` include a level of indirection: array, pointer, reference, or pointer-to-member. More...
static bool | IsNoDerefableChunk (DeclaratorChunk Chunk)
template<typename AttrT >
static AttrT * | createSimpleAttr (ASTContext &Ctx, ParsedAttr &Attr)
static Attr * | createNullabilityAttr (ASTContext &Ctx, ParsedAttr &Attr, NullabilityKind NK)
static TypeSourceInfo * | GetTypeSourceInfoForDeclarator (TypeProcessingState &State, QualType T, TypeSourceInfo *ReturnTypeInfo)
| Create and instantiate a TypeSourceInfo with type source information. More...
static TypeSourceInfo * | GetFullTypeForDeclarator (TypeProcessingState &state, QualType declSpecType, TypeSourceInfo *TInfo)
static void | transferARCOwnershipToDeclSpec (Sema &S, QualType &declSpecTy, Qualifiers::ObjCLifetime ownership)
static void | transferARCOwnership (TypeProcessingState &state, QualType &declSpecTy, Qualifiers::ObjCLifetime ownership)
| Used for transferring ownership in casts resulting in l-values. More...
static void | fillAttributedTypeLoc (AttributedTypeLoc TL, TypeProcessingState &State)
static void | fillAtomicQualLoc (AtomicTypeLoc ATL, const DeclaratorChunk &Chunk)
static void | fillDependentAddressSpaceTypeLoc (DependentAddressSpaceTypeLoc DASTL, const ParsedAttributesView &Attrs)
static void | HandleAddressSpaceTypeAttribute (QualType &Type, const ParsedAttr &Attr, TypeProcessingState &State)
| HandleAddressSpaceTypeAttribute - Process an address_space attribute on the specified type. More...
static bool | hasDirectOwnershipQualifier (QualType type)
| Does this type have a "direct" ownership qualifier? That is, is it written like "__strong id", as opposed to something like "typeof(foo)", where that happens to be strong? More...
static NullabilityKind | mapNullabilityAttrKind (ParsedAttr::Kind kind)
| Map a nullability attribute kind to a nullability kind. More...
static bool | checkNullabilityTypeSpecifier (TypeProcessingState &state, QualType &type, ParsedAttr &attr, bool allowOnArrayType)
| Applies a nullability type specifier to the given type, if possible. More...
static bool | checkObjCKindOfType (TypeProcessingState &state, QualType &type, ParsedAttr &attr)
| Check the application of the Objective-C '__kindof' qualifier to the given type. More...
static bool | distributeNullabilityTypeAttr (TypeProcessingState &state, QualType type, ParsedAttr &attr)
| Distribute a nullability type attribute that cannot be applied to the type specifier to a pointer, block pointer, or member pointer declarator, complaining if necessary. More...
static Attr * | getCCTypeAttr (ASTContext &Ctx, ParsedAttr &Attr)
static void | HandleVectorSizeAttr (QualType &CurType, const ParsedAttr &Attr, Sema &S)
| HandleVectorSizeAttribute - this attribute is only applicable to integral and float scalars, although arrays, pointers, and function return values are allowed in conjunction with this construct. More...
static void | HandleExtVectorTypeAttr (QualType &CurType, const ParsedAttr &Attr, Sema &S)
| Process the OpenCL-like ext_vector_type attribute when it occurs on a type. More...
static bool | isPermittedNeonBaseType (QualType &Ty, VectorType::VectorKind VecKind, Sema &S)
static void | HandleNeonVectorTypeAttr (QualType &CurType, const ParsedAttr &Attr, Sema &S, VectorType::VectorKind VecKind)
| HandleNeonVectorTypeAttr - The "neon_vector_type" and "neon_polyvector_type" attributes are used to create vector types that are mangled according to ARM's ABI. More...
static void | HandleOpenCLAccessAttr (QualType &CurType, const ParsedAttr &Attr, Sema &S)
| Handle OpenCL Access Qualifier Attribute. More...
static void | deduceOpenCLImplicitAddrSpace (TypeProcessingState &State, QualType &T, TypeAttrLocation TAL)
static void | HandleLifetimeBoundAttr (TypeProcessingState &State, QualType &CurType, ParsedAttr &Attr)
static void | assignInheritanceModel (Sema &S, CXXRecordDecl *RD)
| Locks in the inheritance model for the given class and all of its bases. More...
static unsigned | getLiteralDiagFromTagKind (TagTypeKind Tag)
| Get diagnostic select index for tag kind for literal type diagnostic message. More...
static QualType | getDecltypeForExpr (Sema &S, Expr *E)
| getDecltypeForExpr - Given an expr, will return the decltype for that expression, according to the rules in C++11 [dcl.type.simple]p4 and C++11 [expr.lambda.prim]p18. More...

## Macro Definition Documentation

## ◆ CALLING_CONV_ATTRS_CASELIST

#define CALLING_CONV_ATTRS_CASELIST

Value:
case ParsedAttr::AT_CDecl: \
case ParsedAttr::AT_FastCall: \
case ParsedAttr::AT_StdCall: \
case ParsedAttr::AT_ThisCall: \
case ParsedAttr::AT_RegCall: \
case ParsedAttr::AT_Pascal: \
case ParsedAttr::AT_SwiftCall: \
case ParsedAttr::AT_VectorCall: \
case ParsedAttr::AT_AArch64VectorPcs: \
case ParsedAttr::AT_MSABI: \
case ParsedAttr::AT_SysVABI: \
case ParsedAttr::AT_Pcs: \
case ParsedAttr::AT_IntelOclBicc: \
case ParsedAttr::AT_PreserveMost: \
case ParsedAttr::AT_PreserveAll

Definition at line 110 of file SemaType.cpp.

Referenced by getCCForDeclaratorChunk().

## ◆ FUNCTION_TYPE_ATTRS_CASELIST

#define FUNCTION_TYPE_ATTRS_CASELIST

Value:
case ParsedAttr::AT_NSReturnsRetained: \
case ParsedAttr::AT_NoReturn: \
case ParsedAttr::AT_Regparm: \
case ParsedAttr::AT_AnyX86NoCallerSavedRegisters: \
case ParsedAttr::AT_AnyX86NoCfCheck: \
CALLING_CONV_ATTRS_CASELIST

Definition at line 128 of file SemaType.cpp.

Referenced by distributeTypeAttrsFromDeclarator(), and processTypeAttrs().

## ◆ GENERIC_IMAGE_TYPE

#define GENERIC_IMAGE_TYPE | ( |  | ImgType,
|  |  | Id
| ) |  |

Value:
case DeclSpec::TST_##ImgType##_t: \
switch (getImageAccess(DS.getAttributes())) { \
case OpenCLAccessAttr::Keyword_write_only: \
Result = Context.Id##WOTy; \
break; \
case OpenCLAccessAttr::Keyword_read_write: \
Result = Context.Id##RWTy; \
break; \
case OpenCLAccessAttr::Keyword_read_only: \
Result = Context.Id##ROTy; \
break; \
} \
break;
getImageAccess
static OpenCLAccessAttr::Spelling getImageAccess(const ParsedAttributesView &Attrs)
Definition: SemaType.cpp:1217

## ◆ IMAGE_TYPE

#define IMAGE_TYPE | ( |  | ImgType,
|  |  | Id,
|  |  | SingletonId,
|  |  | Access,
|  |  | Suffix
| ) |  |

Value:
case BuiltinType::Id: \
PrevAccessQual = #Access; \
break;
Id
int Id
Definition: ASTDiff.cpp:191

## ◆ MS_TYPE_ATTRS_CASELIST

#define MS_TYPE_ATTRS_CASELIST

Value:
case ParsedAttr::AT_Ptr32: \
case ParsedAttr::AT_Ptr64: \
case ParsedAttr::AT_SPtr: \
case ParsedAttr::AT_UPtr

Definition at line 137 of file SemaType.cpp.

Referenced by distributeTypeAttrsFromDeclarator(), and processTypeAttrs().

## ◆ NULLABILITY_TYPE_ATTRS_CASELIST

#define NULLABILITY_TYPE_ATTRS_CASELIST

Value:
case ParsedAttr::AT_TypeNonNull: \
case ParsedAttr::AT_TypeNullable: \
case ParsedAttr::AT_TypeNullUnspecified

Definition at line 144 of file SemaType.cpp.

Referenced by distributeTypeAttrsFromDeclarator(), and processTypeAttrs().

## ◆ OBJC_POINTER_TYPE_ATTRS_CASELIST

#define OBJC_POINTER_TYPE_ATTRS_CASELIST

Value:
case ParsedAttr::AT_ObjCGC: \
case ParsedAttr::AT_ObjCOwnership

Definition at line 105 of file SemaType.cpp.

Referenced by distributeTypeAttrsFromDeclarator(), and processTypeAttrs().

## Enumeration Type Documentation

## ◆ PointerDeclaratorKind

enum PointerDeclaratorKind
| strong

Describes the kind of a pointer a declarator describes.

Definition at line 3511 of file SemaType.cpp.

## ◆ PointerWrappingDeclaratorKind

enum PointerWrappingDeclaratorKind
| strong

Describes a declarator chunk wrapping a pointer that marks inference as unexpected.

Definition at line 3529 of file SemaType.cpp.

## ◆ QualifiedFunctionKind

enum QualifiedFunctionKind

Kinds of declarator that cannot contain a qualified function type.

C++98 [dcl.fct]p4 / C++11 [dcl.fct]p6: a function type with a cv-qualifier or a ref-qualifier can only appear at the topmost level of a type.

Parens and member pointers are permitted. We don't diagnose array and function declarators, because they don't allow function types at all.

The values of this enum are used in diagnostics.

Definition at line 1909 of file SemaType.cpp.

## ◆ SimplePointerKind

enum SimplePointerKind
| strong

A simple notion of pointer kinds, which matches up with the various pointer declarators.

Definition at line 3460 of file SemaType.cpp.

## ◆ TypeAttrLocation

enum TypeAttrLocation

The location of a type attribute.

Enumerator
TAL_DeclSpec | The attribute is in the decl-specifier-seq.
TAL_DeclChunk | The attribute is part of a DeclaratorChunk.
TAL_DeclName | The attribute is immediately after the declaration's name.

Definition at line 318 of file SemaType.cpp.

## ◆ TypeDiagSelector

enum TypeDiagSelector

Enumerator
TDS_Function |
TDS_Pointer |
TDS_ObjCObjOrBlock |

Definition at line 42 of file SemaType.cpp.

## Function Documentation

## ◆ applyObjCTypeArgs()

static QualType applyObjCTypeArgs | ( | Sema & | S,
|  | SourceLocation | loc,
|  | QualType | type,
|  | ArrayRef< TypeSourceInfo *> | typeArgs,
|  | SourceRange | typeArgsRange,
|  | bool | failOnError = `false`
| ) |  |
| static

Apply Objective-C type arguments to the given type.

Definition at line 802 of file SemaType.cpp.

Referenced by clang::Sema::BuildObjCObjectType().

## ◆ assignInheritanceModel()

static void assignInheritanceModel | ( | Sema & | S,
|  | CXXRecordDecl * | RD
| ) |  |
| static

Locks in the inheritance model for the given class and all of its bases.

Definition at line 7721 of file SemaType.cpp.

References clang::Decl::addAttr(), clang::ASTConsumer::AssignInheritanceModel(), clang::CXXRecordDecl::calculateInheritanceModel(), clang::Sema::Consumer, clang::Type::getAs(), clang::Sema::getASTContext(), clang::CXXRecordDecl::getMostRecentNonInjectedDecl(), clang::TagDecl::getSourceRange(), clang::Decl::hasAttr(), clang::Sema::ImplicitMSInheritanceAttrLoc, clang::SourceLocation::isValid(), clang::Sema::MSPointerToMemberRepresentationMethod, clang::LangOptions::PPTMK_BestCase, clang::LangOptions::PPTMK_FullGeneralityMultipleInheritance, clang::LangOptions::PPTMK_FullGeneralitySingleInheritance, and clang::LangOptions::PPTMK_FullGeneralityVirtualInheritance.

## ◆ checkExtParameterInfos()

static void checkExtParameterInfos | ( | Sema & | S,
|  | ArrayRef< QualType > | paramTypes,
|  | const FunctionProtoType::ExtProtoInfo & | EPI,
|  | llvm::function_ref< SourceLocation(unsigned)> | getParamLoc
| ) |  |
| static

Check the extended parameter information.

Most of the necessary checking should occur when applying the parameter attribute; the only other checks required are positional restrictions.

Definition at line 2429 of file SemaType.cpp.

## ◆ checkNullabilityConsistency()

static void checkNullabilityConsistency | ( | Sema & | S,
|  | SimplePointerKind | pointerKind,
|  | SourceLocation | pointerLoc,
|  | SourceLocation | pointerEndLoc = `SourceLocation()`
| ) |  |
| static

Complains about missing nullability if the file containing `pointerLoc` has other uses of nullability (either the keywords or the `assume_nonnull` pragma).

If the file has not seen other uses of nullability, this particular pointer is saved for possible later diagnosis. See recordNullabilitySeen().

Definition at line 3803 of file SemaType.cpp.

References clang::Sema::Context, emitNullabilityConsistencyWarning(), clang::ASTContext::getDiagnostics(), getNullabilityCompletenessCheckFileID(), clang::DiagnosticsEngine::isIgnored(), clang::FileID::isInvalid(), clang::SourceLocation::isInvalid(), clang::Sema::NullabilityMap, clang::FileNullability::PointerEndLoc, clang::FileNullability::PointerKind, clang::FileNullability::PointerLoc, and clang::FileNullability::SawTypeNullability.

## ◆ checkNullabilityTypeSpecifier()

static bool checkNullabilityTypeSpecifier | ( | TypeProcessingState & | state,
|  | QualType & | type,
|  | ParsedAttr & | attr,
|  | bool | allowOnArrayType
| ) |  |
| static

Applies a nullability type specifier to the given type, if possible.

Parameters

  state | The type processing state.
  type | The type to which the nullability specifier will be added. On success, this type will be updated appropriately.
  attr | The attribute as written on the type.
  allowOnArrayType | Whether to accept nullability specifiers on an array type (e.g., because it will decay to a pointer).

Returns
  true if a problem has been diagnosed, false on success.

Definition at line 6440 of file SemaType.cpp.

References clang::Type::canHaveNullability(), clang::Sema::Context, createNullabilityAttr(), clang::FixItHint::CreateRemoval(), clang::FixItHint::CreateReplacement(), clang::Sema::Diag(), clang::Type::getArrayElementTypeNoTypeQual(), clang::Type::getAs(), clang::ParsedAttr::getKind(), clang::ParsedAttr::getLoc(), clang::Decl::getLocation(), clang::Type::getNullability(), clang::getNullabilitySpelling(), clang::Type::getPointeeType(), clang::QualType::getTypePtr(), clang::TypedefNameDecl::getUnderlyingType(), clang::Type::isAnyPointerType(), clang::Type::isArrayType(), clang::ParsedAttr::isContextSensitiveKeywordAttribute(), clang::Type::isMemberPointerType(), clang::Type::isObjCObjectPointerType(), mapNullabilityAttrKind(), recordNullabilitySeen(), clang::AttributedType::stripOuterNullability(), clang::ast_matchers::type, clang::ast_matchers::typedefDecl, and clang::ast_matchers::typedefType.

Referenced by processTypeAttrs().

## ◆ checkObjCKindOfType()

static bool checkObjCKindOfType | ( | TypeProcessingState & | state,
|  | QualType & | type,
|  | ParsedAttr & | attr
| ) |  |
| static

Check the application of the Objective-C '__kindof' qualifier to the given type.

Definition at line 6544 of file SemaType.cpp.

References clang::Sema::Context, createNullabilityAttr(), clang::Sema::Diag(), false, clang::Type::getAs(), clang::ParsedAttr::getAttributeSpellingListIndex(), clang::ParsedAttr::getLoc(), clang::Type::getNullability(), clang::ASTContext::getObjCObjectPointerType(), clang::ASTContext::getObjCObjectType(), and clang::ObjCObjectPointerType::getObjectType().

Referenced by processTypeAttrs().

## ◆ checkOmittedBlockReturnType()

static bool checkOmittedBlockReturnType | ( | Sema & | S,
|  | Declarator & | declarator,
|  | QualType | Result
| ) |  |
| static

Return true if this is omitted block return type.

Also check type attributes and type qualifiers when returning true.

Definition at line 772 of file SemaType.cpp.

## ◆ checkQualifiedFunction()

static bool checkQualifiedFunction | ( | Sema & | S,
|  | QualType | T,
|  | SourceLocation | Loc,
|  | QualifiedFunctionKind | QFK
| ) |  |
| static

Check whether the type T is a qualified function type, and if it is, diagnose that it cannot be contained within the given kind of declarator.

Definition at line 1914 of file SemaType.cpp.

Referenced by clang::Sema::BuildBlockPointerType(), and clang::Sema::BuildPointerType().

## ◆ classifyPointerDeclarator()

static PointerDeclaratorKind classifyPointerDeclarator | ( | Sema & | S,
|  | QualType | type,
|  | Declarator & | declarator,
|  | PointerWrappingDeclaratorKind & | wrappingKind
| ) |  |
| static

Classify the given declarator, whose type-specified is `type`, based on what kind of pointer it refers to.

This is used to determine the default nullability.

Definition at line 3544 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, clang::Sema::CFError, clang::DeclaratorChunk::Function, clang::Type::getAs(), clang::Decl::getAttr(), clang::Sema::getNSErrorIdent(), clang::Declarator::getNumTypeObjects(), clang::Type::getPointeeType(), clang::TagDecl::getTagKind(), clang::Declarator::getTypeObject(), clang::Type::isDependentType(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::MemberPointer, clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, clang::ast_matchers::recordDecl, clang::ast_matchers::recordType, clang::DeclaratorChunk::Reference, and clang::TTK_Struct.

## ◆ ConvertDeclSpecToType()

static QualType ConvertDeclSpecToType | ( | TypeProcessingState & | state | ) |
| static

Convert the specified declspec to the appropriate type object.

Parameters

  state | Specifies the declarator containing the declaration specifier to be converted, along with other associated processing state.

Returns
  The type described by the declaration specifiers. This function never returns null.

Definition at line 1230 of file SemaType.cpp.

Referenced by GetDeclSpecTypeForDeclarator().

## ◆ createNullabilityAttr()

static Attr* createNullabilityAttr | ( | ASTContext & | Ctx,
|  | ParsedAttr & | Attr,
|  | NullabilityKind | NK
| ) |  |
| static

Definition at line 3909 of file SemaType.cpp.

References GetTypeSourceInfoForDeclarator(), clang::NonNull, clang::Nullable, State, and clang::Unspecified.

Referenced by checkNullabilityTypeSpecifier(), and checkObjCKindOfType().

## ◆ createSimpleAttr()

template<typename AttrT >

static AttrT* createSimpleAttr | ( | ASTContext & | Ctx,
|  | ParsedAttr & | Attr
| ) |  |
| static

Definition at line 3903 of file SemaType.cpp.

References clang::ParsedAttr::getAttributeSpellingListIndex(), clang::ParsedAttr::getRange(), and clang::ParsedAttr::setUsedAsTypeAttr().

## ◆ deduceOpenCLImplicitAddrSpace()

static void deduceOpenCLImplicitAddrSpace | ( | TypeProcessingState & | State,
|  | QualType & | T,
|  | TypeAttrLocation | TAL
| ) |  |
| static

Definition at line 7203 of file SemaType.cpp.

References clang::DeclaratorChunk::BlockPointer, clang::Default, clang::FileContext, clang::DeclaratorChunk::Function, clang::Declarator::getContext(), clang::Declarator::getDeclSpec(), clang::Declarator::getNumTypeObjects(), clang::DeclSpec::getStorageClassSpec(), clang::Declarator::getTypeObject(), clang::Type::isDependentType(), clang::Type::isVoidType(), clang::DeclaratorChunk::Kind, clang::MemberContext, clang::opencl_generic, clang::opencl_global, clang::opencl_private, clang::DeclaratorChunk::Pointer, clang::DeclaratorChunk::Reference, clang::DeclSpec::SCS_extern, clang::DeclSpec::SCS_static, clang::DeclSpec::SCS_typedef, and clang::TemplateArgContext.

Referenced by processTypeAttrs().

## ◆ diagnoseAndRemoveTypeQualifiers()

static void diagnoseAndRemoveTypeQualifiers | ( | Sema & | S,
|  | const DeclSpec & | DS,
|  | unsigned & | TypeQuals,
|  | QualType | TypeSoFar,
|  | unsigned | RemoveTQs,
|  | unsigned | DiagID
| ) |  |
| static

Definition at line 744 of file SemaType.cpp.

## ◆ diagnoseBadTypeAttribute()

static void diagnoseBadTypeAttribute | ( | Sema & | S,
|  | const ParsedAttr & | attr,
|  | QualType | type
| ) |  |
| static

diagnoseBadTypeAttribute - Diagnoses a type attribute which doesn't apply to the given type.

Definition at line 67 of file SemaType.cpp.

Referenced by distributeFunctionTypeAttr(), and distributeObjCPointerTypeAttr().

## ◆ diagnoseRedundantReturnTypeQualifiers()

static void diagnoseRedundantReturnTypeQualifiers | ( | Sema & | S,
|  | QualType | RetTy,
|  | Declarator & | D,
|  | unsigned | FunctionChunkIndex
| ) |  |
| static

Definition at line 2767 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::PointerTypeInfo::AtomicQualLoc, clang::DeclaratorChunk::BlockPointer, clang::DeclaratorChunk::PointerTypeInfo::ConstQualLoc, clang::Sema::diagnoseIgnoredQualifiers(), End, clang::DeclaratorChunk::Fun, clang::DeclaratorChunk::Function, clang::DeclSpec::getAtomicSpecLoc(), clang::DeclSpec::getConstSpecLoc(), clang::QualType::getCVRQualifiers(), clang::Declarator::getDeclSpec(), clang::SourceLocation::getFromRawEncoding(), clang::Declarator::getIdentifierLoc(), clang::UnqualifiedId::getKind(), clang::QualType::getLocalCVRQualifiers(), clang::Declarator::getName(), clang::Declarator::getNumTypeObjects(), clang::DeclSpec::getRestrictSpecLoc(), clang::Declarator::getTypeObject(), clang::DeclSpec::getTypeQualifiers(), clang::DeclSpec::getUnalignedSpecLoc(), clang::DeclSpec::getVolatileSpecLoc(), clang::DeclaratorChunk::FunctionTypeInfo::hasTrailingReturnType(), clang::IK_ConversionFunctionId, clang::Type::isAtomicType(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::MemberPointer, clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, clang::DeclaratorChunk::Ptr, clang::DeclaratorChunk::Reference, clang::DeclaratorChunk::PointerTypeInfo::RestrictQualLoc, clang::DeclSpec::TQ_atomic, clang::DeclaratorChunk::PointerTypeInfo::TypeQuals, clang::DeclaratorChunk::PointerTypeInfo::UnalignedQualLoc, and clang::DeclaratorChunk::PointerTypeInfo::VolatileQualLoc.

## ◆ distributeFunctionTypeAttr()

static void distributeFunctionTypeAttr | ( | TypeProcessingState & | state,
|  | ParsedAttr & | attr,
|  | QualType | type
| ) |  |
| static

A function type attribute was written somewhere in a declaration other than on the declarator itself or in the decl spec.

Given that it didn't apply in whatever position it was written in, try to move it to a more appropriate position.

Definition at line 544 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, diagnoseBadTypeAttribute(), clang::DeclaratorChunk::Function, clang::DeclaratorChunk::getAttrs(), clang::Declarator::getTypeObject(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::MemberPointer, moveAttrFromListToList(), clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, clang::DeclaratorChunk::Reference, and clang::ast_matchers::type.

Referenced by processTypeAttrs().

## ◆ distributeFunctionTypeAttrFromDeclarator()

static void distributeFunctionTypeAttrFromDeclarator | ( | TypeProcessingState & | state,
|  | ParsedAttr & | attr,
|  | QualType & | declSpecType
| ) |  |
| static

A function type attribute was written on the declarator.

Try to apply it somewhere.

Definition at line 620 of file SemaType.cpp.

References distributeFunctionTypeAttrToInnermost(), clang::Declarator::getAttributes(), and clang::ParsedAttributesView::remove().

Referenced by distributeTypeAttrsFromDeclarator().

## ◆ distributeFunctionTypeAttrFromDeclSpec()

static void distributeFunctionTypeAttrFromDeclSpec | ( | TypeProcessingState & | state,
|  | ParsedAttr & | attr,
|  | QualType & | declSpecType
| ) |  |
| static

A function type attribute was written in the decl spec.

Try to apply it somewhere.

Definition at line 594 of file SemaType.cpp.

References distributeFunctionTypeAttrToInnermost(), clang::ParsedAttr::isCXX11Attribute(), and moveAttrFromListToList().

Referenced by processTypeAttrs().

## ◆ distributeFunctionTypeAttrToInnermost()

static bool distributeFunctionTypeAttrToInnermost | ( | TypeProcessingState & | state,
|  | ParsedAttr & | attr,
|  | ParsedAttributesView & | attrList,
|  | QualType & | declSpecType
| ) |  |
| static

Try to distribute a function type attribute to the innermost function chunk or type.

Returns true if the attribute was distributed, false if no location was found.

Definition at line 575 of file SemaType.cpp.

References clang::DeclaratorChunk::Function, clang::DeclaratorChunk::getAttrs(), clang::Declarator::getNumTypeObjects(), clang::Declarator::getTypeObject(), handleFunctionTypeAttr(), clang::DeclaratorChunk::Kind, and moveAttrFromListToList().

Referenced by distributeFunctionTypeAttrFromDeclarator(), and distributeFunctionTypeAttrFromDeclSpec().

## ◆ distributeNullabilityTypeAttr()

static bool distributeNullabilityTypeAttr | ( | TypeProcessingState & | state,
|  | QualType | type,
|  | ParsedAttr & | attr
| ) |  |
| static

Distribute a nullability type attribute that cannot be applied to the type specifier to a pointer, block pointer, or member pointer declarator, complaining if necessary.

Returns
  true if the nullability annotation was distributed, false otherwise.

Attempt to move the attribute to the specified chunk.

Definition at line 6602 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateRemoval(), clang::DeclaratorChunk::Function, clang::DeclaratorChunk::getAttrs(), clang::ParsedAttr::getKind(), clang::ParsedAttr::getLoc(), clang::IdentifierInfo::getName(), clang::ParsedAttr::getName(), clang::Declarator::getTypeObject(), hasNullabilityAttr(), clang::ParsedAttr::isContextSensitiveKeywordAttribute(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::Loc, mapNullabilityAttrKind(), maybeMovePastReturnType(), clang::DeclaratorChunk::MemberPointer, moveAttrFromListToList(), clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, and clang::DeclaratorChunk::Reference.

Referenced by processTypeAttrs().

## ◆ distributeObjCPointerTypeAttr()

static void distributeObjCPointerTypeAttr | ( | TypeProcessingState & | state,
|  | ParsedAttr & | attr,
|  | QualType | type
| ) |  |
| static

Given that an objc_gc attribute was written somewhere on a declaration other than on the declarator itself (for which, use distributeObjCPointerTypeAttrFromDeclarator), and given that it didn't apply in whatever position it was written in, try to move it to a more appropriate position.

Definition at line 427 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, diagnoseBadTypeAttribute(), clang::DeclaratorChunk::Function, clang::DeclaratorChunk::getAttrs(), clang::ParsedAttr::getKind(), clang::Declarator::getTypeObject(), clang::DeclaratorChunk::Kind, maybeMovePastReturnType(), clang::DeclaratorChunk::MemberPointer, moveAttrFromListToList(), clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, clang::DeclaratorChunk::Reference, and clang::ast_matchers::type.

Referenced by processTypeAttrs().

## ◆ distributeObjCPointerTypeAttrFromDeclarator()

static void distributeObjCPointerTypeAttrFromDeclarator | ( | TypeProcessingState & | state,
|  | ParsedAttr & | attr,
|  | QualType & | declSpecType
| ) |  |
| static

Distribute an objc_gc type attribute that was written on the declarator.

Definition at line 483 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, clang::DeclaratorChunk::Function, clang::DeclSpec::getAttributes(), clang::Declarator::getAttributes(), clang::DeclaratorChunk::getAttrs(), clang::Declarator::getMutableDeclSpec(), clang::Declarator::getNumTypeObjects(), clang::Declarator::getTypeObject(), handleObjCPointerTypeAttr(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::MemberPointer, moveAttrFromListToList(), clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, clang::DeclaratorChunk::Reference, and clang::ParsedAttributesView::remove().

Referenced by distributeTypeAttrsFromDeclarator().

## ◆ distributeTypeAttrsFromDeclarator()

static void distributeTypeAttrsFromDeclarator | ( | TypeProcessingState & | state,
|  | QualType & | declSpecType
| ) |  |
| static

Given that there are attributes written on the declarator itself, try to distribute any type attributes to the appropriate declarator chunk.

These are attributes like the following: int f ATTR; int (f ATTR)(); but not necessarily this: int f() ATTR;

Definition at line 645 of file SemaType.cpp.

References distributeFunctionTypeAttrFromDeclarator(), distributeObjCPointerTypeAttrFromDeclarator(), FUNCTION_TYPE_ATTRS_CASELIST, MS_TYPE_ATTRS_CASELIST, NULLABILITY_TYPE_ATTRS_CASELIST, and OBJC_POINTER_TYPE_ATTRS_CASELIST.

Referenced by GetDeclSpecTypeForDeclarator().

## ◆ emitNullabilityConsistencyWarning()

static void emitNullabilityConsistencyWarning | ( | Sema & | S,
|  | SimplePointerKind | PointerKind,
|  | SourceLocation | PointerLoc,
|  | SourceLocation | PointerEndLoc
| ) |  |
| static

Definition at line 3769 of file SemaType.cpp.

References Diag(), clang::Sema::Diag(), fixItNullability(), clang::SourceLocation::isValid(), clang::NonNull, and clang::Nullable.

Referenced by checkNullabilityConsistency(), and recordNullabilitySeen().

## ◆ fillAtomicQualLoc()

static void fillAtomicQualLoc | ( | AtomicTypeLoc | ATL,
|  | const DeclaratorChunk & | Chunk
| ) |  |
| static

Definition at line 5598 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::PointerTypeInfo::AtomicQualLoc, clang::DeclaratorChunk::BlockPointer, clang::DeclaratorChunk::Function, clang::SourceLocation::getFromRawEncoding(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::MemberPointer, clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, clang::DeclaratorChunk::Ptr, clang::DeclaratorChunk::Reference, clang::AtomicTypeLoc::setKWLoc(), and clang::AtomicTypeLoc::setParensRange().

Referenced by GetTypeSourceInfoForDeclarator().

## ◆ fillAttributedTypeLoc()

static void fillAttributedTypeLoc | ( | AttributedTypeLoc | TL,
|  | TypeProcessingState & | State
| ) |  |
| static

Definition at line 5298 of file SemaType.cpp.

References clang::ConcreteTypeLoc< Base, Derived, TypeClass, LocalData >::getTypePtr(), and clang::AttributedTypeLoc::setAttr().

Referenced by GetTypeSourceInfoForDeclarator().

## ◆ fillDependentAddressSpaceTypeLoc()

static void fillDependentAddressSpaceTypeLoc | ( | DependentAddressSpaceTypeLoc | DASTL,
|  | const ParsedAttributesView & | Attrs
| ) |  |
| static

Definition at line 5623 of file SemaType.cpp.

References clang::DependentAddressSpaceTypeLoc::setAttrExprOperand(), clang::DependentAddressSpaceTypeLoc::setAttrNameLoc(), and clang::DependentAddressSpaceTypeLoc::setAttrOperandParensRange().

Referenced by GetTypeSourceInfoForDeclarator().

## ◆ fixItNullability()

static void fixItNullability | ( | Sema & | S,
|  | DiagnosticBuilder & | Diag,
|  | SourceLocation | PointerLoc,
|  | NullabilityKind | Nullability
| ) |  |
| static

Creates a fix-it to insert a C-style nullability keyword at `pointerLoc`, taking into account whitespace before and after.

Definition at line 3734 of file SemaType.cpp.

References clang::FixItHint::CreateInsertion(), clang::SourceManager::getCharacterData(), clang::Sema::getLocForEndOfToken(), clang::getNullabilitySpelling(), clang::isIdentifierBody(), clang::SourceLocation::isMacroID(), clang::SourceLocation::isValid(), clang::isWhitespace(), and clang::Sema::SourceMgr.

Referenced by emitNullabilityConsistencyWarning().

## ◆ getCCForDeclaratorChunk()

static CallingConv getCCForDeclaratorChunk | ( | Sema & | S,
|  | Declarator & | D,
|  | const ParsedAttributesView & | AttrList,
|  | const DeclaratorChunk::FunctionTypeInfo & | FTI,
|  | unsigned | ChunkIndex
| ) |  |
| static

Helper for figuring out the default CC for a function declarator type.

If this is the outermost chunk, then we can determine the CC from the declarator context. If not, then this could be either a member function type or normal function type.

Definition at line 3377 of file SemaType.cpp.

References CALLING_CONV_ATTRS_CASELIST, clang::CC_OpenCLKernel, clang::Sema::CheckCallingConvAttr(), clang::Sema::Context, clang::DeclaratorChunk::Function, clang::DeclSpec::getAttributes(), clang::Declarator::getContext(), clang::Declarator::getDeclSpec(), clang::ASTContext::getDefaultCallingConvention(), clang::Sema::getLangOpts(), clang::DeclSpec::getStorageClassSpec(), clang::Declarator::getTypeObject(), clang::Declarator::isFirstDeclarationOfMember(), clang::Declarator::isFunctionDeclarator(), clang::Declarator::isStaticMember(), clang::DeclaratorChunk::FunctionTypeInfo::isVariadic, clang::DeclaratorChunk::Kind, clang::LambdaExprContext, clang::DeclaratorChunk::MemberPointer, clang::DeclaratorChunk::Paren, clang::DeclSpec::SCS_typedef, and clang::supportsVariadicCall().

## ◆ getCCTypeAttr()

static Attr* getCCTypeAttr | ( | ASTContext & | Ctx,
|  | ParsedAttr & | Attr
| ) |  |
| static

Definition at line 6683 of file SemaType.cpp.

References clang::ParsedAttr::getArgAsExpr(), clang::ParsedAttr::getArgAsIdent(), clang::ParsedAttr::getAttributeSpellingListIndex(), clang::ParsedAttr::getKind(), clang::IdentifierInfo::getName(), clang::ParsedAttr::getRange(), clang::IdentifierLoc::Ident, clang::ParsedAttr::isArgExpr(), and clang::ParsedAttr::isInvalid().

Referenced by handleFunctionTypeAttr().

## ◆ GetDeclSpecTypeForDeclarator()

static QualType GetDeclSpecTypeForDeclarator | ( | TypeProcessingState & | state,
|  | TypeSourceInfo *& | ReturnTypeInfo
| ) |  |
| static

Definition at line 2837 of file SemaType.cpp.

References clang::AliasDeclContext, clang::AliasTemplateContext, clang::Auto, clang::sema::LambdaScopeInfo::AutoTemplateParameterDepth, clang::sema::LambdaScopeInfo::AutoTemplateParams, clang::BlockContext, clang::BlockLiteralContext, clang::ConditionContext, clang::Sema::Context, clang::UnqualifiedId::ConversionFunctionId, clang::ConversionIdContext, ConvertDeclSpecToType(), clang::TemplateTypeParmDecl::Create(), clang::Sema::CurContext, clang::CXXCatchContext, clang::CXXNewContext, clang::DecltypeAuto, clang::ASTContext::DependentTy, clang::Sema::Diag(), distributeTypeAttrsFromDeclarator(), clang::ParsedAttributesView::empty(), clang::Error, clang::FileContext, clang::ForContext, clang::FunctionalCastContext, clang::DeclSpec::getAttributes(), clang::Declarator::getAttributes(), clang::SourceRange::getBegin(), clang::Declarator::getBeginLoc(), clang::Type::getContainedDeducedType(), clang::Declarator::getContext(), clang::Sema::getCurLambda(), clang::Declarator::getDeclSpec(), clang::AutoType::getKeyword(), clang::UnqualifiedId::getKind(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::Declarator::getMutableDeclSpec(), clang::Declarator::getName(), clang::Declarator::getNumTypeObjects(), clang::DeclSpec::getParsedSpecifiers(), clang::DeclSpec::getRepAsDecl(), clang::UnqualifiedId::getSourceRange(), clang::DeclSpec::getStorageClassSpec(), clang::Sema::getTemplateNameKindForDiagnostics(), clang::ASTContext::getTranslationUnitDecl(), clang::ASTContext::getTypeDeclType(), clang::TypeDecl::getTypeForDecl(), clang::Sema::GetTypeFromParser(), clang::DeclSpec::getTypeSpecTypeLoc(), clang::GNUAutoType, clang::Declarator::hasEllipsis(), clang::Declarator::hasTrailingReturnType(), clang::IK_ConstructorName, clang::IK_ConstructorTemplateId, clang::IK_ConversionFunctionId, clang::IK_DeductionGuideName, clang::IK_DestructorName, clang::IK_Identifier, clang::IK_ImplicitSelfParam, clang::IK_LiteralOperatorId, clang::IK_OperatorFunctionId, clang::IK_TemplateId, clang::InitStmtContext, clang::ASTContext::IntTy, clang::TagDecl::isCompleteDefinition(), clang::DeclSpec::isFriendSpecified(), clang::Declarator::isFunctionDeclarator(), clang::Declarator::isInvalidType(), clang::QualType::isNull(), clang::DeclSpec::isTypeSpecOwned(), clang::KNRTypeListContext, clang::LambdaExprContext, clang::LambdaExprParameterContext, clang::MemberContext, clang::ObjCCatchContext, clang::ObjCParameterContext, clang::ObjCResultContext, clang::DeclSpec::PQ_TypeSpecifier, processTypeAttrs(), clang::PrototypeContext, clang::Sema::ReplaceAutoType(), clang::DeclSpec::SCS_static, clang::DeclSpec::SCS_typedef, clang::TagDecl::setEmbeddedInDeclarator(), clang::Declarator::setInvalidType(), TAL_DeclSpec, clang::TemplateArgContext, clang::TemplateParamContext, clang::TemplateTypeArgContext, clang::TrailingReturnContext, clang::TrailingReturnVarContext, clang::TTK_Class, clang::TTK_Enum, clang::TTK_Interface, clang::TTK_Struct, clang::TTK_Union, clang::TypeNameContext, and clang::ASTContext::VoidTy.

Referenced by clang::Sema::GetTypeForDeclarator(), and clang::Sema::GetTypeForDeclaratorCast().

## ◆ getDecltypeForExpr()

static QualType getDecltypeForExpr | ( | Sema & | S,
|  | Expr * | E
| ) |  |
| static

getDecltypeForExpr - Given an expr, will return the decltype for that expression, according to the rules in C++11 [dcl.type.simple]p4 and C++11 [expr.lambda.prim]p18.

Definition at line 8076 of file SemaType.cpp.

References clang::Sema::Context, clang::ASTContext::DependentTy, clang::Sema::getCapturedDeclRefType(), clang::Sema::getCurLambda(), clang::ASTContext::getLValueReferenceType(), clang::ASTContext::getRValueReferenceType(), clang::Expr::getType(), clang::ValueDecl::getType(), clang::Expr::getValueKind(), clang::if(), clang::Expr::IgnoreParens(), clang::QualType::isNull(), clang::Expr::isTypeDependent(), clang::VK_LValue, clang::VK_RValue, and clang::VK_XValue.

## ◆ GetFullTypeForDeclarator()

static TypeSourceInfo* GetFullTypeForDeclarator | ( | TypeProcessingState & | state,
|  | QualType | declSpecType,
|  | TypeSourceInfo * | TInfo
| ) |  |
| static

Never complain.

Complain on the inner pointers (but not the outermost pointer).

Complain about any pointers that don't have nullability specified or inferred.

Definition at line 3928 of file SemaType.cpp.

Referenced by clang::Sema::GetTypeForDeclarator().

## ◆ getFunctionQualifiersAsString()

static std::string getFunctionQualifiersAsString | ( | const FunctionProtoType * | FnTy | ) |
| static

Definition at line 1875 of file SemaType.cpp.

References clang::Qualifiers::getAsString(), clang::FunctionProtoType::getRefQualifier(), clang::FunctionProtoType::getTypeQuals(), clang::RQ_LValue, clang::RQ_None, and clang::RQ_RValue.

## ◆ getImageAccess()

static OpenCLAccessAttr::Spelling getImageAccess | ( | const ParsedAttributesView & | Attrs | ) |
| static

Definition at line 1217 of file SemaType.cpp.

## ◆ getLiteralDiagFromTagKind()

static unsigned getLiteralDiagFromTagKind | ( | TagTypeKind | Tag | ) |
| static

Get diagnostic select index for tag kind for literal type diagnostic message.

WARNING: Indexes apply to particular diagnostics only!

Returns
  diagnostic select index.

Definition at line 7926 of file SemaType.cpp.

References clang::TTK_Class, clang::TTK_Interface, and clang::TTK_Struct.

## ◆ getNullabilityCompletenessCheckFileID()

static FileID getNullabilityCompletenessCheckFileID | ( | Sema & | S,
|  | SourceLocation | loc
| ) |  |
| static

Definition at line 3695 of file SemaType.cpp.

References clang::SrcMgr::C_User, clang::Sema::CurContext, clang::Sema::Diags, clang::SourceManager::getExpansionLoc(), clang::SrcMgr::SLocEntry::getFile(), clang::SrcMgr::FileInfo::getFileCharacteristic(), clang::SourceManager::getFileID(), clang::SrcMgr::FileInfo::getIncludeLoc(), clang::DeclContext::getParent(), clang::SourceManager::getSLocEntry(), clang::DiagnosticsEngine::getSuppressSystemWarnings(), clang::SrcMgr::SLocEntry::isFile(), clang::FileID::isInvalid(), clang::SourceLocation::isInvalid(), and clang::Sema::SourceMgr.

Referenced by checkNullabilityConsistency(), and recordNullabilitySeen().

## ◆ getPrintableNameForEntity()

static std::string getPrintableNameForEntity | ( | DeclarationName | Entity | ) |
| static

Definition at line 1720 of file SemaType.cpp.

References clang::DeclarationName::getAsString().

Referenced by clang::Sema::BuildArrayType(), clang::Sema::BuildMemberPointerType(), and clang::Sema::BuildPointerType().

## ◆ GetTypeSourceInfoForDeclarator()

static TypeSourceInfo * GetTypeSourceInfoForDeclarator | ( | TypeProcessingState & | State,
|  | QualType | T,
|  | TypeSourceInfo * | ReturnTypeInfo
| ) |  |
| static

Create and instantiate a TypeSourceInfo with type source information.

Parameters

  T | QualType referring to the type as written in source code.
  ReturnTypeInfo | For declarators whose return type does not show up in the normal place in the declaration specifiers (such as a C++ conversion function), this pointer will refer to a type source information for that return type.

Definition at line 5647 of file SemaType.cpp.

References clang::TypeLoc::castAs(), clang::Sema::Context, clang::ASTContext::CreateTypeSourceInfo(), fillAtomicQualLoc(), fillAttributedTypeLoc(), fillDependentAddressSpaceTypeLoc(), clang::TypeLoc::getAs(), clang::DeclaratorChunk::getAttrs(), clang::Declarator::getDeclSpec(), clang::Declarator::getEllipsisLoc(), clang::TypeLoc::getFullDataSize(), clang::TypeLoc::getNextTypeLoc(), clang::ConcreteTypeLoc< Base, Derived, TypeClass, LocalData >::getNextTypeLoc(), clang::Declarator::getNumTypeObjects(), clang::TypeLoc::getOpaqueData(), clang::TypeSourceInfo::getTypeLoc(), clang::Declarator::getTypeObject(), clang::TypeLoc::getUnqualifiedLoc(), and memcpy().

Referenced by createNullabilityAttr().

## ◆ HandleAddressSpaceTypeAttribute()

static void HandleAddressSpaceTypeAttribute | ( | QualType & | Type,
|  | const ParsedAttr & | Attr,
|  | TypeProcessingState & | State
| ) |  |
| static

HandleAddressSpaceTypeAttribute - Process an address_space attribute on the specified type.

The attribute contains 1 argument, the id of the address space for the type.

Definition at line 5831 of file SemaType.cpp.

References clang::Sema::ActOnIdExpression(), clang::Sema::BuildAddressSpaceAttr(), clang::Sema::Context, clang::Default, clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::Qualifiers::getAddressSpace(), clang::QualType::getAddressSpace(), clang::ASTContext::getAddrSpaceQualType(), clang::ParsedAttr::getArgAsExpr(), clang::ParsedAttr::getArgAsIdent(), clang::ParsedAttr::getAttributeSpellingListIndex(), clang::Sema::getCurScope(), clang::ParsedAttr::getKind(), clang::ParsedAttr::getLoc(), clang::ParsedAttr::getNumArgs(), clang::QualType::getQualifiers(), clang::ParsedAttr::getRange(), clang::ast_matchers::id(), clang::IdentifierLoc::Ident, clang::ParsedAttr::isArgIdent(), clang::Type::isFunctionType(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::QualType::isNull(), clang::opencl_constant, clang::opencl_generic, clang::opencl_global, clang::opencl_local, clang::opencl_private, and clang::ParsedAttr::setInvalid().

Referenced by processTypeAttrs().

## ◆ HandleExtVectorTypeAttr()

static void HandleExtVectorTypeAttr | ( | QualType & | CurType,
|  | const ParsedAttr & | Attr,
|  | Sema & | S
| ) |  |
| static

Process the OpenCL-like ext_vector_type attribute when it occurs on a type.

Definition at line 7012 of file SemaType.cpp.

References clang::Sema::ActOnIdExpression(), clang::Sema::BuildExtVectorType(), clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::ParsedAttr::getArgAsExpr(), clang::ParsedAttr::getArgAsIdent(), clang::Sema::getCurScope(), clang::ParsedAttr::getLoc(), clang::ParsedAttr::getNumArgs(), clang::ast_matchers::id(), clang::IdentifierLoc::Ident, clang::ParsedAttr::isArgIdent(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), and clang::QualType::isNull().

Referenced by processTypeAttrs().

## ◆ handleFunctionTypeAttr()

static bool handleFunctionTypeAttr | ( | TypeProcessingState & | state,
|  | ParsedAttr & | attr,
|  | QualType & | type
| ) |  |
| static

Process an individual function attribute.

Returns true to indicate that the attribute was handled, false if it wasn't.

Definition at line 6737 of file SemaType.cpp.

References clang::ASTContext::adjustFunctionType(), clang::CC_X86FastCall, clang::CC_X86StdCall, clang::Sema::CheckAttrNoArgs(), clang::Sema::CheckAttrTarget(), clang::Sema::CheckCallingConvAttr(), clang::Sema::checkNSReturnsRetainedReturnType(), clang::Sema::CheckRegparmAttr(), clang::Sema::Context, clang::Sema::Diag(), clang::Equivalent, clang::FunctionType::getCallConv(), clang::Sema::getCallingConvAttributedType(), getCCTypeAttr(), clang::FunctionType::getHasRegParm(), clang::ParsedAttr::getKind(), clang::Sema::getLangOpts(), clang::ParsedAttr::getLoc(), clang::FunctionType::getNameForCallConv(), clang::ParsedAttr::getNumArgs(), clang::FunctionProtoType::isVariadic(), clang::ParsedAttr::setInvalid(), clang::supportsVariadicCall(), and clang::ast_matchers::type.

Referenced by distributeFunctionTypeAttrToInnermost(), and processTypeAttrs().

## ◆ HandleLifetimeBoundAttr()

static void HandleLifetimeBoundAttr | ( | TypeProcessingState & | State,
|  | QualType & | CurType,
|  | ParsedAttr & | Attr
| ) |  |
| static

Definition at line 7296 of file SemaType.cpp.

References clang::ParsedAttr::diagnoseAppertainsTo().

Referenced by processTypeAttrs().

## ◆ handleMSPointerTypeQualifierAttr()

static bool handleMSPointerTypeQualifierAttr | ( | TypeProcessingState & | state,
|  | ParsedAttr & | attr,
|  | QualType & | type
| ) |  |
| static

Definition at line 6338 of file SemaType.cpp.

References clang::Sema::Context, clang::Sema::Diag(), clang::AttributedType::getAttrKind(), clang::AttributedType::getEquivalentType(), clang::Attr::getKind(), clang::ParsedAttr::getKind(), clang::ParsedAttr::getLoc(), clang::ParsedAttr::getName(), and clang::Type::isMemberPointerType().

Referenced by processTypeAttrs().

## ◆ HandleNeonVectorTypeAttr()

static void HandleNeonVectorTypeAttr | ( | QualType & | CurType,
|  | const ParsedAttr & | Attr,
|  | Sema & | S,
|  | VectorType::VectorKind | VecKind
| ) |  |
| static

HandleNeonVectorTypeAttr - The "neon_vector_type" and "neon_polyvector_type" attributes are used to create vector types that are mangled according to ARM's ABI.

Otherwise, these types are identical to those created with the "vector_size" attribute. Unlike "vector_size" the argument to these Neon attributes is the number of vector elements, not the vector size in bytes. The vector width and element type must match one of the standard Neon vector types.

Definition at line 7101 of file SemaType.cpp.

References clang::AANT_ArgumentIntegerConstant, clang::Sema::Context, clang::Sema::Diag(), clang::ParsedAttr::getArgAsExpr(), clang::ParsedAttr::getLoc(), clang::ParsedAttr::getNumArgs(), clang::Stmt::getSourceRange(), clang::ASTContext::getTargetInfo(), clang::ASTContext::getTypeSize(), clang::ASTContext::getVectorType(), clang::TargetInfo::hasFeature(), clang::Expr::isIntegerConstantExpr(), isPermittedNeonBaseType(), clang::Expr::isTypeDependent(), clang::Expr::isValueDependent(), and clang::ParsedAttr::setInvalid().

Referenced by processTypeAttrs().

## ◆ handleObjCGCTypeAttr()

static bool handleObjCGCTypeAttr | ( | TypeProcessingState & | state,
|  | ParsedAttr & | attr,
|  | QualType & | type
| ) |  |
| static

handleObjCGCTypeAttr - Process the attribute((objc_gc)) type attribute on the specified type.

Returns true to indicate that the attribute was handled, false to indicate that the type does not permit the attribute.

Definition at line 6145 of file SemaType.cpp.

References clang::AANT_ArgumentString, clang::Sema::Context, Desugar(), clang::Sema::Diag(), clang::Qualifiers::GCNone, clang::ParsedAttr::getArgAsIdent(), clang::ParsedAttr::getAttributeSpellingListIndex(), clang::ParsedAttr::getLoc(), clang::ParsedAttr::getName(), clang::ParsedAttr::getNumArgs(), clang::QualType::getObjCGCAttr(), clang::ASTContext::getObjCGCQualType(), clang::ParsedAttr::getRange(), clang::IdentifierLoc::Ident, clang::ParsedAttr::isArgIdent(), clang::Type::isBlockPointerType(), clang::Type::isObjCObjectPointerType(), clang::Type::isPointerType(), clang::IdentifierInfo::isStr(), clang::SourceLocation::isValid(), Pointer, clang::ParsedAttr::setInvalid(), clang::Qualifiers::Strong, clang::ast_matchers::type, and clang::Qualifiers::Weak.

Referenced by handleObjCPointerTypeAttr().

## ◆ handleObjCOwnershipTypeAttr()

static bool handleObjCOwnershipTypeAttr | ( | TypeProcessingState & | state,
|  | ParsedAttr & | attr,
|  | QualType & | type
| ) |  |
| static

handleObjCOwnershipTypeAttr - Process an objc_ownership attribute on the specified type.

Returns 'true' if the attribute was handled.

Definition at line 5956 of file SemaType.cpp.

References clang::AANT_ArgumentString, clang::Qualifiers::addObjCLifetime(), clang::Sema::Context, clang::Sema::Diag(), clang::ParsedAttr::getArgAsIdent(), clang::Type::getAs(), clang::ParsedAttr::getAttributeSpellingListIndex(), clang::CharSourceRange::getBegin(), clang::SourceManager::getImmediateExpansionRange(), clang::Sema::getLangOpts(), clang::ParsedAttr::getLoc(), clang::IdentifierInfo::getName(), clang::ParsedAttr::getName(), clang::Declarator::getNumTypeObjects(), clang::Qualifiers::getObjCLifetime(), clang::Type::getPointeeType(), clang::ASTContext::getQualifiedType(), clang::QualType::getQualifiers(), clang::ParsedAttr::getRange(), clang::SplitQualType::getSingleStepDesugaredType(), clang::Sema::getSourceManager(), hasDirectOwnershipQualifier(), clang::IdentifierLoc::Ident, clang::ParsedAttr::isArgIdent(), clang::Type::isDependentType(), clang::SourceLocation::isMacroID(), clang::Type::isObjCRetainableType(), clang::Type::isPointerType(), clang::IdentifierInfo::isStr(), clang::Type::isUndeducedType(), clang::SourceLocation::isValid(), maybeMovePastReturnType(), clang::Qualifiers::OCL_Autoreleasing, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, clang::Qualifiers::OCL_Weak, clang::SplitQualType::Quals, clang::Qualifiers::removeObjCLifetime(), clang::ParsedAttr::setInvalid(), clang::QualType::split(), TDS_ObjCObjOrBlock, clang::SplitQualType::Ty, and clang::ast_matchers::type.

Referenced by handleObjCPointerTypeAttr().

## ◆ handleObjCPointerTypeAttr()

static bool handleObjCPointerTypeAttr | ( | TypeProcessingState & | state,
|  | ParsedAttr & | attr,
|  | QualType & | type
| ) |  |
| static

Definition at line 342 of file SemaType.cpp.

References clang::ParsedAttr::getKind(), handleObjCGCTypeAttr(), and handleObjCOwnershipTypeAttr().

Referenced by distributeObjCPointerTypeAttrFromDeclarator(), and processTypeAttrs().

## ◆ HandleOpenCLAccessAttr()

static void HandleOpenCLAccessAttr | ( | QualType & | CurType,
|  | const ParsedAttr & | Attr,
|  | Sema & | S
| ) |  |
| static

Handle OpenCL Access Qualifier Attribute.

Definition at line 7148 of file SemaType.cpp.

References clang::Sema::Context, clang::Sema::Diag(), clang::Type::getAs(), clang::ParsedAttr::getLoc(), clang::IdentifierInfo::getName(), clang::ParsedAttr::getName(), clang::ParsedAttr::getRange(), clang::ParsedAttr::getSemanticSpelling(), clang::ASTContext::getWritePipeType(), clang::Type::isImageType(), clang::Type::isPipeType(), and clang::ParsedAttr::setInvalid().

Referenced by processTypeAttrs().

## ◆ HandleVectorSizeAttr()

static void HandleVectorSizeAttr | ( | QualType & | CurType,
|  | const ParsedAttr & | Attr,
|  | Sema & | S
| ) |  |
| static

HandleVectorSizeAttribute - this attribute is only applicable to integral and float scalars, although arrays, pointers, and function return values are allowed in conjunction with this construct.

Aggregates with this attribute are invalid, even if they are of the same size as a corresponding scalar. The raw attribute should contain precisely 1 argument, the vector size for the variable, measured in bytes. If curType and rawAttr are well formed, this routine will return a new vector type.

Definition at line 6975 of file SemaType.cpp.

References clang::Sema::ActOnIdExpression(), clang::Sema::BuildVectorType(), clang::Sema::Diag(), clang::ActionResult< PtrTy, CompressInvalid >::get(), clang::ParsedAttr::getArgAsExpr(), clang::ParsedAttr::getArgAsIdent(), clang::Sema::getCurScope(), clang::ParsedAttr::getLoc(), clang::ParsedAttr::getNumArgs(), Id, clang::IdentifierLoc::Ident, clang::ParsedAttr::isArgIdent(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::QualType::isNull(), clang::UnqualifiedId::setIdentifier(), and clang::ParsedAttr::setInvalid().

Referenced by processTypeAttrs().

## ◆ hasDirectOwnershipQualifier()

static bool hasDirectOwnershipQualifier | ( | QualType | type | ) |
| static

Does this type have a "direct" ownership qualifier? That is, is it written like "__strong id", as opposed to something like "typeof(foo)", where that happens to be strong?

Definition at line 5925 of file SemaType.cpp.

References clang::QualType::getQualifiers(), and clang::Qualifiers::hasObjCLifetime().

Referenced by handleObjCOwnershipTypeAttr().

## ◆ hasNullabilityAttr()

static bool hasNullabilityAttr | ( | const ParsedAttributesView & | attrs | ) |
| static

Check whether there is a nullability attribute of any kind in the given attribute list.

Definition at line 3498 of file SemaType.cpp.

Referenced by distributeNullabilityTypeAttr().

## ◆ hasOuterPointerLikeChunk()

static bool hasOuterPointerLikeChunk | ( | const Declarator & | D,
|  | unsigned | endIndex
| ) |  |
| static

Returns true if any of the declarator chunks before `endIndex` include a level of indirection: array, pointer, reference, or pointer-to-member.

Because declarator chunks are stored in outer-to-inner order, testing every chunk before `endIndex` is testing all chunks that embed the current chunk as part of their type.

It is legal to pass the result of Declarator::getNumTypeObjects() as the end index, in which case all chunks are tested.

Definition at line 3873 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, clang::DeclaratorChunk::Function, clang::Declarator::getTypeObject(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::MemberPointer, clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, and clang::DeclaratorChunk::Reference.

Referenced by processTypeAttrs().

## ◆ inferARCLifetimeForPointee()

static QualType inferARCLifetimeForPointee | ( | Sema & | S,
|  | QualType | type,
|  | SourceLocation | loc,
|  | bool | isReference
| ) |  |
| static

Given that we're building a pointer or reference to the given.

Definition at line 1824 of file SemaType.cpp.

Referenced by clang::Sema::BuildPointerType().

## ◆ inferARCWriteback()

static void inferARCWriteback | ( | TypeProcessingState & | state,
|  | QualType & | declSpecType
| ) |  |
| static

Given that this is the declaration of a parameter under ARC, attempt to infer attributes and such for pointer-to-whatever types.

Definition at line 2620 of file SemaType.cpp.

References clang::Qualifiers::addObjCLifetime(), clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, clang::Sema::Context, clang::DeclaratorChunk::Function, clang::DeclaratorChunk::getAttrs(), clang::Declarator::getNumTypeObjects(), clang::QualType::getObjCLifetime(), clang::ASTContext::getQualifiedType(), clang::Declarator::getTypeObject(), isBlockPointer(), clang::Type::isObjCARCImplicitlyUnretainedType(), clang::Type::isObjCObjectType(), clang::Type::isObjCRetainableType(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::MemberPointer, clang::Qualifiers::OCL_Autoreleasing, clang::Qualifiers::OCL_ExplicitNone, clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, clang::DeclaratorChunk::Reference, and transferARCOwnershipToDeclaratorChunk().

Referenced by clang::Sema::GetTypeForDeclarator().

## ◆ isArraySizeVLA()

static bool isArraySizeVLA | ( | Sema & | S,
|  | Expr * | ArraySize,
|  | llvm::APSInt & | SizeVal
| ) |  |
| static

Check whether the specified array size makes the array type a VLA.

If so, return true, if not, return the size of the array in SizeVal.

Definition at line 2055 of file SemaType.cpp.

## ◆ IsNoDerefableChunk()

static bool IsNoDerefableChunk | ( | DeclaratorChunk | Chunk | ) |
| static

Definition at line 3897 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::Kind, and clang::DeclaratorChunk::Pointer.

## ◆ isOmittedBlockReturnType()

static bool isOmittedBlockReturnType | ( | const Declarator & | D | ) |
| static

isOmittedBlockReturnType - Return true if this declarator is missing a return type because this is a omitted return type on a block literal.

Definition at line 50 of file SemaType.cpp.

References clang::BlockLiteralContext, clang::DeclaratorChunk::Function, clang::Declarator::getContext(), clang::Declarator::getDeclSpec(), clang::Declarator::getNumTypeObjects(), clang::Declarator::getTypeObject(), clang::DeclSpec::hasTypeSpecifier(), and clang::DeclaratorChunk::Kind.

## ◆ isPermittedNeonBaseType()

static bool isPermittedNeonBaseType | ( | QualType & | Ty,
|  | VectorType::VectorKind | VecKind,
|  | Sema & | S
| ) |  |
| static

Definition at line 7046 of file SemaType.cpp.

References clang::Sema::Context, clang::Type::getAs(), clang::BuiltinType::getKind(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), and clang::VectorType::NeonPolyVector.

Referenced by HandleNeonVectorTypeAttr().

## ◆ mapNullabilityAttrKind()

static NullabilityKind mapNullabilityAttrKind | ( | ParsedAttr::Kind | kind | ) |
| static

Map a nullability attribute kind to a nullability kind.

Definition at line 6411 of file SemaType.cpp.

References clang::NonNull, clang::Nullable, and clang::Unspecified.

Referenced by checkNullabilityTypeSpecifier(), and distributeNullabilityTypeAttr().

## ◆ maybeMovePastReturnType()

static DeclaratorChunk* maybeMovePastReturnType | ( | Declarator & | declarator,
|  | unsigned | i,
|  | bool | onlyBlockPointers
| ) |  |
| static

Given the index of a declarator chunk, check whether that chunk directly specifies the return type of a function and, if so, find an appropriate place for it.

Parameters

  i | - a notional index which the search will start immediately inside
  onlyBlockPointers | Whether we should only look into block pointer types (vs. all pointer types).

Definition at line 359 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, clang::DeclaratorChunk::Function, clang::Declarator::getNumTypeObjects(), clang::Declarator::getTypeObject(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::MemberPointer, clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, and clang::DeclaratorChunk::Reference.

Referenced by distributeNullabilityTypeAttr(), distributeObjCPointerTypeAttr(), and handleObjCOwnershipTypeAttr().

## ◆ maybeSynthesizeBlockSignature()

static void maybeSynthesizeBlockSignature | ( | TypeProcessingState & | state,
|  | QualType | declSpecType
| ) |  |
| static

Add a synthetic '()' to a block-literal declarator if it is required, given the return type.

Definition at line 688 of file SemaType.cpp.

References clang::Declarator::AddInnermostTypeInfo(), clang::EST_None, clang::Declarator::getBeginLoc(), clang::DeclaratorChunk::getFunction(), clang::Declarator::getFunctionTypeInfo(), clang::Declarator::getNumTypeObjects(), clang::DeclaratorChunk::FunctionTypeInfo::hasPrototype, clang::Declarator::isFunctionDeclarator(), clang::Type::isFunctionType(), and clang::None.

## ◆ moveAttrFromListToList()

static void moveAttrFromListToList | ( | ParsedAttr & | attr,
|  | ParsedAttributesView & | fromList,
|  | ParsedAttributesView & | toList
| ) |  |
| static

Definition at line 310 of file SemaType.cpp.

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

Referenced by distributeFunctionTypeAttr(), distributeFunctionTypeAttrFromDeclSpec(), distributeFunctionTypeAttrToInnermost(), distributeNullabilityTypeAttr(), distributeObjCPointerTypeAttr(), and distributeObjCPointerTypeAttrFromDeclarator().

## ◆ processTypeAttrs()

static void processTypeAttrs | ( | TypeProcessingState & | state,
|  | QualType & | type,
|  | TypeAttrLocation | TAL,
|  | ParsedAttributesView & | attrs
| ) |  |
| static

Definition at line 7309 of file SemaType.cpp.

References clang::Type::canHaveNullability(), checkNullabilityTypeSpecifier(), checkObjCKindOfType(), clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateRemoval(), deduceOpenCLImplicitAddrSpace(), clang::Default, distributeFunctionTypeAttr(), distributeFunctionTypeAttrFromDeclSpec(), distributeNullabilityTypeAttr(), distributeObjCPointerTypeAttr(), FUNCTION_TYPE_ATTRS_CASELIST, clang::QualType::getAddressSpace(), HandleAddressSpaceTypeAttribute(), HandleExtVectorTypeAttr(), handleFunctionTypeAttr(), HandleLifetimeBoundAttr(), handleMSPointerTypeQualifierAttr(), HandleNeonVectorTypeAttr(), handleObjCPointerTypeAttr(), HandleOpenCLAccessAttr(), HandleVectorSizeAttr(), hasOuterPointerLikeChunk(), clang::ParsedAttr::IgnoredAttribute, clang::Type::isArrayType(), clang::Type::isDependentType(), MS_TYPE_ATTRS_CASELIST, clang::VectorType::NeonPolyVector, clang::VectorType::NeonVector, NULLABILITY_TYPE_ATTRS_CASELIST, OBJC_POINTER_TYPE_ATTRS_CASELIST, TAL_DeclChunk, TAL_DeclName, TAL_DeclSpec, and clang::ParsedAttr::UnknownAttribute.

Referenced by GetDeclSpecTypeForDeclarator().

## ◆ recordNullabilitySeen()

static void recordNullabilitySeen | ( | Sema & | S,
|  | SourceLocation | loc
| ) |  |
| static

Marks that a nullability feature has been used in the file containing `loc`.

If this file already had pointer types in it that were missing nullability, the first such instance is retroactively diagnosed.

See also
  checkNullabilityConsistency

Definition at line 3844 of file SemaType.cpp.

References emitNullabilityConsistencyWarning(), getNullabilityCompletenessCheckFileID(), clang::FileID::isInvalid(), clang::SourceLocation::isInvalid(), clang::Sema::NullabilityMap, clang::FileNullability::PointerEndLoc, clang::FileNullability::PointerKind, clang::FileNullability::PointerLoc, and clang::FileNullability::SawTypeNullability.

Referenced by checkNullabilityTypeSpecifier().

## ◆ transferARCOwnership()

static void transferARCOwnership | ( | TypeProcessingState & | state,
|  | QualType & | declSpecTy,
|  | Qualifiers::ObjCLifetime | ownership
| ) |  |
| static

Used for transferring ownership in casts resulting in l-values.

Definition at line 5232 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, clang::DeclaratorChunk::Function, clang::Declarator::getNumTypeObjects(), clang::Declarator::getTypeObject(), clang::Type::isObjCObjectType(), clang::Type::isObjCRetainableType(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::MemberPointer, clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, clang::DeclaratorChunk::Reference, transferARCOwnershipToDeclaratorChunk(), and transferARCOwnershipToDeclSpec().

## ◆ transferARCOwnershipToDeclaratorChunk()

static void transferARCOwnershipToDeclaratorChunk | ( | TypeProcessingState & | state,
|  | Qualifiers::ObjCLifetime | ownership,
|  | unsigned | chunkIndex
| ) |  |
| static

Definition at line 5195 of file SemaType.cpp.

References clang::ParsedAttributesView::addAtEnd(), clang::ParsedAttr::AS_GNU, clang::Sema::Context, clang::AttributePool::create(), clang::IdentifierTable::get(), clang::Declarator::getAttributePool(), clang::DeclaratorChunk::getAttrs(), clang::Declarator::getTypeObject(), clang::ParsedAttributesView::hasAttribute(), clang::IdentifierLoc::Ident, clang::ASTContext::Idents, clang::IdentifierLoc::Loc, clang::Qualifiers::OCL_Autoreleasing, clang::Qualifiers::OCL_ExplicitNone, clang::Qualifiers::OCL_None, clang::Qualifiers::OCL_Strong, and clang::Qualifiers::OCL_Weak.

Referenced by clang::Sema::GetTypeFromParser(), inferARCWriteback(), and transferARCOwnership().

## ◆ transferARCOwnershipToDeclSpec()

static void transferARCOwnershipToDeclSpec | ( | Sema & | S,
|  | QualType & | declSpecTy,
|  | Qualifiers::ObjCLifetime | ownership
| ) |  |
| static

Definition at line 5184 of file SemaType.cpp.

References clang::Qualifiers::addObjCLifetime(), clang::Sema::Context, clang::QualType::getObjCLifetime(), clang::ASTContext::getQualifiedType(), clang::Type::isObjCRetainableType(), and clang::Qualifiers::OCL_None.

Referenced by transferARCOwnership().

## ◆ warnAboutAmbiguousFunction()

static void warnAboutAmbiguousFunction | ( | Sema & | S,
|  | Declarator & | D,
|  | DeclaratorChunk & | DeclType,
|  | QualType | RT
| ) |  |
| static

Produce an appropriate diagnostic for an ambiguity between a function declarator and a C++ direct-initializer.

Definition at line 3160 of file SemaType.cpp.

References clang::prec::Comma, clang::ConditionContext, clang::Sema::CurContext, clang::Sema::Diag(), clang::DeclaratorChunk::EndLoc, clang::FDK_Declaration, clang::DeclaratorChunk::Fun, clang::Declarator::getCommaLoc(), clang::Declarator::getContext(), clang::Declarator::getDeclSpec(), clang::Declarator::getFunctionDefinitionKind(), clang::Declarator::getIdentifier(), clang::DeclSpec::getStorageClassSpec(), clang::DeclaratorChunk::FunctionTypeInfo::isAmbiguous, clang::Declarator::isFirstDeclarator(), clang::Declarator::isFunctionDeclarator(), clang::DeclContext::isFunctionOrMethod(), clang::Type::isRecordType(), clang::Type::isReferenceType(), clang::Type::isVoidType(), clang::DeclaratorChunk::Loc, clang::DeclaratorChunk::FunctionTypeInfo::NumParams, clang::DeclSpec::SCS_unspecified, and clang::Sema::SourceMgr.

## ◆ warnAboutRedundantParens()

static void warnAboutRedundantParens | ( | Sema & | S,
|  | Declarator & | D,
|  | QualType | T
| ) |  |
| static

Produce an appropriate diagnostic for a declarator with top-level parentheses.

Definition at line 3258 of file SemaType.cpp.

References clang::DeclaratorChunk::Array, clang::DeclaratorChunk::BlockPointer, clang::C, clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateRemoval(), clang::CXXNewContext, clang::Sema::Diag(), clang::DeclaratorChunk::EndLoc, clang::DeclaratorChunk::Function, clang::Type::getAsCXXRecordDecl(), clang::Declarator::getBeginLoc(), clang::Declarator::getContext(), clang::Sema::getCurScope(), clang::Declarator::getCXXScopeSpec(), clang::Declarator::getDeclSpec(), clang::Declarator::getEndLoc(), clang::Declarator::getIdentifier(), clang::Sema::getLangOpts(), clang::Sema::getLocForEndOfToken(), clang::Declarator::getNumTypeObjects(), clang::DeclSpec::getParsedSpecifiers(), clang::NestedNameSpecifier::getPrefix(), clang::CXXScopeSpec::getScopeRep(), clang::Declarator::getTypeObject(), clang::DeclSpec::getTypeQualifiers(), clang::NestedNameSpecifier::Global, clang::Sema::inTemplateInstantiation(), clang::Type::isDependentType(), clang::Declarator::isExpressionContext(), clang::Declarator::isFirstDeclarator(), clang::Declarator::isInvalidType(), clang::Type::isRecordType(), clang::CXXScopeSpec::isValid(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::Loc, clang::Sema::LookupName(), clang::Sema::LookupOrdinaryName, clang::DeclaratorChunk::MemberPointer, Paren, clang::DeclaratorChunk::Paren, clang::DeclaratorChunk::Pipe, clang::DeclaratorChunk::Pointer, clang::DeclSpec::PQ_TypeSpecifier, clang::DeclaratorChunk::Reference, clang::Result, and clang::Declarator::type_objects().