clang 20.0.0git
Classes | Macros | Enumerations | Functions
SemaDecl.cpp File Reference
#include "TypeLocBuilder.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTLambda.h"
#include "clang/AST/CXXInheritance.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/CommentDiagnostic.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/EvaluatedExprVisitor.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/NonTrivialTypeVisitor.h"
#include "clang/AST/MangleNumberingContext.h"
#include "clang/AST/Randstruct.h"
#include "clang/AST/StmtCXX.h"
#include "clang/AST/Type.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/HLSLRuntime.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/Lexer.h"
#include "clang/Lex/ModuleLoader.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Sema/CXXFieldCollector.h"
#include "clang/Sema/DeclSpec.h"
#include "clang/Sema/DelayedDiagnostic.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/SemaCUDA.h"
#include "clang/Sema/SemaHLSL.h"
#include "clang/Sema/SemaInternal.h"
#include "clang/Sema/SemaObjC.h"
#include "clang/Sema/SemaOpenMP.h"
#include "clang/Sema/SemaPPC.h"
#include "clang/Sema/SemaRISCV.h"
#include "clang/Sema/SemaSwift.h"
#include "clang/Sema/SemaWasm.h"
#include "clang/Sema/Template.h"
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/TargetParser/Triple.h"
#include <algorithm>
#include <cstring>
#include <functional>
#include <optional>
#include <unordered_map>
#include "clang/Sema/AttrParsedAttrImpl.inc"
#include "clang/Basic/TransformTypeTraits.def"

Go to the source code of this file.

Classes

class  ExitFunctionBodyRAII
 RAII object that pops an ExpressionEvaluationContext when exiting a function body. More...
 

Macros

#define WANT_DECL_MERGE_LOGIC
 
#define TRANSFORM_TYPE_TRAIT_DEF(_, Trait)   case DeclSpec::TST_##Trait:
 

Enumerations

enum  ShadowedDeclKind {
  SDK_Local , SDK_Global , SDK_StaticMember , SDK_Field ,
  SDK_Typedef , SDK_Using , SDK_StructuredBinding
}
 Enum describing the select options in diag::warn_decl_shadow. More...
 
enum  OpenCLParamType {
  ValidKernelParam , PtrPtrKernelParam , PtrKernelParam , InvalidAddrSpacePtrKernelParam ,
  InvalidKernelParam , RecordKernelParam
}
 

Functions

static UnqualifiedTypeNameLookupResult lookupUnqualifiedTypeNameInBase (Sema &S, const IdentifierInfo &II, SourceLocation NameLoc, const CXXRecordDecl *RD)
 Tries to perform unqualified lookup of the type decls in bases for dependent class.
 
static ParsedType recoverFromTypeInKnownDependentBase (Sema &S, const IdentifierInfo &II, SourceLocation NameLoc)
 
static ParsedType buildNamedType (Sema &S, const CXXScopeSpec *SS, QualType T, SourceLocation NameLoc, bool WantNontrivialTypeSourceInfo=true)
 Build a ParsedType for a simple-type-specifier with a nested-name-specifier.
 
static NestedNameSpecifiersynthesizeCurrentNestedNameSpecifier (ASTContext &Context, DeclContext *DC)
 
static const CXXRecordDeclfindRecordWithDependentBasesOfEnclosingMethod (const DeclContext *DC)
 Find the parent class with dependent bases of the innermost enclosing method context.
 
static bool isResultTypeOrTemplate (LookupResult &R, const Token &NextToken)
 Determine whether the given result set contains either a type name or.
 
static bool isTagTypeWithMissingTag (Sema &SemaRef, LookupResult &Result, Scope *S, CXXScopeSpec &SS, IdentifierInfo *&Name, SourceLocation NameLoc)
 
static bool AllowOverloadingOfFunction (const LookupResult &Previous, ASTContext &Context, const FunctionDecl *New)
 Determine whether overloading is allowed for a new function declaration considering prior declarations of the same name.
 
static bool isOutOfScopePreviousDeclaration (NamedDecl *PrevDecl, DeclContext *DC, ASTContext &Context)
 Determines whether the given declaration is an out-of-scope previous declaration.
 
static bool isUsingDeclNotAtClassScope (NamedDecl *D)
 
static void RemoveUsingDecls (LookupResult &R)
 Removes using shadow declarations not at class scope from the lookup results.
 
static bool IsDisallowedCopyOrAssign (const CXXMethodDecl *D)
 Check for this common pattern:
 
static bool isMainFileLoc (const Sema &S, SourceLocation Loc)
 
static bool ShouldDiagnoseUnusedDecl (const LangOptions &LangOpts, const NamedDecl *D)
 
static void GenerateFixForUnusedDecl (const NamedDecl *D, ASTContext &Ctx, FixItHint &Hint)
 
static void CheckPoppedLabel (LabelDecl *L, Sema &S, Sema::DiagReceiverTy DiagReceiver)
 
static StringRef getHeaderName (Builtin::Context &BuiltinInfo, unsigned ID, ASTContext::GetBuiltinTypeError Error)
 
static void filterNonConflictingPreviousTypedefDecls (Sema &S, const TypedefNameDecl *Decl, LookupResult &Previous)
 Typedef declarations don't have linkage, but they still denote the same entity if their types are the same.
 
static bool DeclHasAttr (const Decl *D, const Attr *A)
 DeclhasAttr - returns true if decl Declaration already has the target attribute.
 
static bool isAttributeTargetADefinition (Decl *D)
 
static bool mergeAlignedAttrs (Sema &S, NamedDecl *New, Decl *Old)
 Merge alignment attributes from Old to New, taking into account the special semantics of C11's _Alignas specifier and C++11's alignas attribute.
 
static bool mergeDeclAttribute (Sema &S, NamedDecl *D, const InheritableAttr *Attr, Sema::AvailabilityMergeKind AMK)
 
static const NamedDeclgetDefinition (const Decl *D)
 
static bool hasAttribute (const Decl *D, attr::Kind Kind)
 
static void checkNewAttributesAfterDef (Sema &S, Decl *New, const Decl *Old)
 checkNewAttributesAfterDef - If we already have a definition, check that there are no new attributes in this declaration.
 
static void diagnoseMissingConstinit (Sema &S, const VarDecl *InitDecl, const ConstInitAttr *CIAttr, bool AttrBeforeInit)
 
static void mergeParamDeclAttributes (ParmVarDecl *newDecl, const ParmVarDecl *oldDecl, Sema &S)
 mergeParamDeclAttributes - Copy attributes from the old parameter to the new one.
 
static bool EquivalentArrayTypes (QualType Old, QualType New, const ASTContext &Ctx)
 
static void mergeParamDeclTypes (ParmVarDecl *NewParam, const ParmVarDecl *OldParam, Sema &S)
 
template<typename T >
static std::pair< diag::kind, SourceLocationgetNoteDiagForInvalidRedeclaration (const T *Old, const T *New)
 
static bool canRedefineFunction (const FunctionDecl *FD, const LangOptions &LangOpts)
 canRedefineFunction - checks if a function can be redefined.
 
template<typename T >
static bool haveIncompatibleLanguageLinkages (const T *Old, const T *New)
 
template<typename T >
static bool isExternC (T *D)
 
static bool isExternC (VarTemplateDecl *)
 
static bool isExternC (FunctionTemplateDecl *)
 
template<typename ExpectedDecl >
static bool checkUsingShadowRedecl (Sema &S, UsingShadowDecl *OldS, ExpectedDecl *New)
 Check whether a redeclaration of an entity introduced by a using-declaration is valid, given that we know it's not an overload (nor a hidden tag declaration).
 
static bool hasIdenticalPassObjectSizeAttrs (const FunctionDecl *A, const FunctionDecl *B)
 
static void adjustDeclContextForDeclaratorDecl (DeclaratorDecl *NewD, DeclaratorDecl *OldD)
 If necessary, adjust the semantic declaration context for a qualified declaration to name the correct inline namespace within the qualifier.
 
static void diagnoseVarDeclTypeMismatch (Sema &S, VarDecl *New, VarDecl *Old)
 
static bool mergeTypeWithPrevious (Sema &S, VarDecl *NewVD, VarDecl *OldVD, LookupResult &Previous)
 
static unsigned getMSManglingNumber (const LangOptions &LO, Scope *S)
 
static NonCLikeKind getNonCLikeKindForAnonymousStruct (const CXXRecordDecl *RD)
 Determine whether a class is C-like, according to the rules of C++ [dcl.typedef] for anonymous classes with typedef names for linkage.
 
static unsigned GetDiagnosticTypeSpecifierID (const DeclSpec &DS)
 
static bool CheckAnonMemberRedeclaration (Sema &SemaRef, Scope *S, DeclContext *Owner, DeclarationName Name, SourceLocation NameLoc, bool IsUnion, StorageClass SC)
 We are trying to inject an anonymous member into the given scope; check if there's an existing declaration that can't be overloaded.
 
static bool InjectAnonymousStructOrUnionMembers (Sema &SemaRef, Scope *S, DeclContext *Owner, RecordDecl *AnonRecord, AccessSpecifier AS, StorageClass SC, SmallVectorImpl< NamedDecl * > &Chaining)
 InjectAnonymousStructOrUnionMembers - Inject the members of the anonymous struct or union AnonRecord into the owning context Owner and scope S.
 
static StorageClass StorageClassSpecToVarDeclStorageClass (const DeclSpec &DS)
 StorageClassSpecToVarDeclStorageClass - Maps a DeclSpec::SCS to a VarDecl::StorageClass.
 
static SourceLocation findDefaultInitializer (const CXXRecordDecl *Record)
 
static void checkDuplicateDefaultInit (Sema &S, CXXRecordDecl *Parent, SourceLocation DefaultInitLoc)
 
static void checkDuplicateDefaultInit (Sema &S, CXXRecordDecl *Parent, CXXRecordDecl *AnonUnion)
 
static QualType getCoreType (QualType Ty)
 
static bool hasSimilarParameters (ASTContext &Context, FunctionDecl *Declaration, FunctionDecl *Definition, SmallVectorImpl< unsigned > &Params)
 hasSimilarParameters - Determine whether the C++ functions Declaration and Definition have "nearly" matching parameters.
 
static bool RebuildDeclaratorInCurrentInstantiation (Sema &S, Declarator &D, DeclarationName Name)
 RebuildDeclaratorInCurrentInstantiation - Checks whether the given declarator needs to be rebuilt in the current instantiation.
 
static bool isFromSystemHeader (SourceManager &SM, const Decl *D)
 Returns true if the declaration is declared in a system header or from a system macro.
 
static QualType TryToFixInvalidVariablyModifiedType (QualType T, ASTContext &Context, bool &SizeIsNegative, llvm::APSInt &Oversized)
 Helper method to turn variable array types into constant array types in certain situations which would otherwise be errors (for GCC compatibility).
 
static void FixInvalidVariablyModifiedTypeLoc (TypeLoc SrcTL, TypeLoc DstTL)
 
static TypeSourceInfoTryToFixInvalidVariablyModifiedTypeSourceInfo (TypeSourceInfo *TInfo, ASTContext &Context, bool &SizeIsNegative, llvm::APSInt &Oversized)
 Helper method to turn variable array types into constant array types in certain situations which would otherwise be errors (for GCC compatibility).
 
static void SetNestedNameSpecifier (Sema &S, DeclaratorDecl *DD, Declarator &D)
 
static void checkAttributesAfterMerging (Sema &S, NamedDecl &ND)
 
static void checkDLLAttributeRedeclaration (Sema &S, NamedDecl *OldDecl, NamedDecl *NewDecl, bool IsSpecialization, bool IsDefinition)
 
static bool isFunctionDefinitionDiscarded (Sema &S, FunctionDecl *FD)
 Given that we are within the definition of the given function, will that definition behave like C99's 'inline', where the definition is discarded except for optimization purposes?
 
template<typename T >
static bool isIncompleteDeclExternC (Sema &S, const T *D)
 Determine whether a variable is extern "C" prior to attaching an initializer.
 
static bool shouldConsiderLinkage (const VarDecl *VD)
 
static bool shouldConsiderLinkage (const FunctionDecl *FD)
 
static bool hasParsedAttr (Scope *S, const Declarator &PD, ParsedAttr::Kind Kind)
 
static bool isDeclExternC (const Decl *D)
 Returns true if given declaration has external C language linkage.
 
static bool diagnoseOpenCLTypes (Sema &Se, VarDecl *NewVD)
 Returns true if there hasn't been any invalid type diagnosed.
 
template<typename AttrTy >
static void copyAttrFromTypedefToDecl (Sema &S, Decl *D, const TypedefType *TT)
 
void emitReadOnlyPlacementAttrWarning (Sema &S, const VarDecl *VD)
 
static bool isMainVar (DeclarationName Name, VarDecl *VD)
 
static ShadowedDeclKind computeShadowedDeclKind (const NamedDecl *ShadowedDecl, const DeclContext *OldDC)
 Determine what kind of declaration we're shadowing.
 
static SourceLocation getCaptureLocation (const LambdaScopeInfo *LSI, const VarDecl *VD)
 Return the location of the capture if the given lambda captures the given variable VD, or an invalid source location otherwise.
 
static bool shouldWarnIfShadowedDecl (const DiagnosticsEngine &Diags, const LookupResult &R)
 
template<typename T >
static bool checkGlobalOrExternCConflict (Sema &S, const T *ND, bool IsGlobal, LookupResult &Previous)
 Check for conflict between this global or extern "C" declaration and previous global or extern "C" declarations.
 
template<typename T >
static bool checkForConflictWithNonVisibleExternC (Sema &S, const T *ND, LookupResult &Previous)
 Apply special rules for handling extern "C" declarations.
 
static bool CheckC23ConstexprVarType (Sema &SemaRef, SourceLocation VarLoc, QualType T)
 
static NamedDeclDiagnoseInvalidRedeclaration (Sema &SemaRef, LookupResult &Previous, FunctionDecl *NewFD, ActOnFDArgs &ExtraArgs, bool IsLocalFriend, Scope *S)
 Generate diagnostics for an invalid function redeclaration.
 
static StorageClass getFunctionStorageClass (Sema &SemaRef, Declarator &D)
 
static FunctionDeclCreateNewFunctionDecl (Sema &SemaRef, Declarator &D, DeclContext *DC, QualType &R, TypeSourceInfo *TInfo, StorageClass SC, bool &IsVirtualOkay)
 
static bool isOpenCLSizeDependentType (ASTContext &C, QualType Ty)
 
static OpenCLParamType getOpenCLKernelParameterType (Sema &S, QualType PT)
 
static void checkIsValidOpenCLKernelParameter (Sema &S, Declarator &D, ParmVarDecl *Param, llvm::SmallPtrSetImpl< const Type * > &ValidTypes)
 
static DeclContextgetTagInjectionContext (DeclContext *DC)
 Find the DeclContext in which a tag is implicitly declared if we see an elaborated type specifier in the specified context, and lookup finds nothing.
 
static ScopegetTagInjectionScope (Scope *S, const LangOptions &LangOpts)
 Find the Scope in which a tag is implicitly declared if we see an elaborated type specifier in the specified context, and lookup finds nothing.
 
static bool isStdBuiltin (ASTContext &Ctx, FunctionDecl *FD, unsigned BuiltinID)
 Determine whether a declaration matches a known function in namespace std.
 
static AttrgetImplicitCodeSegAttrFromClass (Sema &S, const FunctionDecl *FD)
 Return a CodeSegAttr from a containing class.
 
static bool CheckMultiVersionValue (Sema &S, const FunctionDecl *FD)
 Check the target or target_version attribute of the function for MultiVersion validity.
 
static bool AttrCompatibleWithMultiVersion (attr::Kind Kind, MultiVersionKind MVKind)
 
static bool checkNonMultiVersionCompatAttributes (Sema &S, const FunctionDecl *FD, const FunctionDecl *CausedFD, MultiVersionKind MVKind)
 
static bool CheckMultiVersionAdditionalRules (Sema &S, const FunctionDecl *OldFD, const FunctionDecl *NewFD, bool CausesMV, MultiVersionKind MVKind)
 
static bool CheckMultiVersionFirstFunction (Sema &S, FunctionDecl *FD)
 Check the validity of a multiversion function declaration that is the first of its kind.
 
static bool PreviousDeclsHaveMultiVersionAttribute (const FunctionDecl *FD)
 
static void patchDefaultTargetVersion (FunctionDecl *From, FunctionDecl *To)
 
static bool CheckDeclarationCausesMultiVersioning (Sema &S, FunctionDecl *OldFD, FunctionDecl *NewFD, bool &Redeclaration, NamedDecl *&OldDecl, LookupResult &Previous)
 
static bool MultiVersionTypesCompatible (FunctionDecl *Old, FunctionDecl *New)
 
static bool CheckMultiVersionAdditionalDecl (Sema &S, FunctionDecl *OldFD, FunctionDecl *NewFD, const CPUDispatchAttr *NewCPUDisp, const CPUSpecificAttr *NewCPUSpec, const TargetClonesAttr *NewClones, bool &Redeclaration, NamedDecl *&OldDecl, LookupResult &Previous)
 Check the validity of a new function declaration being added to an existing multiversioned declaration collection.
 
static bool CheckMultiVersionFunction (Sema &S, FunctionDecl *NewFD, bool &Redeclaration, NamedDecl *&OldDecl, LookupResult &Previous)
 Check the validity of a mulitversion function declaration.
 
static void CheckConstPureAttributesUsage (Sema &S, FunctionDecl *NewFD)
 
static bool isDefaultStdCall (FunctionDecl *FD, Sema &S)
 
static bool hasDeducedAuto (DeclaratorDecl *DD)
 
static void CheckExplicitObjectParameter (Sema &S, ParmVarDecl *P, SourceLocation ExplicitThisLoc)
 
static bool FindPossiblePrototype (const FunctionDecl *FD, const FunctionDecl *&PossiblePrototype)
 
static bool ShouldWarnAboutMissingPrototype (const FunctionDecl *FD, const FunctionDecl *&PossiblePrototype)
 
static void diagnoseImplicitlyRetainedSelf (Sema &S)
 
static bool methodHasName (const FunctionDecl *FD, StringRef Name)
 
static unsigned getRedeclDiagFromTagKind (TagTypeKind Tag)
 Get diagnostic select index for tag kind for redeclaration diagnostic message.
 
static bool isClassCompatTagKind (TagTypeKind Tag)
 Determine if tag kind is a class-key compatible with class for redeclaration (class, struct, or __interface).
 
static FixItHint createFriendTagNNSFixIt (Sema &SemaRef, NamedDecl *ND, Scope *S, SourceLocation NameLoc)
 Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing namespace or file scope inside a friend declaration.
 
static bool isAcceptableTagRedeclContext (Sema &S, DeclContext *OldDC, DeclContext *NewDC)
 Determine whether a tag originally declared in context OldDC can be redeclared with an unqualified name in NewDC (assuming name lookup found a declaration in OldDC as a previous decl, perhaps through a using-declaration).
 
static void ComputeSelectedDestructor (Sema &S, CXXRecordDecl *Record)
 [class.dtor]p4: At the end of the definition of a class, overload resolution is performed among the prospective destructors declared in that class with an empty argument list to select the destructor for the class, also known as the selected destructor.
 
static bool AreSpecialMemberFunctionsSameKind (ASTContext &Context, CXXMethodDecl *M1, CXXMethodDecl *M2, CXXSpecialMemberKind CSM)
 [class.mem.special]p5 Two special member functions are of the same kind if:
 
static void SetEligibleMethods (Sema &S, CXXRecordDecl *Record, ArrayRef< CXXMethodDecl * > Methods, CXXSpecialMemberKind CSM)
 [class.mem.special]p6: An eligible special member function is a special member function for which:
 
static void ComputeSpecialMemberFunctionsEligiblity (Sema &S, CXXRecordDecl *Record)
 
static bool isRepresentableIntegerValue (ASTContext &Context, llvm::APSInt &Value, QualType T)
 Determine whether the given integral value is representable within the given type T.
 
static QualType getNextLargerIntegralType (ASTContext &Context, QualType T)
 
static bool ValidDuplicateEnum (EnumConstantDecl *ECD, EnumDecl *Enum)
 
static void CheckForDuplicateEnumValues (Sema &S, ArrayRef< Decl * > Elements, EnumDecl *Enum, QualType EnumType)
 

Macro Definition Documentation

◆ TRANSFORM_TYPE_TRAIT_DEF

#define TRANSFORM_TYPE_TRAIT_DEF (   _,
  Trait 
)    case DeclSpec::TST_##Trait:

◆ WANT_DECL_MERGE_LOGIC

#define WANT_DECL_MERGE_LOGIC

Definition at line 2779 of file SemaDecl.cpp.

Enumeration Type Documentation

◆ OpenCLParamType

Enumerator
ValidKernelParam 
PtrPtrKernelParam 
PtrKernelParam 
InvalidAddrSpacePtrKernelParam 
InvalidKernelParam 
RecordKernelParam 

Definition at line 9331 of file SemaDecl.cpp.

◆ ShadowedDeclKind

Enum describing the select options in diag::warn_decl_shadow.

Enumerator
SDK_Local 
SDK_Global 
SDK_StaticMember 
SDK_Field 
SDK_Typedef 
SDK_Using 
SDK_StructuredBinding 

Definition at line 8115 of file SemaDecl.cpp.

Function Documentation

◆ adjustDeclContextForDeclaratorDecl()

static void adjustDeclContextForDeclaratorDecl ( DeclaratorDecl NewD,
DeclaratorDecl OldD 
)
static

If necessary, adjust the semantic declaration context for a qualified declaration to name the correct inline namespace within the qualifier.

Definition at line 3496 of file SemaDecl.cpp.

References D, clang::Decl::getDeclContext(), clang::Decl::getLexicalDeclContext(), clang::DeclaratorDecl::getQualifier(), clang::DeclContext::getRedeclContext(), clang::Decl::isInvalidDecl(), clang::Decl::setDeclContext(), and clang::Decl::setLexicalDeclContext().

Referenced by clang::Sema::MergeFunctionDecl(), and clang::Sema::MergeVarDecl().

◆ AllowOverloadingOfFunction()

static bool AllowOverloadingOfFunction ( const LookupResult Previous,
ASTContext Context,
const FunctionDecl New 
)
static

Determine whether overloading is allowed for a new function declaration considering prior declarations of the same name.

This routine determines whether overloading is possible, not whether a new declaration actually overloads a previous one. It will return true in C++ (where overloads are always permitted) or, as a C extension, when either the new declaration or a previous one is declared with the 'overloadable' attribute.

Definition at line 1470 of file SemaDecl.cpp.

References clang::LookupResult::Found, clang::LookupResult::FoundOverloaded, clang::ASTContext::getLangOpts(), clang::Decl::hasAttr(), and Previous.

Referenced by clang::Sema::CheckFunctionDeclaration(), and CheckMultiVersionAdditionalDecl().

◆ AreSpecialMemberFunctionsSameKind()

static bool AreSpecialMemberFunctionsSameKind ( ASTContext Context,
CXXMethodDecl M1,
CXXMethodDecl M2,
CXXSpecialMemberKind  CSM 
)
static

[class.mem.special]p5 Two special member functions are of the same kind if:

  • they are both default constructors,
  • they are both copy or move constructors with the same first parameter type, or
  • they are both copy or move assignment operators with the same first parameter type and the same cv-qualifiers and ref-qualifier, if any.

Definition at line 18727 of file SemaDecl.cpp.

References bool, clang::DefaultConstructor, clang::FunctionDecl::getDescribedFunctionTemplate(), clang::CXXMethodDecl::getFunctionObjectParameterReferenceType(), clang::FunctionDecl::getNonObjectParameter(), clang::ValueDecl::getType(), and clang::ASTContext::hasSameType().

Referenced by SetEligibleMethods().

◆ AttrCompatibleWithMultiVersion()

static bool AttrCompatibleWithMultiVersion ( attr::Kind  Kind,
MultiVersionKind  MVKind 
)
static

◆ buildNamedType()

static ParsedType buildNamedType ( Sema S,
const CXXScopeSpec SS,
QualType  T,
SourceLocation  NameLoc,
bool  WantNontrivialTypeSourceInfo = true 
)
static

◆ canRedefineFunction()

static bool canRedefineFunction ( const FunctionDecl FD,
const LangOptions LangOpts 
)
static

canRedefineFunction - checks if a function can be redefined.

Currently, only extern inline functions can be redefined, and even then only in GNU89 mode.

Definition at line 3406 of file SemaDecl.cpp.

References clang::FunctionDecl::getStorageClass(), clang::Decl::hasAttr(), clang::FunctionDecl::isInlineSpecified(), and clang::SC_Extern.

Referenced by clang::Sema::CheckForFunctionRedefinition(), and clang::Sema::MergeFunctionDecl().

◆ CheckAnonMemberRedeclaration()

static bool CheckAnonMemberRedeclaration ( Sema SemaRef,
Scope S,
DeclContext Owner,
DeclarationName  Name,
SourceLocation  NameLoc,
bool  IsUnion,
StorageClass  SC 
)
static

◆ checkAttributesAfterMerging()

static void checkAttributesAfterMerging ( Sema S,
NamedDecl ND 
)
static

◆ CheckC23ConstexprVarType()

static bool CheckC23ConstexprVarType ( Sema SemaRef,
SourceLocation  VarLoc,
QualType  T 
)
static

◆ CheckConstPureAttributesUsage()

static void CheckConstPureAttributesUsage ( Sema S,
FunctionDecl NewFD 
)
static

◆ CheckDeclarationCausesMultiVersioning()

static bool CheckDeclarationCausesMultiVersioning ( Sema S,
FunctionDecl OldFD,
FunctionDecl NewFD,
bool Redeclaration,
NamedDecl *&  OldDecl,
LookupResult Previous 
)
static

◆ checkDLLAttributeRedeclaration()

static void checkDLLAttributeRedeclaration ( Sema S,
NamedDecl OldDecl,
NamedDecl NewDecl,
bool  IsSpecialization,
bool  IsDefinition 
)
static

◆ checkDuplicateDefaultInit() [1/2]

static void checkDuplicateDefaultInit ( Sema S,
CXXRecordDecl Parent,
CXXRecordDecl AnonUnion 
)
static

Definition at line 5445 of file SemaDecl.cpp.

References checkDuplicateDefaultInit(), findDefaultInitializer(), and Parent.

◆ checkDuplicateDefaultInit() [2/2]

static void checkDuplicateDefaultInit ( Sema S,
CXXRecordDecl Parent,
SourceLocation  DefaultInitLoc 
)
static

◆ CheckExplicitObjectParameter()

static void CheckExplicitObjectParameter ( Sema S,
ParmVarDecl P,
SourceLocation  ExplicitThisLoc 
)
static

◆ checkForConflictWithNonVisibleExternC()

template<typename T >
static bool checkForConflictWithNonVisibleExternC ( Sema S,
const T *  ND,
LookupResult Previous 
)
static

Apply special rules for handling extern "C" declarations.

Returns true if we have found that this is a redeclaration of some prior entity.

Per C++ [dcl.link]p6: Two declarations [for a function or variable] with C language linkage with the same name that appear in different scopes refer to the same [entity]. An entity with C language linkage shall not be declared with the same name as an entity in global scope.

Definition at line 8463 of file SemaDecl.cpp.

References checkGlobalOrExternCConflict(), clang::Sema::findLocallyScopedExternCDecl(), clang::Sema::getLangOpts(), isIncompleteDeclExternC(), and Previous.

Referenced by clang::Sema::CheckFunctionDeclaration(), and clang::Sema::CheckVariableDeclaration().

◆ CheckForDuplicateEnumValues()

static void CheckForDuplicateEnumValues ( Sema S,
ArrayRef< Decl * >  Elements,
EnumDecl Enum,
QualType  EnumType 
)
static

◆ checkGlobalOrExternCConflict()

template<typename T >
static bool checkGlobalOrExternCConflict ( Sema S,
const T *  ND,
bool  IsGlobal,
LookupResult Previous 
)
static

◆ checkIsValidOpenCLKernelParameter()

static void checkIsValidOpenCLKernelParameter ( Sema S,
Declarator D,
ParmVarDecl Param,
llvm::SmallPtrSetImpl< const Type * > &  ValidTypes 
)
static

◆ CheckMultiVersionAdditionalDecl()

static bool CheckMultiVersionAdditionalDecl ( Sema S,
FunctionDecl OldFD,
FunctionDecl NewFD,
const CPUDispatchAttr *  NewCPUDisp,
const CPUSpecificAttr *  NewCPUSpec,
const TargetClonesAttr *  NewClones,
bool Redeclaration,
NamedDecl *&  OldDecl,
LookupResult Previous 
)
static

◆ CheckMultiVersionAdditionalRules()

static bool CheckMultiVersionAdditionalRules ( Sema S,
const FunctionDecl OldFD,
const FunctionDecl NewFD,
bool  CausesMV,
MultiVersionKind  MVKind 
)
static

◆ CheckMultiVersionFirstFunction()

static bool CheckMultiVersionFirstFunction ( Sema S,
FunctionDecl FD 
)
static

Check the validity of a multiversion function declaration that is the first of its kind.

Also sets the multiversion'ness' of the function itself.

This sets NewFD->isInvalidDecl() to true if there was an error.

Returns true if there was an error, false otherwise.

Definition at line 11267 of file SemaDecl.cpp.

References CheckMultiVersionAdditionalRules(), CheckMultiVersionValue(), clang::Decl::getAttr(), clang::FunctionDecl::getMultiVersionKind(), clang::None, clang::Decl::setInvalidDecl(), and clang::FunctionDecl::setIsMultiVersion().

Referenced by CheckMultiVersionFunction().

◆ CheckMultiVersionFunction()

static bool CheckMultiVersionFunction ( Sema S,
FunctionDecl NewFD,
bool Redeclaration,
NamedDecl *&  OldDecl,
LookupResult Previous 
)
static

◆ CheckMultiVersionValue()

static bool CheckMultiVersionValue ( Sema S,
const FunctionDecl FD 
)
static

◆ checkNewAttributesAfterDef()

static void checkNewAttributesAfterDef ( Sema S,
Decl New,
const Decl Old 
)
static

◆ checkNonMultiVersionCompatAttributes()

static bool checkNonMultiVersionCompatAttributes ( Sema S,
const FunctionDecl FD,
const FunctionDecl CausedFD,
MultiVersionKind  MVKind 
)
static

◆ CheckPoppedLabel()

static void CheckPoppedLabel ( LabelDecl L,
Sema S,
Sema::DiagReceiverTy  DiagReceiver 
)
static

◆ checkUsingShadowRedecl()

template<typename ExpectedDecl >
static bool checkUsingShadowRedecl ( Sema S,
UsingShadowDecl OldS,
ExpectedDecl New 
)
static

Check whether a redeclaration of an entity introduced by a using-declaration is valid, given that we know it's not an overload (nor a hidden tag declaration).

Definition at line 3443 of file SemaDecl.cpp.

References clang::SemaBase::Diag(), clang::UsingShadowDecl::getIntroducer(), clang::Decl::getLocation(), clang::UsingShadowDecl::getTargetDecl(), and isExternC().

◆ ComputeSelectedDestructor()

static void ComputeSelectedDestructor ( Sema S,
CXXRecordDecl Record 
)
static

[class.dtor]p4: At the end of the definition of a class, overload resolution is performed among the prospective destructors declared in that class with an empty argument list to select the destructor for the class, also known as the selected destructor.

We do the overload resolution here, then mark the selected constructor in the AST. Later CXXRecordDecl::getDestructor() will return the selected constructor.

Definition at line 18661 of file SemaDecl.cpp.

References clang::Sema::AddOverloadCandidate(), clang::OverloadCandidateSet::begin(), clang::OverloadCandidateSet::BestViableFunction(), clang::OverloadCandidateSet::CSK_Normal, Diag(), clang::OverloadCandidateSet::empty(), clang::Sema::LangOpts, Loc, clang::DeclAccessPair::make(), clang::OverloadCandidateSet::NoteCandidates(), clang::OCD_AllCandidates, clang::OCD_AmbiguousCandidates, clang::OR_Ambiguous, clang::OR_Deleted, clang::OR_No_Viable_Function, clang::OR_Success, and clang::SemaBase::PDiag().

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

◆ computeShadowedDeclKind()

static ShadowedDeclKind computeShadowedDeclKind ( const NamedDecl ShadowedDecl,
const DeclContext OldDC 
)
static

◆ ComputeSpecialMemberFunctionsEligiblity()

static void ComputeSpecialMemberFunctionsEligiblity ( Sema S,
CXXRecordDecl Record 
)
static

◆ copyAttrFromTypedefToDecl()

template<typename AttrTy >
static void copyAttrFromTypedefToDecl ( Sema S,
Decl D,
const TypedefType TT 
)
static

◆ createFriendTagNNSFixIt()

static FixItHint createFriendTagNNSFixIt ( Sema SemaRef,
NamedDecl ND,
Scope S,
SourceLocation  NameLoc 
)
static

Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing namespace or file scope inside a friend declaration.

This should provide the commented out code in the following snippet: namespace N { struct X; namespace M { struct Y { friend struct /*N::*‍/ X; }; } }

Definition at line 16955 of file SemaDecl.cpp.

References clang::FixItHint::CreateInsertion(), clang::Decl::getDeclContext(), clang::DeclContext::getParent(), clang::DeclContext::getRedeclContext(), clang::DeclContext::isTranslationUnit(), clang::Sema::LookupNestedNameSpecifierName, and clang::Sema::LookupSingleName().

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

◆ CreateNewFunctionDecl()

static FunctionDecl * CreateNewFunctionDecl ( Sema SemaRef,
Declarator D,
DeclContext DC,
QualType R,
TypeSourceInfo TInfo,
StorageClass  SC,
bool IsVirtualOkay 
)
static

◆ DeclHasAttr()

static bool DeclHasAttr ( const Decl D,
const Attr A 
)
static

DeclhasAttr - returns true if decl Declaration already has the target attribute.

Definition at line 2641 of file SemaDecl.cpp.

References clang::Decl::attrs(), D, and clang::Attr::getKind().

Referenced by mergeDeclAttribute(), and mergeParamDeclAttributes().

◆ diagnoseImplicitlyRetainedSelf()

static void diagnoseImplicitlyRetainedSelf ( Sema S)
static

◆ DiagnoseInvalidRedeclaration()

static NamedDecl * DiagnoseInvalidRedeclaration ( Sema SemaRef,
LookupResult Previous,
FunctionDecl NewFD,
ActOnFDArgs &  ExtraArgs,
bool  IsLocalFriend,
Scope S 
)
static

Generate diagnostics for an invalid function redeclaration.

This routine handles generating the diagnostic messages for an invalid function redeclaration, including finding possible similar declarations or performing typo correction if there are no previous declarations with the same name.

Returns a NamedDecl iff typo correction was performed and substituting in the new declaration name does not cause new errors.

Definition at line 8967 of file SemaDecl.cpp.

References clang::Sema::ActOnFunctionDeclarator(), clang::TypoCorrection::begin(), clang::LookupResult::begin(), clang::Sema::Context, clang::Sema::CorrectTypo(), clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateRemoval(), clang::Sema::CTK_ErrorRecovery, clang::SemaBase::Diag(), clang::Sema::diagnoseTypo(), E, clang::LookupResult::empty(), clang::TypoCorrection::end(), clang::LookupResult::end(), clang::Func, clang::TypoCorrection::getCorrection(), clang::TypoCorrection::getCorrectionAsIdentifierInfo(), clang::TypoCorrection::getCorrectionDecl(), clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::SourceRange::getEnd(), clang::Decl::getFriendObjectKind(), clang::Decl::getLocation(), clang::LookupResult::getLookupKind(), clang::LookupResult::getLookupNameInfo(), clang::FunctionDecl::getParamDecl(), clang::CXXMethodDecl::getParent(), clang::FunctionDecl::getSourceRange(), clang::ValueDecl::getType(), clang::DeclaratorDecl::getTypeSourceInfo(), clang::DeclaratorDecl::getTypeSpecStartLoc(), clang::FunctionDecl::hasBody(), clang::Sema::SFINAETrap::hasErrorOccurred(), hasSimilarParameters(), clang::LookupResult::isAmbiguous(), clang::CXXMethodDecl::isConst(), clang::SourceLocation::isInvalid(), Loc, clang::Sema::LookupLocalFriendName, clang::Sema::LookupName(), clang::Sema::LookupOrdinaryName, clang::Sema::LookupQualifiedName(), clang::Sema::MarkTypoCorrectedFunctionDefinition(), clang::SemaBase::PDiag(), Previous, clang::Result, clang::TypoCorrection::setCorrectionDecl(), and clang::Decl::setInvalidDecl().

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

◆ diagnoseMissingConstinit()

static void diagnoseMissingConstinit ( Sema S,
const VarDecl InitDecl,
const ConstInitAttr *  CIAttr,
bool  AttrBeforeInit 
)
static

◆ diagnoseOpenCLTypes()

static bool diagnoseOpenCLTypes ( Sema Se,
VarDecl NewVD 
)
static

◆ diagnoseVarDeclTypeMismatch()

static void diagnoseVarDeclTypeMismatch ( Sema S,
VarDecl New,
VarDecl Old 
)
static

◆ emitReadOnlyPlacementAttrWarning()

void emitReadOnlyPlacementAttrWarning ( Sema S,
const VarDecl VD 
)

◆ EquivalentArrayTypes()

static bool EquivalentArrayTypes ( QualType  Old,
QualType  New,
const ASTContext Ctx 
)
static

◆ filterNonConflictingPreviousTypedefDecls()

static void filterNonConflictingPreviousTypedefDecls ( Sema S,
const TypedefNameDecl Decl,
LookupResult Previous 
)
static

Typedef declarations don't have linkage, but they still denote the same entity if their types are the same.

FIXME: This is notionally doing the same thing as ASTReaderDecl's isSameEntity.

Definition at line 2396 of file SemaDecl.cpp.

References clang::Sema::Context, clang::Sema::getLangOpts(), clang::ASTContext::hasSameType(), clang::Sema::isVisible(), and Previous.

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

◆ findDefaultInitializer()

static SourceLocation findDefaultInitializer ( const CXXRecordDecl Record)
static

Definition at line 5422 of file SemaDecl.cpp.

Referenced by checkDuplicateDefaultInit().

◆ FindPossiblePrototype()

static bool FindPossiblePrototype ( const FunctionDecl FD,
const FunctionDecl *&  PossiblePrototype 
)
static

◆ findRecordWithDependentBasesOfEnclosingMethod()

static const CXXRecordDecl * findRecordWithDependentBasesOfEnclosingMethod ( const DeclContext DC)
static

Find the parent class with dependent bases of the innermost enclosing method context.

Do not look for enclosing CXXRecordDecls directly, or we will end up allowing unqualified dependent type names at class-level, which MSVC correctly rejects.

Definition at line 581 of file SemaDecl.cpp.

References clang::DeclContext::getLookupParent(), clang::DeclContext::getParent(), clang::DeclContext::getPrimaryContext(), and clang::DeclContext::isDependentContext().

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

◆ FixInvalidVariablyModifiedTypeLoc()

static void FixInvalidVariablyModifiedTypeLoc ( TypeLoc  SrcTL,
TypeLoc  DstTL 
)
static

◆ GenerateFixForUnusedDecl()

static void GenerateFixForUnusedDecl ( const NamedDecl D,
ASTContext Ctx,
FixItHint Hint 
)
static

◆ getCaptureLocation()

static SourceLocation getCaptureLocation ( const LambdaScopeInfo LSI,
const VarDecl VD 
)
static

Return the location of the capture if the given lambda captures the given variable VD, or an invalid source location otherwise.

Definition at line 8142 of file SemaDecl.cpp.

References clang::sema::CapturingScopeInfo::Captures, clang::sema::Capture::getLocation(), clang::sema::Capture::getVariable(), and clang::sema::Capture::isVariableCapture().

Referenced by clang::Sema::CheckShadow(), and clang::Sema::DiagnoseShadowingLambdaDecls().

◆ getCoreType()

static QualType getCoreType ( QualType  Ty)
static

◆ getDefinition()

static const NamedDecl * getDefinition ( const Decl D)
static

◆ GetDiagnosticTypeSpecifierID()

static unsigned GetDiagnosticTypeSpecifierID ( const DeclSpec DS)
static

◆ getFunctionStorageClass()

static StorageClass getFunctionStorageClass ( Sema SemaRef,
Declarator D 
)
static

◆ getHeaderName()

static StringRef getHeaderName ( Builtin::Context BuiltinInfo,
unsigned  ID,
ASTContext::GetBuiltinTypeError  Error 
)
static

◆ getImplicitCodeSegAttrFromClass()

static Attr * getImplicitCodeSegAttrFromClass ( Sema S,
const FunctionDecl FD 
)
static

Return a CodeSegAttr from a containing class.

The Microsoft docs say when __declspec(code_seg) "is applied to a class, all member functions of the class and nested classes &ndash; this includes compiler-generated special member functions &ndash; are put in the specified segment." The actual behavior is a little more complicated. The Microsoft compiler won't check outer classes if there is an active value from #pragma code_seg. The CodeSeg is always applied from the direct parent but only from outer classes when the #pragma code_seg stack is empty. See: https://reviews.llvm.org/D22931, the Microsoft feedback page is no longer available since MS has removed the page.

Definition at line 10891 of file SemaDecl.cpp.

References clang::Attr::clone(), clang::Sema::CodeSegStack, clang::Sema::getASTContext(), Parent, and clang::Attr::setImplicit().

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

◆ getMSManglingNumber()

static unsigned getMSManglingNumber ( const LangOptions LO,
Scope S 
)
static

◆ getNextLargerIntegralType()

static QualType getNextLargerIntegralType ( ASTContext Context,
QualType  T 
)
static

◆ getNonCLikeKindForAnonymousStruct()

static NonCLikeKind getNonCLikeKindForAnonymousStruct ( const CXXRecordDecl RD)
static

◆ getNoteDiagForInvalidRedeclaration()

template<typename T >
static std::pair< diag::kind, SourceLocation > getNoteDiagForInvalidRedeclaration ( const T *  Old,
const T *  New 
)
static

◆ getOpenCLKernelParameterType()

static OpenCLParamType getOpenCLKernelParameterType ( Sema S,
QualType  PT 
)
static

◆ getRedeclDiagFromTagKind()

static unsigned getRedeclDiagFromTagKind ( TagTypeKind  Tag)
static

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

WARNING: Indexes apply to particular diagnostics only!

Returns
diagnostic select index.

Definition at line 16779 of file SemaDecl.cpp.

References clang::Class, clang::Interface, and clang::Struct.

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

◆ getTagInjectionContext()

static DeclContext * getTagInjectionContext ( DeclContext DC)
static

Find the DeclContext in which a tag is implicitly declared if we see an elaborated type specifier in the specified context, and lookup finds nothing.

Definition at line 9642 of file SemaDecl.cpp.

References clang::DeclContext::getParent(), clang::DeclContext::isFileContext(), and clang::DeclContext::isFunctionOrMethod().

Referenced by clang::Sema::ActOnFunctionDeclarator(), and clang::Sema::ActOnTag().

◆ getTagInjectionScope()

static Scope * getTagInjectionScope ( Scope S,
const LangOptions LangOpts 
)
static

Find the Scope in which a tag is implicitly declared if we see an elaborated type specifier in the specified context, and lookup finds nothing.

Definition at line 9651 of file SemaDecl.cpp.

References clang::Scope::DeclScope.

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

◆ hasAttribute()

static bool hasAttribute ( const Decl D,
attr::Kind  Kind 
)
static

Definition at line 2902 of file SemaDecl.cpp.

References clang::Decl::attrs(), and D.

◆ hasDeducedAuto()

static bool hasDeducedAuto ( DeclaratorDecl DD)
static

Definition at line 14719 of file SemaDecl.cpp.

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

◆ hasIdenticalPassObjectSizeAttrs()

static bool hasIdenticalPassObjectSizeAttrs ( const FunctionDecl A,
const FunctionDecl B 
)
static

◆ hasParsedAttr()

static bool hasParsedAttr ( Scope S,
const Declarator PD,
ParsedAttr::Kind  Kind 
)
static

◆ hasSimilarParameters()

static bool hasSimilarParameters ( ASTContext Context,
FunctionDecl Declaration,
FunctionDecl Definition,
SmallVectorImpl< unsigned > &  Params 
)
static

hasSimilarParameters - Determine whether the C++ functions Declaration and Definition have "nearly" matching parameters.

This heuristic is used to improve diagnostics in the case where an out-of-line function definition doesn't match any declaration within the class or namespace. Also sets Params to the list of indices to the parameters that differ between the declaration and the definition. If hasSimilarParameters returns true and Params is empty, then all of the parameters match.

Definition at line 5911 of file SemaDecl.cpp.

References clang::Declaration, clang::Definition, clang::QualType::getBaseTypeIdentifier(), getCoreType(), and clang::ASTContext::hasSameUnqualifiedType().

Referenced by DiagnoseInvalidRedeclaration().

◆ haveIncompatibleLanguageLinkages()

template<typename T >
static bool haveIncompatibleLanguageLinkages ( const T *  Old,
const T *  New 
)
static

◆ InjectAnonymousStructOrUnionMembers()

static bool InjectAnonymousStructOrUnionMembers ( Sema SemaRef,
Scope S,
DeclContext Owner,
RecordDecl AnonRecord,
AccessSpecifier  AS,
StorageClass  SC,
SmallVectorImpl< NamedDecl * > &  Chaining 
)
static

InjectAnonymousStructOrUnionMembers - Inject the members of the anonymous struct or union AnonRecord into the owning context Owner and scope S.

This routine will be invoked just after we realize that an unnamed union or struct is actually an anonymous union or struct, e.g.,

union {
int i;
float f;
}; // InjectAnonymousStructOrUnionMembers called here to inject i and
// f into the surrounding scope.x

This routine is recursive, injecting the names of nested anonymous structs/unions into the owning context and scope as well.

Definition at line 5338 of file SemaDecl.cpp.

References clang::Decl::addAttr(), clang::AS_none, clang::Decl::attrs(), CheckAnonMemberRedeclaration(), clang::Attr::clone(), clang::Sema::Context, clang::IndirectFieldDecl::Create(), D, clang::DeclContext::decls(), clang::NamedDecl::getDeclName(), clang::NamedDecl::getIdentifier(), clang::Decl::getLocation(), clang::ValueDecl::getType(), clang::Invalid, clang::TagDecl::isUnion(), clang::Sema::PushOnScopeChains(), clang::Decl::setAccess(), and clang::Decl::setImplicit().

Referenced by clang::Sema::BuildAnonymousStructOrUnion(), and clang::Sema::BuildMicrosoftCAnonymousStruct().

◆ isAcceptableTagRedeclContext()

static bool isAcceptableTagRedeclContext ( Sema S,
DeclContext OldDC,
DeclContext NewDC 
)
static

Determine whether a tag originally declared in context OldDC can be redeclared with an unqualified name in NewDC (assuming name lookup found a declaration in OldDC as a previous decl, perhaps through a using-declaration).

Definition at line 16992 of file SemaDecl.cpp.

References clang::DeclContext::Encloses(), clang::DeclContext::Equals(), clang::Sema::getLangOpts(), and clang::DeclContext::getRedeclContext().

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

◆ isAttributeTargetADefinition()

static bool isAttributeTargetADefinition ( Decl D)
static

Definition at line 2660 of file SemaDecl.cpp.

References D.

Referenced by mergeAlignedAttrs().

◆ isClassCompatTagKind()

static bool isClassCompatTagKind ( TagTypeKind  Tag)
static

Determine if tag kind is a class-key compatible with class for redeclaration (class, struct, or __interface).

Returns
true iff the tag kind is compatible.

Definition at line 16795 of file SemaDecl.cpp.

References clang::Class, clang::Interface, and clang::Struct.

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

◆ isDeclExternC()

static bool isDeclExternC ( const Decl D)
static

Returns true if given declaration has external C language linkage.

Definition at line 7223 of file SemaDecl.cpp.

References D.

◆ isDefaultStdCall()

static bool isDefaultStdCall ( FunctionDecl FD,
Sema S 
)
static

◆ IsDisallowedCopyOrAssign()

static bool IsDisallowedCopyOrAssign ( const CXXMethodDecl D)
static

Check for this common pattern:

class S {
S(const S&); // DO NOT IMPLEMENT
void operator=(const S&); // DO NOT IMPLEMENT
};

Definition at line 1797 of file SemaDecl.cpp.

References D.

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

◆ isExternC() [1/3]

static bool isExternC ( FunctionTemplateDecl )
static

Definition at line 3437 of file SemaDecl.cpp.

◆ isExternC() [2/3]

template<typename T >
static bool isExternC ( T *  D)
static

Definition at line 3435 of file SemaDecl.cpp.

References D.

◆ isExternC() [3/3]

static bool isExternC ( VarTemplateDecl )
static

Definition at line 3436 of file SemaDecl.cpp.

◆ isFromSystemHeader()

static bool isFromSystemHeader ( SourceManager SM,
const Decl D 
)
static

Returns true if the declaration is declared in a system header or from a system macro.

Definition at line 6020 of file SemaDecl.cpp.

References D, clang::Decl::getLocation(), and SM.

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

◆ isFunctionDefinitionDiscarded()

static bool isFunctionDefinitionDiscarded ( Sema S,
FunctionDecl FD 
)
static

Given that we are within the definition of the given function, will that definition behave like C99's 'inline', where the definition is discarded except for optimization purposes?

Definition at line 7110 of file SemaDecl.cpp.

References clang::Sema::Context, clang::ASTContext::GetGVALinkageForFunction(), clang::Sema::getLangOpts(), clang::GVA_AvailableExternally, clang::Decl::hasAttr(), and clang::FunctionDecl::isInlined().

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

◆ isIncompleteDeclExternC()

template<typename T >
static bool isIncompleteDeclExternC ( Sema S,
const T *  D 
)
static

Determine whether a variable is extern "C" prior to attaching an initializer.

We can't just call isExternC() here, because that will also compute and cache whether the declaration is externally visible, which might change when we attach the initializer.

This can only be used if the declaration is known to not be a redeclaration of an internal linkage declaration.

For instance:

auto x = []{};

Attaching the initializer here makes this declaration not externally visible, because its type has internal linkage.

FIXME: This is a hack.

Definition at line 7141 of file SemaDecl.cpp.

References D, and clang::Sema::getLangOpts().

Referenced by clang::Sema::ActOnFunctionDeclarator(), clang::Sema::ActOnVariableDeclarator(), checkForConflictWithNonVisibleExternC(), and checkGlobalOrExternCConflict().

◆ isMainFileLoc()

static bool isMainFileLoc ( const Sema S,
SourceLocation  Loc 
)
static

◆ isMainVar()

static bool isMainVar ( DeclarationName  Name,
VarDecl VD 
)
static

◆ isOpenCLSizeDependentType()

static bool isOpenCLSizeDependentType ( ASTContext C,
QualType  Ty 
)
static

◆ isOutOfScopePreviousDeclaration()

static bool isOutOfScopePreviousDeclaration ( NamedDecl PrevDecl,
DeclContext DC,
ASTContext Context 
)
static

Determines whether the given declaration is an out-of-scope previous declaration.

This routine should be invoked when name lookup has found a previous declaration (PrevDecl) that is not in the scope where a new declaration by the same name is being introduced. If the new declaration occurs in a local scope, previous declarations with linkage may still be considered previous declarations (C99 6.2.2p4-5, C++ [basic.link]p6).

Parameters
PrevDeclthe previous declaration found by name lookup
DCthe context in which the new declaration is being declared.
Returns
true if PrevDecl is an out-of-scope previous declaration for a new delcaration with the same name.

Definition at line 6772 of file SemaDecl.cpp.

References clang::DeclContext::Equals(), clang::Decl::getDeclContext(), clang::DeclContext::getEnclosingNamespaceContext(), clang::ASTContext::getLangOpts(), clang::DeclContext::getRedeclContext(), clang::NamedDecl::hasLinkage(), clang::DeclContext::isFunctionOrMethod(), and clang::DeclContext::isRecord().

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

◆ isRepresentableIntegerValue()

static bool isRepresentableIntegerValue ( ASTContext Context,
llvm::APSInt Value,
QualType  T 
)
static

Determine whether the given integral value is representable within the given type T.

Definition at line 19373 of file SemaDecl.cpp.

References clang::ASTContext::getIntWidth(), clang::Type::isEnumeralType(), clang::Type::isIntegralType(), clang::Type::isSignedIntegerOrEnumerationType(), and clang::T.

Referenced by clang::Sema::ActOnEnumBody(), and clang::Sema::CheckEnumConstant().

◆ isResultTypeOrTemplate()

static bool isResultTypeOrTemplate ( LookupResult R,
const Token NextToken 
)
static

Determine whether the given result set contains either a type name or.

Definition at line 795 of file SemaDecl.cpp.

References clang::LookupResult::begin(), clang::LookupResult::end(), clang::Sema::getLangOpts(), clang::LookupResult::getSema(), and clang::Token::is().

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

◆ isStdBuiltin()

static bool isStdBuiltin ( ASTContext Ctx,
FunctionDecl FD,
unsigned  BuiltinID 
)
static

◆ isTagTypeWithMissingTag()

static bool isTagTypeWithMissingTag ( Sema SemaRef,
LookupResult Result,
Scope S,
CXXScopeSpec SS,
IdentifierInfo *&  Name,
SourceLocation  NameLoc 
)
static

◆ isUsingDeclNotAtClassScope()

static bool isUsingDeclNotAtClassScope ( NamedDecl D)
static

Definition at line 1770 of file SemaDecl.cpp.

References D, clang::Decl::getDeclContext(), and clang::DeclContext::isFileContext().

Referenced by RemoveUsingDecls().

◆ lookupUnqualifiedTypeNameInBase()

static UnqualifiedTypeNameLookupResult lookupUnqualifiedTypeNameInBase ( Sema S,
const IdentifierInfo II,
SourceLocation  NameLoc,
const CXXRecordDecl RD 
)
static

Tries to perform unqualified lookup of the type decls in bases for dependent class.

Returns
NotFound if no any decls is found, FoundNotType if found not a type decl, FoundType if only type decls are found.

Definition at line 153 of file SemaDecl.cpp.

References clang::CXXRecordDecl::bases(), clang::CXXRecordDecl::getCanonicalDecl(), clang::CXXRecordDecl::hasDefinition(), clang::DeclContext::lookup(), and lookupUnqualifiedTypeNameInBase().

Referenced by lookupUnqualifiedTypeNameInBase(), and recoverFromTypeInKnownDependentBase().

◆ mergeAlignedAttrs()

static bool mergeAlignedAttrs ( Sema S,
NamedDecl New,
Decl Old 
)
static

Merge alignment attributes from Old to New, taking into account the special semantics of C11's _Alignas specifier and C++11's alignas attribute.

Returns
true if any attributes were added to New.

Definition at line 2672 of file SemaDecl.cpp.

References clang::Decl::addAttr(), clang::Sema::Context, clang::SemaBase::Diag(), clang::Decl::getLocation(), clang::CharUnits::getQuantity(), clang::ASTContext::getTagDeclType(), clang::ASTContext::getTypeAlign(), isAttributeTargetADefinition(), clang::Decl::specific_attrs(), and clang::ASTContext::toCharUnitsFromBits().

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

◆ mergeDeclAttribute()

static bool mergeDeclAttribute ( Sema S,
NamedDecl D,
const InheritableAttr Attr,
Sema::AvailabilityMergeKind  AMK 
)
static

◆ mergeParamDeclAttributes()

static void mergeParamDeclAttributes ( ParmVarDecl newDecl,
const ParmVarDecl oldDecl,
Sema S 
)
static

◆ mergeParamDeclTypes()

static void mergeParamDeclTypes ( ParmVarDecl NewParam,
const ParmVarDecl OldParam,
Sema S 
)
static

◆ mergeTypeWithPrevious()

static bool mergeTypeWithPrevious ( Sema S,
VarDecl NewVD,
VarDecl OldVD,
LookupResult Previous 
)
static

◆ methodHasName()

static bool methodHasName ( const FunctionDecl FD,
StringRef  Name 
)
static

◆ MultiVersionTypesCompatible()

static bool MultiVersionTypesCompatible ( FunctionDecl Old,
FunctionDecl New 
)
static

◆ patchDefaultTargetVersion()

static void patchDefaultTargetVersion ( FunctionDecl From,
FunctionDecl To 
)
static

◆ PreviousDeclsHaveMultiVersionAttribute()

static bool PreviousDeclsHaveMultiVersionAttribute ( const FunctionDecl FD)
static

◆ RebuildDeclaratorInCurrentInstantiation()

static bool RebuildDeclaratorInCurrentInstantiation ( Sema S,
Declarator D,
DeclarationName  Name 
)
static

◆ recoverFromTypeInKnownDependentBase()

static ParsedType recoverFromTypeInKnownDependentBase ( Sema S,
const IdentifierInfo II,
SourceLocation  NameLoc 
)
static

◆ RemoveUsingDecls()

static void RemoveUsingDecls ( LookupResult R)
static

◆ SetEligibleMethods()

static void SetEligibleMethods ( Sema S,
CXXRecordDecl Record,
ArrayRef< CXXMethodDecl * >  Methods,
CXXSpecialMemberKind  CSM 
)
static

[class.mem.special]p6: An eligible special member function is a special member function for which:

  • the function is not deleted,
  • the associated constraints, if any, are satisfied, and
  • no special member function of the same kind whose associated constraints [CWG2595], if any, are satisfied is more constrained.

Definition at line 18754 of file SemaDecl.cpp.

References AreSpecialMemberFunctionsSameKind(), clang::Sema::CheckFunctionConstraints(), clang::Sema::Context, clang::FunctionDecl::getInstantiatedFromMemberFunction(), clang::DeclaratorDecl::getTrailingRequiresClause(), clang::Sema::IsAtLeastAsConstrained(), clang::ConstraintSatisfaction::IsSatisfied, and clang::FunctionDecl::setIneligibleOrNotSelected().

Referenced by ComputeSpecialMemberFunctionsEligiblity().

◆ SetNestedNameSpecifier()

static void SetNestedNameSpecifier ( Sema S,
DeclaratorDecl DD,
Declarator D 
)
static

◆ shouldConsiderLinkage() [1/2]

static bool shouldConsiderLinkage ( const FunctionDecl FD)
static

◆ shouldConsiderLinkage() [2/2]

static bool shouldConsiderLinkage ( const VarDecl VD)
static

◆ ShouldDiagnoseUnusedDecl()

static bool ShouldDiagnoseUnusedDecl ( const LangOptions LangOpts,
const NamedDecl D 
)
static

◆ ShouldWarnAboutMissingPrototype()

static bool ShouldWarnAboutMissingPrototype ( const FunctionDecl FD,
const FunctionDecl *&  PossiblePrototype 
)
static

◆ shouldWarnIfShadowedDecl()

static bool shouldWarnIfShadowedDecl ( const DiagnosticsEngine Diags,
const LookupResult R 
)
static

◆ StorageClassSpecToVarDeclStorageClass()

static StorageClass StorageClassSpecToVarDeclStorageClass ( const DeclSpec DS)
static

◆ synthesizeCurrentNestedNameSpecifier()

static NestedNameSpecifier * synthesizeCurrentNestedNameSpecifier ( ASTContext Context,
DeclContext DC 
)
static

◆ TryToFixInvalidVariablyModifiedType()

static QualType TryToFixInvalidVariablyModifiedType ( QualType  T,
ASTContext Context,
bool SizeIsNegative,
llvm::APSInt Oversized 
)
static

◆ TryToFixInvalidVariablyModifiedTypeSourceInfo()

static TypeSourceInfo * TryToFixInvalidVariablyModifiedTypeSourceInfo ( TypeSourceInfo TInfo,
ASTContext Context,
bool SizeIsNegative,
llvm::APSInt Oversized 
)
static

◆ ValidDuplicateEnum()

static bool ValidDuplicateEnum ( EnumConstantDecl ECD,
EnumDecl Enum 
)
static