clang
15.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/CommentDiagnostic.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/Randstruct.h"
#include "clang/AST/StmtCXX.h"
#include "clang/Basic/Builtins.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/SemaInternal.h"
#include "clang/Sema/Template.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Triple.h"
#include <algorithm>
#include <cstring>
#include <functional>
#include <unordered_map>
#include "clang/Sema/AttrParsedAttrImpl.inc"
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 |
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. More... | |
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. More... | |
static bool | isResultTypeOrTemplate (LookupResult &R, const Token &NextToken) |
Determine whether the given result set contains either a type name or. More... | |
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. More... | |
static bool | isOutOfScopePreviousDeclaration (NamedDecl *PrevDecl, DeclContext *DC, ASTContext &Context) |
Determines whether the given declaration is an out-of-scope previous declaration. More... | |
static bool | isUsingDecl (NamedDecl *D) |
static void | RemoveUsingDecls (LookupResult &R) |
Removes using shadow declarations from the lookup results. More... | |
static bool | IsDisallowedCopyOrAssign (const CXXMethodDecl *D) |
Check for this common pattern: More... | |
static bool | isMainFileLoc (const Sema &S, SourceLocation Loc) |
static bool | ShouldDiagnoseUnusedDecl (const NamedDecl *D) |
static void | GenerateFixForUnusedDecl (const NamedDecl *D, ASTContext &Ctx, FixItHint &Hint) |
static void | CheckPoppedLabel (LabelDecl *L, Sema &S) |
static StringRef | getHeaderName (Builtin::Context &BuiltinInfo, unsigned ID, ASTContext::GetBuiltinTypeError Error) |
static void | filterNonConflictingPreviousTypedefDecls (Sema &S, TypedefNameDecl *Decl, LookupResult &Previous) |
Typedef declarations don't have linkage, but they still denote the same entity if their types are the same. More... | |
static bool | DeclHasAttr (const Decl *D, const Attr *A) |
DeclhasAttr - returns true if decl Declaration already has the target attribute. More... | |
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. More... | |
static bool | mergeDeclAttribute (Sema &S, NamedDecl *D, const InheritableAttr *Attr, Sema::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. More... | |
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. More... | |
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. More... | |
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). More... | |
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. More... | |
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. More... | |
static unsigned | GetDiagnosticTypeSpecifierID (DeclSpec::TST T) |
static bool | CheckAnonMemberRedeclaration (Sema &SemaRef, Scope *S, DeclContext *Owner, DeclarationName Name, SourceLocation NameLoc, bool IsUnion) |
We are trying to inject an anonymous member into the given scope; check if there's an existing declaration that can't be overloaded. More... | |
static bool | InjectAnonymousStructOrUnionMembers (Sema &SemaRef, Scope *S, DeclContext *Owner, RecordDecl *AnonRecord, AccessSpecifier AS, SmallVectorImpl< NamedDecl * > &Chaining) |
InjectAnonymousStructOrUnionMembers - Inject the members of the anonymous struct or union AnonRecord into the owning context Owner and scope S. More... | |
static StorageClass | StorageClassSpecToVarDeclStorageClass (const DeclSpec &DS) |
StorageClassSpecToVarDeclStorageClass - Maps a DeclSpec::SCS to a VarDecl::StorageClass. More... | |
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. More... | |
static bool | RebuildDeclaratorInCurrentInstantiation (Sema &S, Declarator &D, DeclarationName Name) |
RebuildDeclaratorInCurrentInstantiation - Checks whether the given declarator needs to be rebuilt in the current instantiation. More... | |
static bool | isFromSystemHeader (SourceManager &SM, const Decl *D) |
Returns true if the declaration is declared in a system header or from a system macro. More... | |
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). More... | |
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). More... | |
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? More... | |
template<typename T > | |
static bool | isIncompleteDeclExternC (Sema &S, const T *D) |
Determine whether a variable is extern "C" prior to attaching an initializer. More... | |
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. More... | |
static bool | diagnoseOpenCLTypes (Sema &Se, VarDecl *NewVD) |
Returns true if there hasn't been any invalid type diagnosed. More... | |
template<typename AttrTy > | |
static void | copyAttrFromTypedefToDecl (Sema &S, Decl *D, const TypedefType *TT) |
static ShadowedDeclKind | computeShadowedDeclKind (const NamedDecl *ShadowedDecl, const DeclContext *OldDC) |
Determine what kind of declaration we're shadowing. More... | |
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. More... | |
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. More... | |
template<typename T > | |
static bool | checkForConflictWithNonVisibleExternC (Sema &S, const T *ND, LookupResult &Previous) |
Apply special rules for handling extern "C" declarations. More... | |
static NamedDecl * | DiagnoseInvalidRedeclaration (Sema &SemaRef, LookupResult &Previous, FunctionDecl *NewFD, ActOnFDArgs &ExtraArgs, bool IsLocalFriend, Scope *S) |
Generate diagnostics for an invalid function redeclaration. More... | |
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. More... | |
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. More... | |
static bool | isStdBuiltin (ASTContext &Ctx, FunctionDecl *FD, unsigned BuiltinID) |
Determine whether a declaration matches a known function in namespace std. More... | |
static Attr * | getImplicitCodeSegAttrFromClass (Sema &S, const FunctionDecl *FD) |
Return a CodeSegAttr from a containing class. More... | |
static bool | CheckMultiVersionValue (Sema &S, const FunctionDecl *FD) |
Check the target attribute of the function for MultiVersion validity. More... | |
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, MultiVersionKind MVKind, const TargetAttr *TA) |
Check the validity of a multiversion function declaration that is the first of its kind. More... | |
static bool | PreviousDeclsHaveMultiVersionAttribute (const FunctionDecl *FD) |
static bool | CheckTargetCausesMultiVersioning (Sema &S, FunctionDecl *OldFD, FunctionDecl *NewFD, const TargetAttr *NewTA, bool &Redeclaration, NamedDecl *&OldDecl, LookupResult &Previous) |
static bool | MultiVersionTypesCompatible (MultiVersionKind Old, MultiVersionKind New) |
static bool | CheckMultiVersionAdditionalDecl (Sema &S, FunctionDecl *OldFD, FunctionDecl *NewFD, MultiVersionKind NewMVKind, const TargetAttr *NewTA, 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. More... | |
static bool | CheckMultiVersionFunction (Sema &S, FunctionDecl *NewFD, bool &Redeclaration, NamedDecl *&OldDecl, LookupResult &Previous) |
Check the validity of a mulitversion function declaration. More... | |
static bool | isDefaultStdCall (FunctionDecl *FD, Sema &S) |
static bool | hasDeducedAuto (DeclaratorDecl *DD) |
static bool | ShouldWarnAboutMissingPrototype (const FunctionDecl *FD, const FunctionDecl *&PossiblePrototype) |
static void | RebuildLambdaScopeInfo (CXXMethodDecl *CallOperator, Sema &S) |
static void | diagnoseImplicitlyRetainedSelf (Sema &S) |
static unsigned | getRedeclDiagFromTagKind (TagTypeKind Tag) |
Get diagnostic select index for tag kind for redeclaration diagnostic message. More... | |
static bool | isClassCompatTagKind (TagTypeKind Tag) |
Determine if tag kind is a class-key compatible with class for redeclaration (class, struct, or __interface). More... | |
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. More... | |
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). More... | |
static ObjCIvarDecl::AccessControl | TranslateIvarVisibility (tok::ObjCKeywordKind ivarVisibility) |
TranslateIvarVisibility - Translate visibility from a token ID to an AST enum value. More... | |
static bool | isRepresentableIntegerValue (ASTContext &Context, llvm::APSInt &Value, QualType T) |
Determine whether the given integral value is representable within the given type T. More... | |
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) |
#define WANT_DECL_MERGE_LOGIC |
Definition at line 2723 of file SemaDecl.cpp.
enum OpenCLParamType |
Enumerator | |
---|---|
ValidKernelParam | |
PtrPtrKernelParam | |
PtrKernelParam | |
InvalidAddrSpacePtrKernelParam | |
InvalidKernelParam | |
RecordKernelParam |
Definition at line 8945 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 7815 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 3366 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::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 alway permitted) or, as a C extension, when either the new declaration or a previous one is declared with the 'overloadable' attribute.
Definition at line 1482 of file SemaDecl.cpp.
References clang::LookupResult::Found, clang::LookupResult::FoundOverloaded, clang::ASTContext::getLangOpts(), clang::Decl::hasAttr(), and Previous.
|
static |
Definition at line 10524 of file SemaDecl.cpp.
References clang::Target, and Used.
|
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 3276 of file SemaDecl.cpp.
Referenced by clang::Sema::CheckForFunctionRedefinition().
|
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 5112 of file SemaDecl.cpp.
Definition at line 6690 of file SemaDecl.cpp.
Referenced by clang::Sema::FinalizeDeclaration().
|
static |
Definition at line 6782 of file SemaDecl.cpp.
|
static |
Definition at line 5259 of file SemaDecl.cpp.
|
static |
Definition at line 5250 of file SemaDecl.cpp.
|
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 8155 of file SemaDecl.cpp.
Referenced by clang::Sema::CheckVariableDeclaration().
|
static |
Definition at line 18633 of file SemaDecl.cpp.
|
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 8072 of file SemaDecl.cpp.
|
static |
Definition at line 9058 of file SemaDecl.cpp.
|
static |
Check the validity of a new function declaration being added to an existing multiversioned declaration collection.
Definition at line 10855 of file SemaDecl.cpp.
|
static |
Definition at line 10689 of file SemaDecl.cpp.
|
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 10735 of file SemaDecl.cpp.
|
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 11032 of file SemaDecl.cpp.
|
static |
Check the target attribute of the function for MultiVersion validity.
Returns true if there was an error, false otherwise.
Definition at line 10490 of file SemaDecl.cpp.
checkNewAttributesAfterDef - If we already have a definition, check that there are no new attributes in this declaration.
Definition at line 2852 of file SemaDecl.cpp.
Referenced by clang::Sema::mergeDeclAttributes().
|
static |
Definition at line 10539 of file SemaDecl.cpp.
Definition at line 2082 of file SemaDecl.cpp.
|
static |
Definition at line 10769 of file SemaDecl.cpp.
|
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 3313 of file SemaDecl.cpp.
|
static |
Determine what kind of declaration we're shadowing.
Definition at line 7826 of file SemaDecl.cpp.
References clang::DeclContext::isFileContext(), SDK_Field, SDK_Global, SDK_Local, SDK_StaticMember, SDK_StructuredBinding, SDK_Typedef, and SDK_Using.
Referenced by clang::Sema::DiagnoseShadowingLambdaDecls().
|
static |
Definition at line 7138 of file SemaDecl.cpp.
|
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 15931 of file SemaDecl.cpp.
|
static |
Definition at line 8770 of file SemaDecl.cpp.
References clang::Sema::GetNameForDeclarator().
DeclhasAttr - returns true if decl Declaration already has the target attribute.
Definition at line 2585 of file SemaDecl.cpp.
References clang::Decl::attrs(), and clang::Attr::getKind().
|
static |
Definition at line 14805 of file SemaDecl.cpp.
|
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 8583 of file SemaDecl.cpp.
|
static |
Definition at line 2967 of file SemaDecl.cpp.
Referenced by clang::Sema::mergeDeclAttributes().
Returns true if there hasn't been any invalid type diagnosed.
Definition at line 7042 of file SemaDecl.cpp.
References clang::Sema::Context, clang::Sema::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 4165 of file SemaDecl.cpp.
Referenced by clang::Sema::MergeVarDeclTypes().
|
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 2334 of file SemaDecl.cpp.
|
static |
Definition at line 5236 of file SemaDecl.cpp.
References clang::DeclContext::decls(), and clang::CXXRecordDecl::hasInClassInitializer().
|
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 571 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 6298 of file SemaDecl.cpp.
References clang::TypeLoc::castAs(), 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 TryToFixInvalidVariablyModifiedTypeSourceInfo().
|
static |
Definition at line 1981 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(), 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 7842 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 5722 of file SemaDecl.cpp.
References clang::Type::castAsArrayTypeUnsafe(), clang::ArrayType::getElementType(), clang::Type::getPointeeType(), clang::Type::isArrayType(), clang::Type::isPointerType(), clang::Type::isReferenceType(), and clang::QualType::withoutLocalFastQualifiers().
Referenced by hasSimilarParameters().
Definition at line 2826 of file SemaDecl.cpp.
References clang::VarDecl::getActingDefinition(), and clang::VarDecl::getDefinition().
Referenced by clang::CodeGen::CodeGenFunction::EmitDecl(), and clang::serialization::getDefinitiveDeclContext().
|
static |
Definition at line 4829 of file SemaDecl.cpp.
References clang::DeclSpec::TST_class, clang::DeclSpec::TST_enum, clang::DeclSpec::TST_interface, clang::DeclSpec::TST_struct, and clang::DeclSpec::TST_union.
|
static |
Definition at line 8734 of file SemaDecl.cpp.
References clang::DeclSpec::ClearStorageClassSpecs(), clang::Sema::CurContext, clang::Sema::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().
|
static |
Definition at line 2211 of file SemaDecl.cpp.
References BuiltinInfo, clang::ASTContext::GE_Missing_setjmp, clang::ASTContext::GE_Missing_stdio, clang::ASTContext::GE_Missing_type, clang::ASTContext::GE_Missing_ucontext, and clang::ASTContext::GE_None.
|
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 10370 of file SemaDecl.cpp.
Referenced by clang::Sema::getImplicitCodeSegOrSectionAttrForFunction().
|
static |
Definition at line 4645 of file SemaDecl.cpp.
Referenced by clang::Sema::handleTagNumbering().
|
static |
Definition at line 18289 of file SemaDecl.cpp.
References clang::ASTContext::getTypeSize(), clang::ASTContext::IntTy, clang::Type::isEnumeralType(), clang::Type::isIntegralType(), clang::ASTContext::LongLongTy, clang::ASTContext::LongTy, clang::ASTContext::ShortTy, clang::ASTContext::UnsignedIntTy, clang::ASTContext::UnsignedLongLongTy, clang::ASTContext::UnsignedLongTy, and clang::ASTContext::UnsignedShortTy.
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 4699 of file SemaDecl.cpp.
References clang::CXXRecordDecl::bases_begin(), clang::CXXRecordDecl::bases_end(), clang::DeclContext::decls(), clang::CXXBaseSpecifier::getBeginLoc(), clang::CXXBaseSpecifier::getEndLoc(), clang::CXXRecordDecl::getNumBases(), clang::DeclaratorDecl::getSourceRange(), clang::RISCV::Invalid, clang::Decl::isImplicit(), clang::Decl::isInvalidDecl(), and clang::XRayInstrKind::None.
Referenced by clang::Sema::setTagNameForLinkagePurposes().
|
static |
Definition at line 3255 of file SemaDecl.cpp.
References clang::SourceLocation::isInvalid().
Referenced by clang::Sema::MergeVarDecl().
|
static |
Definition at line 8976 of file SemaDecl.cpp.
|
static |
Get diagnostic select index for tag kind for redeclaration diagnostic message.
WARNING: Indexes apply to particular diagnostics only!
Definition at line 15755 of file SemaDecl.cpp.
References clang::TTK_Class, clang::TTK_Interface, and clang::TTK_Struct.
|
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 9236 of file SemaDecl.cpp.
References clang::DeclContext::getParent(), clang::DeclContext::isFileContext(), and clang::DeclContext::isFunctionOrMethod().
|
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 9245 of file SemaDecl.cpp.
|
static |
Definition at line 2843 of file SemaDecl.cpp.
References clang::Decl::attrs().
|
static |
Definition at line 13859 of file SemaDecl.cpp.
|
static |
Definition at line 3348 of file SemaDecl.cpp.
References clang::Decl::getAttr(), clang::FunctionDecl::getNumParams(), and clang::FunctionDecl::param_begin().
|
static |
Definition at line 6989 of file SemaDecl.cpp.
|
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 5740 of file SemaDecl.cpp.
References clang::QualType::getBaseTypeIdentifier(), getCoreType(), and clang::ASTContext::hasSameUnqualifiedType().
|
static |
Definition at line 3292 of file SemaDecl.cpp.
References clang::CLanguageLinkage, clang::CXXLanguageLinkage, and clang::DeclContext::isRecord().
Referenced by 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 5153 of file SemaDecl.cpp.
|
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 15968 of file SemaDecl.cpp.
Definition at line 2604 of file SemaDecl.cpp.
|
static |
Determine if tag kind is a class-key compatible with class for redeclaration (class, struct, or __interface).
Definition at line 15768 of file SemaDecl.cpp.
References clang::TTK_Class, clang::TTK_Interface, and clang::TTK_Struct.
Returns true if given declaration has external C language linkage.
Definition at line 7032 of file SemaDecl.cpp.
|
static |
Definition at line 11622 of file SemaDecl.cpp.
Referenced by clang::Sema::CheckMSVCRTEntryPoint().
|
static |
Check for this common pattern:
Definition at line 1739 of file SemaDecl.cpp.
References clang::FunctionDecl::doesThisDeclarationHaveABody(), and clang::CXXMethodDecl::isCopyAssignmentOperator().
Referenced by clang::Sema::ShouldWarnIfUnusedFileScopedDecl().
|
static |
Definition at line 3307 of file SemaDecl.cpp.
|
static |
Definition at line 3305 of file SemaDecl.cpp.
|
static |
Definition at line 3306 of file SemaDecl.cpp.
|
static |
Returns true if the declaration is declared in a system header or from a system macro.
Definition at line 5846 of file SemaDecl.cpp.
References clang::Decl::getLocation(), and SM.
|
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 6920 of file SemaDecl.cpp.
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 6951 of file SemaDecl.cpp.
|
static |
Definition at line 1777 of file SemaDecl.cpp.
Referenced by clang::Sema::ShouldWarnIfUnusedFileScopedDecl().
|
static |
Definition at line 8954 of file SemaDecl.cpp.
References clang::QualType::getAsString(), clang::QualType::getSingleStepDesugaredType(), and clang::QualType::getUnqualifiedType().
|
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 6560 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().
|
static |
Determine whether the given integral value is representable within the given type T.
Definition at line 18272 of file SemaDecl.cpp.
References clang::ASTContext::getIntWidth(), clang::Type::isEnumeralType(), clang::Type::isIntegralType(), and clang::Type::isSignedIntegerOrEnumerationType().
Referenced by clang::Sema::CheckEnumConstant().
|
static |
Determine whether the given result set contains either a type name or.
Definition at line 798 of file SemaDecl.cpp.
References clang::LookupResult::begin(), clang::LookupResult::end(), clang::Sema::getLangOpts(), clang::LookupResult::getSema(), and clang::Token::is().
|
static |
Determine whether a declaration matches a known function in namespace std.
Definition at line 9256 of file SemaDecl.cpp.
References clang::Type::castAs(), clang::TargetInfo::getCXXABI(), clang::FunctionProtoType::getNumParams(), clang::ASTContext::getTargetInfo(), clang::ValueDecl::getType(), and clang::TargetCXXABI::isMicrosoft().
|
static |
Definition at line 813 of file SemaDecl.cpp.
Definition at line 1716 of file SemaDecl.cpp.
Referenced by RemoveUsingDecls().
|
static |
Tries to perform unqualified lookup of the type decls in bases for dependent class.
Definition at line 183 of file SemaDecl.cpp.
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 2616 of file SemaDecl.cpp.
Referenced by clang::Sema::mergeDeclAttributes().
|
static |
Definition at line 2727 of file SemaDecl.cpp.
Referenced by clang::Sema::mergeDeclAttributes().
|
static |
mergeParamDeclAttributes - Copy attributes from the old parameter to the new one.
Definition at line 3169 of file SemaDecl.cpp.
Referenced by clang::Sema::mergeObjCMethodDecls().
|
static |
Definition at line 3212 of file SemaDecl.cpp.
|
static |
Definition at line 4275 of file SemaDecl.cpp.
Referenced by clang::Sema::MergeVarDecl().
|
static |
Definition at line 10841 of file SemaDecl.cpp.
References clang::CPUDispatch, clang::CPUSpecific, and clang::None.
|
static |
Definition at line 10760 of file SemaDecl.cpp.
References clang::Decl::getAsFunction(), clang::FunctionDecl::getMultiVersionKind(), clang::Redeclarable< decl_type >::getPreviousDecl(), clang::Decl::getPreviousDecl(), and clang::None.
|
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 5775 of file SemaDecl.cpp.
|
static |
Definition at line 14498 of file SemaDecl.cpp.
Referenced by clang::Sema::ActOnStartOfFunctionDef().
|
static |
Definition at line 238 of file SemaDecl.cpp.
|
static |
Removes using shadow declarations from the lookup results.
Definition at line 1723 of file SemaDecl.cpp.
References clang::LookupResult::Filter::done(), clang::LookupResult::Filter::erase(), clang::LookupResult::Filter::hasNext(), isUsingDecl(), clang::LookupResult::makeFilter(), and clang::LookupResult::Filter::next().
|
static |
Definition at line 6599 of file SemaDecl.cpp.
|
static |
Definition at line 6979 of file SemaDecl.cpp.
References clang::Decl::getDeclContext(), clang::DeclContext::getRedeclContext(), clang::DeclContext::isFileContext(), clang::DeclContext::isFunctionOrMethod(), and clang::DeclContext::isRecord().
Definition at line 6965 of file SemaDecl.cpp.
References clang::Decl::getDeclContext(), clang::DeclContext::getRedeclContext(), clang::VarDecl::hasExternalStorage(), clang::DeclContext::isFileContext(), clang::DeclContext::isFunctionOrMethod(), and clang::DeclContext::isRecord().
Definition at line 1866 of file SemaDecl.cpp.
References clang::Type::getAs(), clang::CXXConstructExpr::getConstructor(), clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::Decl::hasAttr(), clang::CXXConstructExpr::isElidable(), clang::DeclContext::isFunctionOrMethod(), clang::Decl::isInvalidDecl(), clang::Decl::isReferenced(), clang::FunctionDecl::isTrivial(), and clang::Decl::isUsed().
Referenced by clang::Sema::DiagnoseUnusedDecl().
|
static |
Definition at line 14383 of file SemaDecl.cpp.
References clang::Decl::getDeclContext(), clang::FunctionDecl::getDescribedFunctionTemplate(), clang::NamedDecl::getIdentifier(), clang::Redeclarable< decl_type >::getPreviousDecl(), clang::DeclContext::getRedeclContext(), clang::ValueDecl::getType(), clang::Decl::hasAttr(), clang::FunctionDecl::isDeleted(), clang::NamedDecl::isExternallyVisible(), clang::Type::isFunctionNoProtoType(), clang::FunctionDecl::isFunctionTemplateSpecialization(), clang::FunctionDecl::isGlobal(), clang::FunctionDecl::isInlined(), and clang::Decl::isInvalidDecl().
Referenced by clang::Sema::ActOnFinishFunctionBody().
|
static |
Definition at line 7851 of file SemaDecl.cpp.
References clang::LookupResult::Found, clang::LookupResult::getNameLoc(), clang::LookupResult::getResultKind(), and clang::DiagnosticsEngine::isIgnored().
Referenced by 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 5215 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.
|
static |
Definition at line 551 of file SemaDecl.cpp.
References clang::NestedNameSpecifier::Create(), clang::DeclContext::getLookupParent(), clang::DeclContext::getPrimaryContext(), and clang::NestedNameSpecifier::GlobalSpecifier().
Referenced by clang::Sema::ActOnMSVCUnknownTypeName().
|
static |
TranslateIvarVisibility - Translate visibility from a token ID to an AST enum value.
Definition at line 17558 of file SemaDecl.cpp.
References clang::ObjCIvarDecl::Package, clang::ObjCIvarDecl::Private, clang::ObjCIvarDecl::Protected, and clang::ObjCIvarDecl::Public.
|
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 6220 of file SemaDecl.cpp.
References clang::QualifierCollector::apply(), clang::Type::getPointeeType(), clang::ASTContext::getPointerType(), clang::Type::isDependentType(), clang::QualType::isNull(), and clang::QualifierCollector::strip().
Referenced by clang::Sema::CheckVariableDeclarationType(), 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 6336 of file SemaDecl.cpp.
References FixInvalidVariablyModifiedTypeLoc(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::TypeSourceInfo::getType(), clang::TypeSourceInfo::getTypeLoc(), clang::QualType::isNull(), and TryToFixInvalidVariablyModifiedType().
Referenced by clang::Sema::CheckVariableDeclarationType(), and clang::Sema::tryToFixVariablyModifiedVarType().
|
static |
Definition at line 18597 of file SemaDecl.cpp.
References clang::TagDecl::castFromDeclContext(), clang::DeclRefExpr::getDecl(), clang::Decl::getDeclContext(), clang::EnumConstantDecl::getInitExpr(), clang::APIntStorage::getValue(), and clang::Expr::IgnoreImpCasts().