clang  6.0.0svn
Classes | Macros | Typedefs | Enumerations | Functions
SemaDeclCXX.cpp File Reference
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/EvaluatedExprVisitor.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/StmtVisitor.h"
#include "clang/AST/TypeLoc.h"
#include "clang/AST/TypeOrdering.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/LiteralSupport.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/CXXFieldCollector.h"
#include "clang/Sema/DeclSpec.h"
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/ParsedTemplate.h"
#include "clang/Sema/Scope.h"
#include "clang/Sema/ScopeInfo.h"
#include "clang/Sema/SemaInternal.h"
#include "clang/Sema/Template.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include <map>
#include <set>
#include "clang/AST/TypeLocNodes.def"
#include "clang/Basic/OperatorKinds.def"
Include dependency graph for SemaDeclCXX.cpp:

Go to the source code of this file.

Classes

class  clang::Sema::InheritedConstructorInfo
 

Macros

#define ABSTRACT_TYPELOC(CLASS, PARENT)
 
#define TYPELOC(CLASS, PARENT)   case TypeLoc::CLASS: Check(TL.castAs<CLASS##TypeLoc>(), Sel); break;
 
#define CheckPolymorphic(Type)
 
#define OVERLOADED_OPERATOR(Name, Spelling, Token, Unary, Binary, MemberOnly)   , { Unary, Binary, MemberOnly }
 

Typedefs

typedef llvm::SmallPtrSet< QualType, 4 > IndirectBaseSet
 Use small set to collect indirect bases. More...
 

Enumerations

enum  IsTupleLike
 
enum  ImplicitInitializerKind { IIK_Default, IIK_Copy, IIK_Move, IIK_Inherit }
 ImplicitInitializerKind - How an implicit base or member initializer should initialize its base or member. More...
 
enum  TrivialSubobjectKind { TSK_BaseClass, TSK_Field, TSK_CompleteObject }
 The kind of subobject we are checking for triviality. More...
 

Functions

static bool functionDeclHasDefaultArgument (const FunctionDecl *FD)
 
static bool checkSimpleDecomposition (Sema &S, ArrayRef< BindingDecl *> Bindings, ValueDecl *Src, QualType DecompType, const llvm::APSInt &NumElems, QualType ElemType, llvm::function_ref< ExprResult(SourceLocation, Expr *, unsigned)> GetInit)
 
static bool checkArrayLikeDecomposition (Sema &S, ArrayRef< BindingDecl *> Bindings, ValueDecl *Src, QualType DecompType, const llvm::APSInt &NumElems, QualType ElemType)
 
static bool checkArrayDecomposition (Sema &S, ArrayRef< BindingDecl *> Bindings, ValueDecl *Src, QualType DecompType, const ConstantArrayType *CAT)
 
static bool checkVectorDecomposition (Sema &S, ArrayRef< BindingDecl *> Bindings, ValueDecl *Src, QualType DecompType, const VectorType *VT)
 
static bool checkComplexDecomposition (Sema &S, ArrayRef< BindingDecl *> Bindings, ValueDecl *Src, QualType DecompType, const ComplexType *CT)
 
static std::string printTemplateArgs (const PrintingPolicy &PrintingPolicy, TemplateArgumentListInfo &Args)
 
static bool lookupStdTypeTraitMember (Sema &S, LookupResult &TraitMemberLookup, SourceLocation Loc, StringRef Trait, TemplateArgumentListInfo &Args, unsigned DiagID)
 
static TemplateArgumentLoc getTrivialIntegralTemplateArgument (Sema &S, SourceLocation Loc, QualType T, uint64_t I)
 
static TemplateArgumentLoc getTrivialTypeTemplateArgument (Sema &S, SourceLocation Loc, QualType T)
 
static IsTupleLike isTupleLike (Sema &S, SourceLocation Loc, QualType T, llvm::APSInt &Size)
 
static QualType getTupleLikeElementType (Sema &S, SourceLocation Loc, unsigned I, QualType T)
 
static bool checkTupleLikeDecomposition (Sema &S, ArrayRef< BindingDecl *> Bindings, VarDecl *Src, QualType DecompType, const llvm::APSInt &TupleSize)
 
static const CXXRecordDeclfindDecomposableBaseClass (Sema &S, SourceLocation Loc, const CXXRecordDecl *RD, CXXCastPath &BasePath)
 Find the base class to decompose in a built-in decomposition of a class type. More...
 
static bool checkMemberDecomposition (Sema &S, ArrayRef< BindingDecl *> Bindings, ValueDecl *Src, QualType DecompType, const CXXRecordDecl *RD)
 
static bool CheckConstexprParameterTypes (Sema &SemaRef, const FunctionDecl *FD)
 
static unsigned getRecordDiagFromTagKind (TagTypeKind Tag)
 Get diagnostic select index for tag kind for record diagnostic message. More...
 
static bool CheckConstexprDeclStmt (Sema &SemaRef, const FunctionDecl *Dcl, DeclStmt *DS, SourceLocation &Cxx1yLoc)
 Check the given declaration statement is legal within a constexpr function body. More...
 
static void CheckConstexprCtorInitializer (Sema &SemaRef, const FunctionDecl *Dcl, FieldDecl *Field, llvm::SmallSet< Decl *, 16 > &Inits, bool &Diagnosed)
 Check that the given field is initialized within a constexpr constructor. More...
 
static bool CheckConstexprFunctionStmt (Sema &SemaRef, const FunctionDecl *Dcl, Stmt *S, SmallVectorImpl< SourceLocation > &ReturnStmts, SourceLocation &Cxx1yLoc)
 Check the provided statement is allowed in a constexpr function definition. More...
 
static bool findCircularInheritance (const CXXRecordDecl *Class, const CXXRecordDecl *Current)
 Determine whether the given class is a base class of the given class, including looking at dependent bases. More...
 
static void NoteIndirectBases (ASTContext &Context, IndirectBaseSet &Set, const QualType &Type)
 Recursively add the bases of Type. Don't add Type itself. More...
 
static void BuildBasePathArray (const CXXBasePath &Path, CXXCastPath &BasePathArray)
 
static bool InitializationHasSideEffects (const FieldDecl &FD)
 
static AttributeListgetMSPropertyAttr (AttributeList *list)
 
static bool FindBaseInitializer (Sema &SemaRef, CXXRecordDecl *ClassDecl, QualType BaseType, const CXXBaseSpecifier *&DirectBaseSpec, const CXXBaseSpecifier *&VirtualBaseSpec)
 Find the direct and/or virtual base specifiers that correspond to the given base type, for use in base initialization within a constructor. More...
 
static void CheckForDanglingReferenceOrPointer (Sema &S, ValueDecl *Member, Expr *Init, SourceLocation IdLoc)
 Checks a member initializer expression for cases where reference (or pointer) members are bound to by-value parameters (or their addresses). More...
 
static ExprCastForMoving (Sema &SemaRef, Expr *E, QualType T=QualType())
 
static bool BuildImplicitBaseInitializer (Sema &SemaRef, CXXConstructorDecl *Constructor, ImplicitInitializerKind ImplicitInitKind, CXXBaseSpecifier *BaseSpec, bool IsInheritedVirtualBase, CXXCtorInitializer *&CXXBaseInit)
 
static bool RefersToRValueRef (Expr *MemRef)
 
static bool BuildImplicitMemberInitializer (Sema &SemaRef, CXXConstructorDecl *Constructor, ImplicitInitializerKind ImplicitInitKind, FieldDecl *Field, IndirectFieldDecl *Indirect, CXXCtorInitializer *&CXXMemberInit)
 
static bool isIncompleteOrZeroLengthArrayType (ASTContext &Context, QualType T)
 Determine whether the given type is an incomplete or zero-lenfgth array type. More...
 
static bool CollectFieldInitializer (Sema &SemaRef, BaseAndFieldInfo &Info, FieldDecl *Field, IndirectFieldDecl *Indirect=nullptr)
 
static void PopulateKeysForFields (FieldDecl *Field, SmallVectorImpl< const void *> &IdealInits)
 
static const void * GetKeyForBase (ASTContext &Context, QualType BaseType)
 
static const void * GetKeyForMember (ASTContext &Context, CXXCtorInitializer *Member)
 
static void DiagnoseBaseOrMemInitializerOrder (Sema &SemaRef, const CXXConstructorDecl *Constructor, ArrayRef< CXXCtorInitializer *> Inits)
 
static void CheckAbstractClassUsage (AbstractUsageInfo &Info, CXXMethodDecl *MD)
 Check for invalid uses of an abstract type in a method declaration. More...
 
static void CheckAbstractClassUsage (AbstractUsageInfo &Info, CXXRecordDecl *RD)
 Check for invalid uses of an abstract type within a class definition. More...
 
static void ReferenceDllExportedMethods (Sema &S, CXXRecordDecl *Class)
 
static void checkForMultipleExportedDefaultConstructors (Sema &S, CXXRecordDecl *Class)
 
static void DefineImplicitSpecialMember (Sema &S, CXXMethodDecl *MD, SourceLocation DefaultLoc)
 
static bool computeCanPassInRegisters (Sema &S, CXXRecordDecl *D)
 Determine whether a type is permitted to be passed or returned in registers, per C++ [class.temporary]p3. More...
 
static Sema::SpecialMemberOverloadResult lookupCallFromSpecialMember (Sema &S, CXXRecordDecl *Class, Sema::CXXSpecialMember CSM, unsigned FieldQuals, bool ConstRHS)
 Look up the special member function that would be called by a special member function for a subobject of class type. More...
 
static bool specialMemberIsConstexpr (Sema &S, CXXRecordDecl *ClassDecl, Sema::CXXSpecialMember CSM, unsigned Quals, bool ConstRHS, CXXConstructorDecl *InheritedCtor=nullptr, Sema::InheritedConstructorInfo *Inherited=nullptr)
 Is the special member function which would be selected to perform the specified operation on the specified class type a constexpr constructor? More...
 
static bool defaultedSpecialMemberIsConstexpr (Sema &S, CXXRecordDecl *ClassDecl, Sema::CXXSpecialMember CSM, bool ConstArg, CXXConstructorDecl *InheritedCtor=nullptr, Sema::InheritedConstructorInfo *Inherited=nullptr)
 Determine whether the specified special member function would be constexpr if it were implicitly defined. More...
 
static Sema::ImplicitExceptionSpecification ComputeDefaultedSpecialMemberExceptionSpec (Sema &S, SourceLocation Loc, CXXMethodDecl *MD, Sema::CXXSpecialMember CSM, Sema::InheritedConstructorInfo *ICI)
 
static Sema::ImplicitExceptionSpecification computeImplicitExceptionSpec (Sema &S, SourceLocation Loc, CXXMethodDecl *MD)
 
static FunctionProtoType::ExtProtoInfo getImplicitMethodEPI (Sema &S, CXXMethodDecl *MD)
 
static bool findTrivialSpecialMember (Sema &S, CXXRecordDecl *RD, Sema::CXXSpecialMember CSM, unsigned Quals, bool ConstRHS, CXXMethodDecl **Selected)
 Perform lookup for a special member of the specified kind, and determine whether it is trivial. More...
 
static CXXConstructorDeclfindUserDeclaredCtor (CXXRecordDecl *RD)
 
static bool checkTrivialSubobjectCall (Sema &S, SourceLocation SubobjLoc, QualType SubType, bool ConstRHS, Sema::CXXSpecialMember CSM, TrivialSubobjectKind Kind, bool Diagnose)
 Check whether the special member selected for a given type would be trivial. More...
 
static bool checkTrivialClassMembers (Sema &S, CXXRecordDecl *RD, Sema::CXXSpecialMember CSM, bool ConstArg, bool Diagnose)
 Check whether the members of a class type allow a special member to be trivial. More...
 
static void AddMostOverridenMethods (const CXXMethodDecl *MD, llvm::SmallPtrSetImpl< const CXXMethodDecl *> &Methods)
 Add the most overriden methods from MD to Methods. More...
 
static void extendLeft (SourceRange &R, SourceRange Before)
 
static void extendRight (SourceRange &R, SourceRange After)
 
static void DiagnoseNamespaceInlineMismatch (Sema &S, SourceLocation KeywordLoc, SourceLocation Loc, IdentifierInfo *II, bool *IsInline, NamespaceDecl *PrevNS)
 Diagnose a mismatch in 'inline' qualifiers when a namespace is reopened. More...
 
static NamespaceDeclgetNamespaceDecl (NamedDecl *D)
 getNamespaceDecl - Returns the namespace a decl represents. More...
 
static ClassTemplateDeclLookupStdInitializerList (Sema &S, SourceLocation Loc)
 
static bool IsUsingDirectiveInToplevelContext (DeclContext *CurContext)
 Determine whether a using statement is in a context where it will be apply in all contexts. More...
 
static bool TryNamespaceTypoCorrection (Sema &S, LookupResult &R, Scope *Sc, CXXScopeSpec &SS, SourceLocation IdentLoc, IdentifierInfo *Ident)
 
static bool IsEquivalentForUsingDecl (ASTContext &Context, NamedDecl *D1, NamedDecl *D2)
 Determine whether a using declaration considers the given declarations as "equivalent", e.g., if they are redeclarations of the same entity or are both typedefs of the same type. More...
 
static bool isVirtualDirectBase (CXXRecordDecl *Derived, CXXRecordDecl *Base)
 Determine whether a direct base class is a virtual base class. More...
 
static CXXBaseSpecifierfindDirectBaseWithType (CXXRecordDecl *Derived, QualType DesiredBase, bool &AnyDependentBases)
 Find the base specifier for a base class with the given type. More...
 
static StmtResult buildMemcpyForAssignmentOp (Sema &S, SourceLocation Loc, QualType T, const ExprBuilder &ToB, const ExprBuilder &FromB)
 When generating a defaulted copy or move assignment operator, if a field should be copied with __builtin_memcpy rather than via explicit assignments, do so. More...
 
static StmtResult buildSingleCopyAssignRecursively (Sema &S, SourceLocation Loc, QualType T, const ExprBuilder &To, const ExprBuilder &From, bool CopyingBaseSubobject, bool Copying, unsigned Depth=0)
 Builds a statement that copies/moves the given entity from From to To. More...
 
static StmtResult buildSingleCopyAssign (Sema &S, SourceLocation Loc, QualType T, const ExprBuilder &To, const ExprBuilder &From, bool CopyingBaseSubobject, bool Copying)
 
static void diagnoseDeprecatedCopyOperation (Sema &S, CXXMethodDecl *CopyOp)
 Diagnose an implicit copy operation for a class which is odr-used, but which is deprecated because the class has a user-declared copy constructor, copy assignment operator, or destructor. More...
 
static void checkMoveAssignmentForRepeatedMove (Sema &S, CXXRecordDecl *Class, SourceLocation CurrentLocation)
 Check if we're implicitly defining a move assignment operator for a class with virtual bases. More...
 
static bool hasOneRealArgument (MultiExprArg Args)
 Determine whether the given list arguments contains exactly one "real" (non-default) argument. More...
 
static bool CheckOperatorNewDeleteDeclarationScope (Sema &SemaRef, const FunctionDecl *FnDecl)
 
static bool CheckOperatorNewDeleteTypes (Sema &SemaRef, const FunctionDecl *FnDecl, CanQualType ExpectedResultType, CanQualType ExpectedFirstParamType, unsigned DependentParamTypeDiag, unsigned InvalidParamTypeDiag)
 
static bool CheckOperatorNewDeclaration (Sema &SemaRef, const FunctionDecl *FnDecl)
 
static bool CheckOperatorDeleteDeclaration (Sema &SemaRef, FunctionDecl *FnDecl)
 
static bool checkLiteralOperatorTemplateParameterList (Sema &SemaRef, FunctionTemplateDecl *TpDecl)
 
static void SearchForReturnInStmt (Sema &Self, Stmt *S)
 
static bool isNonlocalVariable (const Decl *D)
 Determine whether the given declaration is a global variable or static data member. More...
 
static void DelegatingCycleHelper (CXXConstructorDecl *Ctor, llvm::SmallSet< CXXConstructorDecl *, 4 > &Valid, llvm::SmallSet< CXXConstructorDecl *, 4 > &Invalid, llvm::SmallSet< CXXConstructorDecl *, 4 > &Current, Sema &S)
 

Macro Definition Documentation

◆ ABSTRACT_TYPELOC

#define ABSTRACT_TYPELOC (   CLASS,
  PARENT 
)

◆ CheckPolymorphic

#define CheckPolymorphic (   Type)
Value:
void Check(Type TL, Sema::AbstractDiagSelID Sel) { \
Visit(TL.getNextTypeLoc(), Sema::AbstractNone); \
}
The base class of the type hierarchy.
Definition: Type.h:1353
AbstractDiagSelID
Definition: Sema.h:5991

Definition at line 5369 of file SemaDeclCXX.cpp.

◆ OVERLOADED_OPERATOR

#define OVERLOADED_OPERATOR (   Name,
  Spelling,
  Token,
  Unary,
  Binary,
  MemberOnly 
)    , { Unary, Binary, MemberOnly }

◆ TYPELOC

#define TYPELOC (   CLASS,
  PARENT 
)    case TypeLoc::CLASS: Check(TL.castAs<CLASS##TypeLoc>(), Sel); break;

Typedef Documentation

◆ IndirectBaseSet

typedef llvm::SmallPtrSet<QualType, 4> IndirectBaseSet

Use small set to collect indirect bases.

As this is only used locally, there's no need to abstract the small size parameter.

Definition at line 2327 of file SemaDeclCXX.cpp.

Enumeration Type Documentation

◆ ImplicitInitializerKind

ImplicitInitializerKind - How an implicit base or member initializer should initialize its base or member.

Enumerator
IIK_Default 
IIK_Copy 
IIK_Move 
IIK_Inherit 

Definition at line 4219 of file SemaDeclCXX.cpp.

◆ IsTupleLike

enum IsTupleLike
strong

Definition at line 1002 of file SemaDeclCXX.cpp.

◆ TrivialSubobjectKind

The kind of subobject we are checking for triviality.

The values of this enumeration are used in diagnostics.

Enumerator
TSK_BaseClass 

The subobject is a base class.

TSK_Field 

The subobject is a non-static data member.

TSK_CompleteObject 

The object is actually the complete object.

Definition at line 7156 of file SemaDeclCXX.cpp.

Function Documentation

◆ AddMostOverridenMethods()

static void AddMostOverridenMethods ( const CXXMethodDecl MD,
llvm::SmallPtrSetImpl< const CXXMethodDecl *> &  Methods 
)
static

Add the most overriden methods from MD to Methods.

Definition at line 7484 of file SemaDeclCXX.cpp.

References clang::CXXMethodDecl::getCanonicalDecl(), and clang::CXXMethodDecl::size_overridden_methods().

◆ BuildBasePathArray()

static void BuildBasePathArray ( const CXXBasePath Path,
CXXCastPath BasePathArray 
)
static

Definition at line 2510 of file SemaDeclCXX.cpp.

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

◆ BuildImplicitBaseInitializer()

static bool BuildImplicitBaseInitializer ( Sema SemaRef,
CXXConstructorDecl Constructor,
ImplicitInitializerKind  ImplicitInitKind,
CXXBaseSpecifier BaseSpec,
bool  IsInheritedVirtualBase,
CXXCtorInitializer *&  CXXBaseInit 
)
static

◆ BuildImplicitMemberInitializer()

static bool BuildImplicitMemberInitializer ( Sema SemaRef,
CXXConstructorDecl Constructor,
ImplicitInitializerKind  ImplicitInitKind,
FieldDecl Field,
IndirectFieldDecl Indirect,
CXXCtorInitializer *&  CXXMemberInit 
)
static

◆ buildMemcpyForAssignmentOp()

static StmtResult buildMemcpyForAssignmentOp ( Sema S,
SourceLocation  Loc,
QualType  T,
const ExprBuilder &  ToB,
const ExprBuilder &  FromB 
)
static

◆ buildSingleCopyAssign()

static StmtResult buildSingleCopyAssign ( Sema S,
SourceLocation  Loc,
QualType  T,
const ExprBuilder &  To,
const ExprBuilder &  From,
bool  CopyingBaseSubobject,
bool  Copying 
)
static

◆ buildSingleCopyAssignRecursively()

static StmtResult buildSingleCopyAssignRecursively ( Sema S,
SourceLocation  Loc,
QualType  T,
const ExprBuilder &  To,
const ExprBuilder &  From,
bool  CopyingBaseSubobject,
bool  Copying,
unsigned  Depth = 0 
)
static

Builds a statement that copies/moves the given entity from From to To.

This routine is used to copy/move the members of a class with an implicitly-declared copy/move assignment operator. When the entities being copied are arrays, this routine builds for loops to copy them.

Parameters
SThe Sema object used for type-checking.
LocThe location where the implicit copy/move is being generated.
TThe type of the expressions being copied/moved. Both expressions must have this type.
ToThe expression we are copying/moving to.
FromThe expression we are copying/moving from.
CopyingBaseSubobjectWhether we're copying/moving a base subobject. Otherwise, it's a non-static member subobject.
CopyingWhether we're copying or moving.
DepthInternal parameter recording the depth of the recursion.
Returns
A statement or a loop that copies the expressions, or StmtResult(0) if a memcpy should be used instead.

Definition at line 11063 of file SemaDeclCXX.cpp.

References clang::Type::getAs().

Referenced by buildSingleCopyAssign().

◆ CastForMoving()

static Expr* CastForMoving ( Sema SemaRef,
Expr E,
QualType  T = QualType() 
)
static

◆ CheckAbstractClassUsage() [1/2]

static void CheckAbstractClassUsage ( AbstractUsageInfo &  Info,
CXXMethodDecl MD 
)
static

Check for invalid uses of an abstract type in a method declaration.

Definition at line 5421 of file SemaDeclCXX.cpp.

References clang::Sema::AbstractNone, clang::FunctionDecl::doesThisDeclarationHaveABody(), and clang::DeclaratorDecl::getTypeSourceInfo().

Referenced by CheckAbstractClassUsage(), and clang::Sema::CheckCompletedCXXClass().

◆ CheckAbstractClassUsage() [2/2]

static void CheckAbstractClassUsage ( AbstractUsageInfo &  Info,
CXXRecordDecl RD 
)
static

Check for invalid uses of an abstract type within a class definition.

Definition at line 5436 of file SemaDeclCXX.cpp.

References clang::Sema::AbstractFieldType, clang::Sema::AbstractVariableType, CheckAbstractClassUsage(), clang::DeclContext::decls(), and clang::DeclaratorDecl::getTypeSourceInfo().

◆ checkArrayDecomposition()

static bool checkArrayDecomposition ( Sema S,
ArrayRef< BindingDecl *>  Bindings,
ValueDecl Src,
QualType  DecompType,
const ConstantArrayType CAT 
)
static

◆ checkArrayLikeDecomposition()

static bool checkArrayLikeDecomposition ( Sema S,
ArrayRef< BindingDecl *>  Bindings,
ValueDecl Src,
QualType  DecompType,
const llvm::APSInt &  NumElems,
QualType  ElemType 
)
static

Definition at line 874 of file SemaDeclCXX.cpp.

References checkSimpleDecomposition().

Referenced by checkArrayDecomposition(), and checkVectorDecomposition().

◆ checkComplexDecomposition()

static bool checkComplexDecomposition ( Sema S,
ArrayRef< BindingDecl *>  Bindings,
ValueDecl Src,
QualType  DecompType,
const ComplexType CT 
)
static

◆ CheckConstexprCtorInitializer()

static void CheckConstexprCtorInitializer ( Sema SemaRef,
const FunctionDecl Dcl,
FieldDecl Field,
llvm::SmallSet< Decl *, 16 > &  Inits,
bool Diagnosed 
)
static

Check that the given field is initialized within a constexpr constructor.

Parameters
DclThe constexpr constructor being checked.
FieldThe field being checked. This may be a member of an anonymous struct or union nested within the class being checked.
InitsAll declarations, including anonymous struct/union members and indirect members, for which any initialization was provided.
DiagnosedSet to true if an error is produced.

Definition at line 1772 of file SemaDeclCXX.cpp.

References clang::Type::castAs(), clang::Sema::Diag(), clang::Type::getAsCXXRecordDecl(), clang::Decl::getLocation(), clang::ValueDecl::getType(), clang::CXXRecordDecl::hasVariantMembers(), clang::FieldDecl::isAnonymousStructOrUnion(), clang::CXXRecordDecl::isEmpty(), clang::Decl::isInvalidDecl(), clang::Type::isUnionType(), and clang::FieldDecl::isUnnamedBitfield().

◆ CheckConstexprDeclStmt()

static bool CheckConstexprDeclStmt ( Sema SemaRef,
const FunctionDecl Dcl,
DeclStmt DS,
SourceLocation Cxx1yLoc 
)
static

Check the given declaration statement is legal within a constexpr function body.

C++11 [dcl.constexpr]p3,p4, and C++1y [dcl.constexpr]p3.

Returns
true if the body is OK (maybe only as an extension), false if we have diagnosed a problem.

Definition at line 1658 of file SemaDeclCXX.cpp.

References clang::DeclStmt::decls(), clang::Sema::Diag(), clang::TypeLoc::getBeginLoc(), clang::Sema::getLangOpts(), clang::DeclStmt::getLocStart(), clang::TypeLoc::getSourceRange(), clang::TypeLoc::getType(), clang::SourceLocation::isValid(), clang::Sema::RequireLiteralType(), and clang::VarDecl::TLS_Dynamic.

Referenced by CheckConstexprFunctionStmt().

◆ CheckConstexprFunctionStmt()

static bool CheckConstexprFunctionStmt ( Sema SemaRef,
const FunctionDecl Dcl,
Stmt S,
SmallVectorImpl< SourceLocation > &  ReturnStmts,
SourceLocation Cxx1yLoc 
)
static

Check the provided statement is allowed in a constexpr function definition.

Definition at line 1811 of file SemaDeclCXX.cpp.

References CheckConstexprDeclStmt(), clang::Stmt::getLocStart(), clang::Stmt::getStmtClass(), and clang::SourceLocation::isValid().

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

◆ CheckConstexprParameterTypes()

static bool CheckConstexprParameterTypes ( Sema SemaRef,
const FunctionDecl FD 
)
static

◆ CheckForDanglingReferenceOrPointer()

static void CheckForDanglingReferenceOrPointer ( Sema S,
ValueDecl Member,
Expr Init,
SourceLocation  IdLoc 
)
static

◆ checkForMultipleExportedDefaultConstructors()

static void checkForMultipleExportedDefaultConstructors ( Sema S,
CXXRecordDecl Class 
)
static

◆ checkLiteralOperatorTemplateParameterList()

static bool checkLiteralOperatorTemplateParameterList ( Sema SemaRef,
FunctionTemplateDecl TpDecl 
)
static

◆ checkMemberDecomposition()

static bool checkMemberDecomposition ( Sema S,
ArrayRef< BindingDecl *>  Bindings,
ValueDecl Src,
QualType  DecompType,
const CXXRecordDecl RD 
)
static

◆ checkMoveAssignmentForRepeatedMove()

static void checkMoveAssignmentForRepeatedMove ( Sema S,
CXXRecordDecl Class,
SourceLocation  CurrentLocation 
)
static

◆ CheckOperatorDeleteDeclaration()

static bool CheckOperatorDeleteDeclaration ( Sema SemaRef,
FunctionDecl FnDecl 
)
static

◆ CheckOperatorNewDeclaration()

static bool CheckOperatorNewDeclaration ( Sema SemaRef,
const FunctionDecl FnDecl 
)
static

◆ CheckOperatorNewDeleteDeclarationScope()

static bool CheckOperatorNewDeleteDeclarationScope ( Sema SemaRef,
const FunctionDecl FnDecl 
)
inlinestatic

◆ CheckOperatorNewDeleteTypes()

static bool CheckOperatorNewDeleteTypes ( Sema SemaRef,
const FunctionDecl FnDecl,
CanQualType  ExpectedResultType,
CanQualType  ExpectedFirstParamType,
unsigned  DependentParamTypeDiag,
unsigned  InvalidParamTypeDiag 
)
inlinestatic

◆ checkSimpleDecomposition()

static bool checkSimpleDecomposition ( Sema S,
ArrayRef< BindingDecl *>  Bindings,
ValueDecl Src,
QualType  DecompType,
const llvm::APSInt &  NumElems,
QualType  ElemType,
llvm::function_ref< ExprResult(SourceLocation, Expr *, unsigned)>  GetInit 
)
static

Definition at line 848 of file SemaDeclCXX.cpp.

Referenced by checkArrayLikeDecomposition(), and checkComplexDecomposition().

◆ checkTrivialClassMembers()

static bool checkTrivialClassMembers ( Sema S,
CXXRecordDecl RD,
Sema::CXXSpecialMember  CSM,
bool  ConstArg,
bool  Diagnose 
)
static

◆ checkTrivialSubobjectCall()

static bool checkTrivialSubobjectCall ( Sema S,
SourceLocation  SubobjLoc,
QualType  SubType,
bool  ConstRHS,
Sema::CXXSpecialMember  CSM,
TrivialSubobjectKind  Kind,
bool  Diagnose 
)
static

◆ checkTupleLikeDecomposition()

static bool checkTupleLikeDecomposition ( Sema S,
ArrayRef< BindingDecl *>  Bindings,
VarDecl Src,
QualType  DecompType,
const llvm::APSInt &  TupleSize 
)
static

◆ checkVectorDecomposition()

static bool checkVectorDecomposition ( Sema S,
ArrayRef< BindingDecl *>  Bindings,
ValueDecl Src,
QualType  DecompType,
const VectorType VT 
)
static

◆ CollectFieldInitializer()

static bool CollectFieldInitializer ( Sema SemaRef,
BaseAndFieldInfo &  Info,
FieldDecl Field,
IndirectFieldDecl Indirect = nullptr 
)
static

◆ computeCanPassInRegisters()

static bool computeCanPassInRegisters ( Sema S,
CXXRecordDecl D 
)
static

◆ ComputeDefaultedSpecialMemberExceptionSpec()

static Sema::ImplicitExceptionSpecification ComputeDefaultedSpecialMemberExceptionSpec ( Sema S,
SourceLocation  Loc,
CXXMethodDecl MD,
Sema::CXXSpecialMember  CSM,
Sema::InheritedConstructorInfo ICI 
)
static

◆ computeImplicitExceptionSpec()

static Sema::ImplicitExceptionSpecification computeImplicitExceptionSpec ( Sema S,
SourceLocation  Loc,
CXXMethodDecl MD 
)
static

◆ defaultedSpecialMemberIsConstexpr()

static bool defaultedSpecialMemberIsConstexpr ( Sema S,
CXXRecordDecl ClassDecl,
Sema::CXXSpecialMember  CSM,
bool  ConstArg,
CXXConstructorDecl InheritedCtor = nullptr,
Sema::InheritedConstructorInfo Inherited = nullptr 
)
static

◆ DefineImplicitSpecialMember()

static void DefineImplicitSpecialMember ( Sema S,
CXXMethodDecl MD,
SourceLocation  DefaultLoc 
)
static

◆ DelegatingCycleHelper()

static void DelegatingCycleHelper ( CXXConstructorDecl Ctor,
llvm::SmallSet< CXXConstructorDecl *, 4 > &  Valid,
llvm::SmallSet< CXXConstructorDecl *, 4 > &  Invalid,
llvm::SmallSet< CXXConstructorDecl *, 4 > &  Current,
Sema S 
)
static

Definition at line 14675 of file SemaDeclCXX.cpp.

◆ DiagnoseBaseOrMemInitializerOrder()

static void DiagnoseBaseOrMemInitializerOrder ( Sema SemaRef,
const CXXConstructorDecl Constructor,
ArrayRef< CXXCtorInitializer *>  Inits 
)
static

◆ diagnoseDeprecatedCopyOperation()

static void diagnoseDeprecatedCopyOperation ( Sema S,
CXXMethodDecl CopyOp 
)
static

Diagnose an implicit copy operation for a class which is odr-used, but which is deprecated because the class has a user-declared copy constructor, copy assignment operator, or destructor.

Definition at line 11352 of file SemaDeclCXX.cpp.

References clang::Sema::getLangOpts(), clang::CXXMethodDecl::getParent(), and clang::Decl::isImplicit().

Referenced by clang::Sema::DefineImplicitCopyAssignment(), and clang::Sema::DefineImplicitCopyConstructor().

◆ DiagnoseNamespaceInlineMismatch()

static void DiagnoseNamespaceInlineMismatch ( Sema S,
SourceLocation  KeywordLoc,
SourceLocation  Loc,
IdentifierInfo II,
bool IsInline,
NamespaceDecl PrevNS 
)
static

◆ extendLeft()

static void extendLeft ( SourceRange R,
SourceRange  Before 
)
static

◆ extendRight()

static void extendRight ( SourceRange R,
SourceRange  After 
)
static

◆ FindBaseInitializer()

static bool FindBaseInitializer ( Sema SemaRef,
CXXRecordDecl ClassDecl,
QualType  BaseType,
const CXXBaseSpecifier *&  DirectBaseSpec,
const CXXBaseSpecifier *&  VirtualBaseSpec 
)
static

Find the direct and/or virtual base specifiers that correspond to the given base type, for use in base initialization within a constructor.

Definition at line 3614 of file SemaDeclCXX.cpp.

References clang::CXXRecordDecl::bases(), clang::CXXBasePaths::begin(), clang::Sema::Context, clang::CXXBasePaths::end(), clang::Decl::getLocation(), clang::ASTContext::getTypeDeclType(), clang::ASTContext::hasSameUnqualifiedType(), clang::Sema::IsDerivedFrom(), and clang::CXXBaseSpecifier::isVirtual().

◆ findCircularInheritance()

static bool findCircularInheritance ( const CXXRecordDecl Class,
const CXXRecordDecl Current 
)
static

Determine whether the given class is a base class of the given class, including looking at dependent bases.

Definition at line 2112 of file SemaDeclCXX.cpp.

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

◆ findDecomposableBaseClass()

static const CXXRecordDecl* findDecomposableBaseClass ( Sema S,
SourceLocation  Loc,
const CXXRecordDecl RD,
CXXCastPath BasePath 
)
static

◆ findDirectBaseWithType()

static CXXBaseSpecifier* findDirectBaseWithType ( CXXRecordDecl Derived,
QualType  DesiredBase,
bool AnyDependentBases 
)
static

◆ findTrivialSpecialMember()

static bool findTrivialSpecialMember ( Sema S,
CXXRecordDecl RD,
Sema::CXXSpecialMember  CSM,
unsigned  Quals,
bool  ConstRHS,
CXXMethodDecl **  Selected 
)
static

Perform lookup for a special member of the specified kind, and determine whether it is trivial.

If the triviality can be determined without the lookup, skip it. This is intended for use when determining whether a special member of a containing object is trivial, and thus does not ever perform overload resolution for default constructors.

If Selected is not NULL, *Selected will be filled in with the member that was most likely to be intended to be trivial, if any.

Definition at line 7021 of file SemaDeclCXX.cpp.

References clang::Sema::SpecialMemberOverloadResult::Ambiguous, clang::Qualifiers::Const, clang::CXXRecordDecl::ctors(), clang::Sema::CXXCopyAssignment, clang::Sema::CXXCopyConstructor, clang::Sema::CXXDefaultConstructor, clang::Sema::CXXDestructor, clang::Sema::CXXInvalid, clang::Sema::CXXMoveAssignment, clang::Sema::CXXMoveConstructor, clang::Sema::DeclareImplicitDefaultConstructor(), clang::Sema::DeclareImplicitDestructor(), clang::CXXRecordDecl::getDestructor(), clang::Sema::SpecialMemberOverloadResult::getKind(), clang::Sema::SpecialMemberOverloadResult::getMethod(), clang::CXXRecordDecl::hasTrivialCopyAssignment(), clang::CXXRecordDecl::hasTrivialCopyConstructor(), clang::CXXRecordDecl::hasTrivialDefaultConstructor(), clang::CXXRecordDecl::hasTrivialDestructor(), clang::FunctionDecl::isTrivial(), clang::CXXMethodDecl::isUserProvided(), lookupCallFromSpecialMember(), clang::CXXRecordDecl::needsImplicitDefaultConstructor(), clang::CXXRecordDecl::needsImplicitDestructor(), and clang::Sema::SpecialMemberOverloadResult::NoMemberOrDeleted.

Referenced by checkTrivialSubobjectCall().

◆ findUserDeclaredCtor()

static CXXConstructorDecl* findUserDeclaredCtor ( CXXRecordDecl RD)
static

◆ functionDeclHasDefaultArgument()

static bool functionDeclHasDefaultArgument ( const FunctionDecl FD)
static

◆ getImplicitMethodEPI()

static FunctionProtoType::ExtProtoInfo getImplicitMethodEPI ( Sema S,
CXXMethodDecl MD 
)
static

◆ GetKeyForBase()

static const void* GetKeyForBase ( ASTContext Context,
QualType  BaseType 
)
static

Definition at line 4848 of file SemaDeclCXX.cpp.

Referenced by DiagnoseBaseOrMemInitializerOrder().

◆ GetKeyForMember()

static const void* GetKeyForMember ( ASTContext Context,
CXXCtorInitializer Member 
)
static

◆ getMSPropertyAttr()

static AttributeList* getMSPropertyAttr ( AttributeList list)
static

◆ getNamespaceDecl()

static NamespaceDecl* getNamespaceDecl ( NamedDecl D)
inlinestatic

getNamespaceDecl - Returns the namespace a decl represents.

If the decl is a namespace alias, returns the namespace it points to.

Definition at line 8635 of file SemaDeclCXX.cpp.

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

◆ getRecordDiagFromTagKind()

static unsigned getRecordDiagFromTagKind ( TagTypeKind  Tag)
static

Get diagnostic select index for tag kind for record diagnostic message.

WARNING: Indexes apply to particular diagnostics only!

Returns
diagnostic select index.

Definition at line 1583 of file SemaDeclCXX.cpp.

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

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

◆ getTrivialIntegralTemplateArgument()

static TemplateArgumentLoc getTrivialIntegralTemplateArgument ( Sema S,
SourceLocation  Loc,
QualType  T,
uint64_t  I 
)
static

Definition at line 991 of file SemaDeclCXX.cpp.

◆ getTrivialTypeTemplateArgument()

static TemplateArgumentLoc getTrivialTypeTemplateArgument ( Sema S,
SourceLocation  Loc,
QualType  T 
)
static

Definition at line 998 of file SemaDeclCXX.cpp.

References clang::Sema::getTrivialTemplateArgumentLoc().

Referenced by isTupleLike().

◆ getTupleLikeElementType()

static QualType getTupleLikeElementType ( Sema S,
SourceLocation  Loc,
unsigned  I,
QualType  T 
)
static
Returns
std::tuple_element<I, T>::type.

Definition at line 1052 of file SemaDeclCXX.cpp.

◆ hasOneRealArgument()

static bool hasOneRealArgument ( MultiExprArg  Args)
static

Determine whether the given list arguments contains exactly one "real" (non-default) argument.

Definition at line 12350 of file SemaDeclCXX.cpp.

◆ InitializationHasSideEffects()

static bool InitializationHasSideEffects ( const FieldDecl FD)
static

◆ IsEquivalentForUsingDecl()

static bool IsEquivalentForUsingDecl ( ASTContext Context,
NamedDecl D1,
NamedDecl D2 
)
static

Determine whether a using declaration considers the given declarations as "equivalent", e.g., if they are redeclarations of the same entity or are both typedefs of the same type.

Definition at line 9067 of file SemaDeclCXX.cpp.

◆ isIncompleteOrZeroLengthArrayType()

static bool isIncompleteOrZeroLengthArrayType ( ASTContext Context,
QualType  T 
)
static

Determine whether the given type is an incomplete or zero-lenfgth array type.

Definition at line 4560 of file SemaDeclCXX.cpp.

Referenced by CollectFieldInitializer(), and clang::Sema::MarkBaseAndMemberDestructorsReferenced().

◆ isNonlocalVariable()

static bool isNonlocalVariable ( const Decl D)
static

Determine whether the given declaration is a global variable or static data member.

Definition at line 14336 of file SemaDeclCXX.cpp.

Referenced by clang::Sema::ActOnCXXEnterDeclInitializer(), and clang::Sema::ActOnCXXExitDeclInitializer().

◆ isTupleLike()

static IsTupleLike isTupleLike ( Sema S,
SourceLocation  Loc,
QualType  T,
llvm::APSInt &  Size 
)
static

◆ IsUsingDirectiveInToplevelContext()

static bool IsUsingDirectiveInToplevelContext ( DeclContext CurContext)
static

Determine whether a using statement is in a context where it will be apply in all contexts.

Definition at line 8825 of file SemaDeclCXX.cpp.

References clang::TypoCorrection::getCorrectionDecl(), clang::DeclContext::getDeclKind(), and clang::DeclContext::getParent().

◆ isVirtualDirectBase()

static bool isVirtualDirectBase ( CXXRecordDecl Derived,
CXXRecordDecl Base 
)
static

Determine whether a direct base class is a virtual base class.

Definition at line 9227 of file SemaDeclCXX.cpp.

References clang::CXXRecordDecl::bases(), and clang::CXXRecordDecl::getNumVBases().

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

◆ lookupCallFromSpecialMember()

static Sema::SpecialMemberOverloadResult lookupCallFromSpecialMember ( Sema S,
CXXRecordDecl Class,
Sema::CXXSpecialMember  CSM,
unsigned  FieldQuals,
bool  ConstRHS 
)
static

Look up the special member function that would be called by a special member function for a subobject of class type.

Parameters
ClassThe class type of the subobject.
CSMThe kind of special member function.
FieldQualsIf the subobject is a field, its cv-qualifiers.
ConstRHSTrue if this is a copy operation with a const object on its RHS, that is, if the argument to the outer special member function is 'const' and this is not a field marked 'mutable'.

Definition at line 5962 of file SemaDeclCXX.cpp.

References clang::Qualifiers::Const, clang::Sema::CXXCopyAssignment, clang::Sema::CXXDefaultConstructor, clang::Sema::CXXDestructor, clang::Sema::CXXMoveAssignment, clang::Sema::LookupSpecialMember(), and clang::Qualifiers::Volatile.

Referenced by findTrivialSpecialMember(), and specialMemberIsConstexpr().

◆ LookupStdInitializerList()

static ClassTemplateDecl* LookupStdInitializerList ( Sema S,
SourceLocation  Loc 
)
static

◆ lookupStdTypeTraitMember()

static bool lookupStdTypeTraitMember ( Sema S,
LookupResult TraitMemberLookup,
SourceLocation  Loc,
StringRef  Trait,
TemplateArgumentListInfo Args,
unsigned  DiagID 
)
static

◆ NoteIndirectBases()

static void NoteIndirectBases ( ASTContext Context,
IndirectBaseSet Set,
const QualType Type 
)
static

Recursively add the bases of Type. Don't add Type itself.

Definition at line 2331 of file SemaDeclCXX.cpp.

◆ PopulateKeysForFields()

static void PopulateKeysForFields ( FieldDecl Field,
SmallVectorImpl< const void *> &  IdealInits 
)
static

◆ printTemplateArgs()

static std::string printTemplateArgs ( const PrintingPolicy PrintingPolicy,
TemplateArgumentListInfo Args 
)
static

◆ ReferenceDllExportedMethods()

static void ReferenceDllExportedMethods ( Sema S,
CXXRecordDecl Class 
)
static

◆ RefersToRValueRef()

static bool RefersToRValueRef ( Expr MemRef)
static

◆ SearchForReturnInStmt()

static void SearchForReturnInStmt ( Sema Self,
Stmt S 
)
static

Definition at line 14141 of file SemaDeclCXX.cpp.

References clang::Stmt::children(), and clang::Sema::Diag().

◆ specialMemberIsConstexpr()

static bool specialMemberIsConstexpr ( Sema S,
CXXRecordDecl ClassDecl,
Sema::CXXSpecialMember  CSM,
unsigned  Quals,
bool  ConstRHS,
CXXConstructorDecl InheritedCtor = nullptr,
Sema::InheritedConstructorInfo Inherited = nullptr 
)
static

Is the special member function which would be selected to perform the specified operation on the specified class type a constexpr constructor?

Definition at line 6067 of file SemaDeclCXX.cpp.

References clang::Sema::CXXDefaultConstructor, clang::Sema::SpecialMemberOverloadResult::getMethod(), clang::CXXRecordDecl::hasConstexprDefaultConstructor(), clang::FunctionDecl::isConstexpr(), and lookupCallFromSpecialMember().

Referenced by defaultedSpecialMemberIsConstexpr().

◆ TryNamespaceTypoCorrection()

static bool TryNamespaceTypoCorrection ( Sema S,
LookupResult R,
Scope Sc,
CXXScopeSpec SS,
SourceLocation  IdentLoc,
IdentifierInfo Ident 
)
static