33 #include "llvm/Support/ErrorHandling.h"
36 using namespace clang;
47 TranslationUnitDecl::TranslationUnitDecl(
ASTContext &ctx)
49 DeclContext(TranslationUnit), Ctx(ctx), AnonymousNamespace(nullptr) {
50 Hidden = Ctx.getLangOpts().ModulesLocalVisibility;
158 "asking for explicit visibility when we shouldn't be");
165 return isa<TypeDecl>(D) ||
166 isa<ClassTemplateDecl>(D) ||
167 isa<ObjCInterfaceDecl>(D);
172 template <
class T>
static typename
173 std::enable_if<!std::is_base_of<RedeclarableTemplateDecl, T>::value,
bool>
::type
176 D->getMemberSpecializationInfo()) {
177 return member->isExplicitSpecialization();
193 switch (attr->getVisibility()) {
201 llvm_unreachable(
"bad visibility kind");
210 if (
const TypeVisibilityAttr *A = D->
getAttr<TypeVisibilityAttr>()) {
216 if (
const VisibilityAttr *A = D->
getAttr<VisibilityAttr>()) {
224 if (A->getPlatform()->getName().equals(
"macosx"))
248 if (isa<TemplateTypeParmDecl>(
P))
256 dyn_cast<NonTypeTemplateParmDecl>(
P)) {
258 if (!NTTP->isExpandedParameterPack()) {
259 if (!NTTP->getType()->isDependentType()) {
266 for (
unsigned i = 0, n = NTTP->getNumExpansionTypes(); i != n; ++i) {
301 const Decl *Ret =
nullptr;
303 while (DC->
getDeclKind() != Decl::TranslationUnit) {
304 if (isa<FunctionDecl>(DC) || isa<BlockDecl>(DC))
305 Ret = cast<Decl>(DC);
321 switch (Arg.getKind()) {
332 if (
NamedDecl *ND = dyn_cast<NamedDecl>(Arg.getAsDecl())) {
339 LV.
merge(Arg.getNullPtrType()->getLinkageAndVisibility());
345 Arg.getAsTemplateOrTemplatePattern().getAsTemplateDecl())
353 llvm_unreachable(
"bad template argument kind");
374 return !fn->
hasAttr<VisibilityAttr>();
388 bool considerVisibility =
407 switch (computation) {
410 if (D->
hasAttr<TypeVisibilityAttr>())
415 if (D->
hasAttr<VisibilityAttr>())
421 llvm_unreachable(
"bad visibility computation kind");
481 if (considerVisibility)
533 if (considerVisibility)
541 if (!Opts.CPlusPlus || !Opts.InlineVisibilityHidden)
551 TSK = spec->getTemplateSpecializationKind();
554 TSK = MSI->getTemplateSpecializationKind();
567 const T *First = D->getFirstDecl();
568 return First->isInExternCContext();
573 if (!SD->hasBraces())
581 "Not a name having namespace scope");
590 if (
const VarDecl *Var = dyn_cast<VarDecl>(D)) {
598 if (Context.getLangOpts().CPlusPlus &&
599 Var->getType().isConstQualified() &&
600 !Var->getType().isVolatileQualified()) {
605 if (Var->getStorageClass() !=
SC_Extern &&
614 Var->getStorageClass() ==
SC_None)
615 return PrevVar->getLinkageAndVisibility();
617 if (PrevVar->getStorageClass() ==
SC_Static)
626 if (Function->getCanonicalDecl()->getStorageClass() ==
SC_Static)
628 }
else if (
const auto *IFD = dyn_cast<IndirectFieldDecl>(D)) {
630 const VarDecl *VD = IFD->getVarDecl();
631 assert(VD &&
"Expected a VarDecl in this IndirectFieldDecl!");
634 assert(!isa<FieldDecl>(D) &&
"Didn't expect a FieldDecl!");
659 !isa<TranslationUnitDecl>(DC);
675 globalVisibility = Context.getLangOpts().getValueVisibilityMode();
678 globalVisibility = Context.getLangOpts().getTypeVisibilityMode();
695 if (
const VarDecl *Var = dyn_cast<VarDecl>(D)) {
736 = dyn_cast<VarTemplateSpecializationDecl>(Var)) {
741 }
else if (
const FunctionDecl *Function = dyn_cast<FunctionDecl>(D)) {
758 if (Context.getLangOpts().CPlusPlus &&
759 !Function->isInExternCContext()) {
767 QualType TypeAsWritten = Function->getType();
769 TypeAsWritten = TSI->getType();
778 = Function->getTemplateSpecializationInfo()) {
788 }
else if (
const TagDecl *Tag = dyn_cast<TagDecl>(D)) {
790 if (!Tag->hasNameForLinkage())
797 = dyn_cast<ClassTemplateSpecializationDecl>(Tag)) {
802 }
else if (isa<EnumConstantDecl>(D)) {
811 }
else if (
const TemplateDecl *temp = dyn_cast<TemplateDecl>(D)) {
824 }
else if (isa<ObjCInterfaceDecl>(D)) {
854 if (!(isa<CXXMethodDecl>(D) ||
857 isa<IndirectFieldDecl>(D) ||
859 isa<TemplateDecl>(D)))
898 const NamedDecl *explicitSpecSuppressor =
nullptr;
911 QualType TypeAsWritten = MD->getType();
913 TypeAsWritten = TSI->getType();
920 = MD->getTemplateSpecializationInfo()) {
922 if (spec->isExplicitSpecialization()) {
923 explicitSpecSuppressor = MD;
925 explicitSpecSuppressor = spec->getTemplate()->getTemplatedDecl();
928 explicitSpecSuppressor = MD;
931 }
else if (
const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(D)) {
933 = dyn_cast<ClassTemplateSpecializationDecl>(RD)) {
935 if (spec->isExplicitSpecialization()) {
936 explicitSpecSuppressor = spec;
944 explicitSpecSuppressor = RD;
948 }
else if (
const VarDecl *VD = dyn_cast<VarDecl>(D)) {
950 = dyn_cast<VarTemplateSpecializationDecl>(VD))
961 explicitSpecSuppressor = VD;
965 }
else if (
const TemplateDecl *temp = dyn_cast<TemplateDecl>(D)) {
966 bool considerVisibility =
975 dyn_cast<RedeclarableTemplateDecl>(temp)) {
977 explicitSpecSuppressor = temp->getTemplatedDecl();
983 assert(!explicitSpecSuppressor || !isa<TemplateDecl>(explicitSpecSuppressor));
987 bool considerClassVisibility =
true;
988 if (explicitSpecSuppressor &&
993 considerClassVisibility =
false;
1001 void NamedDecl::anchor() { }
1018 if (name.front() ==
'C')
1019 if (name ==
"CFStringCreateWithFormat" ||
1020 name ==
"CFStringCreateWithFormatAndArguments" ||
1021 name ==
"CFStringAppendFormat" ||
1022 name ==
"CFStringAppendFormatAndArguments")
1042 bool IsMostRecent) {
1051 if (
const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(ND)) {
1053 if (InstantiatedFrom)
1061 = dyn_cast<ClassTemplateSpecializationDecl>(ND))
1062 return getVisibilityOf(spec->getSpecializedTemplate()->getTemplatedDecl(),
1066 if (!IsMostRecent && !isa<NamespaceDecl>(ND)) {
1068 if (MostRecent != ND)
1072 if (
const VarDecl *Var = dyn_cast<VarDecl>(ND)) {
1073 if (Var->isStaticDataMember()) {
1075 if (InstantiatedFrom)
1079 if (
const auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(Var))
1080 return getVisibilityOf(VTSD->getSpecializedTemplate()->getTemplatedDecl(),
1086 if (
const FunctionDecl *fn = dyn_cast<FunctionDecl>(ND)) {
1090 = fn->getTemplateSpecializationInfo())
1091 return getVisibilityOf(templateInfo->getTemplate()->getTemplatedDecl(),
1097 if (InstantiatedFrom)
1104 if (
const TemplateDecl *TD = dyn_cast<TemplateDecl>(ND))
1110 Optional<Visibility>
1119 if (isa<ParmVarDecl>(ContextDecl))
1122 return getLVForDecl(cast<NamedDecl>(ContextDecl), computation);
1125 if (
const NamedDecl *ND = dyn_cast<NamedDecl>(DC))
1133 if (
const FunctionDecl *Function = dyn_cast<FunctionDecl>(D)) {
1134 if (Function->isInAnonymousNamespace() &&
1135 !Function->isInExternCContext())
1139 if (Function->getCanonicalDecl()->getStorageClass() ==
SC_Static)
1144 if (Optional<Visibility> Vis =
1156 if (
const VarDecl *Var = dyn_cast<VarDecl>(D)) {
1157 if (Var->hasExternalStorage()) {
1158 if (Var->isInAnonymousNamespace() && !Var->isInExternCContext())
1179 if (!Var->isStaticLocal())
1192 if (
const BlockDecl *BD = dyn_cast<BlockDecl>(OuterD)) {
1193 if (!BD->getBlockManglingNumber())
1197 BD->getBlockManglingContextDecl(), computation);
1215 while (Record && Record->
isLambda()) {
1219 Record = dyn_cast_or_null<CXXRecordDecl>(
1234 case Decl::TemplateTemplateParm:
1235 case Decl::NonTypeTemplateParm:
1236 case Decl::ObjCAtDefsField:
1237 case Decl::ObjCCategory:
1238 case Decl::ObjCCategoryImpl:
1239 case Decl::ObjCCompatibleAlias:
1240 case Decl::ObjCImplementation:
1241 case Decl::ObjCMethod:
1242 case Decl::ObjCProperty:
1243 case Decl::ObjCPropertyImpl:
1244 case Decl::ObjCProtocol:
1247 case Decl::CXXRecord: {
1331 if (!Opts.CPlusPlus || Opts.MicrosoftExt)
1361 std::string QualName;
1362 llvm::raw_string_ostream OS(QualName);
1384 while (Ctx && isa<NamedDecl>(Ctx)) {
1385 Contexts.push_back(Ctx);
1389 for (ContextsTy::reverse_iterator I = Contexts.rbegin(), E = Contexts.rend();
1392 = dyn_cast<ClassTemplateSpecializationDecl>(*I)) {
1393 OS << Spec->getName();
1396 TemplateArgs.
data(),
1397 TemplateArgs.
size(),
1399 }
else if (
const NamespaceDecl *ND = dyn_cast<NamespaceDecl>(*I)) {
1401 (ND->isAnonymousNamespace() || ND->isInline()))
1403 if (ND->isAnonymousNamespace())
1404 OS <<
"(anonymous namespace)";
1407 }
else if (
const RecordDecl *RD = dyn_cast<RecordDecl>(*I)) {
1408 if (!RD->getIdentifier())
1409 OS <<
"(anonymous " << RD->getKindName() <<
')';
1412 }
else if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(*I)) {
1414 if (FD->hasWrittenPrototype())
1415 FT = dyn_cast<FunctionProtoType>(FD->getType()->castAs<
FunctionType>());
1420 for (
unsigned i = 0; i < NumParams; ++i) {
1423 OS << FD->getParamDecl(i)->getType().stream(P);
1434 OS << *cast<NamedDecl>(*I);
1442 OS <<
"(anonymous)";
1447 bool Qualified)
const {
1486 #define DECL(Type, Base) \
1488 return isRedeclarableImpl((Type##Decl *)nullptr);
1489 #define ABSTRACT_DECL(DECL)
1490 #include "clang/AST/DeclNodes.inc"
1492 llvm_unreachable(
"unknown decl kind");
1513 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(
this))
1517 if (FD->getPreviousDecl() != OldD)
1522 dyn_cast<FunctionTemplateDecl>(
this))
1523 return FunctionTemplate->getTemplatedDecl()->declarationReplaces(
1524 cast<FunctionTemplateDecl>(OldD)->getTemplatedDecl());
1530 if (
auto *USD = dyn_cast<UsingShadowDecl>(
this))
1531 if (USD->getTargetDecl() != cast<UsingShadowDecl>(OldD)->getTargetDecl())
1535 if (
auto *UD = dyn_cast<UsingDecl>(
this)) {
1539 cast<UsingDecl>(OldD)->getQualifier());
1541 if (
auto *UUVD = dyn_cast<UnresolvedUsingValueDecl>(
this)) {
1545 cast<UnresolvedUsingValueDecl>(OldD)->getQualifier());
1550 if (
auto *UD = dyn_cast<UsingDirectiveDecl>(
this))
1551 return UD->getNominatedNamespace()->getOriginalNamespace() ==
1552 cast<UsingDirectiveDecl>(OldD)->getNominatedNamespace()
1553 ->getOriginalNamespace();
1567 if (D->isCanonicalDecl())
1581 NamedDecl *NamedDecl::getUnderlyingDeclImpl() {
1584 ND = UD->getTargetDecl();
1587 return AD->getClassInterface();
1597 if (isa<UsingShadowDecl>(D))
1598 D = cast<UsingShadowDecl>(D)->getTargetDecl();
1600 if (isa<FieldDecl>(D) || isa<IndirectFieldDecl>(D) || isa<MSPropertyDecl>(D))
1604 return MD->isInstance();
1612 template <
typename DeclT>
1614 if (decl->getNumTemplateParameterLists() > 0)
1615 return decl->getTemplateParameterList(0)->getTemplateLoc();
1617 return decl->getInnerLocStart();
1629 if (!hasExtInfo()) {
1635 getExtInfo()->TInfo = savedTInfo;
1638 getExtInfo()->QualifierLoc = QualifierLoc;
1642 if (getExtInfo()->NumTemplParamLists == 0) {
1648 DeclInfo = savedTInfo;
1651 getExtInfo()->QualifierLoc = QualifierLoc;
1658 unsigned NumTPLists,
1660 assert(NumTPLists > 0);
1662 if (!hasExtInfo()) {
1668 getExtInfo()->TInfo = savedTInfo;
1671 getExtInfo()->setTemplateParameterListsInfo(Context, NumTPLists, TPLists);
1689 QT = cast<PointerType>(T)->getPointeeType();
1691 case Type::BlockPointer:
1692 QT = cast<BlockPointerType>(T)->getPointeeType();
1694 case Type::MemberPointer:
1695 QT = cast<MemberPointerType>(T)->getPointeeType();
1697 case Type::LValueReference:
1698 case Type::RValueReference:
1699 QT = cast<ReferenceType>(T)->getPointeeType();
1701 case Type::PackExpansion:
1702 QT = cast<PackExpansionType>(T)->getPattern();
1705 case Type::ConstantArray:
1706 case Type::DependentSizedArray:
1707 case Type::IncompleteArray:
1708 case Type::VariableArray:
1709 case Type::FunctionProto:
1710 case Type::FunctionNoProto:
1723 if (!
getDeclName() || typeIsPostfix(TInfo->getType()))
1724 RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();
1731 unsigned NumTPLists,
1733 assert((NumTPLists == 0 || TPLists !=
nullptr) &&
1734 "Empty array of template parameters with positive size!");
1743 if (NumTPLists > 0) {
1765 llvm_unreachable(
"Invalid storage class");
1774 static_assert(
sizeof(VarDeclBitfields) <=
sizeof(
unsigned),
1775 "VarDeclBitfields too large!");
1777 "ParmVarDeclBitfields too large!");
1779 "NonParmVarDeclBitfields too large!");
1789 return new (
C, DC)
VarDecl(Var, C, DC, StartL, IdL, Id, T, TInfo, S);
1806 if (!hasAttr<ThreadAttr>() &&
1809 hasAttr<OMPThreadPrivateDeclAttr>()))
1811 return ((
getASTContext().getLangOpts().isCompatibleWithMSVC(
1813 hasAttr<OMPThreadPrivateDeclAttr>())
1822 llvm_unreachable(
"Unknown thread storage class specifier!");
1836 template<
typename T>
1840 if (!D.hasExternalFormalLinkage())
1864 template<
typename T>
1870 assert(D.getASTContext().getLangOpts().CPlusPlus);
1918 isa<VarTemplatePartialSpecializationDecl>(
this)))
1933 if (hasAttr<AliasAttr>())
1936 if (
const auto *SAA = getAttr<SelectAnyAttr>())
1937 if (!SAA->isInherited())
1943 if (isa<VarTemplateSpecializationDecl>(
this) &&
1975 VarDecl *LastTentative =
nullptr;
1977 for (
auto I : First->
redecls()) {
1978 Kind = I->isThisDeclarationADefinition();
1984 return LastTentative;
1989 for (
auto I : First->
redecls()) {
1990 if (I->isThisDeclarationADefinition(C) ==
Definition)
2000 for (
auto I : First->
redecls()) {
2001 Kind = std::max(Kind, I->isThisDeclarationADefinition(C));
2011 if (
auto Expr = I->getInit()) {
2030 return VD->isOutOfLine();
2040 if (RD->getLexicalDeclContext()->isFileContext())
2049 Eval->~EvaluatedStmt();
2059 if (!Lang.CPlusPlus)
2064 if (Lang.CPlusPlus11 &&
getType()->isReferenceType())
2070 if (!
getType().isConstQualified() ||
getType().isVolatileQualified())
2075 if (
getType()->isIntegralOrEnumerationType())
2108 void DestroyAPValue(
void* UntypedValue) {
2129 Eval->
IsICE =
false;
2153 Eval->
IsICE = Result && Notes.empty();
2156 return Result ? &Eval->
Evaluated :
nullptr;
2197 return cast<VarDecl>(MSI->getInstantiatedFrom());
2204 dyn_cast<VarTemplateSpecializationDecl>(
this))
2205 return Spec->getSpecializationKind();
2208 return MSI->getTemplateSpecializationKind();
2215 dyn_cast<VarTemplateSpecializationDecl>(
this))
2216 return Spec->getPointOfInstantiation();
2219 return MSI->getPointOfInstantiation();
2244 assert((isa<VarTemplateSpecializationDecl>(
this) ||
2246 "not a variable or static data member template specialization");
2249 dyn_cast<VarTemplateSpecializationDecl>(
this)) {
2250 Spec->setSpecializationKind(TSK);
2252 Spec->getPointOfInstantiation().isInvalid())
2253 Spec->setPointOfInstantiation(PointOfInstantiation);
2257 MSI->setTemplateSpecializationKind(TSK);
2259 MSI->getPointOfInstantiation().isInvalid())
2260 MSI->setPointOfInstantiation(PointOfInstantiation);
2267 assert(
getASTContext().getTemplateOrSpecializationInfo(
this).isNull() &&
2268 "Previous template or instantiation?");
2281 return new (
C, DC)
ParmVarDecl(ParmVar, C, DC, StartLoc, IdLoc, Id, T, TInfo,
2288 if (
const DecayedType *DT = dyn_cast<DecayedType>(T))
2289 return DT->getOriginalType();
2317 "Default argument is not yet instantiated!");
2321 return E->getSubExpr();
2328 return E->getSourceRange();
2337 return isa<PackExpansionType>(
getType());
2340 void ParmVarDecl::setParameterIndexLarge(
unsigned parameterIndex) {
2345 unsigned ParmVarDecl::getParameterIndexLarge()
const {
2354 raw_ostream &OS,
const PrintingPolicy &Policy,
bool Qualified)
const {
2359 OS, TemplateArgs->
data(), TemplateArgs->
size(), Policy);
2364 return FT->isVariadic();
2370 if (I->Body || I->IsLateTemplateParsed) {
2388 if (isa<CompoundStmt>(S) && cast<CompoundStmt>(S)->body_empty())
2395 if (I->IsDeleted || I->IsDefaulted || I->Body || I->IsLateTemplateParsed ||
2396 I->hasAttr<AliasAttr>()) {
2397 Definition = I->IsDeleted ? I->getCanonicalDecl() : I;
2409 if (Definition->Body)
2418 EndRangeLoc = B->getLocEnd();
2425 Parent->markedVirtualFunctionPure();
2428 template<std::
size_t Len>
2431 return II && II->
isStr(Str);
2459 return llvm::StringSwitch<bool>(
getName())
2471 assert(
getDeclName().getCXXOverloadedOperator() == OO_New ||
2472 getDeclName().getCXXOverloadedOperator() == OO_Delete ||
2473 getDeclName().getCXXOverloadedOperator() == OO_Array_New ||
2474 getDeclName().getCXXOverloadedOperator() == OO_Array_Delete);
2495 if (
getDeclName().getCXXOverloadedOperator() != OO_New &&
2496 getDeclName().getCXXOverloadedOperator() != OO_Delete &&
2497 getDeclName().getCXXOverloadedOperator() != OO_Array_New &&
2498 getDeclName().getCXXOverloadedOperator() != OO_Array_Delete)
2550 if (
const CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(
this))
2551 return Method->isStatic();
2558 DC = DC->getParent()) {
2559 if (
const NamespaceDecl *Namespace = cast<NamespaceDecl>(DC)) {
2560 if (!Namespace->getDeclName())
2570 return hasAttr<NoReturnAttr>() || hasAttr<CXX11NoReturnAttr>() ||
2571 hasAttr<C11NoReturnAttr>() ||
2582 assert((!PrevDecl || PrevFunTmpl) &&
"Function/function template mismatch");
2583 FunTmpl->setPreviousDecl(PrevFunTmpl);
2586 if (PrevDecl && PrevDecl->IsInline)
2618 if (BuiltinID == Builtin::BI__GetExceptionInfo &&
2621 return Builtin::BI__GetExceptionInfo;
2630 if (hasAttr<OverloadableAttr>())
2658 assert(!ParamInfo &&
"Already has param info!");
2659 assert(NewParamInfo.size() ==
getNumParams() &&
"Parameter count mismatch!");
2662 if (!NewParamInfo.empty()) {
2664 std::copy(NewParamInfo.begin(), NewParamInfo.end(), ParamInfo);
2669 assert(DeclsInPrototypeScope.empty() &&
"Already has prototype decls!");
2671 if (!NewDecls.empty()) {
2673 std::copy(NewDecls.begin(), NewDecls.end(), A);
2674 DeclsInPrototypeScope = llvm::makeArrayRef(A, NewDecls.size());
2676 for (
auto I : NewDecls) {
2683 I->setDeclContext(
this);
2698 unsigned NumRequiredArgs = 0;
2699 for (
auto *Param :
params())
2700 if (!Param->isParameterPack() && !Param->hasDefaultArg())
2702 return NumRequiredArgs;
2711 assert(
isInlined() &&
"expected to get called on an inlined function!");
2714 if (!Context.
getLangOpts().MSVCCompat && !hasAttr<DLLExportAttr>())
2719 if (!FD->isImplicit() && FD->getStorageClass() ==
SC_Extern)
2731 if (!FD->isImplicit() && FD->getStorageClass() ==
SC_Extern)
2761 "Must have a declaration without a body.");
2772 if (Context.
getLangOpts().GNUInline || hasAttr<GNUInlineAttr>()) {
2782 bool FoundBody =
false;
2784 FoundBody |= Prev->Body.
isValid();
2810 bool FoundBody =
false;
2812 FoundBody |= Prev->Body.
isValid();
2844 if (Ret && Ret->
hasAttr<WarnUnusedResultAttr>() &&
2848 return hasAttr<WarnUnusedResultAttr>();
2870 assert(
isInlined() &&
"Function must be inline");
2873 if (Context.
getLangOpts().GNUInline || hasAttr<GNUInlineAttr>()) {
2885 for (
auto Redecl :
redecls()) {
2886 if (Redecl->isInlineSpecified() &&
2896 "should not use C inline rules in C++");
2902 for (
auto Redecl :
redecls()) {
2933 if (TemplateOrSpecialization.isNull())
2941 if (TemplateOrSpecialization.is
2945 llvm_unreachable(
"Did we miss a TemplateOrSpecialization type?");
2950 return cast<FunctionDecl>(Info->getInstantiatedFrom());
2956 FunctionDecl::setInstantiationOfMemberFunction(
ASTContext &C,
2959 assert(TemplateOrSpecialization.isNull() &&
2960 "Member function is already a specialization");
2963 TemplateOrSpecialization = Info;
2991 bool HasPattern =
false;
2993 HasPattern = PatternDecl->
hasBody(PatternDecl);
2999 if (!HasPattern || !PatternDecl)
3015 llvm_unreachable(
"All TSK values handled.");
3033 dyn_cast<CXXMethodDecl>(
this))) {
3035 "generated from a primary call operator "
3038 "A generic lambda call operator template must always have a body - "
3039 "even if instantiated from a prototype (i.e. as written) member "
3045 while (Primary->getInstantiatedFromMemberTemplate()) {
3048 if (Primary->isMemberSpecialization())
3050 Primary = Primary->getInstantiatedFromMemberTemplate();
3053 return Primary->getTemplatedDecl();
3061 = TemplateOrSpecialization
3062 .dyn_cast<FunctionTemplateSpecializationInfo*>()) {
3063 return Info->Template.getPointer();
3075 = TemplateOrSpecialization
3076 .dyn_cast<FunctionTemplateSpecializationInfo*>()) {
3077 return Info->TemplateArguments;
3085 = TemplateOrSpecialization
3086 .dyn_cast<FunctionTemplateSpecializationInfo*>()) {
3087 return Info->TemplateArgumentsAsWritten;
3093 FunctionDecl::setFunctionTemplateSpecialization(
ASTContext &C,
3101 "Must specify the type of function template specialization");
3107 TemplateArgsAsWritten,
3108 PointOfInstantiation);
3109 TemplateOrSpecialization = Info;
3117 assert(TemplateOrSpecialization.isNull());
3121 void *Buffer = Context.
Allocate(Size);
3125 TemplateOrSpecialization = Info;
3131 : AngleLocs(TArgs.getLAngleLoc(), TArgs.getRAngleLoc()) {
3132 static_assert(
sizeof(*
this) % llvm::AlignOf<void *>::Alignment == 0,
3133 "Trailing data is unaligned!");
3135 d.NumTemplates = Ts.
size();
3136 d.NumArgs = TArgs.
size();
3140 for (
unsigned I = 0, E = Ts.
size(); I != E; ++I)
3141 TsArray[I] = cast<FunctionTemplateDecl>(Ts[I]->getUnderlyingDecl());
3145 for (
unsigned I = 0, E = TArgs.
size(); I != E; ++I)
3169 = TemplateOrSpecialization.dyn_cast<
3171 FTSInfo->setTemplateSpecializationKind(TSK);
3173 PointOfInstantiation.
isValid() &&
3174 FTSInfo->getPointOfInstantiation().isInvalid())
3175 FTSInfo->setPointOfInstantiation(PointOfInstantiation);
3178 MSInfo->setTemplateSpecializationKind(TSK);
3180 PointOfInstantiation.
isValid() &&
3181 MSInfo->getPointOfInstantiation().isInvalid())
3182 MSInfo->setPointOfInstantiation(PointOfInstantiation);
3184 llvm_unreachable(
"Function cannot have a template specialization kind");
3189 = TemplateOrSpecialization.dyn_cast<
3191 return FTSInfo->getPointOfInstantiation();
3194 return MSInfo->getPointOfInstantiation();
3215 if (FunTmpl->getTemplatedDecl()->hasBody(Definition))
3234 case Builtin::BI__builtin_memset:
3235 case Builtin::BI__builtin___memset_chk:
3236 case Builtin::BImemset:
3237 return Builtin::BImemset;
3239 case Builtin::BI__builtin_memcpy:
3240 case Builtin::BI__builtin___memcpy_chk:
3241 case Builtin::BImemcpy:
3242 return Builtin::BImemcpy;
3244 case Builtin::BI__builtin_memmove:
3245 case Builtin::BI__builtin___memmove_chk:
3246 case Builtin::BImemmove:
3247 return Builtin::BImemmove;
3249 case Builtin::BIstrlcpy:
3250 case Builtin::BI__builtin___strlcpy_chk:
3251 return Builtin::BIstrlcpy;
3253 case Builtin::BIstrlcat:
3254 case Builtin::BI__builtin___strlcat_chk:
3255 return Builtin::BIstrlcat;
3257 case Builtin::BI__builtin_memcmp:
3258 case Builtin::BImemcmp:
3259 return Builtin::BImemcmp;
3261 case Builtin::BI__builtin_strncpy:
3262 case Builtin::BI__builtin___strncpy_chk:
3263 case Builtin::BIstrncpy:
3264 return Builtin::BIstrncpy;
3266 case Builtin::BI__builtin_strncmp:
3267 case Builtin::BIstrncmp:
3268 return Builtin::BIstrncmp;
3270 case Builtin::BI__builtin_strncasecmp:
3271 case Builtin::BIstrncasecmp:
3272 return Builtin::BIstrncasecmp;
3274 case Builtin::BI__builtin_strncat:
3275 case Builtin::BI__builtin___strncat_chk:
3276 case Builtin::BIstrncat:
3277 return Builtin::BIstrncat;
3279 case Builtin::BI__builtin_strndup:
3280 case Builtin::BIstrndup:
3281 return Builtin::BIstrndup;
3283 case Builtin::BI__builtin_strlen:
3284 case Builtin::BIstrlen:
3285 return Builtin::BIstrlen;
3289 if (FnInfo->
isStr(
"memset"))
3290 return Builtin::BImemset;
3291 else if (FnInfo->
isStr(
"memcpy"))
3292 return Builtin::BImemcpy;
3293 else if (FnInfo->
isStr(
"memmove"))
3294 return Builtin::BImemmove;
3295 else if (FnInfo->
isStr(
"memcmp"))
3296 return Builtin::BImemcmp;
3297 else if (FnInfo->
isStr(
"strncpy"))
3298 return Builtin::BIstrncpy;
3299 else if (FnInfo->
isStr(
"strncmp"))
3300 return Builtin::BIstrncmp;
3301 else if (FnInfo->
isStr(
"strncasecmp"))
3302 return Builtin::BIstrncasecmp;
3303 else if (FnInfo->
isStr(
"strncat"))
3304 return Builtin::BIstrncat;
3305 else if (FnInfo->
isStr(
"strndup"))
3306 return Builtin::BIstrndup;
3307 else if (FnInfo->
isStr(
"strlen"))
3308 return Builtin::BIstrlen;
3324 return new (
C, DC)
FieldDecl(Decl::Field, DC, StartLoc, IdLoc, Id, T, TInfo,
3325 BW, Mutable, InitStyle);
3339 return Record->getDecl()->isAnonymousStructOrUnion();
3346 Expr *BitWidth =
static_cast<Expr *
>(InitStorage.getPointer());
3352 if (Canonical !=
this)
3355 if (CachedFieldIndex)
return CachedFieldIndex - 1;
3360 for (
auto *Field : RD->
fields()) {
3361 Field->getCanonicalDecl()->CachedFieldIndex = Index + 1;
3365 assert(CachedFieldIndex &&
"failed to find field in parent");
3366 return CachedFieldIndex - 1;
3370 switch (InitStorage.getInt()) {
3372 case ISK_BitWidthOrNothing:
3373 case ISK_InClassCopyInit:
3374 case ISK_InClassListInit:
3375 if (
const Expr *E = static_cast<const Expr *>(InitStorage.getPointer()))
3379 case ISK_CapturedVLAType:
3382 llvm_unreachable(
"bad init storage kind");
3387 "capturing type in non-lambda or captured record.");
3388 assert(InitStorage.getInt() == ISK_BitWidthOrNothing &&
3389 InitStorage.getPointer() ==
nullptr &&
3390 "bit width, initializer or captured type already set");
3391 InitStorage.setPointerAndInt(const_cast<VariableArrayType *>(VLAType),
3392 ISK_CapturedVLAType);
3411 NamedDeclOrQualifier = TDD;
3414 assert(T->isLinkageValid());
3423 struct CXXRecordDecl::DefinitionData *Data =
3424 new (
getASTContext())
struct CXXRecordDecl::DefinitionData(D);
3426 cast<CXXRecordDecl>(I)->DefinitionData = Data;
3431 assert((!isa<CXXRecordDecl>(
this) ||
3432 cast<CXXRecordDecl>(
this)->hasDefinition()) &&
3433 "definition completed but not started");
3435 IsCompleteDefinition =
true;
3439 L->CompletedTagDefinition(
this);
3444 return const_cast<TagDecl *
>(
this);
3449 if (II->isOutOfDate()) {
3455 if (
const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(
this))
3456 return CXXRD->getDefinition();
3459 if (R->isCompleteDefinition())
3475 if (getExtInfo()->NumTemplParamLists == 0) {
3486 unsigned NumTPLists,
3488 assert(NumTPLists > 0);
3501 void EnumDecl::anchor() { }
3507 bool IsScopedUsingClassTag,
bool IsFixed) {
3509 IsScoped, IsScopedUsingClassTag,
3519 nullptr,
nullptr,
false,
false,
false);
3526 return TI->getTypeLoc().getSourceRange();
3532 unsigned NumPositiveBits,
3533 unsigned NumNegativeBits) {
3537 PromotionType = NewPromotionType;
3545 return MSI->getTemplateSpecializationKind();
3553 assert(MSI &&
"Not an instantiated member enumeration?");
3556 PointOfInstantiation.
isValid() &&
3562 if (SpecializationInfo)
3570 assert(!SpecializationInfo &&
"Member enum is already a specialization");
3582 :
TagDecl(DK, TK, C, DC, IdLoc, Id, PrevDecl, StartLoc) {
3583 HasFlexibleArrayMember =
false;
3584 AnonymousStructOrUnion =
false;
3585 HasObjectMember =
false;
3586 HasVolatileMember =
false;
3587 LoadedFieldsFromExternalStorage =
false;
3588 assert(
classof(static_cast<Decl*>(
this)) &&
"Invalid Kind!");
3595 StartLoc, IdLoc, Id, PrevDecl);
3616 if (
auto RD = dyn_cast<CXXRecordDecl>(
this))
3617 return RD->isLambda();
3622 return hasAttr<CapturedRecordAttr>();
3631 LoadFieldsFromExternalStorage();
3647 return hasAttr<MSStructAttr>() || C.
getLangOpts().MSBitfields == 1;
3654 void RecordDecl::LoadFieldsFromExternalStorage()
const {
3662 LoadedFieldsFromExternalStorage =
true;
3675 for (
unsigned i=0, e=Decls.size(); i != e; ++i)
3676 assert(isa<FieldDecl>(Decls[i]) || isa<IndirectFieldDecl>(Decls[i]));
3689 SanitizerKind::Address | SanitizerKind::KernelAddress) ||
3690 !Context.
getLangOpts().SanitizeAddressFieldPadding)
3695 int ReasonToReject = -1;
3698 else if (CXXRD->
hasAttr<PackedAttr>())
3708 else if (Blacklist.isBlacklistedLocation(
getLocation(),
"field-padding"))
3715 if (ReasonToReject >= 0)
3718 diag::remark_sanitize_address_insert_extra_padding_rejected)
3723 diag::remark_sanitize_address_insert_extra_padding_accepted)
3726 return ReasonToReject < 0;
3730 for (
const auto *I :
fields()) {
3731 if (I->getIdentifier())
3736 RT->getDecl()->findFirstNamedDataMember())
3737 return NamedDataMember;
3750 assert(!ParamInfo &&
"Already has param info!");
3753 if (!NewParamInfo.empty()) {
3754 NumParams = NewParamInfo.size();
3756 std::copy(NewParamInfo.begin(), NewParamInfo.end(), ParamInfo);
3763 bool capturesCXXThis) {
3772 NumCaptures = end - begin;
3776 size_t allocationSize = NumCaptures *
sizeof(
Capture);
3777 void *buffer = Context.
Allocate(allocationSize,
sizeof(
void*));
3778 memcpy(buffer, begin, allocationSize);
3779 Captures =
static_cast<Capture*
>(buffer);
3785 if (I.getVariable() == variable)
3799 void TranslationUnitDecl::anchor() { }
3805 void ExternCContextDecl::anchor() { }
3812 void LabelDecl::anchor() { }
3816 return new (
C, DC)
LabelDecl(DC, IdentL, II,
nullptr, IdentL);
3822 assert(GnuLabelL != IdentL &&
"Use this only for GNU local labels");
3823 return new (
C, DC)
LabelDecl(DC, IdentL, II,
nullptr, GnuLabelL);
3832 char *Buffer =
new (
getASTContext(), 1)
char[Name.size() + 1];
3833 memcpy(Buffer, Name.data(), Name.size());
3834 Buffer[Name.size()] =
'\0';
3838 void ValueDecl::anchor() { }
3841 for (
const auto *I :
attrs())
3842 if (isa<WeakAttr>(I) || isa<WeakRefAttr>(I))
3848 void ImplicitParamDecl::anchor() { }
3868 bool isInlineSpecified,
3869 bool hasWrittenPrototype,
3870 bool isConstexprSpecified) {
3872 new (
C, DC)
FunctionDecl(Function, C, DC, StartLoc, NameInfo, T, TInfo,
3873 SC, isInlineSpecified, isConstexprSpecified);
3893 unsigned NumParams) {
3899 unsigned NumParams) {
3907 Expr *E,
const llvm::APSInt &V) {
3914 QualType(),
nullptr, llvm::APSInt());
3917 void IndirectFieldDecl::anchor() { }
3936 End = Init->getLocEnd();
3940 void TypeDecl::anchor() { }
3945 return new (
C, DC)
TypedefDecl(C, DC, StartLoc, IdLoc, Id, TInfo);
3948 void TypedefNameDecl::anchor() { }
3953 auto *ThisTypedef =
this;
3954 if (AnyRedecl && OwningTypedef) {
3958 if (OwningTypedef == ThisTypedef)
3959 return TT->getDecl();
3974 return new (
C, DC)
TypeAliasDecl(C, DC, StartLoc, IdLoc, Id, TInfo);
3985 if (typeIsPostfix(TInfo->getType()))
3986 RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();
3994 RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();
3998 void FileScopeAsmDecl::anchor() { }
4013 void EmptyDecl::anchor() {}
4041 :
Decl(Import, DC, StartLoc), ImportedAndComplete(Imported,
true),
4046 memcpy(StoredLocs, IdentifierLocs.data(),
4052 :
Decl(Import, DC, StartLoc), ImportedAndComplete(Imported,
false),
4062 ImportDecl(DC, StartLoc, Imported, IdentifierLocs);
4077 unsigned NumLocations) {
4083 if (!ImportedAndComplete.getInt())
4088 return llvm::makeArrayRef(StoredLocs,
4093 if (!ImportedAndComplete.getInt())
void setLinkage(Linkage L)
bool isCapturedRecord() const
Determine whether this record is a record for captured variables in CapturedStmt construct.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization, retrieves the member specialization information.
Defines the clang::ASTContext interface.
void setTemplateOrSpecializationInfo(VarDecl *Inst, TemplateOrSpecializationInfo TSI)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static LinkageInfo computeLVForDecl(const NamedDecl *D, LVComputationKind computation)
SourceLocation getEnd() const
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
void setImplicit(bool I=true)
bool isMSVCRTEntryPoint() const
Determines whether this function is a MSVCRT user defined entry point.
void setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl, TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
Note that the static data member Inst is an instantiation of the static data member template Tmpl of ...
void setDeclsInPrototypeScope(ArrayRef< NamedDecl * > NewDecls)
External linkage, which indicates that the entity can be referred to from other translation units...
void updateOutOfDate(IdentifierInfo &II) const
Update a potentially out-of-date declaration.
StringRef getName() const
TemplateParameterList * getExpansionTemplateParameters(unsigned I) const
Retrieve a particular expansion type within an expanded parameter pack.
static ImportDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumLocations)
Create a new, deserialized module import declaration.
APValue * evaluateValue() const
Attempt to evaluate the value of the initializer attached to this declaration, and produce notes expl...
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
const IdentifierInfo * getLiteralIdentifier() const
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
bool isReplaceableGlobalAllocationFunction() const
Determines whether this function is one of the replaceable global allocation functions: void *operato...
bool isBitField() const
Determines whether this field is a bitfield.
bool hasTrivialDestructor() const
Determine whether this class has a trivial destructor (C++ [class.dtor]p3)
RAII class for safely pairing a StartedDeserializing call with FinishedDeserializing.
static VarDecl * CreateDeserialized(ASTContext &C, unsigned ID)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool hasUnusedResultAttr() const
Returns true if this function or its return type has the warn_unused_result attribute. If the return type has the attribute and this function is a method of the return type's class, then false will be returned to avoid spurious warnings on member methods such as assignment operators.
IdentifierInfo * getIdentifier() const
bool isGenericLambdaCallOperatorSpecialization(const CXXMethodDecl *MD)
bool isExternCContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
void setPreviousDecl(FunctionDecl *PrevDecl)
Set the previous declaration. If PrevDecl is NULL, set this as the first and only declaration...
SanitizerSet Sanitize
Set of enabled sanitizers.
bool isMain() const
Determines whether this function is "main", which is the entry point into an executable program...
bool IsICE
Whether this statement is an integral constant expression, or in C++11, whether the statement is a co...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a member function...
bool IsBeingDefined
IsBeingDefined - True if this is currently being defined.
IdentifierInfo * getCXXLiteralIdentifier() const
No linkage, which means that the entity is unique and can only be referred to from within its scope...
void setTypedefNameForAnonDecl(TypedefNameDecl *TDD)
bool IsEvaluating
Whether this statement is being evaluated.
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
bool isRecordType() const
Defines the clang::Module class, which describes a module in the source code.
bool isNoReturn() const
Determines whether this function is known to be 'noreturn', through an attribute on its declaration o...
bool isPredefinedLibFunction(unsigned ID) const
Determines whether this builtin is a predefined libc/libm function, such as "malloc", where we know the signature a priori.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
unsigned getBuiltinID() const
Return a value indicating whether this is a builtin function.
Defines the C++ template declaration subclasses.
void setPure(bool P=true)
void setPreviousDeclaration(FunctionDecl *PrevDecl)
static Visibility getVisibilityFromAttr(const T *attr)
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this enumeration is an instantiation of a member enumeration of a class template specialization...
Represents an empty-declaration.
void setParameterIndex(const ParmVarDecl *D, unsigned index)
Used by ParmVarDecl to store on the side the index of the parameter when it exceeds the size of the n...
bool doesDeclarationForceExternallyVisibleDefinition() const
For a function declaration in C or C++, determine whether this declaration causes the definition to b...
bool isInStdNamespace() const
bool hasLinkage() const
Determine whether this declaration has linkage.
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
bool capturesVariable(const VarDecl *var) const
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Declaration of a variable template.
const Expr * getInit() const
NamespaceDecl - Represent a C++ namespace.
static std::enable_if<!std::is_base_of< RedeclarableTemplateDecl, T >::value, bool >::type isExplicitMemberSpecialization(const T *D)
virtual void completeDefinition()
static bool classofKind(Kind K)
bool isWeakImported() const
Determine whether this is a weak-imported symbol.
A container of type source information.
TypeSourceInfo * getIntegerTypeSourceInfo() const
Return the type source info for the underlying integer type, if no type source info exists...
SourceRange getIntegerTypeRange() const LLVM_READONLY
Retrieve the source range that covers the underlying type if specified.
bool CheckingICE
Whether we are checking whether this statement is an integral constant expression.
void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const override
bool isLambda() const
Determine whether this record is a class describing a lambda function object.
static CapturedDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumParams)
This file provides some common utility functions for processing Lambda related AST Constructs...
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
ExplicitVisibilityKind
Kinds of explicit visibility.
bool isUsableInConstantExpressions(ASTContext &C) const
Determine whether this variable's value can be used in a constant expression, according to the releva...
const unsigned IgnoreAllVisibilityBit
bool isFileVarDecl() const
isFileVarDecl - Returns true for file scoped variable declaration.
bool WasEvaluated
Whether this statement was already evaluated.
Declaration of a redeclarable template.
static LanguageLinkage getDeclLanguageLinkage(const T &D)
bool capturesCXXThis() const
void mergeVisibility(Visibility newVis, bool newExplicit)
Merge in the visibility 'newVis'.
TLSKind getTLSKind() const
Represents an empty template argument, e.g., one that has not been deduced.
Declaration context for names declared as extern "C" in C++. This is neither the semantic nor lexical...
field_iterator field_begin() const
static bool classofKind(Kind K)
Represents a variable template specialization, which refers to a variable template with a given set o...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>". This is safe to be used inside an AST node, in contrast with TemplateArgumentListInfo.
void setParams(ArrayRef< ParmVarDecl * > NewParamInfo)
Stores a list of template parameters for a TemplateDecl and its derived classes.
Describes how types, statements, expressions, and declarations should be printed. ...
bool MayHaveOutOfDateDef
Indicates whether it is possible for declarations of this kind to have an out-of-date definition...
ParmVarDecl - Represents a parameter to a function.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
Defines the clang::Expr interface and subclasses for C++ expressions.
void removeDecl(Decl *D)
Removes a declaration from this context.
static bool isFieldOrIndirectField(Decl::Kind K)
Provides information about a dependent function-template specialization declaration.
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
EvaluatedStmt * ensureEvaluatedStmt() const
static LinkageInfo getLVForClosure(const DeclContext *DC, Decl *ContextDecl, LVComputationKind computation)
void setTemplateParameterListsInfo(ASTContext &Context, unsigned NumTPLists, TemplateParameterList **TPLists)
unsigned getNumParams() const
Visibility getVisibility() const
ASTMutationListener * getASTMutationListener() const
bool hasBody(const FunctionDecl *&Definition) const
Returns true if the function has a body (definition). The function body might be in any of the (re-)d...
bool hasUninstantiatedDefaultArg() const
bool isExternC() const
Determines whether this function is a function with external, C linkage.
Provides common interface for the Decls that can be redeclared.
bool isInlineDefinitionExternallyVisible() const
For an inline function definition in C, or for a gnu_inline function in C++, determine whether the de...
static bool isRedeclarable(Decl::Kind K)
Represents a class template specialization, which refers to a class template with a given set of temp...
bool hasBody() const override
Returns true if this Decl represents a declaration for a body of code, such as a function or method d...
FieldDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this field.
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
TagDecl * getAnonDeclWithTypedefName(bool AnyRedecl=false) const
static RecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl=nullptr)
static IndirectFieldDecl * CreateDeserialized(ASTContext &C, unsigned ID)
static LinkageInfo getLVForDecl(const NamedDecl *D, LVComputationKind computation)
const TemplateArgumentList * getTemplateSpecializationArgs() const
Retrieve the template arguments used to produce this function template specialization from the primar...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
static bool redeclForcesDefMSVC(const FunctionDecl *Redecl)
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
bool CheckedICE
Whether we already checked whether this statement was an integral constant expression.
SourceLocation getPointOfInstantiation() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
static LinkageInfo internal()
static bool usesTypeVisibility(const NamedDecl *D)
bool isReferenceType() const
QualType getReturnType() const
static unsigned getNumModuleIdentifiers(Module *Mod)
Retrieve the number of module identifiers needed to name the given module.
static const Decl * getOutermostFuncOrBlockContext(const Decl *D)
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
bool isCompleteDefinition() const
void completeDefinition()
Completes the definition of this tag declaration.
bool declarationReplaces(NamedDecl *OldD, bool IsKnownNewer=true) const
Determine whether this declaration, if known to be well-formed within its context, will replace the declaration OldD if introduced into scope. A declaration will replace another declaration if, for example, it is a redeclaration of the same variable or function, but not if it is a declaration of a different kind (function vs. class) or an overloaded function.
void Deallocate(void *Ptr) const
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
void startDefinition()
Starts the definition of this tag declaration.
void setCaptures(ASTContext &Context, const Capture *begin, const Capture *end, bool capturesCXXThis)
bool isTranslationUnit() const
unsigned size() const
Retrieve the number of template arguments in this template argument list.
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
This declaration is definitely a definition.
static LinkageInfo getLVForClassMember(const NamedDecl *D, LVComputationKind computation)
static std::pair< Decl *, Decl * > BuildDeclChain(ArrayRef< Decl * > Decls, bool FieldsAlreadyLoaded)
Build up a chain of declarations.
void setNumPositiveBits(unsigned Num)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
Linkage getLinkage() const
Describes a module or submodule.
bool hasExternalStorage() const
Returns true if a variable has extern or private_extern storage.
virtual void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const
bool isLinkageValid() const
True if the computed linkage is valid. Used for consistency checking. Should always return true...
Provides information about a function template specialization, which is a FunctionDecl that has been ...
TypedefNameDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this typedef-name.
SourceLocation getBeginLoc() const
Get the begin source location.
VarDecl * getActingDefinition()
Get the tentative definition that acts as the real definition in a TU. Returns null if there is a pro...
const TemplateArgumentList * TemplateArguments
The template arguments used to produce the function template specialization from the function templat...
TemplateParameterList ** TemplParamLists
unsigned getLambdaManglingNumber() const
If this is the closure type of a lambda expression, retrieve the number to be used for name mangling ...
const TargetInfo & getTargetInfo() const
QualType getOriginalType() const
void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
For an enumeration member that was instantiated from a member enumeration of a templated class...
const LangOptions & getLangOpts() const
static ExternCContextDecl * Create(const ASTContext &C, TranslationUnitDecl *TU)
LinkageInfo getLinkageAndVisibility() const
Determine the linkage and visibility of this type.
Wrapper for source info for functions.
static EnumConstantDecl * Create(ASTContext &C, EnumDecl *DC, SourceLocation L, IdentifierInfo *Id, QualType T, Expr *E, const llvm::APSInt &V)
unsigned getMinRequiredArguments() const
static void mergeTemplateLV(LinkageInfo &LV, const FunctionDecl *fn, const FunctionTemplateSpecializationInfo *specInfo, LVComputationKind computation)
bool isExternC() const
Determines whether this variable is a variable with external, C linkage.
Visibility
Describes the different kinds of visibility that a declaration may have.
field_range fields() const
bool containsDecl(Decl *D) const
Checks whether a declaration is in this context.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool isValueDependent() const
A set of unresolved declarations.
bool needsCleanup() const
Returns whether the object performed allocations.
FunctionDecl * getTemplateInstantiationPattern() const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
Module * Parent
The parent of this module. This will be NULL for the top-level module.
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr * > VL, ArrayRef< Expr * > IL, Expr *Step, Expr *CalcStep)
Creates clause with a list of variables VL and a linear step Step.
const SanitizerBlacklist & getSanitizerBlacklist() const
bool isVariadic() const
Whether this function is variadic.
virtual ExternalLoadResult FindExternalLexicalDecls(const DeclContext *DC, bool(*isKindWeWant)(Decl::Kind), SmallVectorImpl< Decl * > &Result)
Finds all declarations lexically contained within the given DeclContext, after applying an optional f...
static LinkageInfo getLVForLocalDecl(const NamedDecl *D, LVComputationKind computation)
static FileScopeAsmDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isTemplateInstantiation() const
Determines if the given function was instantiated from a function template.
bool isWeak() const
Determine whether this symbol is weakly-imported, or declared with the weak or weak-ref attr...
static TypeAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
TypeClass getTypeClass() const
DeclContext * getLexicalDeclContext()
void setNumNegativeBits(unsigned Num)
static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)
static FunctionTemplateSpecializationInfo * Create(ASTContext &C, FunctionDecl *FD, FunctionTemplateDecl *Template, TemplateSpecializationKind TSK, const TemplateArgumentList *TemplateArgs, const TemplateArgumentListInfo *TemplateArgsAsWritten, SourceLocation POI)
This represents the body of a CapturedStmt, and serves as its DeclContext.
Represents a linkage specification.
static ParmVarDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Decl * getPrimaryMergedDecl(Decl *D)
static FunctionDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation NLoc, DeclarationName N, QualType T, TypeSourceInfo *TInfo, StorageClass SC, bool isInlineSpecified=false, bool hasWrittenPrototype=true, bool isConstexprSpecified=false)
CXXMethodDecl * getCorrespondingMethodInClass(const CXXRecordDecl *RD, bool MayBeBase=false)
Find the method in RD that corresponds to this one.
DiagnosticsEngine & getDiagnostics() const
DependentFunctionTemplateSpecializationInfo(const UnresolvedSetImpl &Templates, const TemplateArgumentListInfo &TemplateArgs)
unsigned getNumExpansionTemplateParameters() const
Retrieves the number of expansion template parameters in an expanded parameter pack.
bool isExternalFormalLinkage(Linkage L)
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
unsigned NumTemplParamLists
QualType getParamType(unsigned i) const
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getOuterLocStart() const
bool isParameterPack() const
Determine whether this parameter is actually a function parameter pack.
Represents a ValueDecl that came out of a declarator. Contains type source information through TypeSo...
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
void setTemplateParameterListsInfo(ASTContext &Context, unsigned NumTPLists, TemplateParameterList **TPLists)
const ASTTemplateArgumentListInfo * getTemplateSpecializationArgsAsWritten() const
Retrieve the template argument list as written in the sources, if any.
SourceLocation getTypeSpecStartLoc() const
static EmptyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L)
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this variable is an instantiation of a static data member of a class template specialization, retrieves the member specialization information.
bool isCXXInstanceMember() const
Determine whether the given declaration is an instance member of a C++ class.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
ID
Defines the set of possible language-specific address spaces.
StorageClass getStorageClass() const
Returns the storage class as written in the source. For the computed linkage of symbol, see getLinkage.
QualType getPointeeType() const
bool isCXXClassMember() const
Determine whether this declaration is a C++ class member.
FieldDecl(Kind DK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
static bool isKindReplaceableBy(Decl::Kind OldK, Decl::Kind NewK)
bool isGlobal() const
Determines whether this is a global function.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
ArrayRef< SourceLocation > getIdentifierLocs() const
Retrieves the locations of each of the identifiers that make up the complete module name in the impor...
const Type * getTypeForDecl() const
bool isExplicitSpecialization() const
static bool classofKind(Kind K)
VarDecl * getOutOfLineDefinition()
If this is a static data member, find its out-of-line definition.
void mergeExternalVisibility(Linkage L)
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
static bool hasExplicitVisibilityAlready(LVComputationKind computation)
Loading the external information has succeeded.
unsigned getParameterIndex(const ParmVarDecl *D) const
Used by ParmVarDecl to retrieve on the side the index of the parameter when it exceeds the size of th...
The external information has already been loaded, and therefore no additional processing is required...
bool isInAnonymousNamespace() const
static Optional< Visibility > getVisibilityOf(const NamedDecl *D, NamedDecl::ExplicitVisibilityKind kind)
Return the explicit visibility of the given declaration.
bool isImplicitlyInstantiable() const
Determines whether this function is a function template specialization or a member of a class templat...
DeclContext * getDeclContext()
static bool classofKind(Kind K)
This declaration is a tentative definition.
Decl * getPrimaryMergedDecl(Decl *D)
Get the primary declaration for a declaration from an AST file. That will be the first-loaded declara...
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
bool isInExternCContext() const
Determines whether this variable's context is, or is nested within, a C++ extern "C" linkage spec...
Defines the clang::TypeLoc interface and its subclasses.
TemplateOrSpecializationInfo getTemplateOrSpecializationInfo(const VarDecl *Var)
SourceRange getDefaultArgRange() const
Retrieve the source range that covers the entire default argument.
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
static bool RedeclForcesDefC99(const FunctionDecl *Redecl)
static const CXXRecordDecl * getOutermostEnclosingLambda(const CXXRecordDecl *Record)
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
StorageClass
Storage classes.
Expr * getUninstantiatedDefaultArg()
static Optional< Visibility > getExplicitVisibility(const NamedDecl *D, LVComputationKind kind)
bool isDependentType() const
bool isFunctionOrMethod() const
InClassInitStyle
In-class initialization styles for non-static data members.
static CapturedDecl * Create(ASTContext &C, DeclContext *DC, unsigned NumParams)
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
const TemplateArgument * data() const
Retrieve a pointer to the template argument list.
bool isExternallyVisible(Linkage L)
specific_decl_iterator< FieldDecl > field_iterator
const TemplateArgumentLoc * getTemplateArgs() const
Returns the explicit template arguments that were given.
DeclarationName getDeclName() const
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
Linkage getLinkageInternal() const
Determine what kind of linkage this entity has. This is not the linkage as defined by the standard or...
TagDecl * getDefinition() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Linkage getFormalLinkage() const
Get the linkage from a semantic point of view. Entities in anonymous namespaces are external (in c++9...
void setStorageClass(StorageClass SC)
ObjCStringFormatFamily getObjCFStringFormattingFamily() const
The result type of a method or function.
bool isInExternCContext() const
Determines whether this function's context is, or is nested within, a C++ extern "C" linkage spec...
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
bool checkInitIsICE() const
Determine whether the value of the initializer attached to this declaration is an integral constant e...
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
TypeSourceInfo * getTypeSourceInfo() const
static bool isNamed(const NamedDecl *ND, const char(&Str)[Len])
TypedefNameDecl * getTypedefNameForAnonDecl() const
VarDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
static LinkageInfo external()
const Expr * getAnyInitializer() const
Optional< Visibility > getExplicitVisibility(ExplicitVisibilityKind kind) const
If visibility was explicitly specified for this declaration, return that visibility.
VarDecl * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
bool EvaluateAsInitializer(APValue &Result, const ASTContext &Ctx, const VarDecl *VD, SmallVectorImpl< PartialDiagnosticAt > &Notes) const
Abstract interface for external sources of AST nodes.
BlockDecl(DeclContext *DC, SourceLocation CaretLoc)
bool doesThisDeclarationHaveABody() const
SourceRange getReturnTypeSourceRange() const
Attempt to compute an informative source range covering the function return type. This may omit quali...
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
NamedDecl * getInstantiatedFrom() const
Retrieve the member declaration from which this member was instantiated.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl. It will iterate at least once ...
static bool classof(const Decl *D)
static EnumConstantDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool hasOneOf(SanitizerMask K) const
Check if one or more sanitizers are enabled.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
bool mayInsertExtraPadding(bool EmitRemark=false) const
Whether we are allowed to insert extra padding between fields. These padding are added to help Addres...
bool isInjectedClassName() const
Determines whether this declaration represents the injected class name.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
static SourceLocation getTemplateOrInnerLocStart(const DeclT *decl)
static LinkageInfo getLVForDecl(const NamedDecl *D, LVComputationKind computation)
getLVForDecl - Get the linkage and visibility for the given declaration.
void AddDeallocation(void(*Callback)(void *), void *Data)
Add a deallocation callback that will be invoked when the ASTContext is destroyed.
SourceLocation getOuterLocStart() const
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
static EmptyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isAnonymousStructOrUnion() const
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
unsigned getNumParams() const
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
const Type * getTypePtr() const
static LVComputationKind withExplicitVisibilityAlready(LVComputationKind oldKind)
unsigned getBitWidthValue(const ASTContext &Ctx) const
bool isValid() const
Return true if this is a valid SourceLocation object.
OverloadedOperatorKind getCXXOverloadedOperator() const
TagDecl - Represents the declaration of a struct/union/class/enum.
LanguageLinkage
Describes the different kinds of language linkage (C++ [dcl.link]) that an entity may have...
ASTContext & getASTContext() const LLVM_READONLY
TagDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
llvm::APSInt EvaluateKnownConstInt(const ASTContext &Ctx, SmallVectorImpl< PartialDiagnosticAt > *Diag=nullptr) const
bool isMSExternInline() const
The combination of the extern and inline keywords under MSVC forces the function to be required...
void printName(raw_ostream &os) const
bool isLegalForVariable(StorageClass SC)
Checks whether the given storage class is legal for variables.
Represents a static or instance method of a struct/union/class.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool isIntegerConstantExpr(llvm::APSInt &Result, const ASTContext &Ctx, SourceLocation *Loc=nullptr, bool isEvaluated=true) const
ASTContext & getASTContext() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
unsigned getMemoryFunctionKind() const
Identify a memory copying or setting function. If the given function is a memory copy or setting func...
void setCachedLinkage(Linkage L) const
FunctionDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, const DeclarationNameInfo &NameInfo, QualType T, TypeSourceInfo *TInfo, StorageClass S, bool isInlineSpecified, bool isConstexprSpecified)
This declaration is only a declaration.
LinkageInfo getLinkageAndVisibility() const
Determines the linkage and visibility of this entity.
static FunctionDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Linkage getCachedLinkage() const
T * get(ExternalASTSource *Source) const
Retrieve the pointer to the AST node that this lazy pointer.
TypeLoc getReturnLoc() const
bool isFileContext() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
unsigned getBuiltinID() const
Returns a value indicating whether this function corresponds to a builtin function.
VarDecl * getInstantiatedFromStaticDataMember() const
If this variable is an instantiated static data member of a class template specialization, returns the templated static data member from which it was instantiated.
static ImportDecl * CreateImplicit(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, Module *Imported, SourceLocation EndLoc)
Create a new module import declaration for an implicitly-generated import.
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
FunctionDecl * getClassScopeSpecializationPattern(const FunctionDecl *FD)
bool hasCachedLinkage() const
Stmt * getBody() const override
void addSpecialization(FunctionTemplateSpecializationInfo *Info, void *InsertPos)
Add a specialization of this function template.
bool isExternCXXContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
QualType getType() const
Return the type wrapped by this type source info.
void setTemplateParameterListsInfo(ASTContext &Context, unsigned NumTPLists, TemplateParameterList **TPLists)
void printQualifiedName(raw_ostream &OS) const
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Represents a pointer type decayed from an array or function type.
static bool isDeclExternC(const T &D)
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the template specialization kind.
static TypeAliasDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
Defines various enumerations that describe declaration and type specifiers.
static const char * getStorageClassSpecifierString(StorageClass SC)
void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
For a static data member that was instantiated from a static data member of a class template...
static LinkageInfo getLVForType(const Type &T, LVComputationKind computation)
static TypedefDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
Base class for declarations which introduce a typedef-name.
TLS with a dynamic initializer.
Represents a template argument.
void setCapturedRecord()
Mark the record as a record for captured variables in CapturedStmt construct.
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl. It will iterate at least once ...
TagTypeKind
The kind of a tag type.
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
RecordDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl)
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
External linkage within a unique namespace.
static LinkageInfo getLVForTemplateParameterList(const TemplateParameterList *Params, LVComputationKind computation)
Get the most restrictive linkage for the types in the given template parameter list. For visibility purposes, template parameters are part of the signature of a template.
SourceLocation getLocStart() const LLVM_READONLY
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
The base class of all kinds of template declarations (e.g., class, function, etc.).
bool hasUnparsedDefaultArg() const
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
const unsigned IgnoreExplicitVisibilityBit
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
Do an LV computation when we only care about the linkage.
TemplateSpecializationKind getTemplateSpecializationKind() const
If this enumeration is a member of a specialization of a templated class, determine what kind of temp...
InitType Init
The initializer for this variable or, for a ParmVarDecl, the C++ default argument.
bool isInvalidDecl() const
ParmVarDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
bool isValid() const
Whether this pointer is non-NULL.
TypeLoc IgnoreParens() const
static bool shouldConsiderTemplateVisibility(const FunctionDecl *fn, const FunctionTemplateSpecializationInfo *specInfo)
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
bool hasWrittenPrototype() const
TLSKind
Kinds of thread-local storage.
void setDependentTemplateSpecialization(ASTContext &Context, const UnresolvedSetImpl &Templates, const TemplateArgumentListInfo &TemplateArgs)
Specifies that this function declaration is actually a dependent function template specialization...
ParmVarDeclBitfields ParmVarDeclBits
SourceLocation getLocStart() const LLVM_READONLY
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
static bool isSingleLineLanguageLinkage(const Decl &D)
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
bool isMsStruct(const ASTContext &C) const
static EnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl, bool IsScoped, bool IsScopedUsingClassTag, bool IsFixed)
SourceLocation getPointOfInstantiation() const
Retrieve the (first) point of instantiation of a function template specialization or a member of a cl...
DefinitionKind hasDefinition() const
static FileScopeAsmDecl * Create(ASTContext &C, DeclContext *DC, StringLiteral *Str, SourceLocation AsmLoc, SourceLocation RParenLoc)
static LabelDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isLambda() const
Determine whether this class describes a lambda function object.
static LabelDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdentL, IdentifierInfo *II)
SmallVector< Context, 8 > Contexts
bool isVisibilityExplicit() const
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
bool hasInheritedDefaultArg() const
bool SuppressUnwrittenScope
Suppress printing parts of scope specifiers that don't need to be written, e.g., for inline or anonym...
Not an overloaded operator.
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
static LinkageInfo getLVForNamespaceScopeDecl(const NamedDecl *D, LVComputationKind computation)
void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
Determine what kind of template instantiation this function represents.
QualType getCanonicalType() const
Decl::Kind getDeclKind() const
static ImplicitParamDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType T)
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member. If the point of instantiation is an invalid...
LanguageLinkage getLanguageLinkage() const
Compute the language linkage.
static ImplicitParamDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
static RecordDecl * CreateDeserialized(const ASTContext &C, unsigned ID)
void setInstantiationOfStaticDataMember(VarDecl *VD, TemplateSpecializationKind TSK)
Specify that this variable is an instantiation of the static data member VD.
LanguageLinkage getLanguageLinkage() const
Compute the language linkage.
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
static EnumDecl * CreateDeserialized(ASTContext &C, unsigned ID)
DeclContext * getRedeclContext()
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
The template argument is a type.
Internal linkage, which indicates that the entity can be referred to from within the translation unit...
static bool classofKind(Kind K)
void addDecl(Decl *D)
Add the declaration D into this context.
bool isStaticDataMember() const
Determines whether this is a static data member.
unsigned getFieldIndex() const
void merge(LinkageInfo other)
Merge both linkage and visibility.
SourceManager & getSourceManager()
Linkage getLinkage() const
Determine the linkage of this type.
std::string getQualifiedNameAsString() const
bool isInExternCXXContext() const
Determines whether this function's context is, or is nested within, a C++ extern "C++" linkage spec...
virtual bool isDefined() const
A template argument list.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
static bool isFirstInExternCContext(T *D)
static BlockDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L)
unsigned Hidden
Whether this declaration is hidden from normal name lookup, e.g., because it is was loaded from an AS...
NestedNameSpecifierLoc QualifierLoc
static FieldDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
const FieldDecl * findFirstNamedDataMember() const
Represents a C++ struct/union/class.
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
bool isTriviallyCopyable() const
Determine whether this class is considered trivially copyable per (C++11 [class]p6).
void setDescribedVarTemplate(VarTemplateDecl *Template)
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
static LinkageInfo getLVForTemplateArgumentList(ArrayRef< TemplateArgument > Args, LVComputationKind computation)
Get the most restrictive linkage for the types and declarations in the given template argument list...
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a static data member...
static TranslationUnitDecl * Create(ASTContext &C)
llvm::iterator_range< specific_attr_iterator< T > > specific_attrs() const
virtual bool isOutOfLine() const
bool isExpandedParameterPack() const
Whether this parameter is a template template parameter pack that has a known list of different templ...
static TypedefDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
void * Allocate(size_t Size, unsigned Align=8) const
ImplicitParamDecl(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType Type)
Provides information a specialization of a member of a class template, which may be a member function...
bool isReservedGlobalPlacementOperator() const
Determines whether this operator new or delete is one of the reserved global placement operators: voi...
No linkage according to the standard, but is visible from other translation units because of types de...
void setMSAsmLabel(StringRef Name)
VarDecl * getDefinition()
Builtin::Context & BuiltinInfo
Declaration of a class template.
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
void setCapturedVLAType(const VariableArrayType *VLAType)
Set the captured variable length array type for this field.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static BlockDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Defines the clang::TargetInfo interface.
static IndirectFieldDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, NamedDecl **CH, unsigned CHS)
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC...
TLS with a known-constant initializer.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Kind
Lists the kind of concrete classes of Decl.
static bool isRedeclarableImpl(Redeclarable< T > *)
VarDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass SC)
VarDeclBitfields VarDeclBits
FunctionDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
TranslationUnitDecl - The top declaration context.
Loading the external information has failed.
bool isStandardLayout() const
Determine whether this class has standard layout per (C++ [class]p7)
bool isInExternCXXContext() const
Determines whether this variable's context is, or is nested within, a C++ extern "C++" linkage spec...
NamedDecl * getMostRecentDecl()
DefinitionKind isThisDeclarationADefinition() const
EnumConstantDecl(DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, Expr *E, const llvm::APSInt &V)
static bool useInlineVisibilityHidden(const NamedDecl *D)
SourceLocation getInnerLocStart() const
static void PrintTemplateArgumentList(raw_ostream &OS, const TemplateArgument *Args, unsigned NumArgs, const PrintingPolicy &Policy, bool SkipBrackets=false)
Print a template argument list, including the '<' and '>' enclosing the template arguments...
A trivial tuple used to represent a source range.
SourceLocation getLocation() const
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
DeclarationNameInfo getNameInfo() const
FunctionDecl * getInstantiatedFromMemberFunction() const
If this function is an instantiation of a member function of a class template specialization, retrieves the function from which it was instantiated.
void mergeMaybeWithVisibility(LinkageInfo other, bool withVis)
Merge linkage and conditionally merge visibility.
static LinkageInfo none()
static bool classofKind(Kind K)
TypeSourceInfo * getTypeSourceInfo() const
static FieldDecl * Create(const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, Expr *BW, bool Mutable, InClassInitStyle InitStyle)
void setPointOfInstantiation(SourceLocation POI)
Set the first point of instantiation.
static bool hasDirectVisibilityAttribute(const NamedDecl *D, LVComputationKind computation)
bool hasTrivialBody() const
bool isExplicitSpecialization() const
static LinkageInfo uniqueExternal()
static Optional< Visibility > getExplicitVisibilityAux(const NamedDecl *ND, NamedDecl::ExplicitVisibilityKind kind, bool IsMostRecent)
FunctionDecl * getClassScopeSpecializationPattern() const
Retrieve the class scope template pattern that this function template specialization is instantiated ...
This class handles loading and caching of source files into memory.
Defines enum values for all the target-independent builtin functions.
Declaration of a template function.
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
const RecordDecl * getParent() const
Structure used to store a statement, the constant value to which it was evaluated (if any)...
OverloadedOperatorKind getOverloadedOperator() const
TemplatedKind
The kind of templated function a FunctionDecl can be.