clang API Documentation
#include "clang/Sema/SemaInternal.h"
#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/ExprCXX.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/Parse/ParseDiagnostic.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/Template.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Triple.h"
#include <algorithm>
#include <cstring>
#include <functional>
Go to the source code of this file.
Classes | |
struct | FindOverriddenMethodData |
Data used with FindOverriddenMethod. More... | |
struct | DupKey |
struct | DenseMapInfoDupKey |
Enumerations | |
enum | OverrideErrorKind |
enum | OpenCLParamType { ValidKernelParam, PtrPtrKernelParam, PtrKernelParam, PrivatePtrKernelParam, InvalidKernelParam, RecordKernelParam } |
Functions | |
static ParsedType | recoverFromTypeInKnownDependentBase (Sema &S, const IdentifierInfo &II, SourceLocation NameLoc) |
static NestedNameSpecifier * | synthesizeCurrentNestedNameSpecifier (ASTContext &Context, DeclContext *DC) |
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 ParsedType | buildNestedType (Sema &S, CXXScopeSpec &SS, QualType T, SourceLocation NameLoc) |
Build a ParsedType for a simple-type-specifier with a nested-name-specifier. | |
static bool | AllowOverloadingOfFunction (LookupResult &Previous, ASTContext &Context) |
Determine whether we allow overloading of the function PrevDecl with another declaration. | |
static bool | isOutOfScopePreviousDeclaration (NamedDecl *PrevDecl, DeclContext *DC, ASTContext &Context) |
Determines whether the given declaration is an out-of-scope previous declaration. | |
static bool | isUsingDecl (NamedDecl *D) |
static void | RemoveUsingDecls (LookupResult &R) |
Removes using shadow declarations 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 NamedDecl *D) |
static void | GenerateFixForUnusedDecl (const NamedDecl *D, ASTContext &Ctx, FixItHint &Hint) |
static void | CheckPoppedLabel (LabelDecl *L, Sema &S) |
static void | LookupPredefedObjCSuperType (Sema &ThisSema, Scope *S, IdentifierInfo *II) |
Looks up the declaration of "struct objc_super" and saves it for later use in building builtin declaration of objc_msgSendSuper and objc_msgSendSuper_stret. If no such pre-existing declaration exists no action takes place. | |
static StringRef | getHeaderName (ASTContext::GetBuiltinTypeError Error) |
static void | filterNonConflictingPreviousDecls (ASTContext &context, NamedDecl *decl, LookupResult &previous) |
Filter out any previous declarations that the given declaration should not consider because they are not permitted to conflict, e.g., because they come from hidden sub-modules and do not refer to the same entity. | |
static void | filterNonConflictingPreviousTypedefDecls (ASTContext &Context, TypedefNameDecl *Decl, LookupResult &Previous) |
static bool | DeclHasAttr (const Decl *D, const Attr *A) |
static bool | isAttributeTargetADefinition (Decl *D) |
static bool | mergeAlignedAttrs (Sema &S, NamedDecl *New, Decl *Old) |
static bool | mergeDeclAttribute (Sema &S, NamedDecl *D, const InheritableAttr *Attr, bool Override) |
static const Decl * | getDefinition (const Decl *D) |
static bool | hasAttribute (const Decl *D, attr::Kind Kind) |
static void | checkNewAttributesAfterDef (Sema &S, Decl *New, const Decl *Old) |
static void | mergeParamDeclAttributes (ParmVarDecl *newDecl, const ParmVarDecl *oldDecl, 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) |
template<typename T > | |
static bool | haveIncompatibleLanguageLinkages (const T *Old, const T *New) |
static bool | mergeTypeWithPrevious (Sema &S, VarDecl *NewVD, VarDecl *OldVD, LookupResult &Previous) |
static void | HandleTagNumbering (Sema &S, const TagDecl *Tag, Scope *TagScope) |
static bool | CheckAnonMemberRedeclaration (Sema &SemaRef, Scope *S, DeclContext *Owner, DeclarationName Name, SourceLocation NameLoc, unsigned diagnostic) |
static bool | InjectAnonymousStructOrUnionMembers (Sema &SemaRef, Scope *S, DeclContext *Owner, RecordDecl *AnonRecord, AccessSpecifier AS, SmallVectorImpl< NamedDecl * > &Chaining, bool MSAnonStruct) |
static StorageClass | StorageClassSpecToVarDeclStorageClass (const DeclSpec &DS) |
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) |
static bool | RebuildDeclaratorInCurrentInstantiation (Sema &S, Declarator &D, DeclarationName Name) |
static QualType | TryToFixInvalidVariablyModifiedType (QualType T, ASTContext &Context, bool &SizeIsNegative, llvm::APSInt &Oversized) |
static void | FixInvalidVariablyModifiedTypeLoc (TypeLoc SrcTL, TypeLoc DstTL) |
static TypeSourceInfo * | TryToFixInvalidVariablyModifiedTypeSourceInfo (TypeSourceInfo *TInfo, ASTContext &Context, bool &SizeIsNegative, llvm::APSInt &Oversized) |
static void | SetNestedNameSpecifier (DeclaratorDecl *DD, Declarator &D) |
static void | checkAttributesAfterMerging (Sema &S, NamedDecl &ND) |
static void | checkDLLAttributeRedeclaration (Sema &S, NamedDecl *OldDecl, NamedDecl *NewDecl, bool IsSpecialization) |
static bool | isFunctionDefinitionDiscarded (Sema &S, FunctionDecl *FD) |
template<typename T > | |
static bool | isIncompleteDeclExternC (Sema &S, const T *D) |
static bool | shouldConsiderLinkage (const VarDecl *VD) |
static bool | shouldConsiderLinkage (const FunctionDecl *FD) |
static bool | hasParsedAttr (Scope *S, const AttributeList *AttrList, AttributeList::Kind Kind) |
static bool | hasParsedAttr (Scope *S, const Declarator &PD, AttributeList::Kind Kind) |
template<typename T > | |
static bool | checkGlobalOrExternCConflict (Sema &S, const T *ND, bool IsGlobal, LookupResult &Previous) |
template<typename T > | |
static bool | checkForConflictWithNonVisibleExternC (Sema &S, const T *ND, LookupResult &Previous) |
static bool | FindOverriddenMethod (const CXXBaseSpecifier *Specifier, CXXBasePath &Path, void *UserData) |
Member lookup function that determines whether a given C++ method overrides a method in a base class, to be used with CXXRecordDecl::lookupInBases(). | |
static void | ReportOverrides (Sema &S, unsigned DiagID, const CXXMethodDecl *MD, OverrideErrorKind OEK=OEK_All) |
Report an error regarding overriding, along with any relevant overriden methods. | |
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 OpenCLParamType | getOpenCLKernelParameterType (QualType PT) |
static void | checkIsValidOpenCLKernelParameter (Sema &S, Declarator &D, ParmVarDecl *Param, llvm::SmallPtrSetImpl< const Type * > &ValidTypes) |
static bool | ShouldWarnAboutMissingPrototype (const FunctionDecl *FD, const FunctionDecl *&PossibleZeroParamPrototype) |
static void | RebuildLambdaScopeInfo (CXXMethodDecl *CallOperator, Sema &S) |
static unsigned | getRedeclDiagFromTagKind (TagTypeKind Tag) |
Get diagnostic select index for tag kind for redeclaration diagnostic message. WARNING: Indexes apply to particular diagnostics only! | |
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) |
static ObjCIvarDecl::AccessControl | TranslateIvarVisibility (tok::ObjCKeywordKind ivarVisibility) |
static bool | isRepresentableIntegerValue (ASTContext &Context, llvm::APSInt &Value, QualType T) |
Determine whether the given integral value is representable within the given type T. | |
static QualType | getNextLargerIntegralType (ASTContext &Context, QualType T) |
static bool | ValidDuplicateEnum (EnumConstantDecl *ECD, EnumDecl *Enum) |
static DupKey | GetDupKey (const llvm::APSInt &Val) |
static void | CheckForDuplicateEnumValues (Sema &S, ArrayRef< Decl * > Elements, EnumDecl *Enum, QualType EnumType) |
static void | checkModuleImportContext (Sema &S, Module *M, SourceLocation ImportLoc, DeclContext *DC) |
Variables | |
X |
enum OpenCLParamType |
ValidKernelParam | |
PtrPtrKernelParam | |
PtrKernelParam | |
PrivatePtrKernelParam | |
InvalidKernelParam | |
RecordKernelParam |
Definition at line 6724 of file SemaDecl.cpp.
enum OverrideErrorKind |
Definition at line 6284 of file SemaDecl.cpp.
static bool AllowOverloadingOfFunction | ( | LookupResult & | Previous, |
ASTContext & | Context | ||
) | [static] |
Determine whether we allow overloading of the function PrevDecl with another declaration.
This routine determines whether overloading is possible, not whether some new function is actually an overload. It will return true in C++ (where we can always provide overloads) or, as an extension, in C when the previous function is already an overloaded function declaration or has the "overloadable" attribute.
Definition at line 1133 of file SemaDecl.cpp.
References clang::LookupResult::Found, clang::LookupResult::FoundOverloaded, clang::LookupResult::getFoundDecl(), clang::ASTContext::getLangOpts(), clang::LookupResult::getResultKind(), and clang::Decl::hasAttr().
Referenced by clang::Sema::CheckFunctionDeclaration().
static ParsedType buildNestedType | ( | Sema & | S, |
CXXScopeSpec & | SS, | ||
QualType | T, | ||
SourceLocation | NameLoc | ||
) | [static] |
Build a ParsedType for a simple-type-specifier with a nested-name-specifier.
Definition at line 676 of file SemaDecl.cpp.
References Builder, clang::Sema::Context, Context, clang::Sema::CreateParsedType(), clang::ETK_None, clang::Sema::getElaboratedType(), clang::TypeLocBuilder::getTypeSourceInfo(), clang::CXXScopeSpec::getWithLocInContext(), clang::TypeLocBuilder::push(), clang::TypeLocBuilder::pushTypeSpec(), clang::ElaboratedTypeLoc::setElaboratedKeywordLoc(), clang::TypeSpecTypeLoc::setNameLoc(), and clang::ElaboratedTypeLoc::setQualifierLoc().
Referenced by clang::Sema::ClassifyName().
static bool canRedefineFunction | ( | const FunctionDecl * | FD, |
const LangOptions & | LangOpts | ||
) | [static] |
canRedefineFunction - checks if a function can be redefined. Currently, only extern inline functions can be redefined, and even then only in GNU89 mode.
Definition at line 2432 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().
static bool CheckAnonMemberRedeclaration | ( | Sema & | SemaRef, |
Scope * | S, | ||
DeclContext * | Owner, | ||
DeclarationName | Name, | ||
SourceLocation | NameLoc, | ||
unsigned | diagnostic | ||
) | [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 3640 of file SemaDecl.cpp.
References clang::Sema::Diag(), clang::Sema::ForRedeclaration, clang::LookupResult::getAsSingle(), clang::Decl::getLocation(), clang::LookupResult::getRepresentativeDecl(), clang::NamedDecl::getUnderlyingDecl(), clang::Sema::isDeclInScope(), clang::Sema::LookupMemberName, and clang::Sema::LookupName().
Referenced by InjectAnonymousStructOrUnionMembers().
static void checkAttributesAfterMerging | ( | Sema & | S, |
NamedDecl & | ND | ||
) | [static] |
Definition at line 5074 of file SemaDecl.cpp.
References clang::Sema::Diag(), clang::Decl::dropAttr(), clang::Decl::getAttr(), clang::getDLLAttr(), clang::Attr::getLocation(), clang::Decl::getLocation(), clang::NamedDecl::isExternallyVisible(), clang::Sema::ParsingInitForAutoVars, and clang::Decl::setInvalidDecl().
Referenced by clang::Sema::ActOnFunctionDeclarator(), and clang::Sema::FinalizeDeclaration().
static void checkDLLAttributeRedeclaration | ( | Sema & | S, |
NamedDecl * | OldDecl, | ||
NamedDecl * | NewDecl, | ||
bool | IsSpecialization | ||
) | [static] |
Definition at line 5112 of file SemaDecl.cpp.
References clang::Sema::Context, clang::Sema::Diag(), clang::Decl::dropAttr(), clang::Decl::FOK_Declared, clang::Decl::getAttr(), clang::TargetInfo::getCXXABI(), clang::Decl::getLocation(), clang::ASTContext::getTargetInfo(), clang::NamedDecl::isCXXClassMember(), clang::Decl::isImplicit(), clang::Decl::isLocalExternDecl(), clang::TargetCXXABI::isMicrosoft(), clang::Decl::isUsed(), clang::Decl::setInvalidDecl(), and clang::FunctionDecl::TK_NonTemplate.
Referenced by clang::Sema::ActOnFunctionDeclarator(), and clang::Sema::ActOnVariableDeclarator().
static void checkDuplicateDefaultInit | ( | Sema & | S, |
CXXRecordDecl * | Parent, | ||
SourceLocation | DefaultInitLoc | ||
) | [static] |
Definition at line 3786 of file SemaDecl.cpp.
References clang::Sema::Diag(), findDefaultInitializer(), clang::CXXRecordDecl::hasInClassInitializer(), and clang::TagDecl::isUnion().
Referenced by clang::Sema::BuildAnonymousStructOrUnion(), checkDuplicateDefaultInit(), and clang::Sema::CheckFieldDecl().
static void checkDuplicateDefaultInit | ( | Sema & | S, |
CXXRecordDecl * | Parent, | ||
CXXRecordDecl * | AnonUnion | ||
) | [static] |
Definition at line 3795 of file SemaDecl.cpp.
References checkDuplicateDefaultInit(), findDefaultInitializer(), clang::CXXRecordDecl::hasInClassInitializer(), and clang::TagDecl::isUnion().
static bool checkForConflictWithNonVisibleExternC | ( | Sema & | S, |
const T * | ND, | ||
LookupResult & | Previous | ||
) | [static] |
Apply special rules for handling extern "C" declarations. Returns true
if we have found that this is a redeclaration of some prior entity.
Per C++ [dcl.link]p6: Two declarations [for a function or variable] with C language linkage with the same name that appear in different scopes refer to the same [entity]. An entity with C language linkage shall not be declared with the same name as an entity in global scope.
Definition at line 6039 of file SemaDecl.cpp.
References clang::LookupResult::addDecl(), checkGlobalOrExternCConflict(), clang::LookupResult::clear(), clang::Sema::findLocallyScopedExternCDecl(), clang::Sema::getLangOpts(), and isIncompleteDeclExternC().
Referenced by clang::Sema::CheckFunctionDeclaration(), and clang::Sema::CheckVariableDeclaration().
static void CheckForDuplicateEnumValues | ( | Sema & | S, |
ArrayRef< Decl * > | Elements, | ||
EnumDecl * | Enum, | ||
QualType | EnumType | ||
) | [static] |
Definition at line 13380 of file SemaDecl.cpp.
References clang::Sema::Diag(), clang::Sema::Diags, GetDupKey(), clang::NamedDecl::getIdentifier(), clang::EnumConstantDecl::getInitExpr(), clang::EnumConstantDecl::getInitVal(), clang::Decl::getLocation(), clang::EnumDecl::getNumNegativeBits(), clang::EnumDecl::getNumPositiveBits(), clang::DiagnosticsEngine::isIgnored(), and ValidDuplicateEnum().
Referenced by clang::Sema::ActOnEnumBody().
static bool checkGlobalOrExternCConflict | ( | Sema & | S, |
const T * | ND, | ||
bool | IsGlobal, | ||
LookupResult & | Previous | ||
) | [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 5956 of file SemaDecl.cpp.
References clang::LookupResult::addDecl(), clang::LookupResult::begin(), clang::LookupResult::clear(), clang::Sema::Context, clang::Sema::Diag(), clang::LookupResult::end(), clang::Sema::findLocallyScopedExternCDecl(), clang::Sema::getLangOpts(), clang::ASTContext::getTranslationUnitDecl(), isIncompleteDeclExternC(), and clang::DeclContext::lookup().
Referenced by checkForConflictWithNonVisibleExternC().
static void checkIsValidOpenCLKernelParameter | ( | Sema & | S, |
Declarator & | D, | ||
ParmVarDecl * | Param, | ||
llvm::SmallPtrSetImpl< const Type * > & | ValidTypes | ||
) | [static] |
Definition at line 6763 of file SemaDecl.cpp.
References clang::Type::castAs(), clang::Sema::Diag(), clang::NamedDecl::getDeclName(), clang::Decl::getLocation(), getOpenCLKernelParameterType(), clang::ValueDecl::getType(), clang::QualType::getTypePtr(), InvalidKernelParam, clang::Type::isPointerType(), clang::Type::isUnionType(), PrivatePtrKernelParam, PtrKernelParam, PtrPtrKernelParam, RecordKernelParam, clang::Declarator::setInvalidType(), and ValidKernelParam.
Referenced by clang::Sema::ActOnFunctionDeclarator().
static void checkModuleImportContext | ( | Sema & | S, |
Module * | M, | ||
SourceLocation | ImportLoc, | ||
DeclContext * | DC | ||
) | [static] |
Definition at line 13725 of file SemaDecl.cpp.
References clang::Sema::Diag(), clang::Module::getFullModuleName(), clang::DeclContext::getParent(), clang::Module::IsExternC, clang::LinkageSpecDecl::lang_c, and clang::LinkageSpecDecl::lang_cxx.
Referenced by clang::Sema::ActOnModuleImport(), and clang::Sema::ActOnModuleInclude().
static void checkNewAttributesAfterDef | ( | Sema & | S, |
Decl * | New, | ||
const Decl * | Old | ||
) | [static] |
checkNewAttributesAfterDef - If we already have a definition, check that there are no new attributes in this declaration.
Definition at line 2201 of file SemaDecl.cpp.
References clang::Sema::CheckForFunctionRedefinition(), clang::VarDecl::Definition, Diag(), clang::Sema::Diag(), clang::Decl::getAttrs(), clang::NamedDecl::getDeclName(), getDefinition(), clang::Attr::getKind(), clang::Attr::getLocation(), clang::Decl::getLocation(), clang::hasAttribute(), clang::Decl::hasAttrs(), clang::Decl::setInvalidDecl(), and clang::VarDecl::TentativeDefinition.
Referenced by clang::Sema::mergeDeclAttributes().
static void CheckPoppedLabel | ( | LabelDecl * | L, |
Sema & | S | ||
) | [static] |
Definition at line 1519 of file SemaDecl.cpp.
References clang::Sema::Diag(), clang::NamedDecl::getDeclName(), clang::Decl::getLocation(), clang::LabelDecl::getStmt(), clang::LabelDecl::isMSAsmLabel(), and clang::LabelDecl::isResolvedMSAsmLabel().
Referenced by clang::Sema::ActOnPopScope().
* static FixItHint createFriendTagNNSFixIt | ( | Sema & | SemaRef, |
NamedDecl * | ND, | ||
Scope * | S, | ||
SourceLocation | NameLoc | ||
) | [static] |
Definition at line 11071 of file SemaDecl.cpp.
References clang::FixItHint::CreateInsertion(), clang::Decl::getDeclContext(), clang::NamedDecl::getIdentifier(), clang::DeclContext::getParent(), clang::DeclContext::getRedeclContext(), clang::NamespaceDecl::isAnonymousNamespace(), clang::DeclContext::isTranslationUnit(), clang::Sema::LookupNestedNameSpecifierName, and clang::Sema::LookupSingleName().
Referenced by clang::Sema::ActOnTag().
static FunctionDecl* CreateNewFunctionDecl | ( | Sema & | SemaRef, |
Declarator & | D, | ||
DeclContext * | DC, | ||
QualType & | R, | ||
TypeSourceInfo * | TInfo, | ||
StorageClass | SC, | ||
bool & | IsVirtualOkay | ||
) | [static] |
Definition at line 6584 of file SemaDecl.cpp.
References clang::Sema::AbstractReturnType, clang::Sema::AdjustDestructorExceptionSpec(), clang::Sema::CheckConstructorDeclarator(), clang::Sema::CheckConversionDeclarator(), clang::Sema::CheckDestructorDeclarator(), clang::Sema::Context, clang::FunctionDecl::Create(), clang::CXXMethodDecl::Create(), clang::CXXConstructorDecl::Create(), clang::CXXDestructorDecl::Create(), clang::CXXConversionDecl::Create(), clang::Sema::CurContext, clang::DeclarationName::CXXConstructorName, clang::DeclarationName::CXXConversionFunctionName, clang::DeclarationName::CXXDestructorName, clang::Sema::Diag(), clang::EST_None, clang::Type::getAs(), clang::DeclarationName::getAsIdentifierInfo(), clang::Declarator::getDeclSpec(), clang::CXXRecordDecl::getDefinition(), clang::Declarator::getFunctionTypeInfo(), clang::Declarator::getIdentifierLoc(), clang::Sema::getLangOpts(), clang::Declarator::getLocStart(), clang::DeclarationNameInfo::getName(), clang::Sema::GetNameForDeclarator(), clang::DeclarationName::getNameKind(), clang::QualType::getTypePtr(), clang::DeclSpec::getTypeSpecTypeLoc(), clang::DeclaratorChunk::FunctionTypeInfo::hasPrototype, clang::TagDecl::isBeingDefined(), clang::DeclSpec::isConstexprSpecified(), clang::TagDecl::isDependentType(), clang::DeclSpec::isExplicitSpecified(), clang::Declarator::isFunctionDeclarator(), clang::Type::isFunctionProtoType(), clang::DeclSpec::isInlineSpecified(), clang::Declarator::isInvalidType(), clang::DeclContext::isRecord(), clang::CXXMethodDecl::isStatic(), Record, clang::Sema::RequireNonAbstractType(), clang::Decl::setInvalidDecl(), clang::Declarator::setInvalidType(), and clang::Decl::setLexicalDeclContext().
Referenced by clang::Sema::ActOnFunctionDeclarator().
static bool DeclHasAttr | ( | const Decl * | D, |
const Attr * | A | ||
) | [static] |
DeclhasAttr - returns true if decl Declaration already has the target attribute.
Definition at line 1986 of file SemaDecl.cpp.
References clang::Decl::attrs(), and clang::Attr::getKind().
Referenced by mergeDeclAttribute(), and mergeParamDeclAttributes().
static NamedDecl* DiagnoseInvalidRedeclaration | ( | Sema & | SemaRef, |
LookupResult & | Previous, | ||
FunctionDecl * | NewFD, | ||
ActOnFDArgs & | ExtraArgs, | ||
bool | IsLocalFriend, | ||
Scope * | S | ||
) | [static] |
Generate diagnostics for an invalid function redeclaration.
This routine handles generating the diagnostic messages for an invalid function redeclaration, including finding possible similar declarations or performing typo correction if there are no previous declarations with the same name.
Returns a NamedDecl iff typo correction was performed and substituting in the new declaration name does not cause new errors.
Definition at line 6409 of file SemaDecl.cpp.
References clang::Sema::ActOnFunctionDeclarator(), clang::LookupResult::addDecl(), clang::TypoCorrection::begin(), clang::LookupResult::begin(), clang::LookupResult::clear(), clang::Sema::Context, clang::Sema::CorrectTypo(), clang::Sema::CTK_ErrorRecovery, clang::Sema::Diag(), clang::Sema::diagnoseTypo(), clang::TypoCorrection::end(), clang::LookupResult::end(), clang::Sema::ForRedeclaration, Func, clang::DeclarationName::getAsIdentifierInfo(), clang::Decl::getCanonicalDecl(), clang::TypoCorrection::getCorrection(), clang::TypoCorrection::getCorrectionAsIdentifierInfo(), clang::TypoCorrection::getCorrectionDecl(), clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::SourceRange::getEnd(), clang::Decl::getLocation(), clang::FunctionDecl::getParamDecl(), clang::DeclContext::getParent(), clang::FunctionDecl::getSourceRange(), clang::ValueDecl::getType(), clang::DeclaratorDecl::getTypeSourceInfo(), clang::DeclaratorDecl::getTypeSpecStartLoc(), clang::FunctionDecl::hasBody(), clang::Sema::SFINAETrap::hasErrorOccurred(), hasSimilarParameters(), clang::CXXMethodDecl::isConst(), clang::SourceLocation::isInvalid(), clang::Sema::LookupLocalFriendName, clang::Sema::LookupName(), clang::Sema::LookupOrdinaryName, clang::Sema::LookupQualifiedName(), clang::Sema::PDiag(), Previous, S, clang::TypoCorrection::setCorrectionDecl(), clang::Decl::setInvalidDecl(), and clang::LookupResult::setLookupName().
Referenced by clang::Sema::ActOnFunctionDeclarator().
static void filterNonConflictingPreviousDecls | ( | ASTContext & | context, |
NamedDecl * | decl, | ||
LookupResult & | previous | ||
) | [static] |
Filter out any previous declarations that the given declaration should not consider because they are not permitted to conflict, e.g., because they come from hidden sub-modules and do not refer to the same entity.
Definition at line 1747 of file SemaDecl.cpp.
References clang::LookupResult::Filter::done(), clang::LookupResult::empty(), clang::LookupResult::Filter::erase(), clang::ASTContext::getLangOpts(), clang::LookupResult::Filter::hasNext(), clang::NamedDecl::isExternallyVisible(), clang::NamedDecl::isHidden(), clang::LookupResult::makeFilter(), and clang::LookupResult::Filter::next().
Referenced by clang::Sema::CheckFunctionDeclaration(), and clang::Sema::CheckVariableDeclaration().
static void filterNonConflictingPreviousTypedefDecls | ( | ASTContext & | Context, |
TypedefNameDecl * | Decl, | ||
LookupResult & | Previous | ||
) | [static] |
Typedef declarations don't have linkage, but they still denote the same entity if their types are the same. FIXME: This is notionally doing the same thing as ASTReaderDecl's isSameEntity.
Definition at line 1777 of file SemaDecl.cpp.
References clang::LookupResult::Filter::done(), clang::LookupResult::empty(), clang::LookupResult::Filter::erase(), clang::ASTContext::getLangOpts(), clang::TypedefNameDecl::getUnderlyingType(), clang::LookupResult::Filter::hasNext(), clang::ASTContext::hasSameType(), clang::NamedDecl::isExternallyVisible(), clang::NamedDecl::isHidden(), clang::LookupResult::makeFilter(), and clang::LookupResult::Filter::next().
Referenced by clang::Sema::ActOnTypedefNameDecl().
static SourceLocation findDefaultInitializer | ( | const CXXRecordDecl * | Record | ) | [static] |
Definition at line 3772 of file SemaDecl.cpp.
References clang::DeclContext::decls(), clang::Decl::getLocation(), and clang::CXXRecordDecl::hasInClassInitializer().
Referenced by checkDuplicateDefaultInit().
static bool FindOverriddenMethod | ( | const CXXBaseSpecifier * | Specifier, |
CXXBasePath & | Path, | ||
void * | UserData | ||
) | [static] |
Member lookup function that determines whether a given C++ method overrides a method in a base class, to be used with CXXRecordDecl::lookupInBases().
Definition at line 6251 of file SemaDecl.cpp.
References clang::Sema::Context, clang::DeclarationName::CXXDestructorName, clang::ASTContext::DeclarationNames, clang::CXXBasePath::Decls, clang::Type::getAs(), clang::ASTContext::getCanonicalType(), clang::DeclarationNameTable::getCXXDestructorName(), clang::NamedDecl::getDeclName(), clang::DeclarationName::getNameKind(), clang::CXXBaseSpecifier::getType(), clang::ASTContext::getTypeDeclType(), clang::Sema::IsOverload(), clang::DeclContext::lookup(), FindOverriddenMethodData::Method, and FindOverriddenMethodData::S.
Referenced by clang::Sema::AddOverriddenMethods().
static void FixInvalidVariablyModifiedTypeLoc | ( | TypeLoc | SrcTL, |
TypeLoc | DstTL | ||
) | [static] |
Definition at line 4754 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::initializeFullCopy(), clang::ParenTypeLoc::setLParenLoc(), clang::ParenTypeLoc::setRParenLoc(), and clang::PointerTypeLoc::setStarLoc().
Referenced by TryToFixInvalidVariablyModifiedTypeSourceInfo().
static void GenerateFixForUnusedDecl | ( | const NamedDecl * | D, |
ASTContext & | Ctx, | ||
FixItHint & | Hint | ||
) | [static] |
Definition at line 1467 of file SemaDecl.cpp.
References clang::FixItHint::CreateRemoval(), clang::Lexer::findLocationAfterToken(), clang::ASTContext::getLangOpts(), clang::Decl::getLocEnd(), clang::Decl::getLocStart(), clang::ASTContext::getSourceManager(), and clang::SourceLocation::isInvalid().
Referenced by clang::Sema::DiagnoseUnusedDecl().
static QualType getCoreType | ( | QualType | Ty | ) | [static] |
Definition at line 4222 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().
static const Decl* getDefinition | ( | const Decl * | D | ) | [static] |
Definition at line 2175 of file SemaDecl.cpp.
References clang::VarDecl::getActingDefinition(), and clang::VarDecl::getDefinition().
Referenced by checkNewAttributesAfterDef(), clang::VarDecl::getDefinition(), clang::EnumDecl::getDefinition(), clang::RecordDecl::getDefinition(), and clang::MacroExpansion::getName().
Definition at line 13361 of file SemaDecl.cpp.
Referenced by CheckForDuplicateEnumValues().
static StorageClass getFunctionStorageClass | ( | Sema & | SemaRef, |
Declarator & | D | ||
) | [static] |
Definition at line 6549 of file SemaDecl.cpp.
References clang::Sema::CurContext, clang::Sema::Diag(), clang::Declarator::getDeclSpec(), 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 StringRef getHeaderName | ( | ASTContext::GetBuiltinTypeError | Error | ) | [static] |
Definition at line 1652 of file SemaDecl.cpp.
References clang::ASTContext::GE_Missing_setjmp, clang::ASTContext::GE_Missing_stdio, clang::ASTContext::GE_Missing_ucontext, and clang::ASTContext::GE_None.
Referenced by clang::Sema::LazilyCreateBuiltin().
static QualType getNextLargerIntegralType | ( | ASTContext & | Context, |
QualType | T | ||
) | [static] |
Definition at line 13052 of file SemaDecl.cpp.
References clang::ASTContext::getTypeSize(), clang::ASTContext::IntTy, clang::Type::isIntegralType(), clang::Type::isSignedIntegerOrEnumerationType(), clang::ASTContext::LongLongTy, clang::ASTContext::LongTy, clang::ASTContext::ShortTy, clang::ASTContext::UnsignedIntTy, clang::ASTContext::UnsignedLongLongTy, clang::ASTContext::UnsignedLongTy, and clang::ASTContext::UnsignedShortTy.
static std::pair<diag::kind, SourceLocation> getNoteDiagForInvalidRedeclaration | ( | const T * | Old, |
const T * | New | ||
) | [static] |
Definition at line 2415 of file SemaDecl.cpp.
References clang::SourceLocation::isInvalid().
Referenced by clang::Sema::MergeFunctionDecl(), and clang::Sema::MergeVarDecl().
static OpenCLParamType getOpenCLKernelParameterType | ( | QualType | PT | ) | [static] |
Definition at line 6733 of file SemaDecl.cpp.
References clang::QualType::getAddressSpace(), clang::Type::getPointeeType(), InvalidKernelParam, clang::Type::isBooleanType(), clang::Type::isEventT(), clang::Type::isHalfType(), clang::Type::isImageType(), clang::Type::isPointerType(), clang::Type::isRecordType(), PrivatePtrKernelParam, PtrKernelParam, PtrPtrKernelParam, RecordKernelParam, and ValidKernelParam.
Referenced by checkIsValidOpenCLKernelParameter().
static unsigned getRedeclDiagFromTagKind | ( | TagTypeKind | Tag | ) | [static] |
Get diagnostic select index for tag kind for redeclaration diagnostic message. WARNING: Indexes apply to particular diagnostics only!
Definition at line 10950 of file SemaDecl.cpp.
References clang::TTK_Class, clang::TTK_Interface, and clang::TTK_Struct.
Referenced by clang::Sema::isAcceptableTagRedeclaration().
static void HandleTagNumbering | ( | Sema & | S, |
const TagDecl * | Tag, | ||
Scope * | TagScope | ||
) | [static] |
Definition at line 3363 of file SemaDecl.cpp.
References clang::Sema::Context, clang::Sema::getCurrentMangleNumberContext(), clang::Decl::getDeclContext(), clang::ASTContext::getLangOpts(), clang::MangleNumberingContext::getManglingNumber(), clang::ASTContext::getManglingNumberContext(), clang::Scope::getMSLocalManglingNumber(), clang::NamedDecl::getName(), clang::DeclContext::getParent(), clang::TagDecl::getTypedefNameForAnonDecl(), and clang::ASTContext::setManglingNumber().
Referenced by clang::Sema::FinalizeDeclaratorGroup(), and clang::Sema::ParsedFreeStandingDeclSpec().
static bool hasAttribute | ( | const Decl * | D, |
attr::Kind | Kind | ||
) | [static] |
Definition at line 2192 of file SemaDecl.cpp.
References clang::Decl::attrs().
static bool hasParsedAttr | ( | Scope * | S, |
const AttributeList * | AttrList, | ||
AttributeList::Kind | Kind | ||
) | [static] |
Definition at line 5278 of file SemaDecl.cpp.
References clang::AttributeList::getNext().
Referenced by clang::Sema::ActOnVariableDeclarator(), and hasParsedAttr().
static bool hasParsedAttr | ( | Scope * | S, |
const Declarator & | PD, | ||
AttributeList::Kind | Kind | ||
) | [static] |
Definition at line 5286 of file SemaDecl.cpp.
References clang::DeclSpec::getAttributes(), clang::Declarator::getAttributes(), clang::DeclaratorChunk::getAttrs(), clang::Declarator::getDeclSpec(), clang::ParsedAttributes::getList(), clang::Declarator::getNumTypeObjects(), clang::Declarator::getTypeObject(), and hasParsedAttr().
static bool hasSimilarParameters | ( | ASTContext & | Context, |
FunctionDecl * | Declaration, | ||
FunctionDecl * | Definition, | ||
SmallVectorImpl< unsigned > & | Params | ||
) | [static] |
hasSimilarParameters - Determine whether the C++ functions Declaration and Definition have "nearly" matching parameters. This heuristic is used to improve diagnostics in the case where an out-of-line function definition doesn't match any declaration within the class or namespace. Also sets Params to the list of indices to the parameters that differ between the declaration and the definition. If hasSimilarParameters returns true and Params is empty, then all of the parameters match.
Definition at line 4240 of file SemaDecl.cpp.
References clang::QualType::getBaseTypeIdentifier(), getCoreType(), clang::FunctionDecl::getParamDecl(), clang::ValueDecl::getType(), clang::ASTContext::hasSameType(), clang::ASTContext::hasSameUnqualifiedType(), and clang::FunctionDecl::param_size().
Referenced by DiagnoseInvalidRedeclaration().
static bool haveIncompatibleLanguageLinkages | ( | const T * | Old, |
const T * | New | ||
) | [static] |
Definition at line 2448 of file SemaDecl.cpp.
References clang::CLanguageLinkage, clang::CXXLanguageLinkage, and clang::DeclContext::isRecord().
Referenced by clang::Sema::MergeFunctionDecl(), and clang::Sema::MergeVarDecl().
static bool InjectAnonymousStructOrUnionMembers | ( | Sema & | SemaRef, |
Scope * | S, | ||
DeclContext * | Owner, | ||
RecordDecl * | AnonRecord, | ||
AccessSpecifier | AS, | ||
SmallVectorImpl< NamedDecl * > & | Chaining, | ||
bool | MSAnonStruct | ||
) | [static] |
InjectAnonymousStructOrUnionMembers - Inject the members of the anonymous struct or union AnonRecord into the owning context Owner and scope S. This routine will be invoked just after we realize that an unnamed union or struct is actually an anonymous union or struct, e.g.,
union { int i; float f; }; // InjectAnonymousStructOrUnionMembers called here to inject i and // f into the surrounding scope.x
This routine is recursive, injecting the names of nested anonymous structs/unions into the owning context and scope as well.
Definition at line 3682 of file SemaDecl.cpp.
References clang::Decl::addAttr(), clang::AS_none, clang::Decl::attrs(), 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::TagDecl::isUnion(), clang::Sema::PushOnScopeChains(), clang::Decl::setAccess(), and clang::Decl::setImplicit().
Referenced by clang::Sema::BuildAnonymousStructOrUnion(), and clang::Sema::BuildMicrosoftCAnonymousStruct().
static bool isAttributeTargetADefinition | ( | Decl * | D | ) | [static] |
Definition at line 2005 of file SemaDecl.cpp.
Referenced by mergeAlignedAttrs().
static bool isClassCompatTagKind | ( | TagTypeKind | Tag | ) | [static] |
Determine if tag kind is a class-key compatible with class for redeclaration (class, struct, or __interface).
Definition at line 10963 of file SemaDecl.cpp.
References clang::TTK_Class, clang::TTK_Interface, and clang::TTK_Struct.
Referenced by clang::Sema::isAcceptableTagRedeclaration().
static bool IsDisallowedCopyOrAssign | ( | const CXXMethodDecl * | D | ) | [static] |
Check for this common pattern:
Definition at line 1275 of file SemaDecl.cpp.
References clang::FunctionDecl::doesThisDeclarationHaveABody().
Referenced by clang::Sema::ShouldWarnIfUnusedFileScopedDecl().
static bool isFunctionDefinitionDiscarded | ( | Sema & | S, |
FunctionDecl * | FD | ||
) | [static] |
Given that we are within the definition of the given function, will that definition behave like C99's 'inline', where the definition is discarded except for optimization purposes?
Definition at line 5202 of file SemaDecl.cpp.
References clang::Sema::Context, clang::ASTContext::GetGVALinkageForFunction(), clang::Sema::getLangOpts(), clang::GVA_AvailableExternally, clang::Decl::hasAttr(), clang::FunctionDecl::isInlined(), and clang::FunctionDecl::setLazyBody().
Referenced by clang::Sema::ActOnVariableDeclarator().
static bool isIncompleteDeclExternC | ( | Sema & | S, |
const T * | D | ||
) | [static] |
Determine whether a variable is extern "C" prior to attaching an initializer. We can't just call isExternC() here, because that will also compute and cache whether the declaration is externally visible, which might change when we attach the initializer.
This can only be used if the declaration is known to not be a redeclaration of an internal linkage declaration.
For instance:
auto x = []{};
Attaching the initializer here makes this declaration not externally visible, because its type has internal linkage.
FIXME: This is a hack.
Definition at line 5249 of file SemaDecl.cpp.
References clang::Sema::getLangOpts().
Referenced by clang::Sema::ActOnFunctionDeclarator(), clang::Sema::ActOnVariableDeclarator(), checkForConflictWithNonVisibleExternC(), and checkGlobalOrExternCConflict().
static bool isMainFileLoc | ( | const Sema & | S, |
SourceLocation | Loc | ||
) | [static] |
Definition at line 1315 of file SemaDecl.cpp.
References clang::SourceManager::isInMainFile(), clang::Sema::SourceMgr, clang::TU_Complete, and clang::Sema::TUKind.
Referenced by clang::Sema::ShouldWarnIfUnusedFileScopedDecl().
static bool isOutOfScopePreviousDeclaration | ( | NamedDecl * | PrevDecl, |
DeclContext * | DC, | ||
ASTContext & | Context | ||
) | [static] |
Determines whether the given declaration is an out-of-scope previous declaration.
This routine should be invoked when name lookup has found a previous declaration (PrevDecl) that is not in the scope where a new declaration by the same name is being introduced. If the new declaration occurs in a local scope, previous declarations with linkage may still be considered previous declarations (C99 6.2.2p4-5, C++ [basic.link]p6).
PrevDecl | the previous declaration found by name lookup |
DC | the context in which the new declaration is being declared. |
Definition at line 4985 of file SemaDecl.cpp.
References clang::DeclContext::Equals(), clang::Decl::getDeclContext(), clang::DeclContext::getEnclosingNamespaceContext(), clang::ASTContext::getLangOpts(), clang::DeclContext::getRedeclContext(), clang::NamedDecl::hasLinkage(), clang::DeclContext::isFunctionOrMethod(), and clang::DeclContext::isRecord().
Referenced by clang::Sema::FilterLookupForScope().
static bool isRepresentableIntegerValue | ( | ASTContext & | Context, |
llvm::APSInt & | Value, | ||
QualType | T | ||
) | [static] |
Determine whether the given integral value is representable within the given type T.
Definition at line 13036 of file SemaDecl.cpp.
References clang::ASTContext::getIntWidth(), clang::Type::isIntegralType(), and clang::Type::isSignedIntegerOrEnumerationType().
Referenced by clang::Sema::ActOnEnumBody(), and clang::Sema::CheckEnumConstant().
static bool isResultTypeOrTemplate | ( | LookupResult & | R, |
const Token & | NextToken | ||
) | [static] |
Determine whether the given result set contains either a type name or.
Definition at line 611 of file SemaDecl.cpp.
References clang::LookupResult::begin(), clang::LookupResult::end(), clang::Sema::getLangOpts(), clang::LookupResult::getSema(), and clang::Token::is().
Referenced by clang::Sema::ClassifyName().
static bool isTagTypeWithMissingTag | ( | Sema & | SemaRef, |
LookupResult & | Result, | ||
Scope * | S, | ||
CXXScopeSpec & | SS, | ||
IdentifierInfo *& | Name, | ||
SourceLocation | NameLoc | ||
) | [static] |
Definition at line 626 of file SemaDecl.cpp.
References clang::LookupResult::begin(), clang::LookupResult::clear(), clang::FixItHint::CreateInsertion(), clang::Sema::Diag(), clang::LookupResult::end(), clang::LookupResult::getAsSingle(), clang::Sema::getLangOpts(), clang::Sema::LookupParsedName(), clang::Sema::LookupTagName, clang::TTK_Class, clang::TTK_Enum, clang::TTK_Interface, clang::TTK_Struct, and clang::TTK_Union.
Referenced by clang::Sema::ClassifyName().
static bool isUsingDecl | ( | NamedDecl * | D | ) | [static] |
Definition at line 1252 of file SemaDecl.cpp.
Referenced by RemoveUsingDecls().
static void LookupPredefedObjCSuperType | ( | Sema & | ThisSema, |
Scope * | S, | ||
IdentifierInfo * | II | ||
) | [static] |
Looks up the declaration of "struct objc_super" and saves it for later use in building builtin declaration of objc_msgSendSuper and objc_msgSendSuper_stret. If no such pre-existing declaration exists no action takes place.
Definition at line 1638 of file SemaDecl.cpp.
References clang::Sema::Context, Context, clang::LookupResult::Found, clang::IdentifierTable::get(), clang::ASTContext::getTagDeclType(), clang::ASTContext::Idents, clang::IdentifierInfo::isStr(), clang::Sema::LookupName(), clang::Sema::LookupTagName, and clang::ASTContext::setObjCSuperType().
Referenced by clang::Sema::CheckFunctionDeclaration(), and clang::Sema::LazilyCreateBuiltin().
static bool mergeAlignedAttrs | ( | Sema & | S, |
NamedDecl * | New, | ||
Decl * | Old | ||
) | [static] |
Merge alignment attributes from Old
to New
, taking into account the special semantics of C11's _Alignas specifier and C++11's alignas attribute.
true
if any attributes were added to New
. Definition at line 2017 of file SemaDecl.cpp.
References clang::Decl::addAttr(), clang::Sema::Context, clang::Sema::Diag(), clang::Decl::getLocation(), clang::CharUnits::getQuantity(), clang::ASTContext::getTagDeclType(), clang::ASTContext::getTypeAlign(), isAttributeTargetADefinition(), clang::Decl::specific_attrs(), and clang::ASTContext::toCharUnitsFromBits().
Referenced by clang::Sema::mergeDeclAttributes().
static bool mergeDeclAttribute | ( | Sema & | S, |
NamedDecl * | D, | ||
const InheritableAttr * | Attr, | ||
bool | Override | ||
) | [static] |
Definition at line 2124 of file SemaDecl.cpp.
References clang::Decl::addAttr(), clang::Attr::clone(), clang::Sema::Context, DeclHasAttr(), clang::Attr::duplicatesAllowed(), clang::NamedDecl::getName(), clang::Attr::getSpellingListIndex(), clang::NamedDecl::getVisibility(), clang::Sema::mergeAvailabilityAttr(), clang::Sema::mergeDLLExportAttr(), clang::Sema::mergeDLLImportAttr(), clang::Sema::mergeFormatAttr(), clang::Sema::mergeMSInheritanceAttr(), clang::Sema::mergeSectionAttr(), clang::Sema::mergeTypeVisibilityAttr(), clang::Sema::mergeVisibilityAttr(), and clang::InheritableAttr::setInherited().
Referenced by clang::Sema::mergeDeclAttributes().
static void mergeParamDeclAttributes | ( | ParmVarDecl * | newDecl, |
const ParmVarDecl * | oldDecl, | ||
Sema & | S | ||
) | [static] |
mergeParamDeclAttributes - Copy attributes from the old parameter to the new one.
Definition at line 2334 of file SemaDecl.cpp.
References clang::Decl::addAttr(), clang::Sema::Context, DeclHasAttr(), clang::Sema::Diag(), clang::Decl::dropAttrs(), clang::Decl::getAttr(), clang::Decl::getDeclContext(), clang::ParmVarDecl::getFunctionScopeIndex(), clang::Decl::getLocation(), clang::FunctionDecl::getParamDecl(), clang::Decl::hasAttr(), clang::Decl::hasAttrs(), clang::Decl::setAttrs(), clang::InheritableAttr::setInherited(), and clang::Decl::specific_attrs().
Referenced by clang::Sema::MergeCompatibleFunctionDecls(), and clang::Sema::mergeObjCMethodDecls().
static bool mergeTypeWithPrevious | ( | Sema & | S, |
VarDecl * | NewVD, | ||
VarDecl * | OldVD, | ||
LookupResult & | Previous | ||
) | [static] |
Definition at line 3138 of file SemaDecl.cpp.
References clang::Sema::getLangOpts(), clang::Decl::getLexicalDeclContext(), clang::DeclContext::isFunctionOrMethod(), clang::VarDecl::isPreviousDeclInSameBlockScope(), and clang::LookupResult::isShadowed().
Referenced by clang::Sema::MergeVarDecl().
static bool RebuildDeclaratorInCurrentInstantiation | ( | Sema & | S, |
Declarator & | D, | ||
DeclarationName | Name | ||
) | [static] |
NeedsRebuildingInCurrentInstantiation - 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 4275 of file SemaDecl.cpp.
References clang::Sema::Context, clang::Sema::CreateParsedType(), clang::ActionResult< PtrTy, CompressInvalid >::get(), 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::Type::isDependentType(), clang::ActionResult< PtrTy, CompressInvalid >::isInvalid(), clang::QualType::isNull(), clang::DeclaratorChunk::Kind, clang::DeclaratorChunk::Mem, clang::DeclaratorChunk::MemberPointer, clang::Sema::RebuildExprInCurrentInstantiation(), clang::Sema::RebuildNestedNameSpecifierInCurrentInstantiation(), clang::Sema::RebuildTypeInCurrentInstantiation(), clang::DeclaratorChunk::MemberPointerTypeInfo::Scope(), clang::DeclSpec::TST_atomic, clang::DeclSpec::TST_decltype, clang::DeclSpec::TST_typename, clang::DeclSpec::TST_typeofExpr, clang::DeclSpec::TST_typeofType, clang::DeclSpec::TST_underlyingType, clang::DeclSpec::UpdateExprRep(), and clang::DeclSpec::UpdateTypeRep().
Referenced by clang::Sema::HandleDeclarator().
static void RebuildLambdaScopeInfo | ( | CXXMethodDecl * | CallOperator, |
Sema & | S | ||
) | [static] |
Definition at line 10130 of file SemaDecl.cpp.
References clang::sema::CapturingScopeInfo::addCapture(), clang::sema::CapturingScopeInfo::addThisCapture(), clang::sema::CapturingScopeInfo::addVLATypeCapture(), AttributeLangSupport::C, clang::sema::LambdaScopeInfo::CallOperator, clang::CXXRecordDecl::captures(), clang::Sema::CurrentInstantiationScope, clang::Sema::getCurrentThisType(), clang::DeclarationNameInfo::getCXXOperatorNameRange(), clang::CXXRecordDecl::getLambdaCaptureDefault(), clang::FunctionDecl::getNameInfo(), clang::CXXMethodDecl::getParent(), clang::FunctionDecl::getReturnType(), clang::ValueDecl::getType(), clang::sema::CapturingScopeInfo::ImpCap_LambdaByref, clang::sema::CapturingScopeInfo::ImpCap_LambdaByval, clang::sema::CapturingScopeInfo::ImpCap_None, clang::sema::CapturingScopeInfo::ImpCaptureStyle, clang::LocalInstantiationScope::InstantiatedLocal(), clang::sema::LambdaScopeInfo::IntroducerRange, clang::CXXMethodDecl::isConst(), clang::VarDecl::isInitCapture(), clang::sema::LambdaScopeInfo::Lambda, clang::LCD_ByCopy, clang::LCD_ByRef, clang::LCD_None, clang::LCK_ByRef, clang::sema::LambdaScopeInfo::Mutable, clang::Sema::PushLambdaScope(), and clang::sema::CapturingScopeInfo::ReturnType.
Referenced by clang::Sema::ActOnStartOfFunctionDef().
static ParsedType recoverFromTypeInKnownDependentBase | ( | Sema & | S, |
const IdentifierInfo & | II, | ||
SourceLocation | NameLoc | ||
) | [static] |
Definition at line 131 of file SemaDecl.cpp.
References clang::CXXRecordDecl::bases(), Builder, clang::Sema::Context, Context, clang::NestedNameSpecifier::Create(), clang::Sema::CreateParsedType(), clang::Sema::CurContext, clang::Sema::Diag(), clang::ETK_Typename, clang::TemplateName::getAsTemplateDecl(), clang::ASTContext::getDependentNameType(), clang::CXXRecordDecl::getDescribedClassTemplate(), clang::DeclContext::getParent(), clang::ASTContext::getRecordType(), clang::TemplateSpecializationType::getTemplateName(), clang::TypeLocBuilder::getTypeSourceInfo(), clang::CXXScopeSpec::getWithLocInContext(), clang::CXXScopeSpec::MakeTrivial(), clang::TypeLocBuilder::push(), clang::DependentNameTypeLoc::setElaboratedKeywordLoc(), clang::DependentNameTypeLoc::setNameLoc(), and clang::DependentNameTypeLoc::setQualifierLoc().
Referenced by clang::Sema::ClassifyName(), and clang::Sema::getTypeName().
static void RemoveUsingDecls | ( | LookupResult & | R | ) | [static] |
Removes using shadow declarations from the lookup results.
Definition at line 1259 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().
Referenced by clang::Sema::HandleDeclarator().
static void ReportOverrides | ( | Sema & | S, |
unsigned | DiagID, | ||
const CXXMethodDecl * | MD, | ||
OverrideErrorKind | OEK = OEK_All |
||
) | [static] |
Report an error regarding overriding, along with any relevant overriden methods.
DiagID | the primary error to report. |
MD | the overriding method. |
OEK | which overrides to include as notes. |
Definition at line 6292 of file SemaDecl.cpp.
References clang::CXXMethodDecl::begin_overridden_methods(), clang::Sema::Diag(), clang::CXXMethodDecl::end_overridden_methods(), clang::NamedDecl::getDeclName(), and clang::Decl::getLocation().
Referenced by clang::Sema::AddOverriddenMethods(), and clang::Sema::CheckFunctionDeclaration().
static void SetNestedNameSpecifier | ( | DeclaratorDecl * | DD, |
Declarator & | D | ||
) | [static] |
Definition at line 5024 of file SemaDecl.cpp.
References clang::Decl::getASTContext(), clang::Declarator::getCXXScopeSpec(), clang::CXXScopeSpec::getWithLocInContext(), clang::CXXScopeSpec::isSet(), and clang::DeclaratorDecl::setQualifierInfo().
Referenced by clang::Sema::ActOnFunctionDeclarator(), and clang::Sema::ActOnVariableDeclarator().
static bool shouldConsiderLinkage | ( | const VarDecl * | VD | ) | [static] |
Definition at line 5258 of file SemaDecl.cpp.
References clang::Decl::getDeclContext(), clang::DeclContext::getRedeclContext(), clang::VarDecl::hasExternalStorage(), clang::DeclContext::isFileContext(), clang::DeclContext::isFunctionOrMethod(), and clang::DeclContext::isRecord().
Referenced by clang::Sema::ActOnFunctionDeclarator(), and clang::Sema::ActOnVariableDeclarator().
static bool shouldConsiderLinkage | ( | const FunctionDecl * | FD | ) | [static] |
Definition at line 5269 of file SemaDecl.cpp.
References clang::Decl::getDeclContext(), clang::DeclContext::getRedeclContext(), clang::DeclContext::isFileContext(), clang::DeclContext::isFunctionOrMethod(), and clang::DeclContext::isRecord().
static bool ShouldDiagnoseUnusedDecl | ( | const NamedDecl * | D | ) | [static] |
Definition at line 1392 of file SemaDecl.cpp.
References clang::Type::getAs(), clang::CXXConstructExpr::getConstructor(), clang::Decl::getDeclContext(), clang::Decl::hasAttr(), clang::Type::isDependentType(), clang::CXXConstructExpr::isElidable(), clang::DeclContext::isFunctionOrMethod(), clang::Type::isIncompleteType(), clang::Decl::isInvalidDecl(), clang::Decl::isReferenced(), clang::FunctionDecl::isTrivial(), and clang::Decl::isUsed().
Referenced by clang::Sema::DiagnoseUnusedDecl().
static bool ShouldWarnAboutMissingPrototype | ( | const FunctionDecl * | FD, |
const FunctionDecl *& | PossibleZeroParamPrototype | ||
) | [static] |
Definition at line 10054 of file SemaDecl.cpp.
References clang::FunctionDecl::getDescribedFunctionTemplate(), clang::FunctionDecl::getNumParams(), clang::Redeclarable< decl_type >::getPreviousDecl(), clang::Decl::hasAttr(), clang::FunctionDecl::isFunctionTemplateSpecialization(), clang::FunctionDecl::isGlobal(), clang::FunctionDecl::isInlined(), clang::Decl::isInvalidDecl(), and clang::FunctionDecl::isMain().
Referenced by clang::Sema::ActOnStartOfFunctionDef().
static StorageClass StorageClassSpecToVarDeclStorageClass | ( | const DeclSpec & | DS | ) | [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 3751 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(), and clang::Sema::BuildAnonymousStructOrUnion().
static NestedNameSpecifier* synthesizeCurrentNestedNameSpecifier | ( | ASTContext & | Context, |
DeclContext * | DC | ||
) | [static] |
Definition at line 419 of file SemaDecl.cpp.
References clang::NestedNameSpecifier::Create(), clang::DeclContext::getLookupParent(), clang::DeclContext::getPrimaryContext(), and clang::NestedNameSpecifier::GlobalSpecifier().
Referenced by clang::Sema::ActOnDelayedDefaultTemplateArg().
static ObjCIvarDecl::AccessControl TranslateIvarVisibility | ( | tok::ObjCKeywordKind | ivarVisibility | ) | [static] |
TranslateIvarVisibility - Translate visibility from a token ID to an AST enum value.
Definition at line 12460 of file SemaDecl.cpp.
References clang::ObjCIvarDecl::Package, clang::ObjCIvarDecl::Private, clang::ObjCIvarDecl::Protected, and clang::ObjCIvarDecl::Public.
Referenced by clang::Sema::ActOnIvar().
static QualType TryToFixInvalidVariablyModifiedType | ( | QualType | T, |
ASTContext & | Context, | ||
bool & | SizeIsNegative, | ||
llvm::APSInt & | Oversized | ||
) | [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 4686 of file SemaDecl.cpp.
References clang::QualifierCollector::apply(), clang::Expr::EvaluateAsInt(), clang::ASTContext::getConstantArrayType(), clang::ArrayType::getElementType(), clang::ConstantArrayType::getMaxSizeBits(), clang::ConstantArrayType::getNumAddressingBits(), clang::ASTContext::getParenType(), clang::Type::getPointeeType(), clang::ASTContext::getPointerType(), clang::VariableArrayType::getSizeExpr(), clang::Type::isDependentType(), clang::QualType::isNull(), clang::Type::isVariablyModifiedType(), clang::ArrayType::Normal, and clang::QualifierCollector::strip().
Referenced by TryToFixInvalidVariablyModifiedTypeSourceInfo().
static TypeSourceInfo* TryToFixInvalidVariablyModifiedTypeSourceInfo | ( | TypeSourceInfo * | TInfo, |
ASTContext & | Context, | ||
bool & | SizeIsNegative, | ||
llvm::APSInt & | Oversized | ||
) | [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 4784 of file SemaDecl.cpp.
References Context, FixInvalidVariablyModifiedTypeLoc(), clang::ASTContext::getTrivialTypeSourceInfo(), clang::TypeSourceInfo::getType(), clang::TypeSourceInfo::getTypeLoc(), clang::QualType::isNull(), and TryToFixInvalidVariablyModifiedType().
Referenced by clang::Sema::CheckFieldDecl(), clang::Sema::CheckTypedefForVariablyModifiedType(), and clang::Sema::CheckVariableDeclarationType().
static bool ValidDuplicateEnum | ( | EnumConstantDecl * | ECD, |
EnumDecl * | Enum | ||
) | [static] |
Definition at line 13320 of file SemaDecl.cpp.
References clang::TagDecl::castFromDeclContext(), clang::DeclRefExpr::getDecl(), clang::Decl::getDeclContext(), clang::EnumConstantDecl::getInitExpr(), clang::APIntStorage::getValue(), and clang::Expr::IgnoreImpCasts().
Referenced by CheckForDuplicateEnumValues().
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::
Definition at line 11068 of file SemaDecl.cpp.
Referenced by clang::Sema::ActOnOpenMPAtomicDirective(), clang::ento::BasicValueFactory::Add1(), checkDeducedTemplateArguments(), clang::Sema::CodeCompleteCall(), clang::SrcMgr::ExpansionInfo::create(), DeduceTemplateArgumentByListElement(), clang::Sema::DeduceTemplateArguments(), clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(), clang::CodeGen::CodeGenFunction::EmitR600BuiltinExpr(), clang::ento::nonloc::ConcreteInt::evalBinOp(), clang::ento::loc::ConcreteInt::evalBinOp(), clang::ento::ExprEngine::evalComplement(), clang::ento::ExprEngine::evalMinus(), clang::ento::PathDiagnosticConsumer::FlushDiagnostics(), clang::SrcMgr::FileInfo::get(), clang::ento::SVal::getAsFunctionDecl(), clang::ento::SVal::getAsLocSymbol(), getAsPointeeSymbol(), clang::ento::SVal::getAsRegion(), clang::ento::SVal::getAsSymbol(), clang::ento::SVal::getAsSymbolicExpression(), clang::CFGStmtMap::getBlock(), clang::DeclGroupRef::getFromOpaquePtr(), clang::SourceLocation::getFromRawEncoding(), clang::ento::SVal::getLocSymbolInBase(), isSameEntity(), isSameTemplateParameter(), clang::ento::PathDiagnosticLocation::operator!=(), clang::operator<=(), clang::operator>(), parameterTypeFromSVal(), clang::ento::ExprEngine::processBranch(), clang::ento::ScanReachableSymbols::scan(), clang::ento::BasicValueFactory::Sub1(), TryListConversion(), clang::ento::ExprEngine::VisitGCCAsmStmt(), clang::ento::ExprEngine::VisitLogicalExpr(), clang::ento::TrackConstraintBRVisitor::VisitNode(), clang::ento::ExprEngine::VisitOffsetOfExpr(), and clang::ento::ExprEngine::VisitUnaryOperator().