|
clang 22.0.0git
|
#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/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/MangleNumberingContext.h"#include "clang/AST/NonTrivialTypeVisitor.h"#include "clang/AST/Randstruct.h"#include "clang/AST/StmtCXX.h"#include "clang/AST/Type.h"#include "clang/Basic/Builtins.h"#include "clang/Basic/DiagnosticComment.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/SemaARM.h"#include "clang/Sema/SemaCUDA.h"#include "clang/Sema/SemaHLSL.h"#include "clang/Sema/SemaInternal.h"#include "clang/Sema/SemaObjC.h"#include "clang/Sema/SemaOpenACC.h"#include "clang/Sema/SemaOpenMP.h"#include "clang/Sema/SemaPPC.h"#include "clang/Sema/SemaRISCV.h"#include "clang/Sema/SemaSYCL.h"#include "clang/Sema/SemaSwift.h"#include "clang/Sema/SemaWasm.h"#include "clang/Sema/Template.h"#include "llvm/ADT/ArrayRef.h"#include "llvm/ADT/STLForwardCompat.h"#include "llvm/ADT/ScopeExit.h"#include "llvm/ADT/SmallPtrSet.h"#include "llvm/ADT/SmallString.h"#include "llvm/ADT/StringExtras.h"#include "llvm/ADT/StringRef.h"#include "llvm/Support/SaveAndRestore.h"#include "llvm/TargetParser/Triple.h"#include <algorithm>#include <cstring>#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) |
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 NestedNameSpecifier | synthesizeCurrentNestedNameSpecifier (ASTContext &Context, DeclContext *DC) |
| static const CXXRecordDecl * | findRecordWithDependentBasesOfEnclosingMethod (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 | isImplicitInstantiation (NamedDecl *D) |
| 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, AvailabilityMergeKind AMK) |
| static const NamedDecl * | getDefinition (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) |
| template<class T> | |
| static unsigned | propagateAttribute (ParmVarDecl *To, const ParmVarDecl *From, Sema &S) |
| template<class F> | |
| static void | propagateAttributes (ParmVarDecl *To, const ParmVarDecl *From, F &&propagator) |
| 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, SourceLocation > | getNoteDiagForInvalidRedeclaration (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 TypeSourceInfo * | TryToFixInvalidVariablyModifiedTypeSourceInfo (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 | checkWeakAttr (Sema &S, NamedDecl &ND) |
| static void | checkWeakRefAttr (Sema &S, NamedDecl &ND) |
| static void | checkAliasAttr (Sema &S, NamedDecl &ND) |
| static void | checkSelectAnyAttr (Sema &S, NamedDecl &ND) |
| static void | checkHybridPatchableAttr (Sema &S, NamedDecl &ND) |
| static void | checkInheritableAttr (Sema &S, NamedDecl &ND) |
| static void | checkLifetimeBoundAttr (Sema &S, NamedDecl &ND) |
| static void | checkModularFormatAttr (Sema &S, NamedDecl &ND) |
| 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) |
| static 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 ValueDecl *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 NamedDecl * | DiagnoseInvalidRedeclaration (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 FunctionDecl * | CreateNewFunctionDecl (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 DeclContext * | getTagInjectionContext (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 Scope * | getTagInjectionScope (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 Attr * | getImplicitCodeSegAttrFromClass (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 | looksMutable (QualType T, const ASTContext &Ctx) |
| 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 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) |
| static void | CheckForComparisonInEnumInitializer (SemaBase &Sema, const EnumDecl *Enum) |
| #define TRANSFORM_TYPE_TRAIT_DEF | ( | _, | |
| Trait ) |
| #define WANT_DECL_MERGE_LOGIC |
Definition at line 2863 of file SemaDecl.cpp.
| enum OpenCLParamType |
| Enumerator | |
|---|---|
| ValidKernelParam | |
| PtrPtrKernelParam | |
| PtrKernelParam | |
| InvalidAddrSpacePtrKernelParam | |
| InvalidKernelParam | |
| RecordKernelParam | |
Definition at line 9666 of file SemaDecl.cpp.
| enum 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 8425 of file SemaDecl.cpp.
|
static |
If necessary, adjust the semantic declaration context for a qualified declaration to name the correct inline namespace within the qualifier.
Definition at line 3645 of file SemaDecl.cpp.
References 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().
|
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 1532 of file SemaDecl.cpp.
References clang::Found, clang::FoundOverloaded, clang::Decl::hasAttr(), New, and Previous.
Referenced by clang::Sema::CheckFunctionDeclaration(), and CheckMultiVersionAdditionalDecl().
|
static |
[class.mem.special]p5 Two special member functions are of the same kind if:
Definition at line 19489 of file SemaDecl.cpp.
References bool, clang::DefaultConstructor, clang::FunctionDecl::getDescribedFunctionTemplate(), clang::CXXMethodDecl::getFunctionObjectParameterReferenceType(), clang::FunctionDecl::getNonObjectParameter(), and clang::ValueDecl::getType().
Referenced by SetEligibleMethods().
|
static |
Definition at line 11389 of file SemaDecl.cpp.
References clang::Target, clang::TargetClones, and clang::TargetVersion.
Referenced by checkNonMultiVersionCompatAttributes().
|
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 3555 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().
Definition at line 7112 of file SemaDecl.cpp.
References clang::SemaBase::Diag(), and clang::Attr::getLocation().
Referenced by checkAttributesAfterMerging().
|
static |
We are trying to inject an anonymous member into the given scope; check if there's an existing declaration that can't be overloaded.
Definition at line 5476 of file SemaDecl.cpp.
References clang::SemaBase::Diag(), clang::Sema::DiagPlaceholderVariableDefinition(), ForVisibleRedeclaration, clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::LookupResult::getRepresentativeDecl(), clang::NamedDecl::getUnderlyingDecl(), clang::Sema::isDeclInScope(), clang::DeclContext::isFunctionOrMethod(), clang::NamedDecl::isPlaceholderVar(), clang::DeclContext::isRecord(), clang::Sema::LookupMemberName, clang::Sema::LookupName(), clang::Sema::LookupOrdinaryName, and clang::SC_None.
Referenced by InjectAnonymousStructOrUnionMembers().
Definition at line 7230 of file SemaDecl.cpp.
References checkAliasAttr(), checkHybridPatchableAttr(), checkInheritableAttr(), checkLifetimeBoundAttr(), checkModularFormatAttr(), checkSelectAnyAttr(), checkWeakAttr(), checkWeakRefAttr(), and clang::Sema::ParsingInitForAutoVars.
Referenced by clang::Sema::ActOnFunctionDeclarator(), and clang::Sema::FinalizeDeclaration().
|
static |
Definition at line 8823 of file SemaDecl.cpp.
References clang::Sema::Context, clang::SemaBase::Diag(), clang::RecordDecl::fields(), clang::Type::getAsRecordDecl(), clang::ASTContext::getBaseElementType(), clang::ASTContext::getCanonicalType(), clang::Type::isAtomicType(), clang::Decl::isInvalidDecl(), clang::Type::isRecordType(), clang::QualType::isRestrictQualified(), clang::Type::isVariablyModifiedType(), clang::QualType::isVolatileQualified(), and clang::T.
Referenced by clang::Sema::CheckVariableDeclarationType().
|
static |
Definition at line 12157 of file SemaDecl.cpp.
References clang::SemaBase::Diag(), clang::Decl::dropAttrs(), clang::Decl::getLocation(), clang::FunctionDecl::getReturnType(), clang::Decl::hasAttr(), and clang::Type::isVoidType().
Referenced by clang::Sema::CheckFunctionDeclaration().
|
static |
Definition at line 11674 of file SemaDecl.cpp.
References CheckMultiVersionAdditionalRules(), CheckMultiVersionValue(), clang::SemaBase::Diag(), clang::ParsedTargetAttr::Features, clang::Sema::getASTContext(), clang::Decl::getAttr(), clang::Decl::getLocation(), clang::ASTContext::getTargetInfo(), clang::FunctionDecl::isMultiVersion(), clang::TargetInfo::parseTargetAttr(), patchDefaultTargetVersion(), Previous, PreviousDeclsHaveMultiVersionAttribute(), clang::Redeclaration, clang::FunctionDecl::redecls(), clang::Decl::setInvalidDecl(), clang::FunctionDecl::setIsMultiVersion(), clang::Target, and clang::TargetVersion.
Referenced by CheckMultiVersionFunction().
|
static |
Definition at line 7245 of file SemaDecl.cpp.
References clang::Decl::addAttr(), clang::Sema::Context, clang::VarDecl::DeclarationOnly, clang::SemaBase::Diag(), clang::Decl::dropAttr(), clang::Decl::FOK_Declared, clang::Decl::getAttr(), clang::Decl::getLocation(), clang::ASTContext::getTargetInfo(), clang::isa(), clang::NamedDecl::isCXXClassMember(), clang::Decl::isImplicit(), clang::Decl::isInvalidDecl(), clang::Decl::isLocalExternDecl(), clang::Decl::isUsed(), clang::Decl::setInvalidDecl(), clang::TargetInfo::shouldDLLImportComdatSymbols(), clang::FunctionDecl::TK_MemberSpecialization, and clang::FunctionDecl::TK_NonTemplate.
Referenced by clang::Sema::ActOnFunctionDeclarator(), and clang::Sema::ActOnVariableDeclarator().
|
static |
Definition at line 5665 of file SemaDecl.cpp.
References checkDuplicateDefaultInit(), findDefaultInitializer(), clang::CXXRecordDecl::hasInClassInitializer(), and clang::TagDecl::isUnion().
|
static |
Definition at line 5656 of file SemaDecl.cpp.
References clang::SemaBase::Diag(), findDefaultInitializer(), clang::CXXRecordDecl::hasInClassInitializer(), and clang::TagDecl::isUnion().
Referenced by clang::Sema::BuildAnonymousStructOrUnion(), checkDuplicateDefaultInit(), and clang::Sema::CheckFieldDecl().
|
static |
Definition at line 15490 of file SemaDecl.cpp.
References clang::SemaBase::Diag(), clang::DeclaratorDecl::getBeginLoc(), clang::Sema::getCurLambda(), clang::Sema::getLangOpts(), clang::ParmVarDecl::getSourceRange(), clang::ValueDecl::isParameterPack(), clang::SourceLocation::isValid(), and clang::ParmVarDecl::setExplicitObjectParameterLoc().
Referenced by clang::Sema::ActOnParamDeclarator().
Definition at line 20667 of file SemaDecl.cpp.
References clang::FixItHint::CreateReplacement(), clang::SemaBase::Diag(), clang::Enum, clang::BinaryOperator::getOpcodeStr(), and clang::Expr::IgnoreParenImpCasts().
Referenced by clang::Sema::ActOnEnumBody().
|
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 8792 of file SemaDecl.cpp.
References checkGlobalOrExternCConflict(), clang::Sema::findLocallyScopedExternCDecl(), clang::Sema::getLangOpts(), isIncompleteDeclExternC(), Previous, and clang::T.
Referenced by clang::Sema::CheckFunctionDeclaration(), and clang::Sema::CheckVariableDeclaration().
|
static |
Definition at line 20526 of file SemaDecl.cpp.
References clang::cast(), clang::SemaBase::Diag(), clang::Sema::Diags, clang::Enum, clang::EnumConstantDecl::getInitExpr(), clang::DiagnosticsEngine::isIgnored(), toString(), and ValidDuplicateEnum().
Referenced by clang::Sema::ActOnEnumBody().
|
static |
Check for conflict between this global or extern "C" declaration and previous global or extern "C" declarations.
This is only used in C++.
Definition at line 8709 of file SemaDecl.cpp.
References clang::DeclContextLookupResult::begin(), clang::cast(), clang::Sema::Context, clang::SemaBase::Diag(), clang::DeclContextLookupResult::end(), clang::Sema::findLocallyScopedExternCDecl(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::ASTContext::getTranslationUnitDecl(), clang::isa(), isIncompleteDeclExternC(), clang::DeclContext::lookup(), Previous, and clang::T.
Referenced by checkForConflictWithNonVisibleExternC().
Definition at line 7137 of file SemaDecl.cpp.
References clang::SemaBase::Diag(), clang::Decl::getAttr(), clang::Attr::getLocation(), and clang::NamedDecl::isExternallyVisible().
Referenced by checkAttributesAfterMerging().
Definition at line 7145 of file SemaDecl.cpp.
References clang::Sema::Context, clang::SemaBase::Diag(), clang::TargetInfo::getCXXABI(), clang::getDLLAttr(), clang::Decl::getLocation(), clang::DeclContext::getParent(), clang::ASTContext::getTargetInfo(), clang::NamespaceDecl::isAnonymousNamespace(), clang::NamedDecl::isExternallyVisible(), clang::TargetCXXABI::isMicrosoft(), and clang::Decl::setInvalidDecl().
Referenced by checkAttributesAfterMerging().
|
static |
Definition at line 9803 of file SemaDecl.cpp.
References clang::cast(), clang::Type::castAsRecordDecl(), clang::SemaBase::Diag(), clang::RecordDecl::fields(), clang::Type::getAs(), clang::Decl::getLocation(), getOpenCLKernelParameterType(), clang::Type::getPointeeOrArrayElementType(), clang::ValueDecl::getType(), clang::QualType::getTypePtr(), InvalidAddrSpacePtrKernelParam, InvalidKernelParam, clang::Type::isArrayType(), clang::Type::isHalfType(), clang::Type::isPointerType(), clang::Type::isRecordType(), clang::Type::isUnionType(), clang::SourceLocation::isValid(), Next, PtrKernelParam, PtrPtrKernelParam, RecordKernelParam, clang::Declarator::setInvalidType(), and ValidKernelParam.
Referenced by clang::Sema::ActOnFunctionDeclarator().
Definition at line 7172 of file SemaDecl.cpp.
References clang::SemaBase::Diag(), clang::TypeLoc::getAsAdjusted(), clang::Decl::getAttr(), clang::AttributedTypeLoc::getAttrAs(), clang::AttributedTypeLoc::getModifiedLoc(), and clang::isa().
Referenced by checkAttributesAfterMerging().
Definition at line 7225 of file SemaDecl.cpp.
References clang::SemaBase::Diag(), clang::Decl::getLocation(), and clang::Decl::hasAttr().
Referenced by checkAttributesAfterMerging().
|
static |
Check the validity of a new function declaration being added to an existing multiversioned declaration collection.
Definition at line 11801 of file SemaDecl.cpp.
References AllowOverloadingOfFunction(), CheckMultiVersionAdditionalRules(), CheckMultiVersionValue(), clang::Sema::Context, clang::CPUDispatch, clang::CPUSpecific, clang::Sema::CurContext, clang::SemaBase::Diag(), clang::ParsedTargetAttr::Features, clang::Decl::getAsFunction(), clang::Sema::getASTContext(), clang::Decl::getAttr(), clang::Decl::getFriendObjectKind(), clang::Decl::getLocation(), clang::FunctionDecl::getMultiVersionKind(), clang::ASTContext::getTargetInfo(), clang::Decl::hasAttr(), clang::Decl::isInvalidDecl(), clang::FunctionDecl::isMultiVersion(), clang::Sema::IsOverload(), clang::DeclContext::isRecord(), MultiVersionTypesCompatible(), New, clang::None, clang::TargetInfo::parseTargetAttr(), patchDefaultTargetVersion(), Previous, clang::Redeclaration, clang::Decl::setInvalidDecl(), clang::FunctionDecl::setIsMultiVersion(), clang::Target, clang::TargetClones, and clang::TargetVersion.
Referenced by CheckMultiVersionFunction().
|
static |
Definition at line 11576 of file SemaDecl.cpp.
References clang::Sema::areMultiversionVariantFunctionsCompatible(), checkNonMultiVersionCompatAttributes(), clang::CPUDispatch, clang::CPUSpecific, clang::SemaBase::Diag(), clang::Sema::getASTContext(), clang::Decl::getLocation(), clang::ASTContext::getTargetInfo(), clang::Decl::isUsed(), clang::SemaBase::PDiag(), and clang::TargetInfo::supportsMultiVersioning().
Referenced by CheckDeclarationCausesMultiVersioning(), CheckMultiVersionAdditionalDecl(), and CheckMultiVersionFirstFunction().
|
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 11625 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().
|
static |
Check the validity of a mulitversion function declaration.
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 12062 of file SemaDecl.cpp.
References CheckDeclarationCausesMultiVersioning(), CheckMultiVersionAdditionalDecl(), CheckMultiVersionFirstFunction(), clang::CPUDispatch, clang::CPUSpecific, clang::SemaBase::Diag(), clang::DeclContext::Equals(), clang::Decl::getAsFunction(), clang::Sema::getASTContext(), clang::Decl::getAttr(), clang::Decl::getDeclContext(), clang::Decl::getLocation(), clang::FunctionDecl::getMultiVersionKind(), clang::DeclContext::getRedeclContext(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), clang::TargetInfo::hasFeature(), clang::FunctionDecl::isMain(), clang::FunctionDecl::isMultiVersion(), clang::Decl::isUsed(), clang::None, Previous, clang::Redeclaration, clang::Decl::setInvalidDecl(), clang::FunctionDecl::setIsMultiVersion(), clang::Target, clang::TargetClones, and clang::TargetVersion.
Referenced by clang::Sema::CheckFunctionDeclaration().
|
static |
Check the target or target_version attribute of the function for MultiVersion validity.
Returns true if there was an error, false otherwise.
Definition at line 11329 of file SemaDecl.cpp.
References clang::Sema::Context, clang::ParsedTargetAttr::CPU, clang::SemaBase::Diag(), Feature, clang::ParsedTargetAttr::Features, clang::Sema::getASTContext(), clang::Decl::getAttr(), clang::TargetInfo::getFMVPriority(), clang::Decl::getLocation(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), clang::TargetInfo::isValidFeatureName(), clang::TargetInfo::parseTargetAttr(), clang::TargetInfo::validateCpuIs(), and clang::TargetInfo::validateCpuSupports().
Referenced by CheckDeclarationCausesMultiVersioning(), CheckMultiVersionAdditionalDecl(), and CheckMultiVersionFirstFunction().
checkNewAttributesAfterDef - If we already have a definition, check that there are no new attributes in this declaration.
Definition at line 3013 of file SemaDecl.cpp.
References clang::cast(), clang::Sema::CheckForFunctionRedefinition(), clang::VarDecl::Definition, clang::SemaBase::Diag(), Diag(), clang::NamedDecl::getDeclName(), getDefinition(), clang::Attr::getKind(), clang::Sema::getLangOpts(), clang::Attr::getLocation(), clang::Decl::getLocation(), clang::hasAttribute(), clang::isa(), clang::AttributeCommonInfo::isStandardAttributeSyntax(), New, clang::Sema::notePreviousDefinition(), clang::Decl::setInvalidDecl(), clang::SkipBodyInfo::ShouldSkip, and clang::VarDecl::TentativeDefinition.
Referenced by clang::Sema::mergeDeclAttributes().
|
static |
Definition at line 11407 of file SemaDecl.cpp.
References AttrCompatibleWithMultiVersion(), clang::Decl::attrs(), clang::CPUDispatch, clang::CPUSpecific, clang::SemaBase::Diag(), clang::Decl::getLocation(), clang::Target, clang::TargetClones, and clang::TargetVersion.
Referenced by CheckMultiVersionAdditionalRules().
|
static |
Definition at line 2243 of file SemaDecl.cpp.
References clang::Decl::getLocation(), clang::LabelDecl::getStmt(), clang::LabelDecl::isMSAsmLabel(), clang::LabelDecl::isResolvedMSAsmLabel(), and clang::SemaBase::PDiag().
Referenced by clang::Sema::ActOnPopScope().
Definition at line 7125 of file SemaDecl.cpp.
References clang::SemaBase::Diag(), clang::Decl::dropAttr(), clang::Decl::getAttr(), clang::Attr::getLocation(), clang::isa(), and clang::NamedDecl::isExternallyVisible().
Referenced by checkAttributesAfterMerging().
|
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 3592 of file SemaDecl.cpp.
References clang::SemaBase::Diag(), clang::UsingShadowDecl::getIntroducer(), clang::Decl::getLocation(), clang::UsingShadowDecl::getTargetDecl(), isExternC(), and New.
Referenced by clang::Sema::MergeFunctionDecl(), and clang::Sema::MergeVarDecl().
Definition at line 7093 of file SemaDecl.cpp.
References clang::SemaBase::Diag(), clang::Decl::dropAttr(), clang::Decl::getAttr(), clang::Attr::getLocation(), and clang::NamedDecl::isExternallyVisible().
Referenced by checkAttributesAfterMerging().
Definition at line 7103 of file SemaDecl.cpp.
References clang::SemaBase::Diag(), clang::Decl::dropAttrs(), clang::Decl::getAttr(), clang::Attr::getLocation(), and clang::NamedDecl::isExternallyVisible().
Referenced by checkAttributesAfterMerging().
|
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 19423 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, 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().
|
static |
Determine what kind of declaration we're shadowing.
Definition at line 8436 of file SemaDecl.cpp.
References clang::isa(), clang::DeclContext::isFileContext(), SDK_Field, SDK_Global, SDK_Local, SDK_StaticMember, SDK_StructuredBinding, SDK_Typedef, and SDK_Using.
Referenced by clang::Sema::CheckShadow(), and clang::Sema::DiagnoseShadowingLambdaDecls().
|
static |
Definition at line 19580 of file SemaDecl.cpp.
References clang::CopyAssignment, clang::CopyConstructor, clang::DefaultConstructor, clang::CXXMethodDecl::isCopyAssignmentOperator(), clang::CXXMethodDecl::isMoveAssignmentOperator(), clang::MoveAssignment, clang::MoveConstructor, and SetEligibleMethods().
Referenced by clang::Sema::ActOnFields().
|
static |
Definition at line 7613 of file SemaDecl.cpp.
References clang::Decl::addAttr(), clang::Sema::Context, clang::Decl::getAttr(), and clang::TypedefType::getDecl().
Referenced by clang::Sema::ActOnVariableDeclarator().
|
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 17650 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().
|
static |
Definition at line 9493 of file SemaDecl.cpp.
References clang::Sema::AdjustDestructorExceptionSpec(), clang::cast(), clang::Sema::CheckConstructorDeclarator(), clang::Sema::CheckConversionDeclarator(), clang::Sema::CheckDeductionGuideDeclarator(), clang::Sema::CheckDestructorDeclarator(), clang::Sema::CheckExplicitObjectMemberFunction(), clang::DeclSpec::ClearConstexprSpec(), clang::Constexpr, clang::Constinit, clang::Sema::Context, clang::CXXConstructorDecl::Create(), clang::CXXConversionDecl::Create(), clang::CXXDeductionGuideDecl::Create(), clang::CXXDestructorDecl::Create(), clang::CXXMethodDecl::Create(), clang::FunctionDecl::Create(), clang::Sema::CurContext, clang::DeclarationName::CXXConstructorName, clang::DeclarationName::CXXConversionFunctionName, clang::DeclarationName::CXXDeductionGuideName, clang::DeclarationName::CXXDestructorName, clang::SemaBase::Diag(), clang::Type::getAsAdjusted(), clang::DeclarationName::getAsIdentifierInfo(), clang::Declarator::getBeginLoc(), clang::DeclSpec::getConstexprSpecifier(), clang::DeclSpec::getConstexprSpecLoc(), clang::Sema::getCurFPFeatures(), clang::Declarator::getDeclSpec(), clang::Declarator::getEndLoc(), clang::DeclSpec::getExplicitSpecifier(), clang::Declarator::getFunctionTypeInfo(), clang::Declarator::getIdentifierLoc(), clang::Sema::getLangOpts(), clang::Declarator::getMutableDeclSpec(), clang::DeclarationNameInfo::getName(), clang::Sema::GetNameForDeclarator(), clang::DeclarationName::getNameKind(), clang::DeclSpec::getRepAsType(), clang::Declarator::getTrailingRequiresClause(), clang::Sema::GetTypeFromParser(), clang::DeclSpec::getTypeSpecTypeLoc(), clang::DeclaratorChunk::FunctionTypeInfo::hasPrototype, clang::FPOptions::isFPConstrained(), clang::DeclSpec::isFriendSpecified(), clang::Declarator::isFunctionDeclarator(), clang::Type::isFunctionProtoType(), clang::DeclSpec::isInlineSpecified(), clang::Declarator::isInvalidType(), clang::DeclContext::isRecord(), clang::Normal, clang::LangOptions::requiresStrictPrototypes(), clang::FunctionDecl::setIneligibleOrNotSelected(), clang::Decl::setInvalidDecl(), clang::Declarator::setInvalidType(), and clang::Unspecified.
Referenced by clang::Sema::ActOnFunctionDeclarator().
DeclhasAttr - returns true if decl Declaration already has the target attribute.
Definition at line 2725 of file SemaDecl.cpp.
References clang::Decl::attrs(), clang::cast(), clang::Attr::getKind(), and clang::isa().
Referenced by mergeDeclAttribute(), and propagateAttribute().
|
static |
Definition at line 16383 of file SemaDecl.cpp.
References clang::FixItHint::CreateInsertion(), clang::SemaBase::Diag(), clang::BlockDecl::doesNotEscape(), clang::DeclContext::getInnermostBlockDecl(), clang::DeclContext::getParent(), and clang::Sema::ImplicitlyRetainedSelfLocs.
Referenced by clang::Sema::ActOnFinishFunctionBody().
|
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 9299 of file SemaDecl.cpp.
References clang::Sema::ActOnFunctionDeclarator(), clang::LookupResult::begin(), clang::TypoCorrection::begin(), clang::Sema::Context, clang::Sema::CorrectTypo(), clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateRemoval(), clang::SemaBase::Diag(), clang::Sema::diagnoseTypo(), clang::LookupResult::empty(), clang::LookupResult::end(), clang::TypoCorrection::end(), clang::ErrorRecovery, ForVisibleRedeclaration, clang::Func, clang::DeclarationName::getAsIdentifierInfo(), clang::Decl::getCanonicalDecl(), clang::TypoCorrection::getCorrection(), clang::TypoCorrection::getCorrectionAsIdentifierInfo(), clang::TypoCorrection::getCorrectionDecl(), clang::Declarator::getCXXScopeSpec(), clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::SourceRange::getEnd(), clang::Decl::getFriendObjectKind(), clang::Declarator::getFunctionTypeInfo(), clang::Declarator::getIdentifierLoc(), clang::Decl::getLocation(), clang::LookupResult::getLookupKind(), clang::LookupResult::getLookupNameInfo(), clang::NamedDecl::getName(), 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::Declarator::isFunctionDefinition(), clang::SourceLocation::isInvalid(), clang::Declarator::isRedeclaration(), clang::Sema::LookupLocalFriendName, clang::Sema::LookupName(), clang::Sema::LookupOrdinaryName, clang::Sema::LookupQualifiedName(), clang::Sema::MarkTypoCorrectedFunctionDefinition(), clang::SemaBase::PDiag(), Previous, clang::TypoCorrection::setCorrectionDecl(), clang::Declarator::SetIdentifier(), clang::Decl::setInvalidDecl(), and clang::Declarator::setRedeclaration().
Referenced by clang::Sema::ActOnFunctionDeclarator().
|
static |
Definition at line 3158 of file SemaDecl.cpp.
References clang::FixItHint::CreateInsertion(), clang::FixItHint::CreateRemoval(), clang::SemaBase::Diag(), clang::DeclaratorDecl::getInnerLocStart(), clang::Sema::getLangOpts(), clang::Preprocessor::getLastMacroWithSpelling(), clang::Decl::getLocation(), and clang::Sema::PP.
Referenced by clang::Sema::mergeDeclAttributes().
Returns true if there hasn't been any invalid type diagnosed.
Definition at line 7517 of file SemaDecl.cpp.
References clang::Sema::Context, clang::SemaBase::Diag(), clang::QualType::getAddressSpace(), clang::ASTContext::getBaseElementType(), clang::DeclaratorDecl::getBeginLoc(), clang::QualType::getCanonicalType(), clang::Decl::getDeclContext(), clang::Sema::getLangOpts(), clang::Decl::getLocation(), clang::Sema::getOpenCLOptions(), clang::Type::getPointeeType(), clang::ValueDecl::getType(), clang::VarDecl::hasGlobalStorage(), clang::OpenCLOptions::isAvailableOption(), clang::Type::isClkEventT(), clang::QualType::isConstQualified(), clang::Type::isEventT(), clang::Type::isFunctionPointerType(), clang::Type::isFunctionReferenceType(), clang::Type::isHalfType(), clang::Type::isImageType(), clang::Decl::isInvalidDecl(), clang::Type::isMemberFunctionPointerType(), clang::Type::isPipeType(), clang::Type::isPointerType(), clang::Type::isReferenceType(), clang::Type::isReserveIDT(), clang::Type::isSamplerT(), clang::VarDecl::isStaticLocal(), clang::DeclContext::isTranslationUnit(), clang::opencl_constant, clang::opencl_global, clang::opencl_local, clang::opencl_private, and clang::Decl::setInvalidDecl().
Referenced by clang::Sema::CheckVariableDeclarationType().
Definition at line 4533 of file SemaDecl.cpp.
References clang::Sema::Context, clang::SemaBase::Diag(), getNoteDiagForInvalidRedeclaration(), clang::ValueDecl::getType(), clang::ASTContext::hasSameType(), and New.
Referenced by clang::Sema::MergeVarDeclTypes().
Definition at line 7625 of file SemaDecl.cpp.
References clang::SemaBase::Diag(), clang::Type::getAsRecordDecl(), clang::Sema::getASTContext(), clang::Decl::getAttr(), clang::ASTContext::getBaseElementType(), clang::QualType::getCanonicalType(), clang::Decl::getLocation(), clang::ValueDecl::getType(), clang::VarDecl::hasLocalStorage(), clang::Type::isArrayType(), and clang::QualType::isConstQualified().
Referenced by clang::Sema::ActOnVariableDeclarator().
|
static |
Definition at line 3441 of file SemaDecl.cpp.
References clang::ASTContext::getAsConstantArrayType(), clang::ASTContext::getAsVariableArrayType(), clang::ConstantArrayType::getSize(), clang::Type::isConstantArrayType(), clang::Type::isDependentSizedArrayType(), clang::Type::isVariableArrayType(), New, and clang::Star.
Referenced by mergeParamDeclTypes().
|
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 2476 of file SemaDecl.cpp.
References clang::Sema::Context, clang::Sema::getLangOpts(), clang::ASTContext::hasSameType(), clang::Sema::isVisible(), and Previous.
Referenced by clang::Sema::ActOnTypedefNameDecl().
|
static |
Definition at line 5642 of file SemaDecl.cpp.
Referenced by checkDuplicateDefaultInit(), and checkDuplicateDefaultInit().
|
static |
Definition at line 15872 of file SemaDecl.cpp.
References clang::FunctionDecl::getPreviousDecl(), clang::ValueDecl::getType(), and clang::Type::isFunctionProtoType().
Referenced by clang::Sema::ActOnFinishFunctionBody(), and ShouldWarnAboutMissingPrototype().
|
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 616 of file SemaDecl.cpp.
References clang::DeclContext::getLookupParent(), clang::DeclContext::getParent(), clang::DeclContext::getPrimaryContext(), and clang::DeclContext::isDependentContext().
Referenced by clang::Sema::ActOnMSVCUnknownTypeName().
Definition at line 6739 of file SemaDecl.cpp.
References clang::TypeLoc::castAs(), FixInvalidVariablyModifiedTypeLoc(), clang::TypeLoc::getAs(), clang::ArrayTypeLoc::getElementLoc(), clang::ParenTypeLoc::getInnerLoc(), clang::ArrayTypeLoc::getLBracketLoc(), clang::PointerLikeTypeLoc< Derived, TypeClass, LocalData >::getPointeeLoc(), clang::ArrayTypeLoc::getRBracketLoc(), clang::ArrayTypeLoc::getSizeExpr(), clang::TypeLoc::getUnqualifiedLoc(), clang::TypeLoc::initializeFullCopy(), clang::ParenTypeLoc::setLParenLoc(), clang::ParenTypeLoc::setRParenLoc(), and clang::PointerTypeLoc::setStarLoc().
Referenced by FixInvalidVariablyModifiedTypeLoc(), and TryToFixInvalidVariablyModifiedTypeSourceInfo().
|
static |
Definition at line 2117 of file SemaDecl.cpp.
References clang::FixItHint::CreateRemoval(), clang::Lexer::findLocationAfterToken(), clang::Decl::getBeginLoc(), clang::CharSourceRange::getCharRange(), clang::Decl::getEndLoc(), clang::ASTContext::getLangOpts(), clang::ASTContext::getSourceManager(), clang::isa(), and clang::SourceLocation::isInvalid().
Referenced by clang::Sema::DiagnoseUnusedDecl().
|
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 8452 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().
Definition at line 6113 of file SemaDecl.cpp.
References clang::Type::castAsArrayTypeUnsafe(), clang::ArrayType::getElementType(), clang::Type::getPointeeType(), clang::Type::isArrayType(), clang::Type::isPointerOrReferenceType(), and clang::QualType::withoutLocalFastQualifiers().
Referenced by hasSimilarParameters().
Definition at line 2984 of file SemaDecl.cpp.
References clang::VarDecl::getActingDefinition(), and clang::VarDecl::getDefinition().
Referenced by clang::Sema::ActOnTag(), checkNewAttributesAfterDef(), clang::CodeGen::CodeGenFunction::EmitDecl(), clang::CodeGen::CodeGenModule::EmitTopLevelDecl(), clang::serialization::getDefinitiveDeclContext(), and clang::Sema::InstantiateFunctionDefinition().
Definition at line 5196 of file SemaDecl.cpp.
References clang::DeclSpec::getRepAsDecl(), clang::DeclSpec::getTypeSpecType(), clang::T, clang::DeclSpec::TST_class, clang::DeclSpec::TST_enum, clang::DeclSpec::TST_interface, clang::DeclSpec::TST_struct, and clang::DeclSpec::TST_union.
Referenced by clang::Sema::ParsedFreeStandingDeclSpec().
|
static |
Definition at line 9457 of file SemaDecl.cpp.
References clang::DeclSpec::ClearStorageClassSpecs(), clang::Sema::CurContext, clang::SemaBase::Diag(), clang::Declarator::getDeclSpec(), clang::Declarator::getMutableDeclSpec(), clang::DeclContext::getRedeclContext(), clang::DeclSpec::getStorageClassSpec(), clang::DeclSpec::getStorageClassSpecLoc(), clang::DeclSpec::isExternInLinkageSpec(), clang::DeclContext::isFunctionOrMethod(), clang::SC_Extern, clang::SC_None, clang::SC_PrivateExtern, clang::SC_Static, clang::DeclSpec::SCS_auto, clang::DeclSpec::SCS_extern, clang::DeclSpec::SCS_mutable, clang::DeclSpec::SCS_private_extern, clang::DeclSpec::SCS_register, clang::DeclSpec::SCS_static, clang::DeclSpec::SCS_unspecified, and clang::Declarator::setInvalidType().
Referenced by clang::Sema::ActOnFunctionDeclarator().
|
static |
Definition at line 2349 of file SemaDecl.cpp.
References clang::Error, ASTContext::GE_Missing_setjmp, ASTContext::GE_Missing_stdio, ASTContext::GE_Missing_type, ASTContext::GE_Missing_ucontext, ASTContext::GE_None, and clang::Builtin::Context::getHeaderName().
Referenced by clang::Sema::LazilyCreateBuiltin().
|
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 – this includes compiler-generated special member functions – 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 11236 of file SemaDecl.cpp.
References clang::Attr::clone(), clang::Sema::CodeSegStack, clang::Sema::getASTContext(), clang::Decl::getAttr(), clang::DeclContext::getParent(), and clang::Attr::setImplicit().
Referenced by clang::Sema::getImplicitCodeSegOrSectionAttrForFunction().
|
static |
Definition at line 5009 of file SemaDecl.cpp.
References clang::Scope::getMSCurManglingNumber(), clang::Scope::getMSLastManglingNumber(), clang::LangOptions::isCompatibleWithMSVC(), and clang::LangOptionsBase::MSVC2015.
Referenced by clang::Sema::ActOnVariableDeclarator(), clang::Sema::BuildAnonymousStructOrUnion(), and clang::Sema::handleTagNumbering().
|
static |
Definition at line 20171 of file SemaDecl.cpp.
References clang::T.
Referenced by clang::Sema::CheckEnumConstant().
|
static |
Determine whether a class is C-like, according to the rules of C++ [dcl.typedef] for anonymous classes with typedef names for linkage.
Definition at line 5063 of file SemaDecl.cpp.
References clang::CXXRecordDecl::bases_begin(), clang::CXXRecordDecl::bases_end(), clang::DeclContext::decls(), clang::CXXBaseSpecifier::getBeginLoc(), clang::CXXBaseSpecifier::getEndLoc(), getNonCLikeKindForAnonymousStruct(), clang::CXXRecordDecl::getNumBases(), clang::DeclaratorDecl::getSourceRange(), clang::Init, clang::Invalid, clang::isa(), clang::Decl::isImplicit(), and clang::Decl::isInvalidDecl().
Referenced by getNonCLikeKindForAnonymousStruct(), and clang::Sema::setTagNameForLinkagePurposes().
|
static |
Definition at line 3534 of file SemaDecl.cpp.
References clang::SourceLocation::isInvalid(), New, and clang::T.
Referenced by diagnoseVarDeclTypeMismatch(), clang::Sema::MergeFunctionDecl(), and clang::Sema::MergeVarDecl().
|
static |
Definition at line 9697 of file SemaDecl.cpp.
References clang::Sema::Context, clang::Default, clang::QualType::getAddressSpace(), clang::Type::getAsCXXRecordDecl(), clang::Sema::getASTContext(), clang::QualType::getCanonicalType(), clang::Sema::getLangOpts(), clang::LangOptions::getOpenCLCompatibleVersion(), getOpenCLKernelParameterType(), clang::Sema::getOpenCLOptions(), clang::Type::getPointeeOrArrayElementType(), clang::Type::getPointeeType(), InvalidAddrSpacePtrKernelParam, InvalidKernelParam, clang::Type::isArrayType(), clang::Type::isAtomicType(), clang::OpenCLOptions::isAvailableOption(), clang::Type::isBooleanType(), clang::Type::isDependentType(), clang::Type::isEventT(), clang::Type::isHalfType(), clang::Type::isImageType(), isOpenCLSizeDependentType(), clang::Type::isOpenCLSpecificType(), clang::QualType::isPODType(), clang::Type::isPointerOrReferenceType(), clang::Type::isPointerType(), clang::Type::isRecordType(), clang::Type::isReserveIDT(), clang::Type::isVoidType(), clang::opencl_generic, clang::opencl_private, PtrKernelParam, PtrPtrKernelParam, RecordKernelParam, and ValidKernelParam.
Referenced by checkIsValidOpenCLKernelParameter(), and getOpenCLKernelParameterType().
|
static |
Get diagnostic select index for tag kind for redeclaration diagnostic message.
WARNING: Indexes apply to particular diagnostics only!
Definition at line 17474 of file SemaDecl.cpp.
References clang::Class, clang::Interface, and clang::Struct.
Referenced by clang::Sema::isAcceptableTagRedeclaration().
|
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 9973 of file SemaDecl.cpp.
References clang::DeclContext::getParent(), clang::DeclContext::isFileContext(), and clang::DeclContext::isFunctionOrMethod().
Referenced by clang::Sema::ActOnFunctionDeclarator(), and clang::Sema::ActOnTag().
|
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 9982 of file SemaDecl.cpp.
References clang::Scope::DeclScope, clang::Scope::getEntity(), clang::Scope::getFlags(), clang::Scope::getParent(), clang::Scope::isClassScope(), clang::Scope::isFunctionPrototypeScope(), and clang::DeclContext::isTransparentContext().
Referenced by clang::Sema::ActOnTag().
|
static |
Definition at line 3004 of file SemaDecl.cpp.
References clang::Decl::attrs().
|
static |
Definition at line 15272 of file SemaDecl.cpp.
Referenced by clang::Sema::FinalizeDeclaratorGroup().
|
static |
Definition at line 3627 of file SemaDecl.cpp.
References clang::Decl::getAttr(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::param_begin(), and clang::FunctionDecl::param_end().
Referenced by clang::Sema::MergeFunctionDecl().
|
static |
Definition at line 7466 of file SemaDecl.cpp.
References clang::Declarator::getAttributes(), clang::DeclSpec::getAttributes(), clang::DeclaratorChunk::getAttrs(), clang::Declarator::getDeclarationAttributes(), clang::Declarator::getDeclSpec(), clang::Declarator::getNumTypeObjects(), clang::Declarator::getTypeObject(), and clang::ParsedAttributesView::hasAttribute().
Referenced by clang::Sema::ActOnVariableDeclarator().
|
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 6131 of file SemaDecl.cpp.
References clang::Declaration, clang::Definition, clang::QualType::getBaseTypeIdentifier(), and getCoreType().
Referenced by DiagnoseInvalidRedeclaration().
|
static |
Definition at line 3571 of file SemaDecl.cpp.
References clang::CLanguageLinkage, clang::CXXLanguageLinkage, clang::DeclContext::isRecord(), New, and clang::T.
Referenced by clang::Sema::MergeFunctionDecl(), and clang::Sema::MergeVarDecl().
|
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.,
This routine is recursive, injecting the names of nested anonymous structs/unions into the owning context and scope as well.
Definition at line 5552 of file SemaDecl.cpp.
References clang::Decl::addAttr(), clang::AS_none, clang::Decl::attrs(), clang::cast(), CheckAnonMemberRedeclaration(), clang::Attr::clone(), clang::Sema::Context, clang::IndirectFieldDecl::Create(), clang::DeclContext::decls(), clang::NamedDecl::getDeclName(), clang::NamedDecl::getIdentifier(), clang::Decl::getLocation(), clang::ValueDecl::getType(), clang::Invalid, clang::isa(), clang::TagDecl::isUnion(), clang::Sema::PushOnScopeChains(), clang::Decl::setAccess(), clang::Decl::setImplicit(), and clang::Decl::setInvalidDecl().
Referenced by clang::Sema::BuildAnonymousStructOrUnion(), and clang::Sema::BuildMicrosoftCAnonymousStruct().
|
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 17687 of file SemaDecl.cpp.
References clang::DeclContext::Encloses(), clang::DeclContext::Equals(), clang::Sema::getLangOpts(), and clang::DeclContext::getRedeclContext().
Referenced by clang::Sema::ActOnTag().
Definition at line 2744 of file SemaDecl.cpp.
Referenced by mergeAlignedAttrs().
|
static |
Determine if tag kind is a class-key compatible with class for redeclaration (class, struct, or __interface).
Definition at line 17490 of file SemaDecl.cpp.
References clang::Class, clang::Interface, and clang::Struct.
Referenced by clang::Sema::isAcceptableTagRedeclaration().
Returns true if given declaration has external C language linkage.
Definition at line 7507 of file SemaDecl.cpp.
|
static |
Definition at line 12750 of file SemaDecl.cpp.
References clang::Sema::Context, clang::NamedDecl::getName(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), and clang::T.
Referenced by clang::Sema::CheckMSVCRTEntryPoint().
|
static |
Check for this common pattern:
Definition at line 1878 of file SemaDecl.cpp.
References clang::FunctionDecl::doesThisDeclarationHaveABody(), and clang::CXXMethodDecl::isCopyAssignmentOperator().
Referenced by clang::Sema::ShouldWarnIfUnusedFileScopedDecl().
|
static |
Definition at line 3586 of file SemaDecl.cpp.
|
static |
Definition at line 3584 of file SemaDecl.cpp.
References clang::T.
|
static |
Definition at line 3585 of file SemaDecl.cpp.
|
static |
Returns true if the declaration is declared in a system header or from a system macro.
Definition at line 6240 of file SemaDecl.cpp.
References clang::Decl::getLocation(), and SM.
Referenced by clang::Sema::warnOnReservedIdentifier().
|
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 7394 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().
Definition at line 1659 of file SemaDecl.cpp.
References clang::TSK_ImplicitInstantiation.
Referenced by clang::Sema::CheckRedeclarationModuleOwnership().
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 7425 of file SemaDecl.cpp.
References clang::Sema::getLangOpts(), hasAttr(), and clang::T.
Referenced by clang::Sema::ActOnFunctionDeclarator(), clang::Sema::ActOnVariableDeclarator(), checkForConflictWithNonVisibleExternC(), and checkGlobalOrExternCConflict().
|
static |
Definition at line 1904 of file SemaDecl.cpp.
References clang::Sema::getLangOpts(), clang::LangOptions::IsHeaderFile, clang::SourceManager::isInMainFile(), clang::Sema::SourceMgr, clang::TU_Complete, and clang::Sema::TUKind.
Referenced by clang::Sema::ShouldWarnIfUnusedFileScopedDecl().
|
static |
Definition at line 7653 of file SemaDecl.cpp.
References clang::DeclarationName::getAsIdentifierInfo(), clang::Decl::getDeclContext(), clang::VarDecl::getDescribedVarTemplate(), clang::VarDecl::isExternC(), and clang::IdentifierInfo::isStr().
Referenced by clang::Sema::ActOnVariableDeclarator().
|
static |
Definition at line 9675 of file SemaDecl.cpp.
References clang::C, clang::QualType::getAsString(), clang::QualType::getSingleStepDesugaredType(), clang::QualType::getUnqualifiedType(), and clang::Match.
Referenced by getOpenCLKernelParameterType().
|
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).
| PrevDecl | the previous declaration found by name lookup |
| DC | the context in which the new declaration is being declared. |
Definition at line 7007 of file SemaDecl.cpp.
References clang::DeclContext::Equals(), clang::Decl::getDeclContext(), clang::DeclContext::getEnclosingNamespaceContext(), clang::DeclContext::getRedeclContext(), clang::NamedDecl::hasLinkage(), clang::DeclContext::isFunctionOrMethod(), and clang::DeclContext::isRecord().
Referenced by clang::Sema::FilterLookupForScope().
|
static |
Determine whether the given result set contains either a type name or.
Definition at line 833 of file SemaDecl.cpp.
References clang::LookupResult::begin(), clang::LookupResult::end(), clang::Sema::getLangOpts(), clang::LookupResult::getSema(), clang::Token::is(), and clang::isa().
Referenced by clang::Sema::ClassifyName().
|
static |
Determine whether a declaration matches a known function in namespace std.
Definition at line 9993 of file SemaDecl.cpp.
References clang::Type::castAs(), clang::TargetInfo::getCXXABI(), clang::FunctionProtoType::getNumParams(), clang::ASTContext::getTargetInfo(), clang::ValueDecl::getType(), and clang::TargetCXXABI::isMicrosoft().
Referenced by clang::Sema::ActOnFunctionDeclarator().
|
static |
Definition at line 848 of file SemaDecl.cpp.
References clang::Class, clang::FixItHint::CreateInsertion(), clang::SemaBase::Diag(), clang::Enum, clang::LookupResult::getAsSingle(), clang::Sema::getLangOpts(), clang::Interface, clang::Sema::LookupParsedName(), clang::Sema::LookupTagName, clang::Struct, and clang::Union.
Referenced by clang::Sema::ClassifyName().
Definition at line 1851 of file SemaDecl.cpp.
References clang::Decl::getDeclContext(), clang::isa(), and clang::DeclContext::isFileContext().
Referenced by RemoveUsingDecls().
|
static |
Definition at line 13745 of file SemaDecl.cpp.
References looksMutable(), and clang::T.
Referenced by clang::Sema::DiagnoseUniqueObjectDuplication(), and looksMutable().
|
static |
Tries to perform unqualified lookup of the type decls in bases for dependent class.
Definition at line 178 of file SemaDecl.cpp.
References clang::CXXRecordDecl::bases(), clang::CXXRecordDecl::getCanonicalDecl(), clang::CXXRecordDecl::hasDefinition(), clang::isa(), clang::DeclContext::lookup(), and lookupUnqualifiedTypeNameInBase().
Referenced by lookupUnqualifiedTypeNameInBase(), and recoverFromTypeInKnownDependentBase().
Merge alignment attributes from Old to New, taking into account the special semantics of C11's _Alignas specifier and C++11's alignas attribute.
true if any attributes were added to New. Definition at line 2756 of file SemaDecl.cpp.
References clang::cast(), clang::Sema::Context, clang::SemaBase::Diag(), clang::ASTContext::getCanonicalTagType(), clang::CharUnits::getQuantity(), clang::ASTContext::getTypeAlign(), isAttributeTargetADefinition(), New, clang::Decl::specific_attrs(), and clang::ASTContext::toCharUnitsFromBits().
Referenced by clang::Sema::mergeDeclAttributes().
|
static |
Definition at line 2867 of file SemaDecl.cpp.
References clang::Decl::addAttr(), clang::ASTConsumer::AssignInheritanceModel(), clang::cast(), clang::Attr::clone(), clang::Sema::Consumer, clang::Sema::Context, DeclHasAttr(), clang::IdentifierTable::get(), clang::Sema::getLangOpts(), clang::NamedDecl::getName(), clang::NamedDecl::getVisibility(), clang::Sema::HLSL(), clang::ASTContext::Idents, clang::isa(), clang::Decl::isImplicit(), clang::Sema::mergeAlwaysInlineAttr(), clang::Sema::mergeAvailabilityAttr(), clang::Sema::mergeBTFDeclTagAttr(), clang::Sema::mergeCodeSegAttr(), clang::Sema::mergeDLLExportAttr(), clang::Sema::mergeDLLImportAttr(), clang::Sema::mergeEnforceTCBAttr(), clang::Sema::mergeEnforceTCBLeafAttr(), clang::Sema::mergeErrorAttr(), clang::Sema::mergeFormatAttr(), clang::Sema::mergeFormatMatchesAttr(), clang::SemaWasm::mergeImportModuleAttr(), clang::SemaWasm::mergeImportNameAttr(), clang::Sema::mergeInternalLinkageAttr(), clang::Sema::mergeMinSizeAttr(), clang::Sema::mergeModularFormatAttr(), clang::Sema::mergeMSInheritanceAttr(), clang::SemaSwift::mergeNameAttr(), clang::SemaHLSL::mergeNumThreadsAttr(), clang::Sema::mergeOptimizeNoneAttr(), clang::SemaOpenACC::mergeRoutineDeclAttr(), clang::Sema::mergeSectionAttr(), clang::SemaHLSL::mergeShaderAttr(), clang::Sema::mergeTypeVisibilityAttr(), clang::Sema::mergeUuidAttr(), clang::Sema::mergeVisibilityAttr(), clang::SemaHLSL::mergeVkConstantIdAttr(), clang::SemaHLSL::mergeWaveSizeAttr(), clang::Sema::OpenACC(), clang::OptionalProtocolImplementation, clang::Override, clang::ProtocolImplementation, clang::InheritableAttr::setInherited(), clang::Sema::Swift(), and clang::Sema::Wasm().
Referenced by clang::Sema::mergeDeclAttributes().
|
static |
mergeParamDeclAttributes - Copy attributes from the old parameter to the new one.
Definition at line 3407 of file SemaDecl.cpp.
References clang::cast(), clang::SemaBase::Diag(), clang::Decl::getAttr(), clang::Decl::getDeclContext(), clang::ParmVarDecl::getFunctionScopeIndex(), clang::Decl::getLocation(), clang::FunctionDecl::getParamDecl(), clang::Decl::hasAttr(), propagateAttribute(), and propagateAttributes().
Referenced by clang::Sema::MergeCompatibleFunctionDecls(), and clang::Sema::mergeObjCMethodDecls().
|
static |
Definition at line 3480 of file SemaDecl.cpp.
References clang::Sema::Context, clang::SemaBase::Diag(), EquivalentArrayTypes(), clang::Sema::getASTContext(), clang::ASTContext::getAttributedType(), clang::Decl::getLocation(), clang::Type::getNullability(), clang::ParmVarDecl::getObjCDeclQualifier(), clang::ValueDecl::getType(), clang::Decl::OBJC_TQ_CSNullability, and clang::ValueDecl::setType().
Referenced by clang::Sema::MergeCompatibleFunctionDecls().
|
static |
Definition at line 4636 of file SemaDecl.cpp.
References clang::Sema::getLangOpts(), clang::Decl::getLexicalDeclContext(), clang::DeclContext::isFunctionOrMethod(), clang::VarDecl::isPreviousDeclInSameBlockScope(), and Previous.
Referenced by clang::Sema::MergeVarDecl().
|
static |
Definition at line 16413 of file SemaDecl.cpp.
References clang::NamedDecl::getDeclName(), clang::NamedDecl::getName(), clang::isa(), clang::DeclarationName::isIdentifier(), and clang::FunctionDecl::param_empty().
Referenced by clang::Sema::CanBeGetReturnObject(), and clang::Sema::CanBeGetReturnTypeOnAllocFailure().
|
static |
Definition at line 11770 of file SemaDecl.cpp.
References clang::CPUDispatch, clang::CPUSpecific, clang::Decl::getASTContext(), clang::FunctionDecl::getMultiVersionKind(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), New, clang::None, clang::TargetClones, and clang::TargetVersion.
Referenced by CheckMultiVersionAdditionalDecl().
|
static |
Definition at line 11659 of file SemaDecl.cpp.
References clang::Decl::addAttr(), clang::Decl::getASTContext(), clang::FunctionDecl::getMultiVersionKind(), clang::FunctionDecl::getSourceRange(), clang::ASTContext::getTargetInfo(), clang::TargetInfo::getTriple(), clang::None, clang::TargetClones, and clang::TargetVersion.
Referenced by CheckDeclarationCausesMultiVersioning(), and CheckMultiVersionAdditionalDecl().
|
static |
Definition at line 11650 of file SemaDecl.cpp.
References clang::Decl::getAsFunction(), clang::FunctionDecl::getMultiVersionKind(), clang::Decl::getPreviousDecl(), clang::FunctionDecl::getPreviousDecl(), and clang::None.
Referenced by CheckDeclarationCausesMultiVersioning().
|
static |
Definition at line 3371 of file SemaDecl.cpp.
References clang::Decl::addAttr(), clang::cast(), clang::Sema::Context, DeclHasAttr(), clang::Decl::specific_attrs(), and clang::T.
Referenced by mergeParamDeclAttributes().
|
static |
Definition at line 3386 of file SemaDecl.cpp.
References clang::Decl::dropAttrs(), clang::Decl::hasAttrs(), and clang::Decl::setAttrs().
Referenced by mergeParamDeclAttributes().
|
static |
RebuildDeclaratorInCurrentInstantiation - Checks whether the given declarator needs to be rebuilt in the current instantiation.
Any bits of declarator which appear before the name are valid for consideration here. That's specifically the type in the decl spec and the base type in any member-pointer chunks.
Definition at line 6166 of file SemaDecl.cpp.
References clang::Sema::Context, clang::Sema::CreateParsedType(), clang::Declarator::getIdentifierLoc(), clang::Declarator::getMutableDeclSpec(), clang::Declarator::getNumTypeObjects(), clang::DeclSpec::getRepAsExpr(), clang::DeclSpec::getRepAsType(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::TypeSourceInfo::getType(), clang::Sema::GetTypeFromParser(), clang::Declarator::getTypeObject(), clang::DeclSpec::getTypeSpecType(), clang::DeclSpec::getTypeSpecTypeLoc(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::Mem, clang::DeclaratorChunk::MemberPointer, clang::Sema::RebuildExprInCurrentInstantiation(), clang::Sema::RebuildNestedNameSpecifierInCurrentInstantiation(), clang::Sema::RebuildTypeInCurrentInstantiation(), clang::DeclaratorChunk::MemberPointerTypeInfo::Scope(), clang::T, clang::DeclSpec::TST_atomic, clang::DeclSpec::TST_decltype, clang::DeclSpec::TST_typename, clang::DeclSpec::TST_typeof_unqualExpr, clang::DeclSpec::TST_typeof_unqualType, clang::DeclSpec::TST_typeofExpr, clang::DeclSpec::TST_typeofType, clang::DeclSpec::UpdateExprRep(), and clang::DeclSpec::UpdateTypeRep().
Referenced by clang::Sema::HandleDeclarator().
|
static |
Definition at line 233 of file SemaDecl.cpp.
References clang::Sema::Context, clang::Sema::CreateParsedType(), clang::Sema::CurContext, clang::SemaBase::Diag(), clang::CXXRecordDecl::getDescribedClassTemplate(), clang::DeclContext::getParent(), clang::CXXScopeSpec::getWithLocInContext(), lookupUnqualifiedTypeNameInBase(), clang::CXXScopeSpec::MakeTrivial(), clang::None, clang::DependentNameTypeLoc::setElaboratedKeywordLoc(), clang::DependentNameTypeLoc::setNameLoc(), clang::DependentNameTypeLoc::setQualifierLoc(), and clang::T.
Referenced by clang::Sema::ClassifyName(), and clang::Sema::getTypeName().
|
static |
Removes using shadow declarations not at class scope from the lookup results.
Definition at line 1862 of file SemaDecl.cpp.
References clang::LookupResult::Filter::done(), clang::LookupResult::Filter::erase(), clang::LookupResult::Filter::hasNext(), isUsingDeclNotAtClassScope(), clang::LookupResult::makeFilter(), and clang::LookupResult::Filter::next().
Referenced by clang::Sema::HandleDeclarator().
|
static |
[class.mem.special]p6: An eligible special member function is a special member function for which:
Definition at line 19516 of file SemaDecl.cpp.
References AreSpecialMemberFunctionsSameKind(), clang::cast(), clang::Sema::CheckFunctionConstraints(), clang::Sema::Context, clang::FunctionDecl::getInstantiatedFromMemberFunction(), clang::DeclaratorDecl::getTrailingRequiresClause(), clang::Sema::IsAtLeastAsConstrained(), clang::ConstraintSatisfaction::IsSatisfied, and clang::Other.
Referenced by ComputeSpecialMemberFunctionsEligiblity().
|
static |
Definition at line 7046 of file SemaDecl.cpp.
References clang::Sema::Context, clang::Declarator::getCXXScopeSpec(), clang::CXXScopeSpec::getWithLocInContext(), clang::CXXScopeSpec::isSet(), and clang::DeclaratorDecl::setQualifierInfo().
Referenced by clang::Sema::ActOnClassTemplateSpecialization(), clang::Sema::ActOnExplicitInstantiation(), clang::Sema::ActOnFunctionDeclarator(), clang::Sema::ActOnVariableDeclarator(), and clang::Sema::CheckClassTemplate().
|
static |
Definition at line 7456 of file SemaDecl.cpp.
References clang::Decl::getDeclContext(), clang::DeclContext::getRedeclContext(), clang::isa(), clang::DeclContext::isFileContext(), clang::DeclContext::isFunctionOrMethod(), and clang::DeclContext::isRecord().
Definition at line 7439 of file SemaDecl.cpp.
References clang::Decl::getDeclContext(), clang::DeclContext::getDeclKind(), clang::DeclContext::getRedeclContext(), clang::VarDecl::hasExternalStorage(), clang::isa(), clang::DeclContext::isFileContext(), clang::DeclContext::isFunctionOrMethod(), and clang::DeclContext::isRecord().
Referenced by clang::Sema::ActOnFunctionDeclarator(), and clang::Sema::ActOnVariableDeclarator().
|
static |
Definition at line 1993 of file SemaDecl.cpp.
References clang::Type::getAs(), clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::Decl::hasAttr(), clang::Init, clang::isa(), clang::DeclContext::isFunctionOrMethod(), clang::Decl::isInvalidDecl(), clang::NamedDecl::isPlaceholderVar(), clang::Decl::isReferenced(), clang::FunctionDecl::isTrivial(), and clang::Decl::isUsed().
Referenced by clang::Sema::DiagnoseUnusedDecl().
|
static |
Definition at line 15888 of file SemaDecl.cpp.
References FindPossiblePrototype(), clang::Decl::getDeclContext(), clang::FunctionDecl::getDescribedFunctionTemplate(), clang::NamedDecl::getIdentifier(), clang::DeclContext::getRedeclContext(), clang::Decl::hasAttr(), clang::isa(), clang::FunctionDecl::isDeleted(), clang::NamedDecl::isExternallyVisible(), clang::FunctionDecl::isFunctionTemplateSpecialization(), clang::FunctionDecl::isGlobal(), clang::FunctionDecl::isInlined(), clang::Decl::isInvalidDecl(), and clang::FunctionDecl::isMSVCRTEntryPoint().
Referenced by clang::Sema::ActOnFinishFunctionBody().
|
static |
Definition at line 8461 of file SemaDecl.cpp.
References clang::Found, clang::LookupResult::getNameLoc(), clang::LookupResult::getResultKind(), and clang::DiagnosticsEngine::isIgnored().
Referenced by clang::Sema::getShadowedDeclaration(), clang::Sema::getShadowedDeclaration(), and clang::Sema::getShadowedDeclaration().
|
static |
StorageClassSpecToVarDeclStorageClass - Maps a DeclSpec::SCS to a VarDecl::StorageClass.
Any error reporting is up to the caller: illegal input values are mapped to SC_None.
Definition at line 5621 of file SemaDecl.cpp.
References clang::DeclSpec::getStorageClassSpec(), clang::DeclSpec::isExternInLinkageSpec(), clang::SC_Auto, clang::SC_Extern, clang::SC_None, clang::SC_PrivateExtern, clang::SC_Register, clang::SC_Static, clang::DeclSpec::SCS_auto, clang::DeclSpec::SCS_extern, clang::DeclSpec::SCS_mutable, clang::DeclSpec::SCS_private_extern, clang::DeclSpec::SCS_register, clang::DeclSpec::SCS_static, clang::DeclSpec::SCS_typedef, and clang::DeclSpec::SCS_unspecified.
Referenced by clang::Sema::ActOnVariableDeclarator(), clang::Sema::BuildAnonymousStructOrUnion(), and clang::Sema::BuildMicrosoftCAnonymousStruct().
|
static |
Definition at line 597 of file SemaDecl.cpp.
References clang::NestedNameSpecifier::getGlobal(), clang::DeclContext::getLookupParent(), clang::DeclContext::getPrimaryContext(), and clang::isa().
Referenced by clang::Sema::ActOnMSVCUnknownTypeName().
|
static |
Helper method to turn variable array types into constant array types in certain situations which would otherwise be errors (for GCC compatibility).
Definition at line 6661 of file SemaDecl.cpp.
References clang::QualifierCollector::apply(), clang::Expr::EvaluateAsInt(), clang::ArrayType::getElementType(), clang::ConstantArrayType::getMaxSizeBits(), clang::ConstantArrayType::getNumAddressingBits(), clang::Type::getPointeeType(), clang::VariableArrayType::getSizeExpr(), clang::Type::isDependentType(), clang::Type::isIncompleteType(), clang::QualType::isNull(), clang::Type::isUndeducedType(), clang::Type::isVariablyModifiedType(), clang::Normal, clang::QualifierCollector::strip(), clang::T, and TryToFixInvalidVariablyModifiedType().
Referenced by clang::Sema::CheckVariableDeclarationType(), TryToFixInvalidVariablyModifiedType(), and TryToFixInvalidVariablyModifiedTypeSourceInfo().
|
static |
Helper method to turn variable array types into constant array types in certain situations which would otherwise be errors (for GCC compatibility).
Definition at line 6777 of file SemaDecl.cpp.
References FixInvalidVariablyModifiedTypeLoc(), clang::TypeSourceInfo::getType(), clang::TypeSourceInfo::getTypeLoc(), clang::QualType::isNull(), and TryToFixInvalidVariablyModifiedType().
Referenced by clang::Sema::CheckTypedefForVariablyModifiedType(), clang::Sema::CheckVariableDeclarationType(), and clang::Sema::tryToFixVariablyModifiedVarType().
|
static |
Definition at line 20490 of file SemaDecl.cpp.
References clang::cast(), clang::TagDecl::castFromDeclContext(), clang::Enum, clang::DeclRefExpr::getDecl(), clang::Decl::getDeclContext(), clang::EnumConstantDecl::getInitExpr(), clang::APIntStorage::getValue(), and clang::Expr::IgnoreImpCasts().
Referenced by CheckForDuplicateEnumValues().