53 #include "llvm/ADT/APSInt.h" 54 #include "llvm/ADT/ArrayRef.h" 55 #include "llvm/ADT/None.h" 56 #include "llvm/ADT/Optional.h" 57 #include "llvm/ADT/STLExtras.h" 58 #include "llvm/ADT/SmallVector.h" 59 #include "llvm/ADT/StringSwitch.h" 60 #include "llvm/ADT/StringRef.h" 61 #include "llvm/ADT/Triple.h" 62 #include "llvm/Support/Casting.h" 63 #include "llvm/Support/ErrorHandling.h" 64 #include "llvm/Support/raw_ostream.h" 72 #include <type_traits> 74 using namespace clang;
89 if (
auto *ND = dyn_cast_or_null<NamedDecl>(TheDecl)) {
100 return !getLexicalDeclContext()->Equals(getDeclContext());
103 TranslationUnitDecl::TranslationUnitDecl(
ASTContext &ctx)
174 "asking for explicit visibility when we shouldn't be");
181 return isa<TypeDecl>(D) ||
182 isa<ClassTemplateDecl>(D) ||
183 isa<ObjCInterfaceDecl>(D);
188 template <
class T>
static typename 189 std::enable_if<!std::is_base_of<RedeclarableTemplateDecl, T>::value,
bool>
::type 192 D->getMemberSpecializationInfo()) {
193 return member->isExplicitSpecialization();
209 switch (attr->getVisibility()) {
217 llvm_unreachable(
"bad visibility kind");
226 if (
const auto *A = D->
getAttr<TypeVisibilityAttr>()) {
232 if (
const auto *A = D->
getAttr<VisibilityAttr>()) {
243 return getTypeLinkageAndVisibility(&T);
249 LinkageInfo LinkageComputer::getLVForTemplateParameterList(
255 if (isa<TemplateTypeParmDecl>(
P))
262 if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(
P)) {
264 if (!NTTP->isExpandedParameterPack()) {
265 if (!NTTP->getType()->isDependentType()) {
266 LV.
merge(getLVForType(*NTTP->getType(), computation));
272 for (
unsigned i = 0, n = NTTP->getNumExpansionTypes(); i != n; ++i) {
275 LV.
merge(getTypeLinkageAndVisibility(type));
282 const auto *TTP = cast<TemplateTemplateParmDecl>(
P);
285 if (!TTP->isExpandedParameterPack()) {
286 LV.
merge(getLVForTemplateParameterList(TTP->getTemplateParameters(),
292 for (
unsigned i = 0, n = TTP->getNumExpansionTemplateParameters();
294 LV.
merge(getLVForTemplateParameterList(
295 TTP->getExpansionTemplateParameters(i), computation));
303 const Decl *Ret =
nullptr;
305 while (DC->
getDeclKind() != Decl::TranslationUnit) {
306 if (isa<FunctionDecl>(DC) || isa<BlockDecl>(DC))
307 Ret = cast<Decl>(DC);
324 switch (Arg.getKind()) {
331 LV.
merge(getLVForType(*Arg.getAsType(), computation));
337 LV.
merge(getLVForDecl(ND, computation));
342 LV.
merge(getTypeLinkageAndVisibility(Arg.getNullPtrType()));
348 Arg.getAsTemplateOrTemplatePattern().getAsTemplateDecl())
349 LV.
merge(getLVForDecl(Template, computation));
353 LV.
merge(getLVForTemplateArgumentList(Arg.getPackAsArray(), computation));
356 llvm_unreachable(
"bad template argument kind");
365 return getLVForTemplateArgumentList(TArgs.
asArray(), computation);
377 return !fn->
hasAttr<VisibilityAttr>();
387 void LinkageComputer::mergeTemplateLV(
391 bool considerVisibility =
402 LinkageInfo argsLV = getLVForTemplateArgumentList(templateArgs, computation);
455 void LinkageComputer::mergeTemplateLV(
473 LinkageInfo argsLV = getLVForTemplateArgumentList(templateArgs, computation);
474 if (considerVisibility)
507 void LinkageComputer::mergeTemplateLV(
LinkageInfo &LV,
525 LinkageInfo argsLV = getLVForTemplateArgumentList(templateArgs, computation);
526 if (considerVisibility)
534 if (!Opts.CPlusPlus || !Opts.InlineVisibilityHidden)
543 = FD->getTemplateSpecializationInfo()) {
546 FD->getMemberSpecializationInfo()) {
547 TSK = MSI->getTemplateSpecializationKind();
560 const T *
First = D->getFirstDecl();
561 return First->isInExternCContext();
565 if (
const auto *SD = dyn_cast<LinkageSpecDecl>(D.
getDeclContext()))
566 if (!SD->hasBraces())
582 llvm_unreachable(
"unexpected module ownership kind");
612 LinkageComputer::getLVForNamespaceScopeDecl(
const NamedDecl *D,
614 bool IgnoreVarTypeLinkage) {
616 "Not a name having namespace scope");
625 if (
const auto *Var = dyn_cast<VarDecl>(D)) {
635 if (Context.getLangOpts().CPlusPlus &&
636 Var->getType().isConstQualified() &&
637 !Var->getType().isVolatileQualified() &&
642 return getLVForDecl(PrevVar, computation);
644 if (Var->getStorageClass() !=
SC_Extern &&
653 Var->getStorageClass() ==
SC_None)
654 return getDeclLinkageAndVisibility(PrevVar);
656 if (PrevVar->getStorageClass() ==
SC_Static)
665 if (Function->getCanonicalDecl()->getStorageClass() ==
SC_Static)
667 }
else if (
const auto *IFD = dyn_cast<IndirectFieldDecl>(D)) {
669 const VarDecl *VD = IFD->getVarDecl();
670 assert(VD &&
"Expected a VarDecl in this IndirectFieldDecl!");
671 return getLVForNamespaceScopeDecl(VD, computation, IgnoreVarTypeLinkage);
673 assert(!isa<FieldDecl>(D) &&
"Didn't expect a FieldDecl!");
676 const auto *Var = dyn_cast<
VarDecl>(D);
705 !isa<TranslationUnitDecl>(DC);
721 ? Context.getLangOpts().getValueVisibilityMode()
722 : Context.getLangOpts().getTypeVisibilityMode();
738 if (
const auto *Var = dyn_cast<VarDecl>(D)) {
761 !IgnoreVarTypeLinkage) {
762 LinkageInfo TypeLV = getLVForType(*Var->getType(), computation);
779 if (
const auto *spec = dyn_cast<VarTemplateSpecializationDecl>(Var)) {
780 mergeTemplateLV(LV, spec, computation);
784 }
else if (
const auto *Function = dyn_cast<FunctionDecl>(D)) {
804 QualType TypeAsWritten = Function->getType();
806 TypeAsWritten = TSI->getType();
815 = Function->getTemplateSpecializationInfo()) {
816 mergeTemplateLV(LV, Function, specInfo, computation);
825 }
else if (
const auto *Tag = dyn_cast<TagDecl>(D)) {
827 if (!Tag->hasNameForLinkage())
833 if (
const auto *spec = dyn_cast<ClassTemplateSpecializationDecl>(Tag)) {
834 mergeTemplateLV(LV, spec, computation);
838 }
else if (isa<EnumConstantDecl>(D)) {
847 }
else if (
const auto *temp = dyn_cast<TemplateDecl>(D)) {
850 getLVForTemplateParameterList(temp->getTemplateParameters(), computation);
857 }
else if (isa<NamespaceDecl>(D)) {
862 }
else if (isa<ObjCInterfaceDecl>(D)) {
865 }
else if (
auto *TD = dyn_cast<TypedefNameDecl>(D)) {
868 if (!TD->getAnonDeclWithTypedefName(
true))
885 LinkageComputer::getLVForClassMember(
const NamedDecl *D,
887 bool IgnoreVarTypeLinkage) {
898 if (!(isa<CXXMethodDecl>(D) ||
901 isa<IndirectFieldDecl>(D) ||
903 isa<TemplateDecl>(D)))
929 getLVForDecl(cast<RecordDecl>(D->
getDeclContext()), classComputation);
941 const NamedDecl *explicitSpecSuppressor =
nullptr;
943 if (
const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
946 QualType TypeAsWritten = MD->getType();
948 TypeAsWritten = TSI->getType();
955 = MD->getTemplateSpecializationInfo()) {
956 mergeTemplateLV(LV, MD, spec, computation);
958 explicitSpecSuppressor = MD;
960 explicitSpecSuppressor = spec->getTemplate()->getTemplatedDecl();
963 explicitSpecSuppressor = MD;
966 }
else if (
const auto *RD = dyn_cast<CXXRecordDecl>(D)) {
967 if (
const auto *spec = dyn_cast<ClassTemplateSpecializationDecl>(RD)) {
968 mergeTemplateLV(LV, spec, computation);
970 explicitSpecSuppressor = spec;
978 explicitSpecSuppressor = RD;
982 }
else if (
const auto *VD = dyn_cast<VarDecl>(D)) {
983 if (
const auto *spec = dyn_cast<VarTemplateSpecializationDecl>(VD))
984 mergeTemplateLV(LV, spec, computation);
988 if (!IgnoreVarTypeLinkage) {
989 LinkageInfo typeLV = getLVForType(*VD->getType(), computation);
998 explicitSpecSuppressor = VD;
1002 }
else if (
const auto *temp = dyn_cast<TemplateDecl>(D)) {
1003 bool considerVisibility =
1008 getLVForTemplateParameterList(temp->getTemplateParameters(), computation);
1011 if (
const auto *redeclTemp = dyn_cast<RedeclarableTemplateDecl>(temp)) {
1013 explicitSpecSuppressor = temp->getTemplatedDecl();
1019 assert(!explicitSpecSuppressor || !isa<TemplateDecl>(explicitSpecSuppressor));
1023 bool considerClassVisibility =
true;
1024 if (explicitSpecSuppressor &&
1029 considerClassVisibility =
false;
1037 void NamedDecl::anchor() {}
1040 if (!hasCachedLinkage())
1046 return L == getCachedLinkage();
1053 if (name.front() ==
'C')
1054 if (name ==
"CFStringCreateWithFormat" ||
1055 name ==
"CFStringCreateWithFormatAndArguments" ||
1056 name ==
"CFStringAppendFormat" ||
1057 name ==
"CFStringAppendFormatAndArguments")
1077 bool IsMostRecent) {
1086 if (
const auto *RD = dyn_cast<CXXRecordDecl>(ND)) {
1088 if (InstantiatedFrom)
1095 if (
const auto *spec = dyn_cast<ClassTemplateSpecializationDecl>(ND)) {
1099 while (TD !=
nullptr) {
1103 TD = TD->getPreviousDecl();
1109 if (!IsMostRecent && !isa<NamespaceDecl>(ND)) {
1111 if (MostRecent != ND)
1115 if (
const auto *Var = dyn_cast<VarDecl>(ND)) {
1116 if (Var->isStaticDataMember()) {
1118 if (InstantiatedFrom)
1122 if (
const auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(Var))
1123 return getVisibilityOf(VTSD->getSpecializedTemplate()->getTemplatedDecl(),
1129 if (
const auto *fn = dyn_cast<FunctionDecl>(ND)) {
1134 return getVisibilityOf(templateInfo->getTemplate()->getTemplatedDecl(),
1140 if (InstantiatedFrom)
1147 if (
const auto *TD = dyn_cast<TemplateDecl>(ND))
1165 else if (isa<ParmVarDecl>(ContextDecl))
1169 Owner = cast<NamedDecl>(ContextDecl);
1178 auto *VD = dyn_cast<
VarDecl>(Owner);
1180 VD && VD->getType()->getContainedDeducedType()
1181 ? computeLVForDecl(Owner, computation,
true)
1182 : getLVForDecl(Owner, computation);
1189 OwnerLV.isVisibilityExplicit());
1194 if (
const auto *Function = dyn_cast<FunctionDecl>(D)) {
1195 if (Function->isInAnonymousNamespace() &&
1200 if (Function->getCanonicalDecl()->getStorageClass() ==
SC_Static)
1217 if (
const auto *Var = dyn_cast<VarDecl>(D)) {
1218 if (Var->hasExternalStorage()) {
1231 LinkageInfo PrevLV = getLVForDecl(Prev, computation);
1240 if (!Var->isStaticLocal())
1253 if (
const auto *BD = dyn_cast<BlockDecl>(OuterD)) {
1254 if (!BD->getBlockManglingNumber())
1257 LV = getLVForClosure(BD->getDeclContext()->getRedeclContext(),
1258 BD->getBlockManglingContextDecl(), computation);
1260 const auto *FD = cast<FunctionDecl>(OuterD);
1261 if (!FD->isInlined() &&
1265 LV = getLVForDecl(FD, computation);
1276 while (Record && Record->
isLambda()) {
1280 Record = dyn_cast_or_null<CXXRecordDecl>(
1288 bool IgnoreVarTypeLinkage) {
1290 if (D->
hasAttr<InternalLinkageAttr>())
1305 case Decl::ImplicitParam:
1307 case Decl::NamespaceAlias:
1310 case Decl::UsingShadow:
1311 case Decl::UsingDirective:
1314 case Decl::EnumConstant:
1317 return getLVForDecl(cast<EnumDecl>(D->
getDeclContext()), computation);
1321 case Decl::TypeAlias:
1324 if (!cast<TypedefNameDecl>(D)
1325 ->getAnonDeclWithTypedefName(
true))
1329 case Decl::TemplateTemplateParm:
1330 case Decl::NonTypeTemplateParm:
1331 case Decl::ObjCAtDefsField:
1332 case Decl::ObjCCategory:
1333 case Decl::ObjCCategoryImpl:
1334 case Decl::ObjCCompatibleAlias:
1335 case Decl::ObjCImplementation:
1336 case Decl::ObjCMethod:
1337 case Decl::ObjCProperty:
1338 case Decl::ObjCPropertyImpl:
1339 case Decl::ObjCProtocol:
1342 case Decl::CXXRecord: {
1343 const auto *Record = cast<CXXRecordDecl>(D);
1344 if (Record->isLambda()) {
1345 if (!Record->getLambdaManglingNumber()) {
1365 return getLVForClosure(
1376 return getLVForNamespaceScopeDecl(D, computation, IgnoreVarTypeLinkage);
1386 return getLVForClassMember(D, computation, IgnoreVarTypeLinkage);
1400 return getLVForLocalDecl(D, computation);
1411 if (D->
hasAttr<InternalLinkageAttr>())
1420 LinkageInfo LV = computeLVForDecl(D, computation);
1425 cache(D, computation, LV);
1432 if (!Opts.CPlusPlus || Opts.MicrosoftExt)
1440 auto *T = cast<NamedDecl>(I);
1443 if (!T->isInvalidDecl() && T->hasCachedLinkage()) {
1455 return getLVForDecl(D,
1462 Module *M = getOwningModule();
1482 if (
auto *ND = dyn_cast<NamedDecl>(
this))
1483 InternalLinkage = !ND->hasExternalFormalLinkage();
1486 InternalLinkage = (NSD && NSD->isAnonymousNamespace()) ||
1487 isInAnonymousNamespace();
1489 return InternalLinkage ? M->
Parent :
nullptr;
1493 llvm_unreachable(
"unknown module kind");
1501 std::string QualName;
1502 llvm::raw_string_ostream OS(QualName);
1503 printQualifiedName(OS, getASTContext().getPrintingPolicy());
1508 printQualifiedName(OS, getASTContext().getPrintingPolicy());
1516 if (
auto *MD = dyn_cast<ObjCMethodDecl>(
this))
1517 if (
auto *
ID = MD->getClassInterface())
1526 ContextsTy Contexts;
1530 if (isa<NamedDecl>(Ctx))
1531 Contexts.push_back(Ctx);
1535 for (
const DeclContext *DC : llvm::reverse(Contexts)) {
1536 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(DC)) {
1537 OS << Spec->getName();
1540 }
else if (
const auto *ND = dyn_cast<NamespaceDecl>(DC)) {
1542 (ND->isAnonymousNamespace() || ND->isInline()))
1544 if (ND->isAnonymousNamespace()) {
1546 :
"(anonymous namespace)");
1550 }
else if (
const auto *RD = dyn_cast<RecordDecl>(DC)) {
1551 if (!RD->getIdentifier())
1552 OS <<
"(anonymous " << RD->getKindName() <<
')';
1555 }
else if (
const auto *FD = dyn_cast<FunctionDecl>(DC)) {
1557 if (FD->hasWrittenPrototype())
1558 FT = dyn_cast<FunctionProtoType>(FD->getType()->castAs<
FunctionType>());
1563 for (
unsigned i = 0; i < NumParams; ++i) {
1566 OS << FD->getParamDecl(i)->getType().stream(P);
1576 }
else if (
const auto *ED = dyn_cast<EnumDecl>(DC)) {
1589 OS << *cast<NamedDecl>(DC);
1594 if (getDeclName() || isa<DecompositionDecl>(
this))
1597 OS <<
"(anonymous)";
1602 bool Qualified)
const {
1604 printQualifiedName(OS, Policy);
1615 #define DECL(Type, Base) \ 1617 return isRedeclarableImpl((Type##Decl *)nullptr); 1618 #define ABSTRACT_DECL(DECL) 1619 #include "clang/AST/DeclNodes.inc" 1621 llvm_unreachable(
"unknown decl kind");
1625 assert(getDeclName() == OldD->
getDeclName() &&
"Declaration name mismatch");
1637 if (isa<ObjCMethodDecl>(
this))
1642 if (isa<ParmVarDecl>(
this))
1648 if (!this->getDeclContext()->getRedeclContext()->Equals(
1654 if (
auto *UD = dyn_cast<UsingDecl>(
this)) {
1658 cast<UsingDecl>(OldD)->getQualifier());
1660 if (
auto *UUVD = dyn_cast<UnresolvedUsingValueDecl>(
this)) {
1664 cast<UnresolvedUsingValueDecl>(OldD)->getQualifier());
1677 for (
auto D : redecls()) {
1704 NamedDecl *NamedDecl::getUnderlyingDeclImpl() {
1706 while (
auto *UD = dyn_cast<UsingShadowDecl>(ND))
1707 ND = UD->getTargetDecl();
1709 if (
auto *AD = dyn_cast<ObjCCompatibleAliasDecl>(ND))
1710 return AD->getClassInterface();
1712 if (
auto *AD = dyn_cast<NamespaceAliasDecl>(ND))
1713 return AD->getNamespace();
1719 if (!isCXXClassMember())
1723 if (isa<UsingShadowDecl>(D))
1724 D = cast<UsingShadowDecl>(D)->getTargetDecl();
1726 if (isa<FieldDecl>(D) || isa<IndirectFieldDecl>(D) || isa<MSPropertyDecl>(D))
1728 if (
const auto *MD = dyn_cast_or_null<CXXMethodDecl>(D->
getAsFunction()))
1729 return MD->isInstance();
1737 template <
typename DeclT>
1739 if (decl->getNumTemplateParameterLists() > 0)
1740 return decl->getTemplateParameterList(0)->getTemplateLoc();
1742 return decl->getInnerLocStart();
1754 if (!hasExtInfo()) {
1758 DeclInfo =
new (getASTContext()) ExtInfo;
1760 getExtInfo()->TInfo = savedTInfo;
1763 getExtInfo()->QualifierLoc = QualifierLoc;
1767 if (getExtInfo()->NumTemplParamLists == 0) {
1771 getASTContext().Deallocate(getExtInfo());
1773 DeclInfo = savedTInfo;
1776 getExtInfo()->QualifierLoc = QualifierLoc;
1783 assert(!TPLists.empty());
1785 if (!hasExtInfo()) {
1789 DeclInfo =
new (getASTContext()) ExtInfo;
1791 getExtInfo()->TInfo = savedTInfo;
1794 getExtInfo()->setTemplateParameterListsInfo(Context, TPLists);
1810 QT = cast<PointerType>(T)->getPointeeType();
1812 case Type::BlockPointer:
1813 QT = cast<BlockPointerType>(T)->getPointeeType();
1815 case Type::MemberPointer:
1816 QT = cast<MemberPointerType>(T)->getPointeeType();
1818 case Type::LValueReference:
1819 case Type::RValueReference:
1820 QT = cast<ReferenceType>(T)->getPointeeType();
1822 case Type::PackExpansion:
1823 QT = cast<PackExpansionType>(T)->getPattern();
1826 case Type::ConstantArray:
1827 case Type::DependentSizedArray:
1828 case Type::IncompleteArray:
1829 case Type::VariableArray:
1830 case Type::FunctionProto:
1831 case Type::FunctionNoProto:
1843 RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();
1851 if (NumTemplParamLists > 0) {
1853 TemplParamLists =
nullptr;
1854 NumTemplParamLists = 0;
1857 if (!TPLists.empty()) {
1859 NumTemplParamLists = TPLists.size();
1860 std::copy(TPLists.begin(), TPLists.end(), TemplParamLists);
1878 llvm_unreachable(
"Invalid storage class");
1887 static_assert(
sizeof(VarDeclBitfields) <=
sizeof(
unsigned),
1888 "VarDeclBitfields too large!");
1890 "ParmVarDeclBitfields too large!");
1892 "NonParmVarDeclBitfields too large!");
1902 return new (
C, DC)
VarDecl(Var, C, DC, StartL, IdL, Id, T, TInfo, S);
1919 if (!hasAttr<ThreadAttr>() &&
1922 hasAttr<OMPThreadPrivateDeclAttr>()))
1924 return ((
getASTContext().getLangOpts().isCompatibleWithMSVC(
1926 hasAttr<OMPThreadPrivateDeclAttr>())
1935 llvm_unreachable(
"Unknown thread storage class specifier!");
1949 template<
typename T>
1953 if (!D.hasExternalFormalLinkage())
1977 template<
typename T>
1983 assert(D.getASTContext().getLangOpts().CPlusPlus);
2038 isa<VarTemplatePartialSpecializationDecl>(
this)))
2058 if (
const auto *SAA = getAttr<SelectAnyAttr>())
2059 if (!SAA->isInherited())
2065 if (
auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(
this)) {
2067 !isa<VarTemplatePartialSpecializationDecl>(VTSD) &&
2068 !VTSD->IsCompleteDefinition)
2100 VarDecl *LastTentative =
nullptr;
2102 for (
auto I : First->
redecls()) {
2103 Kind = I->isThisDeclarationADefinition();
2109 return LastTentative;
2114 for (
auto I : First->
redecls()) {
2115 if (I->isThisDeclarationADefinition(C) ==
Definition)
2125 for (
auto I : First->
redecls()) {
2126 Kind =
std::max(Kind, I->isThisDeclarationADefinition(C));
2136 if (
auto Expr = I->getInit()) {
2145 if (
auto *
P = dyn_cast<ParmVarDecl>(
this))
2146 if (
P->hasUnparsedDefaultArg() ||
P->hasUninstantiatedDefaultArg())
2149 return !
Init.isNull();
2156 if (
auto *S =
Init.dyn_cast<
Stmt *>())
2157 return cast<Expr>(S);
2166 return Init.getAddrOfPtr1();
2180 return VD->isOutOfLine();
2187 Eval->~EvaluatedStmt();
2197 if (!Lang.CPlusPlus)
2202 if (Lang.CPlusPlus11 &&
getType()->isReferenceType())
2208 if (!
getType().isConstQualified() ||
getType().isVolatileQualified())
2213 if (
getType()->isIntegralOrEnumerationType())
2253 const auto *
Init = cast<Expr>(Eval->
Value);
2254 assert(!
Init->isValueDependent());
2259 Eval->
IsICE =
false;
2283 Eval->
IsICE = Result && Notes.empty();
2286 return Result ? &Eval->
Evaluated :
nullptr;
2291 if (Eval->WasEvaluated)
2292 return &Eval->Evaluated;
2299 return Eval->CheckedICE;
2306 "Check whether we already know that the initializer is an ICE");
2321 const auto *
Init = cast<Expr>(Eval->
Value);
2322 assert(!
Init->isValueDependent());
2346 template<
typename DeclT>
2349 if (
auto *Def = D->getDefinition())
2357 if (
auto *VDTemplSpec = dyn_cast<VarTemplateSpecializationDecl>(
this)) {
2358 auto From = VDTemplSpec->getInstantiatedFrom();
2360 while (
auto *NewVTD = VTD->getInstantiatedFromMemberTemplate()) {
2361 if (NewVTD->isMemberSpecialization())
2369 while (
auto *NewVTPSD = VTPSD->getInstantiatedFromMember()) {
2370 if (NewVTPSD->isMemberSpecialization())
2374 return getDefinitionOrSelf<VarDecl>(VTPSD);
2388 while (VarTemplate->getInstantiatedFromMemberTemplate()) {
2389 if (VarTemplate->isMemberSpecialization())
2391 VarTemplate = VarTemplate->getInstantiatedFromMemberTemplate();
2401 return cast<VarDecl>(MSI->getInstantiatedFrom());
2407 if (
const auto *Spec = dyn_cast<VarTemplateSpecializationDecl>(
this))
2408 return Spec->getSpecializationKind();
2411 return MSI->getTemplateSpecializationKind();
2417 if (
const auto *Spec = dyn_cast<VarTemplateSpecializationDecl>(
this))
2418 return Spec->getPointOfInstantiation();
2421 return MSI->getPointOfInstantiation();
2444 if (LangOpts.CUDA && !LangOpts.CUDARelocatableDeviceCode &&
2446 isa<IncompleteArrayType>(
getType()))
2463 assert((isa<VarTemplateSpecializationDecl>(
this) ||
2465 "not a variable or static data member template specialization");
2468 dyn_cast<VarTemplateSpecializationDecl>(
this)) {
2469 Spec->setSpecializationKind(TSK);
2471 Spec->getPointOfInstantiation().isInvalid()) {
2472 Spec->setPointOfInstantiation(PointOfInstantiation);
2474 L->InstantiationRequested(
this);
2479 MSI->setTemplateSpecializationKind(TSK);
2481 MSI->getPointOfInstantiation().isInvalid()) {
2482 MSI->setPointOfInstantiation(PointOfInstantiation);
2484 L->InstantiationRequested(
this);
2492 assert(
getASTContext().getTemplateOrSpecializationInfo(
this).isNull() &&
2493 "Previous template or instantiation?");
2506 return new (
C, DC)
ParmVarDecl(ParmVar, C, DC, StartLoc, IdLoc, Id, T, TInfo,
2513 if (
const auto *DT = dyn_cast<DecayedType>(T))
2514 return DT->getOriginalType();
2525 if (!hasInheritedDefaultArg()) {
2540 assert(!hasUnparsedDefaultArg() &&
"Default argument is not yet parsed!");
2541 assert(!hasUninstantiatedDefaultArg() &&
2542 "Default argument is not yet instantiated!");
2545 if (
auto *E = dyn_cast_or_null<ExprWithCleanups>(Arg))
2546 return E->getSubExpr();
2564 return getUninstantiatedDefaultArg()->getSourceRange();
2568 return E->getSourceRange();
2573 llvm_unreachable(
"Invalid default argument kind.");
2582 assert(hasUninstantiatedDefaultArg() &&
2583 "Wrong kind of initialization expression!");
2584 return cast_or_null<Expr>(
Init.get<
Stmt *>());
2591 return hasUnparsedDefaultArg() || hasUninstantiatedDefaultArg() ||
2596 return isa<PackExpansionType>(
getType());
2599 void ParmVarDecl::setParameterIndexLarge(
unsigned parameterIndex) {
2604 unsigned ParmVarDecl::getParameterIndexLarge()
const {
2613 raw_ostream &OS,
const PrintingPolicy &Policy,
bool Qualified)
const {
2621 if (
const auto *FT =
getType()->getAs<FunctionProtoType>())
2622 return FT->isVariadic();
2628 if (I->doesThisDeclarationHaveABody()) {
2646 if (isa<CompoundStmt>(S) && cast<CompoundStmt>(S)->body_empty())
2653 if (I->isThisDeclarationADefinition()) {
2666 if (Definition->Body)
2682 Parent->markedVirtualFunctionPure();
2685 template<std::
size_t Len>
2688 return II && II->
isStr(Str);
2716 return llvm::StringSwitch<bool>(
getName())
2728 assert(
getDeclName().getCXXOverloadedOperator() == OO_New ||
2729 getDeclName().getCXXOverloadedOperator() == OO_Delete ||
2730 getDeclName().getCXXOverloadedOperator() == OO_Array_New ||
2731 getDeclName().getCXXOverloadedOperator() == OO_Array_Delete);
2737 if (proto->getNumParams() != 2 || proto->isVariadic())
2746 return (proto->getParamType(1).getCanonicalType() == Context.
VoidPtrTy);
2752 if (
getDeclName().getCXXOverloadedOperator() != OO_New &&
2753 getDeclName().getCXXOverloadedOperator() != OO_Delete &&
2754 getDeclName().getCXXOverloadedOperator() != OO_Array_New &&
2755 getDeclName().getCXXOverloadedOperator() != OO_Array_Delete)
2766 if (FPT->getNumParams() == 0 || FPT->getNumParams() > 3 || FPT->isVariadic())
2771 if (FPT->getNumParams() == 1)
2774 unsigned Params = 1;
2775 QualType Ty = FPT->getParamType(Params);
2778 auto Consume = [&] {
2780 Ty = Params < FPT->getNumParams() ? FPT->getParamType(Params) :
QualType();
2784 bool IsSizedDelete =
false;
2789 IsSizedDelete =
true;
2812 return Params == FPT->getNumParams();
2820 if (!isa<CXXMethodDecl>(
this) || getOverloadedOperator() != OO_Delete ||
2824 auto *RD = getParamDecl(1)->getType()->getAsCXXRecordDecl();
2825 return RD && RD->isInStdNamespace() && RD->getIdentifier() &&
2826 RD->getIdentifier()->isStr(
"destroying_delete_t");
2846 if (
const auto *Method = dyn_cast<CXXMethodDecl>(
this))
2847 return Method->isStatic();
2855 if (
const auto *Namespace = cast<NamespaceDecl>(DC)) {
2856 if (!Namespace->getDeclName())
2866 if (hasAttr<NoReturnAttr>() || hasAttr<CXX11NoReturnAttr>() ||
2867 hasAttr<C11NoReturnAttr>())
2870 if (
auto *FnTy =
getType()->getAs<FunctionType>())
2871 return FnTy->getNoReturnAttr();
2877 return isMultiVersion() && hasAttr<CPUDispatchAttr>();
2881 return isMultiVersion() && hasAttr<CPUSpecificAttr>();
2891 assert((!PrevDecl || PrevFunTmpl) &&
"Function/function template mismatch");
2892 FunTmpl->setPreviousDecl(PrevFunTmpl);
2895 if (PrevDecl && PrevDecl->IsInline)
2920 const auto *LinkageDecl =
2927 if (BuiltinID == Builtin::BI__GetExceptionInfo &&
2929 return Builtin::BI__GetExceptionInfo;
2938 if (hasAttr<OverloadableAttr>())
2960 if (Context.
getLangOpts().CUDA && hasAttr<CUDADeviceAttr>() &&
2961 !hasAttr<CUDAHostAttr>() &&
2962 !(BuiltinID == Builtin::BIprintf || BuiltinID == Builtin::BImalloc))
2978 assert(!ParamInfo &&
"Already has param info!");
2979 assert(NewParamInfo.size() == getNumParams() &&
"Parameter count mismatch!");
2982 if (!NewParamInfo.empty()) {
2984 std::copy(NewParamInfo.begin(), NewParamInfo.end(), ParamInfo);
2994 return getNumParams();
2996 unsigned NumRequiredArgs = 0;
2997 for (
auto *Param : parameters())
2998 if (!Param->isParameterPack() && !Param->hasDefaultArg())
3000 return NumRequiredArgs;
3009 assert(isInlined() &&
"expected to get called on an inlined function!");
3013 !hasAttr<DLLExportAttr>())
3018 if (!FD->isImplicit() && FD->getStorageClass() ==
SC_Extern)
3030 if (!FD->isImplicit() && FD->getStorageClass() ==
SC_Extern)
3059 assert(!doesThisDeclarationHaveABody() &&
3060 "Must have a declaration without a body.");
3071 if (Context.
getLangOpts().GNUInline || hasAttr<GNUInlineAttr>()) {
3081 bool FoundBody =
false;
3083 FoundBody |= Prev->Body.
isValid();
3109 bool FoundBody =
false;
3111 FoundBody |= Prev->Body.
isValid();
3151 QualType RetType = getReturnType();
3153 if (
const auto *R = Ret->getAttr<WarnUnusedResultAttr>())
3156 if (
const EnumDecl *ED = ET->getDecl()) {
3157 if (
const auto *R = ED->getAttr<WarnUnusedResultAttr>())
3161 return getAttr<WarnUnusedResultAttr>();
3182 assert((doesThisDeclarationHaveABody() || willHaveBody()) &&
3183 "Must be a function definition");
3184 assert(isInlined() &&
"Function must be inline");
3187 if (Context.
getLangOpts().GNUInline || hasAttr<GNUInlineAttr>()) {
3199 for (
auto Redecl :
redecls()) {
3200 if (Redecl->isInlineSpecified() &&
3210 "should not use C inline rules in C++");
3216 for (
auto Redecl :
redecls()) {
3247 if (TemplateOrSpecialization.isNull())
3248 return TK_NonTemplate;
3250 return TK_FunctionTemplate;
3252 return TK_MemberSpecialization;
3254 return TK_FunctionTemplateSpecialization;
3255 if (TemplateOrSpecialization.is
3257 return TK_DependentFunctionTemplateSpecialization;
3259 llvm_unreachable(
"Did we miss a TemplateOrSpecialization type?");
3264 return cast<FunctionDecl>(Info->getInstantiatedFrom());
3274 FunctionDecl::setInstantiationOfMemberFunction(
ASTContext &C,
3277 assert(TemplateOrSpecialization.isNull() &&
3278 "Member function is already a specialization");
3281 TemplateOrSpecialization = Info;
3289 TemplateOrSpecialization = Template;
3308 return getClassScopeSpecializationPattern() !=
nullptr;
3317 bool HasPattern =
false;
3319 HasPattern = PatternDecl->
hasBody(PatternDecl);
3325 if (!HasPattern || !PatternDecl)
3341 llvm_unreachable(
"All TSK values handled.");
3347 if (
auto *Spec = getClassScopeSpecializationPattern())
3362 dyn_cast<CXXMethodDecl>(
this))) {
3363 assert(getPrimaryTemplate() &&
"not a generic lambda call operator?");
3368 while (Primary->getInstantiatedFromMemberTemplate()) {
3371 if (Primary->isMemberSpecialization())
3373 Primary = Primary->getInstantiatedFromMemberTemplate();
3379 if (
auto *MFD = getInstantiatedFromMemberFunction())
3387 = TemplateOrSpecialization
3388 .dyn_cast<FunctionTemplateSpecializationInfo*>()) {
3389 return Info->Template.getPointer();
3400 return TemplateOrSpecialization
3407 = TemplateOrSpecialization
3408 .dyn_cast<FunctionTemplateSpecializationInfo*>()) {
3409 return Info->TemplateArguments;
3417 = TemplateOrSpecialization
3418 .dyn_cast<FunctionTemplateSpecializationInfo*>()) {
3419 return Info->TemplateArgumentsAsWritten;
3425 FunctionDecl::setFunctionTemplateSpecialization(
ASTContext &C,
3433 "Must specify the type of function template specialization");
3439 TemplateArgsAsWritten,
3440 PointOfInstantiation);
3441 TemplateOrSpecialization = Info;
3449 assert(TemplateOrSpecialization.isNull());
3453 TemplateOrSpecialization = Info;
3458 return TemplateOrSpecialization
3467 totalSizeToAlloc<TemplateArgumentLoc, FunctionTemplateDecl *>(
3472 DependentFunctionTemplateSpecializationInfo::
3476 NumTemplates = Ts.
size();
3477 NumArgs = TArgs.
size();
3480 for (
unsigned I = 0, E = Ts.
size(); I != E; ++I)
3484 for (
unsigned I = 0, E = TArgs.
size(); I != E; ++I)
3508 = TemplateOrSpecialization.dyn_cast<
3510 FTSInfo->setTemplateSpecializationKind(TSK);
3512 PointOfInstantiation.
isValid() &&
3513 FTSInfo->getPointOfInstantiation().isInvalid()) {
3514 FTSInfo->setPointOfInstantiation(PointOfInstantiation);
3516 L->InstantiationRequested(
this);
3520 MSInfo->setTemplateSpecializationKind(TSK);
3522 PointOfInstantiation.
isValid() &&
3523 MSInfo->getPointOfInstantiation().isInvalid()) {
3524 MSInfo->setPointOfInstantiation(PointOfInstantiation);
3526 L->InstantiationRequested(
this);
3529 llvm_unreachable(
"Function cannot have a template specialization kind");
3534 = TemplateOrSpecialization.dyn_cast<
3536 return FTSInfo->getPointOfInstantiation();
3539 return MSInfo->getPointOfInstantiation();
3550 if (
FunctionDecl *FD = getInstantiatedFromMemberFunction()) {
3560 if (FunTmpl->getTemplatedDecl()->hasBody(Definition))
3578 switch (getBuiltinID()) {
3579 case Builtin::BI__builtin_memset:
3580 case Builtin::BI__builtin___memset_chk:
3581 case Builtin::BImemset:
3582 return Builtin::BImemset;
3584 case Builtin::BI__builtin_memcpy:
3585 case Builtin::BI__builtin___memcpy_chk:
3586 case Builtin::BImemcpy:
3587 return Builtin::BImemcpy;
3589 case Builtin::BI__builtin_memmove:
3590 case Builtin::BI__builtin___memmove_chk:
3591 case Builtin::BImemmove:
3592 return Builtin::BImemmove;
3594 case Builtin::BIstrlcpy:
3595 case Builtin::BI__builtin___strlcpy_chk:
3596 return Builtin::BIstrlcpy;
3598 case Builtin::BIstrlcat:
3599 case Builtin::BI__builtin___strlcat_chk:
3600 return Builtin::BIstrlcat;
3602 case Builtin::BI__builtin_memcmp:
3603 case Builtin::BImemcmp:
3604 return Builtin::BImemcmp;
3606 case Builtin::BI__builtin_strncpy:
3607 case Builtin::BI__builtin___strncpy_chk:
3608 case Builtin::BIstrncpy:
3609 return Builtin::BIstrncpy;
3611 case Builtin::BI__builtin_strncmp:
3612 case Builtin::BIstrncmp:
3613 return Builtin::BIstrncmp;
3615 case Builtin::BI__builtin_strncasecmp:
3616 case Builtin::BIstrncasecmp:
3617 return Builtin::BIstrncasecmp;
3619 case Builtin::BI__builtin_strncat:
3620 case Builtin::BI__builtin___strncat_chk:
3621 case Builtin::BIstrncat:
3622 return Builtin::BIstrncat;
3624 case Builtin::BI__builtin_strndup:
3625 case Builtin::BIstrndup:
3626 return Builtin::BIstrndup;
3628 case Builtin::BI__builtin_strlen:
3629 case Builtin::BIstrlen:
3630 return Builtin::BIstrlen;
3632 case Builtin::BI__builtin_bzero:
3633 case Builtin::BIbzero:
3634 return Builtin::BIbzero;
3638 if (FnInfo->
isStr(
"memset"))
3639 return Builtin::BImemset;
3640 else if (FnInfo->
isStr(
"memcpy"))
3641 return Builtin::BImemcpy;
3642 else if (FnInfo->
isStr(
"memmove"))
3643 return Builtin::BImemmove;
3644 else if (FnInfo->
isStr(
"memcmp"))
3645 return Builtin::BImemcmp;
3646 else if (FnInfo->
isStr(
"strncpy"))
3647 return Builtin::BIstrncpy;
3648 else if (FnInfo->
isStr(
"strncmp"))
3649 return Builtin::BIstrncmp;
3650 else if (FnInfo->
isStr(
"strncasecmp"))
3651 return Builtin::BIstrncasecmp;
3652 else if (FnInfo->
isStr(
"strncat"))
3653 return Builtin::BIstrncat;
3654 else if (FnInfo->
isStr(
"strndup"))
3655 return Builtin::BIstrndup;
3656 else if (FnInfo->
isStr(
"strlen"))
3657 return Builtin::BIstrlen;
3658 else if (FnInfo->
isStr(
"bzero"))
3659 return Builtin::BIbzero;
3675 if (
auto *FT = getInstantiatedFromMemberFunction()) {
3697 return new (
C, DC)
FieldDecl(Decl::Field, DC, StartLoc, IdLoc, Id, T, TInfo,
3698 BW, Mutable, InitStyle);
3711 if (
const auto *Record =
getType()->getAs<RecordType>())
3712 return Record->getDecl()->isAnonymousStructOrUnion();
3718 assert(isBitField() &&
"not a bitfield");
3719 return getBitWidth()->EvaluateKnownConstInt(Ctx).getZExtValue();
3723 return isUnnamedBitfield() && !getBitWidth()->isValueDependent() &&
3724 getBitWidthValue(Ctx) == 0;
3729 if (Canonical !=
this)
3732 if (CachedFieldIndex)
return CachedFieldIndex - 1;
3736 assert(RD &&
"requested index for field of struct with no definition");
3738 for (
auto *Field : RD->
fields()) {
3739 Field->getCanonicalDecl()->CachedFieldIndex = Index + 1;
3743 assert(CachedFieldIndex &&
"failed to find field in parent");
3744 return CachedFieldIndex - 1;
3748 const Expr *FinalExpr = getInClassInitializer();
3750 FinalExpr = getBitWidth();
3757 assert((getParent()->isLambda() || getParent()->isCapturedRecord()) &&
3758 "capturing type in non-lambda or captured record.");
3759 assert(InitStorage.getInt() == ISK_NoInit &&
3760 InitStorage.getPointer() ==
nullptr &&
3761 "bit width, initializer or captured type already set");
3762 InitStorage.setPointerAndInt(const_cast<VariableArrayType *>(VLAType),
3763 ISK_CapturedVLAType);
3783 TypedefNameDeclOrQualifier = TDD;
3784 if (
const Type *T = getTypeForDecl()) {
3792 IsBeingDefined =
true;
3794 if (
auto *D = dyn_cast<CXXRecordDecl>(
this)) {
3795 struct CXXRecordDecl::DefinitionData *Data =
3796 new (
getASTContext())
struct CXXRecordDecl::DefinitionData(D);
3798 cast<CXXRecordDecl>(I)->DefinitionData = Data;
3803 assert((!isa<CXXRecordDecl>(
this) ||
3805 "definition completed but not started");
3807 IsCompleteDefinition =
true;
3808 IsBeingDefined =
false;
3811 L->CompletedTagDefinition(
this);
3815 if (isCompleteDefinition())
3816 return const_cast<TagDecl *
>(
this);
3819 if (MayHaveOutOfDateDef) {
3821 if (II->isOutOfDate()) {
3827 if (
const auto *CXXRD = dyn_cast<CXXRecordDecl>(
this))
3828 return CXXRD->getDefinition();
3831 if (R->isCompleteDefinition())
3847 if (getExtInfo()->NumTemplParamLists == 0) {
3852 getExtInfo()->QualifierLoc = QualifierLoc;
3859 assert(!TPLists.empty());
3872 void EnumDecl::anchor() {}
3878 bool IsScopedUsingClassTag,
bool IsFixed) {
3879 auto *
Enum =
new (
C, DC)
EnumDecl(C, DC, StartLoc, IdLoc, Id, PrevDecl,
3880 IsScoped, IsScopedUsingClassTag, IsFixed);
3889 nullptr,
nullptr,
false,
false,
false);
3896 return TI->getTypeLoc().getSourceRange();
3902 unsigned NumPositiveBits,
3903 unsigned NumNegativeBits) {
3904 assert(!isCompleteDefinition() &&
"Cannot redefine enums!");
3907 PromotionType = NewPromotionType;
3908 setNumPositiveBits(NumPositiveBits);
3909 setNumNegativeBits(NumNegativeBits);
3914 if (
const auto *A = getAttr<EnumExtensibilityAttr>())
3915 return A->getExtensibility() == EnumExtensibilityAttr::Closed;
3920 return isClosed() && hasAttr<FlagEnumAttr>();
3924 return isClosed() && !hasAttr<FlagEnumAttr>();
3929 return MSI->getTemplateSpecializationKind();
3937 assert(MSI &&
"Not an instantiated member enumeration?");
3940 PointOfInstantiation.
isValid() &&
3948 EnumDecl *ED = getInstantiatedFromMemberEnum();
3956 "couldn't find pattern for enum instantiation");
3961 if (SpecializationInfo)
3962 return cast<EnumDecl>(SpecializationInfo->getInstantiatedFrom());
3969 assert(!SpecializationInfo &&
"Member enum is already a specialization");
3992 :
TagDecl(DK, TK, C, DC, IdLoc, Id, PrevDecl, StartLoc),
3993 HasFlexibleArrayMember(
false), AnonymousStructOrUnion(
false),
3994 HasObjectMember(
false), HasVolatileMember(
false),
3995 LoadedFieldsFromExternalStorage(
false),
3996 NonTrivialToPrimitiveDefaultInitialize(
false),
3997 NonTrivialToPrimitiveCopy(
false), NonTrivialToPrimitiveDestroy(
false),
3998 ParamDestroyedInCallee(
false), ArgPassingRestrictions(APK_CanPassInRegs) {
3999 assert(
classof(static_cast<Decl*>(
this)) &&
"Invalid Kind!");
4006 StartLoc, IdLoc, Id, PrevDecl);
4027 if (
auto RD = dyn_cast<CXXRecordDecl>(
this))
4028 return RD->isLambda();
4033 return hasAttr<CapturedRecordAttr>();
4042 LoadFieldsFromExternalStorage();
4058 return hasAttr<MSStructAttr>() || C.
getLangOpts().MSBitfields == 1;
4061 void RecordDecl::LoadFieldsFromExternalStorage()
const {
4069 LoadedFieldsFromExternalStorage =
true;
4076 for (
unsigned i=0, e=Decls.size(); i != e; ++i)
4077 assert(isa<FieldDecl>(Decls[i]) || isa<IndirectFieldDecl>(Decls[i]));
4090 (SanitizerKind::Address | SanitizerKind::KernelAddress);
4091 if (!EnabledAsanMask || !Context.
getLangOpts().SanitizeAddressFieldPadding)
4096 int ReasonToReject = -1;
4097 if (!CXXRD || CXXRD->isExternCContext())
4099 else if (CXXRD->hasAttr<PackedAttr>())
4101 else if (CXXRD->isUnion())
4103 else if (CXXRD->isTriviallyCopyable())
4105 else if (CXXRD->hasTrivialDestructor())
4107 else if (CXXRD->isStandardLayout())
4109 else if (Blacklist.isBlacklistedLocation(EnabledAsanMask,
getLocation(),
4112 else if (Blacklist.isBlacklistedType(EnabledAsanMask,
4118 if (ReasonToReject >= 0)
4121 diag::remark_sanitize_address_insert_extra_padding_rejected)
4126 diag::remark_sanitize_address_insert_extra_padding_accepted)
4129 return ReasonToReject < 0;
4133 for (
const auto *I :
fields()) {
4134 if (I->getIdentifier())
4137 if (
const auto *RT = I->getType()->getAs<
RecordType>())
4139 RT->getDecl()->findFirstNamedDataMember())
4140 return NamedDataMember;
4152 assert(!ParamInfo &&
"Already has param info!");
4155 if (!NewParamInfo.empty()) {
4156 NumParams = NewParamInfo.size();
4158 std::copy(NewParamInfo.begin(), NewParamInfo.end(), ParamInfo);
4163 bool CapturesCXXThis) {
4164 this->CapturesCXXThis = CapturesCXXThis;
4165 this->NumCaptures = Captures.size();
4167 if (Captures.empty()) {
4168 this->Captures =
nullptr;
4172 this->Captures = Captures.copy(Context).data();
4176 for (
const auto &I : captures())
4178 if (I.getVariable() == variable)
4192 void TranslationUnitDecl::anchor() {}
4198 void PragmaCommentDecl::anchor() {}
4206 new (
C, DC, additionalSizeToAlloc<char>(Arg.size() + 1))
4208 memcpy(PCD->getTrailingObjects<
char>(), Arg.data(), Arg.size());
4209 PCD->getTrailingObjects<
char>()[Arg.size()] =
'\0';
4216 return new (
C,
ID, additionalSizeToAlloc<char>(ArgSize + 1))
4220 void PragmaDetectMismatchDecl::anchor() {}
4226 size_t ValueStart = Name.size() + 1;
4228 new (
C, DC, additionalSizeToAlloc<char>(ValueStart + Value.size() + 1))
4230 memcpy(PDMD->getTrailingObjects<
char>(), Name.data(), Name.size());
4231 PDMD->getTrailingObjects<
char>()[Name.size()] =
'\0';
4232 memcpy(PDMD->getTrailingObjects<
char>() + ValueStart, Value.data(),
4234 PDMD->getTrailingObjects<
char>()[ValueStart + Value.size()] =
'\0';
4240 unsigned NameValueSize) {
4241 return new (
C,
ID, additionalSizeToAlloc<char>(NameValueSize + 1))
4245 void ExternCContextDecl::anchor() {}
4252 void LabelDecl::anchor() {}
4256 return new (
C, DC)
LabelDecl(DC, IdentL, II,
nullptr, IdentL);
4262 assert(GnuLabelL != IdentL &&
"Use this only for GNU local labels");
4263 return new (
C, DC)
LabelDecl(DC, IdentL, II,
nullptr, GnuLabelL);
4272 char *Buffer =
new (
getASTContext(), 1)
char[Name.size() + 1];
4273 memcpy(Buffer, Name.data(), Name.size());
4274 Buffer[Name.size()] =
'\0';
4278 void ValueDecl::anchor() {}
4281 for (
const auto *I :
attrs())
4282 if (isa<WeakAttr>(I) || isa<WeakRefAttr>(I))
4288 void ImplicitParamDecl::anchor() {}
4312 bool isInlineSpecified,
4313 bool hasWrittenPrototype,
4314 bool isConstexprSpecified) {
4317 SC, isInlineSpecified, isConstexprSpecified);
4318 New->HasWrittenPrototype = hasWrittenPrototype;
4336 CapturedDecl::CapturedDecl(
DeclContext *DC,
unsigned NumParams)
4338 NumParams(NumParams), ContextParam(0), BodyAndNothrow(
nullptr,
false) {}
4341 unsigned NumParams) {
4342 return new (
C, DC, additionalSizeToAlloc<ImplicitParamDecl *>(NumParams))
4347 unsigned NumParams) {
4348 return new (
C,
ID, additionalSizeToAlloc<ImplicitParamDecl *>(NumParams))
4361 Expr *E,
const llvm::APSInt &V) {
4368 QualType(),
nullptr, llvm::APSInt());
4371 void IndirectFieldDecl::anchor() {}
4377 :
ValueDecl(IndirectField, DC, L, N, T), Chaining(CH.data()),
4378 ChainingSize(CH.size()) {
4401 End = Init->getLocEnd();
4405 void TypeDecl::anchor() {}
4410 return new (
C, DC)
TypedefDecl(C, DC, StartLoc, IdLoc, Id, TInfo);
4413 void TypedefNameDecl::anchor() {}
4416 if (
auto *TT = getTypeSourceInfo()->getType()->getAs<TagType>()) {
4418 auto *ThisTypedef =
this;
4419 if (AnyRedecl && OwningTypedef) {
4423 if (OwningTypedef == ThisTypedef)
4424 return TT->getDecl();
4430 bool TypedefNameDecl::isTransparentTagSlow()
const {
4431 auto determineIsTransparent = [&]() {
4433 if (
auto *TD = TT->getDecl()) {
4434 if (TD->getName() !=
getName())
4447 bool isTransparent = determineIsTransparent();
4448 MaybeModedTInfo.setInt((isTransparent << 1) | 1);
4449 return isTransparent;
4461 return new (
C, DC)
TypeAliasDecl(C, DC, StartLoc, IdLoc, Id, TInfo);
4473 RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();
4481 RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();
4485 void FileScopeAsmDecl::anchor() {}
4500 void EmptyDecl::anchor() {}
4528 :
Decl(Import, DC, StartLoc), ImportedAndComplete(Imported,
true) {
4530 auto *StoredLocs = getTrailingObjects<SourceLocation>();
4531 std::uninitialized_copy(IdentifierLocs.begin(), IdentifierLocs.end(),
4537 :
Decl(Import, DC, StartLoc), ImportedAndComplete(Imported,
false) {
4538 *getTrailingObjects<SourceLocation>() = EndLoc;
4545 additionalSizeToAlloc<SourceLocation>(IdentifierLocs.size()))
4546 ImportDecl(DC, StartLoc, Imported, IdentifierLocs);
4553 ImportDecl *Import =
new (
C, DC, additionalSizeToAlloc<SourceLocation>(1))
4560 unsigned NumLocations) {
4561 return new (
C,
ID, additionalSizeToAlloc<SourceLocation>(NumLocations))
4566 if (!ImportedAndComplete.getInt())
4569 const auto *StoredLocs = getTrailingObjects<SourceLocation>();
4570 return llvm::makeArrayRef(StoredLocs,
4575 if (!ImportedAndComplete.getInt())
4585 void ExportDecl::anchor() {}
void setLinkage(Linkage L)
EnumDecl * getTemplateInstantiationPattern() const
Retrieve the enum definition from which this enumeration could be instantiated, if it is an instantia...
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
bool isNoReturn() const
Determines whether this function is known to be 'noreturn', through an attribute on its declaration o...
Defines the clang::ASTContext interface.
void setTemplateOrSpecializationInfo(VarDecl *Inst, TemplateOrSpecializationInfo TSI)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static const Decl * getCanonicalDecl(const Decl *D)
void setImplicit(bool I=true)
Represents a function declaration or definition.
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 ...
SourceRange getExceptionSpecRange() const
bool isReservedGlobalPlacementOperator() const
Determines whether this operator new or delete is one of the reserved global placement operators: voi...
FunctionTemplateDecl * getTemplate() const
Retrieve the template from which this function was specialized.
unsigned getMemoryFunctionKind() const
Identify a memory copying or setting function.
bool isThisDeclarationADemotedDefinition() const
If this definition should pretend to be a declaration.
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.
LanguageLinkage getLanguageLinkage() const
Compute the language linkage.
bool isClosedNonFlag() const
Returns true if this enum is annotated with neither flag_enum nor enum_extensibility(open).
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
static ImportDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumLocations)
Create a new, deserialized module import declaration.
bool isInExternCXXContext() const
Determines whether this function's context is, or is nested within, a C++ extern "C++" linkage spec...
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
A (possibly-)qualified type.
TagDecl * getDefinition() const
Returns the TagDecl that actually defines this struct/union/class/enum.
virtual void FindExternalLexicalDecls(const DeclContext *DC, llvm::function_ref< bool(Decl::Kind)> IsKindWeWant, SmallVectorImpl< Decl *> &Result)
Finds all declarations lexically contained within the given DeclContext, after applying an optional f...
Internal linkage according to the Modules TS, but can be referred to from other translation units ind...
bool isExternC() const
Determines whether this function is a function with external, C linkage.
RAII class for safely pairing a StartedDeserializing call with FinishedDeserializing.
static VarDecl * CreateDeserialized(ASTContext &C, unsigned ID)
This file contains the declaration of the ODRHash class, which calculates a hash based on AST nodes...
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
This declaration has an owning module, but is only visible to lookups that occur within that module...
virtual Stmt * getBody() const
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
Module * getOwningModuleForLinkage(bool IgnoreLinkage=false) const
Get the module that owns this declaration for linkage purposes.
static IndirectFieldDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L, IdentifierInfo *Id, QualType T, llvm::MutableArrayRef< NamedDecl *> CH)
Stmt - This represents one statement.
bool isGenericLambdaCallOperatorSpecialization(const CXXMethodDecl *MD)
void setPreviousDecl(VarDecl *PrevDecl)
Set the previous declaration.
FunctionType - C99 6.7.5.3 - Function Declarators.
SanitizerSet Sanitize
Set of enabled sanitizers.
bool IsICE
Whether this statement is an integral constant expression, or in C++11, whether the statement is a co...
const ASTTemplateArgumentListInfo * getTemplateSpecializationArgsAsWritten() const
Retrieve the template argument list as written in the sources, if any.
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
bool isMain() const
Determines whether this function is "main", which is the entry point into an executable program...
bool isOutOfLine() const override
Determine whether this is or was instantiated from an out-of-line definition of a member function...
const llvm::Triple & getTriple() const
Returns the target triple of the primary target.
An instance of this object exists for each enum constant that is defined.
No linkage, which means that the entity is unique and can only be referred to from within its scope...
StorageClass getStorageClass() const
Returns the storage class as written in the source.
void setTypedefNameForAnonDecl(TypedefNameDecl *TDD)
Represents the declaration of a typedef-name via the 'typedef' type specifier.
C Language Family Type Representation.
Defines the SourceManager interface.
bool IsEvaluating
Whether this statement is being evaluated.
The template argument is an expression, and we've not resolved it to one of the other forms yet...
bool isInExternCContext() const
Determines whether this function's context is, or is nested within, a C++ extern "C" linkage spec...
bool isInitICE() const
Determines whether the initializer is an integral constant expression, or in C++11, whether the initializer is a constant expression.
Defines the clang::Module class, which describes a module in the source code.
Decl - This represents one declaration (or definition), e.g.
static LinkageInfo getExternalLinkageFor(const NamedDecl *D)
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
Defines the C++ template declaration subclasses.
void setPure(bool P=true)
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
void setPreviousDeclaration(FunctionDecl *PrevDecl)
unsigned getFieldIndex() const
Returns the index of this field within its record, as appropriate for passing to ASTRecordLayout::get...
static Visibility getVisibilityFromAttr(const T *attr)
Given a visibility attribute, return the explicit visibility associated with it.
bool isExplicitSpecialization() const
ImplicitParamKind
Defines the kind of the implicit parameter: is this an implicit parameter with pointer to 'this'...
The base class of the type hierarchy.
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...
void setParams(ArrayRef< ParmVarDecl *> NewParamInfo)
DiagnosticsEngine & getDiagnostics() const
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
Declaration of a variable template.
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
Represent a C++ namespace.
static std::enable_if<!std::is_base_of< RedeclarableTemplateDecl, T >::value, bool >::type isExplicitMemberSpecialization(const T *D)
Does the given declaration have member specialization information, and if so, is it an explicit speci...
virtual void completeDefinition()
Note that the definition of this type is now complete.
const TargetInfo & getTargetInfo() const
A container of type source information.
constexpr XRayInstrMask Function
Linkage getLinkage() const
Determine the linkage of this type.
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
Appends a human-readable name for this declaration into the given stream.
SourceLocation getOuterLocStart() const
Return SourceLocation representing start of source range taking into account any outer template decla...
void setTemplateParameterListsInfo(ASTContext &Context, ArrayRef< TemplateParameterList *> TPLists)
Sets info about "outer" template parameter lists.
const Expr * getAnyInitializer() const
Get the initializer for this variable, no matter which declaration it is attached to...
bool isImplicitlyInstantiable() const
Determines whether this function is a function template specialization or a member of a class templat...
This is a module that was defined by a module map and built out of header files.
static CapturedDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NumParams)
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
LinkageInfo getDeclLinkageAndVisibility(const NamedDecl *D)
void setNothrow(bool Nothrow=true)
This file provides some common utility functions for processing Lambda related AST Constructs...
ExplicitVisibilityKind
Kinds of explicit visibility.
Represents a variable declaration or definition.
ASTMutationListener * getASTMutationListener() const
Objects with "hidden" visibility are not seen by the dynamic linker.
bool WasEvaluated
Whether this statement was already evaluated.
Declaration of a redeclarable template.
static LanguageLinkage getDeclLanguageLinkage(const T &D)
unsigned getNumParams() const
void mergeVisibility(Visibility newVis, bool newExplicit)
Merge in the visibility 'newVis'.
const T * getAs() const
Member-template getAs<specific type>'.
bool hasDefaultArg() const
Determines whether this parameter has a default argument, either parsed or not.
Visibility getVisibility() const
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
Represents an empty template argument, e.g., one that has not been deduced.
Declaration context for names declared as extern "C" in C++.
Represents a variable template specialization, which refers to a variable template with a given set o...
bool isExternCContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
NamedDecl * getUnderlyingDecl()
Looks through UsingDecls and ObjCCompatibleAliasDecls for the underlying named decl.
bool isZeroLengthBitField(const ASTContext &Ctx) const
Is this a zero-length bit-field? Such bit-fields aren't really bit-fields at all and instead act as a...
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
Decl * FirstDecl
FirstDecl - The first declaration stored within this declaration context.
bool isInvalidDecl() const
Stores a list of template parameters for a TemplateDecl and its derived classes.
Describes how types, statements, expressions, and declarations should be printed. ...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template specialization this is.
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.
LinkageInfo getLVForDecl(const NamedDecl *D, LVComputationKind computation)
getLVForDecl - Get the linkage and visibility for the given declaration.
std::string getName(ArrayRef< StringRef > Parts) const
Get the platform-specific name separator.
Provides information about a dependent function-template specialization declaration.
bool isAnonymousStructOrUnion() const
Determines whether this field is a representative for an anonymous struct or union.
bool mayInsertExtraPadding(bool EmitRemark=false) const
Whether we are allowed to insert extra padding between fields.
ModuleKind Kind
The kind of this module.
SourceRange getReturnTypeSourceRange() const
Attempt to compute an informative source range covering the function return type. ...
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
Defines the clang::SanitizerKind enum.
Represents a struct/union/class.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Provides common interface for the Decls that can be redeclared.
static bool isRedeclarable(Decl::Kind K)
One of these records is kept for each identifier that is lexed.
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...
TargetCXXABI getCXXABI() const
Get the C++ ABI currently in use.
SourceLocation getOuterLocStart() const
Return start of source range taking into account any outer template declarations. ...
static bool typeIsPostfix(QualType QT)
bool isInAnonymousNamespace() const
bool isStr(const char(&Str)[StrLen]) const
Return true if this is the identifier for the specified string.
bool isCapturedRecord() const
Determine whether this record is a record for captured variables in CapturedStmt construct.
static RecordDecl * Create(const ASTContext &C, TagKind TK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl=nullptr)
void print(raw_ostream &OS, const SourceManager &SM) const
void setUninstantiatedDefaultArg(Expr *arg)
static IndirectFieldDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool hasTrivialBody() const
Returns whether the function has a trivial body that does not require any specific codegen...
A C++ nested-name-specifier augmented with source location information.
static bool redeclForcesDefMSVC(const FunctionDecl *Redecl)
bool CheckedICE
Whether we already checked whether this statement was an integral constant expression.
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
static LinkageInfo internal()
static bool usesTypeVisibility(const NamedDecl *D)
Is the given declaration a "type" or a "value" for the purposes of visibility computation?
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
field_range fields() 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)
Represents a member of a struct/union/class.
void completeDefinition()
Completes the definition of this tag declaration.
void startDefinition()
Starts the definition of this tag declaration.
bool isReferenceType() const
SanitizerMask Mask
Bitmask of enabled sanitizers.
const Attr * getUnusedResultAttr() const
Returns the WarnUnusedResultAttr that is either declared on this function, or its return type declara...
Linkage getFormalLinkage(Linkage L)
This declaration is definitely a definition.
bool isLinkageValid() const
True if the computed linkage is valid.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Describes a module or submodule.
specific_decl_iterator< FieldDecl > field_iterator
Objects with "default" visibility are seen by the dynamic linker and act like normal objects...
virtual bool isDefined() const
Provides information about a function template specialization, which is a FunctionDecl that has been ...
SourceLocation getPointOfInstantiation() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
TypedefNameDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this typedef-name.
VarDecl * getActingDefinition()
Get the tentative definition that acts as the real definition in a TU.
bool isReplaceableGlobalAllocationFunction(bool *IsAligned=nullptr) const
Determines whether this function is one of the replaceable global allocation functions: void *operato...
const TemplateArgumentList * TemplateArguments
The template arguments used to produce the function template specialization from the function templat...
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
For an enumeration member that was instantiated from a member enumeration of a templated class...
QualType getOriginalType() const
static ExternCContextDecl * Create(const ASTContext &C, TranslationUnitDecl *TU)
A convenient class for passing around template argument information.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
void AddFunctionDecl(const FunctionDecl *Function, bool SkipBody=false)
TagDecl * getAnonDeclWithTypedefName(bool AnyRedecl=false) const
Retrieves the tag declaration for which this is the typedef name for linkage purposes, if any.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
Wrapper for source info for functions.
ModuleOwnershipKind getModuleOwnershipKind() const
Get the kind of module ownership for this declaration.
static EnumConstantDecl * Create(ASTContext &C, EnumDecl *DC, SourceLocation L, IdentifierInfo *Id, QualType T, Expr *E, const llvm::APSInt &V)
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
bool isMemberSpecialization() const
Determines whether this template was a specialization of a member template.
ASTContext & getASTContext() const
Visibility
Describes the different kinds of visibility that a declaration may have.
DefinitionKind hasDefinition() const
const clang::PrintingPolicy & getPrintingPolicy() const
TemplateSpecializationKind getTemplateSpecializationKind() const
If this variable is an instantiation of a variable template or a static data member of a class templa...
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
A set of unresolved declarations.
Module * Parent
The parent of this module.
bool isConstexpr() const
Whether this variable is (C++11) constexpr.
FunctionTemplateSpecializationInfo * getTemplateSpecializationInfo() const
If this function is actually a function template specialization, retrieve information about this func...
VarTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
bool isLambda() const
Determine whether this class describes a lambda function object.
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
field_iterator field_begin() const
unsigned getBitWidthValue(const ASTContext &Ctx) const
static FileScopeAsmDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isInlineDefinitionExternallyVisible() const
For an inline function definition in C, or for a gnu_inline function in C++, determine whether the de...
bool isCPUSpecificMultiVersion() const
True if this function is a multiversioned processor specific function as a part of the cpu_specific/c...
Defines the Linkage enumeration and various utility functions.
static TypeAliasDecl * CreateDeserialized(ASTContext &C, unsigned ID)
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID. ...
static VarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S)
ArrayRef< SourceLocation > getIdentifierLocs() const
Retrieves the locations of each of the identifiers that make up the complete module name in the impor...
bool needsCleanup() const
Returns whether the object performed allocations.
SourceRange getExceptionSpecSourceRange() const
Attempt to compute an informative source range covering the function exception specification, if any.
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.
static FunctionTemplateSpecializationInfo * Create(ASTContext &C, FunctionDecl *FD, FunctionTemplateDecl *Template, TemplateSpecializationKind TSK, const TemplateArgumentList *TemplateArgs, const TemplateArgumentListInfo *TemplateArgsAsWritten, SourceLocation POI)
Represents the body of a CapturedStmt, and serves as its DeclContext.
Represents a linkage specification.
static ParmVarDecl * CreateDeserialized(ASTContext &C, unsigned ID)
SourceLocation getTypeSpecStartLoc() const
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
LinkageInfo computeLVForDecl(const NamedDecl *D, LVComputationKind computation, bool IgnoreVarTypeLinkage=false)
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization, retrieves the member specialization information.
Decl * getPrimaryMergedDecl(Decl *D)
void setCachedLinkage(Linkage L) const
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)
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Defines the clang::Visibility enumeration and various utility functions.
FunctionTemplateDecl * getPrimaryTemplate() const
Retrieve the primary template that this function template specialization either specializes or was in...
static ImplicitParamDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, ImplicitParamKind ParamKind)
Create implicit parameter.
bool isExplicitSpecialization() const
bool isExternC() const
Determines whether this variable is a variable with external, C linkage.
bool isInExternCContext() const
Determines whether this variable's context is, or is nested within, a C++ extern "C" linkage spec...
static ImportDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, Module *Imported, ArrayRef< SourceLocation > IdentifierLocs)
Create a new module import declaration.
unsigned getLambdaManglingNumber() const
If this is the closure type of a lambda expression, retrieve the number to be used for name mangling ...
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
bool isExternalFormalLinkage(Linkage L)
A placeholder type used to construct an empty shell of a decl-derived type that will be filled in lat...
static bool isExportedFromModuleIntefaceUnit(const NamedDecl *D)
Represents the declaration of a typedef-name via a C++11 alias-declaration.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
Represents a prototype with parameter type info, e.g.
bool isFileVarDecl() const
Returns true for file scoped variable declaration.
SourceLocation getLocStart() const LLVM_READONLY
bool isUsableInConstantExpressions(ASTContext &C) const
Determine whether this variable's value can be used in a constant expression, according to the releva...
OverloadedOperatorKind getOverloadedOperator() const
getOverloadedOperator - Which C++ overloaded operator this function represents, if any...
Represents a ValueDecl that came out of a declarator.
OverloadedOperatorKind getCXXOverloadedOperator() const
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e...
Module linkage, which indicates that the entity can be referred to from other translation units withi...
bool isClosed() const
Returns true if this enum is either annotated with enum_extensibility(closed) or isn't annotated with...
static EmptyDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L)
FunctionDecl * getClassScopeSpecializationPattern() const
Retrieve the class scope template pattern that this function template specialization is instantiated ...
bool isInlineSpecified() const
Stmt ** getInitAddress()
Retrieve the address of the initializer expression.
bool isMsStruct(const ASTContext &C) const
Get whether or not this is an ms_struct which can be turned on with an attribute, pragma...
SourceLocation getBeginLoc() const
Get the begin source location.
unsigned IgnoreExplicitVisibility
Whether explicit visibility attributes should be ignored.
Defines the TargetCXXABI class, which abstracts details of the C++ ABI that we're targeting...
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
bool isCanonicalDecl() const
Whether this particular Decl is a canonical one.
bool isWeak() const
Determine whether this symbol is weakly-imported, or declared with the weak or weak-ref attr...
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Pepresents a block literal declaration, which is like an unnamed FunctionDecl.
const FieldDecl * findFirstNamedDataMember() const
Finds the first data member which has a name.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Expr - This represents one expression.
Defines the clang::LangOptions interface.
bool isTypeVisibility() const
bool isVariadic() const
Whether this function is variadic.
static bool classofKind(Kind K)
void mergeExternalVisibility(Linkage L)
const T * castAs() const
Member-template castAs<specific type>.
static bool hasExplicitVisibilityAlready(LVComputationKind computation)
Does this computation kind permit us to consider additional visibility settings from attributes and t...
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
ObjCStringFormatFamily getObjCFStringFormattingFamily() const
Decl * LastDecl
LastDecl - The last declaration stored within this declaration context.
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
const TemplateArgumentList * getTemplateSpecializationArgs() const
Retrieve the template arguments used to produce this function template specialization from the primar...
bool isKnownToBeDefined() const
static Optional< Visibility > getVisibilityOf(const NamedDecl *D, NamedDecl::ExplicitVisibilityKind kind)
Return the explicit visibility of the given declaration.
static LVComputationKind withExplicitVisibilityAlready(LVComputationKind Kind)
Given an LVComputationKind, return one of the same type/value sort that records that it already has e...
Linkage getLinkage() const
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
bool isFileContext() const
DeclContext * getDeclContext()
LanguageLinkage getLanguageLinkage() const
Compute the language linkage.
bool isCPUDispatchMultiVersion() const
True if this function is a multiversioned dispatch function as a part of the cpu_specific/cpu_dispatc...
This declaration is a tentative definition.
Decl * getPrimaryMergedDecl(Decl *D)
Get the primary declaration for a declaration from an AST file.
TLSKind getTLSKind() const
An abstract interface that should be implemented by listeners that want to be notified when an AST en...
StorageClass getStorageClass() const
Returns the storage class as written in the source.
ArrayRef< TemplateArgument > asArray() const
Produce this as an array ref.
void printTemplateArgumentList(raw_ostream &OS, ArrayRef< TemplateArgument > Args, const PrintingPolicy &Policy)
Print a template argument list, including the '<' and '>' enclosing the template arguments.
Defines the clang::TypeLoc interface and its subclasses.
TemplateOrSpecializationInfo getTemplateOrSpecializationInfo(const VarDecl *Var)
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
VarDecl * getTemplateInstantiationPattern() const
Retrieve the variable declaration from which this variable could be instantiated, if it is an instant...
static bool RedeclForcesDefC99(const FunctionDecl *Redecl)
static const CXXRecordDecl * getOutermostEnclosingLambda(const CXXRecordDecl *Record)
bool hasBody(const FunctionDecl *&Definition) const
Returns true if the function has a body.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
bool isFunctionOrMethod() const
StorageClass
Storage classes.
static Optional< Visibility > getExplicitVisibility(const NamedDecl *D, LVComputationKind kind)
Objects with "protected" visibility are seen by the dynamic linker but always dynamically resolve to ...
unsigned IgnoreAllVisibility
Whether all visibility should be ignored.
InClassInitStyle
In-class initialization styles for non-static data members.
static CapturedDecl * Create(ASTContext &C, DeclContext *DC, unsigned NumParams)
This declaration has an owning module, and is visible when that module is imported.
DeclContext * getParent()
getParent - Returns the containing DeclContext.
bool isExternallyVisible(Linkage L)
SourceLocation getEnd() const
bool capturesVariable(const VarDecl *var) const
APValue * evaluateValue() const
Attempt to evaluate the value of the initializer attached to this declaration, and produce notes expl...
bool isValueVisibility() const
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...
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
void printQualifiedName(raw_ostream &OS) const
Returns a human-readable qualified name for this declaration, like A::B::i, for i being member of nam...
void setStorageClass(StorageClass SC)
QualType getTypeDeclType(const TypeDecl *Decl, const TypeDecl *PrevDecl=nullptr) const
Return the unique reference to the type for the specified type declaration.
void addDestruction(T *Ptr)
If T isn't trivially destructible, calls AddDeallocation to register it for destruction.
The result type of a method or function.
This template specialization was implicitly instantiated from a template.
DefinitionKind isThisDeclarationADefinition() const
bool isNull() const
Return true if this QualType doesn't point to a type yet.
bool isTemplateInstantiation(TemplateSpecializationKind Kind)
Determine whether this template specialization kind refers to an instantiation of an entity (as oppos...
static LinkageInfo visible_none()
void setTemplateParameterListsInfo(ASTContext &Context, ArrayRef< TemplateParameterList *> TPLists)
TypeLoc getReturnLoc() const
static bool isNamed(const NamedDecl *ND, const char(&Str)[Len])
const SanitizerBlacklist & getSanitizerBlacklist() const
VarDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
static LinkageInfo external()
VarDecl * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
unsigned getCVRQualifiers() const
Retrieve the set of CVR (const-volatile-restrict) qualifiers applied to this type.
unsigned getBuiltinID() const
Return a value indicating whether this is a builtin function.
virtual bool hasBody() const
Returns true if this Decl represents a declaration for a body of code, such as a function or method d...
EnumDecl * getInstantiatedFromMemberEnum() const
Returns the enumeration (declared within the template) from which this enumeration type was instantia...
Abstract interface for external sources of AST nodes.
static PragmaDetectMismatchDecl * CreateDeserialized(ASTContext &C, unsigned ID, unsigned NameValueSize)
bool isInjectedClassName() const
Determines whether this declaration represents the injected class name.
virtual void printName(raw_ostream &os) const
Represents a C++ Modules TS module export declaration.
A struct with extended info about a syntactic name qualifier, to be used for the case of out-of-line ...
APValue * getEvaluatedValue() const
Return the already-evaluated value of this variable's initializer, or NULL if the value is not yet kn...
Decl::Kind getDeclKind() const
IdentifierInfo * getCXXLiteralIdentifier() const
getCXXLiteralIdentifier - If this name is the name of a literal operator, retrieve the identifier ass...
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
This declaration has an owning module, but is globally visible (typically because its owning module i...
static bool classof(const Decl *D)
static EnumConstantDecl * CreateDeserialized(ASTContext &C, unsigned ID)
TypeLoc IgnoreParens() const
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.
FunctionDecl * getAsFunction() LLVM_READONLY
Returns the function itself, or the templated function if this is a function template.
static SourceLocation getTemplateOrInnerLocStart(const DeclT *decl)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
Encodes a location in the source.
static EmptyDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isLinkageValid() const
True if the computed linkage is valid.
static ExportDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation ExportLoc)
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
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
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.
static QualType getUnderlyingType(const SubRegion *R)
Represents the declaration of a label.
void setTemplateParameterListsInfo(ASTContext &Context, ArrayRef< TemplateParameterList *> TPLists)
TemplateSpecializationKind getTemplateSpecializationKind() const
If this enumeration is a member of a specialization of a templated class, determine what kind of temp...
TagDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isLegalForVariable(StorageClass SC)
Checks whether the given storage class is legal for variables.
bool isLambda() const
Determine whether this record is a class describing a lambda function object.
This file defines OpenMP nodes for declarative directives.
bool hasCachedLinkage() const
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
bool doesDeclarationForceExternallyVisibleDefinition() const
For a function declaration in C or C++, determine whether this declaration causes the definition to b...
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
This is a fragment of the global module within some C++ Modules TS module.
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
Linkage getCachedLinkage() const
This declaration is only a declaration.
static FunctionDecl * CreateDeserialized(ASTContext &C, unsigned ID)
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
unsigned getODRHash()
Returns ODRHash of the function.
SourceLocation getLocEnd() const LLVM_READONLY
TypeClass getTypeClass() const
unsigned getMinRequiredArguments() const
Returns the minimum number of arguments needed to call this function.
This template specialization was instantiated from a template due to an explicit instantiation defini...
This template specialization was formed from a template-id but has not yet been declared, defined, or instantiated.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static ImportDecl * CreateImplicit(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, Module *Imported, SourceLocation EndLoc)
Create a new module import declaration for an implicitly-generated import.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
FunctionDecl * getClassScopeSpecializationPattern(const FunctionDecl *FD)
Stmt * getBody() const override
getBody - If this Decl represents a declaration for a body of code, such as a function or method defi...
void addSpecialization(FunctionTemplateSpecializationInfo *Info, void *InsertPos)
Add a specialization of this function template.
bool isValid() const
Whether this pointer is non-NULL.
virtual bool isOutOfLine() const
Determine whether this declaration is declared out of line (outside its semantic context).
bool isWeakImported() const
Determine whether this is a weak-imported symbol.
void AddEnumDecl(const EnumDecl *Enum)
Linkage getLinkageInternal() const
Determine what kind of linkage this entity has.
Describes a module import declaration, which makes the contents of the named module visible in the cu...
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.
void * Allocate(size_t Size, unsigned Align=8) const
static const char * getStorageClassSpecifierString(StorageClass SC)
Return the string used to specify the storage class SC.
decl_iterator - Iterates through the declarations stored within this context.
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 TypedefDecl * CreateDeserialized(ASTContext &C, unsigned ID)
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.
TagTypeKind
The kind of a tag type.
RecordDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, RecordDecl *PrevDecl)
redecl_range redecls() const
Returns an iterator range for all the redeclarations of the same decl.
static ParmVarDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)
Dataflow Directional Tag Classes.
virtual void getNameForDiagnostic(raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const
Appends a human-readable name for this declaration into the given stream.
void updateOutOfDate(IdentifierInfo &II) const
Update a potentially out-of-date declaration.
bool isValid() const
Return true if this is a valid SourceLocation object.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this variable is an instantiation of a static data member of a class template specialization, retrieves the member specialization information.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
The base class of all kinds of template declarations (e.g., class, function, etc.).
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
static PragmaDetectMismatchDecl * Create(const ASTContext &C, TranslationUnitDecl *DC, SourceLocation Loc, StringRef Name, StringRef Value)
bool isVisibilityExplicit() const
bool isInitKnownICE() const
Determines whether it is already known whether the initializer is an integral constant expression or ...
bool isInExternCXXContext() const
Determines whether this variable's context is, or is nested within, a C++ extern "C++" linkage spec...
The template argument is a pack expansion of a template name that was provided for a template templat...
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
InitType Init
The initializer for this variable or, for a ParmVarDecl, the C++ default argument.
Represents a field injected from an anonymous union/struct into the parent scope. ...
const Expr * getInit() const
static bool shouldConsiderTemplateVisibility(const FunctionDecl *fn, const FunctionTemplateSpecializationInfo *specInfo)
This template specialization was instantiated from a template due to an explicit instantiation declar...
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
IdentifierNamespace
IdentifierNamespace - The different namespaces in which declarations may appear.
TLSKind
Kinds of thread-local storage.
Do an LV computation for, ultimately, a non-type declaration.
FunctionDecl * getTemplateInstantiationPattern() const
Retrieve the function declaration from which this function could be instantiated, if it is an instant...
DeclarationName - The name of a declaration.
void setDependentTemplateSpecialization(ASTContext &Context, const UnresolvedSetImpl &Templates, const TemplateArgumentListInfo &TemplateArgs)
Specifies that this function declaration is actually a dependent function template specialization...
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
ParmVarDeclBitfields ParmVarDeclBits
bool isMSVCRTEntryPoint() const
Determines whether this function is a MSVCRT user defined entry point.
SourceLocation getLocStart() const LLVM_READONLY
static bool isSingleLineLanguageLinkage(const Decl &D)
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
bool isDestroyingOperatorDelete() const
Determine whether this is a destroying operator delete.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
Tags, declared with 'struct foo;' and referenced with 'struct foo'.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
bool isTemplateInstantiation() const
Determines if the given function was instantiated from a function template.
static EnumDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl, bool IsScoped, bool IsScopedUsingClassTag, bool IsFixed)
T * get(ExternalASTSource *Source) const
Retrieve the pointer to the AST node that this lazy pointer points to.
static FileScopeAsmDecl * Create(ASTContext &C, DeclContext *DC, StringLiteral *Str, SourceLocation AsmLoc, SourceLocation RParenLoc)
static LabelDecl * CreateDeserialized(ASTContext &C, unsigned ID)
specific_decl_iterator - Iterates over a subrange of declarations stored in a DeclContext, providing only those that are of type SpecificDecl (or a class derived from it).
This declaration is not owned by a module.
static LabelDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation IdentL, IdentifierInfo *II)
SourceRange getSourceRange() const LLVM_READONLY
Get the full source range.
bool SuppressUnwrittenScope
Suppress printing parts of scope specifiers that don't need to be written, e.g., for inline or anonym...
Do an LV computation for, ultimately, a type.
unsigned MayHaveOutOfDateDef
Indicates whether it is possible for declarations of this kind to have an out-of-date definition...
Not an overloaded operator.
bool isClosedFlag() const
Returns true if this enum is annotated with flag_enum and isn't annotated with enum_extensibility(ope...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
static ExportDecl * CreateDeserialized(ASTContext &C, unsigned ID)
Location wrapper for a TemplateArgument.
Expr * getUninstantiatedDefaultArg()
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
LinkageInfo getLinkageAndVisibility() const
Determines the linkage and visibility of this entity.
void setTemplateSpecializationKind(TemplateSpecializationKind TSK, SourceLocation PointOfInstantiation=SourceLocation())
Determine what kind of template instantiation this function represents.
bool checkInitIsICE() const
Determine whether the value of the initializer attached to this declaration is an integral constant e...
This template specialization was declared or defined by an explicit specialization (C++ [temp...
static ImplicitParamDecl * CreateDeserialized(ASTContext &C, unsigned ID)
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
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.
TypeSourceInfo * getTypeSourceInfo() const
bool isMSExternInline() const
The combination of the extern and inline keywords under MSVC forces the function to be required...
void print(raw_ostream &OS) const override
static EnumDecl * CreateDeserialized(ASTContext &C, unsigned ID)
DeclContext * getRedeclContext()
getRedeclContext - Retrieve the context in which an entity conflicts with other entities of the same ...
bool hasSameType(QualType T1, QualType T2) const
Determine whether the given types T1 and T2 are equivalent.
static LinkageInfo getInternalLinkageFor(const NamedDecl *D)
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)
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
The template argument is actually a parameter pack.
APValue - This class implements a discriminated union of [uninitialized] [APSInt] [APFloat]...
NamedDecl::ExplicitVisibilityKind getExplicitVisibilityKind() const
void merge(LinkageInfo other)
Merge both linkage and visibility.
SourceManager & getSourceManager()
const IdentifierInfo * getLiteralIdentifier() const
getLiteralIdentifier - The literal suffix identifier this function represents, if any...
bool isInlined() const
Determine whether this function should be inlined, because it is either marked "inline" or "constexpr...
A template argument list.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
static bool isFirstInExternCContext(T *D)
static BlockDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation L)
Optional< Visibility > getExplicitVisibility(ExplicitVisibilityKind kind) const
If visibility was explicitly specified for this declaration, return that visibility.
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).
void Deallocate(void *Ptr) const
Defines the clang::SourceLocation class and associated facilities.
TypedefNameDecl * getTypedefNameForAnonDecl() const
void setDefaultArg(Expr *defarg)
Represents a C++ struct/union/class.
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.
The template argument is a template name that was provided for a template template parameter...
unsigned getBuiltinID() const
Returns a value indicating whether this function corresponds to a builtin function.
void setDescribedVarTemplate(VarTemplateDecl *Template)
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)
static std::pair< Decl *, Decl * > BuildDeclChain(ArrayRef< Decl *> Decls, bool FieldsAlreadyLoaded)
Build up a chain of declarations.
static TypedefDecl * Create(ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, TypeSourceInfo *TInfo)
Provides information a specialization of a member of a class template, which may be a member function...
No linkage according to the standard, but is visible from other translation units because of types de...
void setMSAsmLabel(StringRef Name)
Decl(Kind DK, DeclContext *DC, SourceLocation L)
VarDecl * getDefinition()
Builtin::Context & BuiltinInfo
Declaration of a class template.
unsigned kind
All of the diagnostics that can be emitted by the frontend.
bool hasExternalStorage() const
Returns true if a variable has extern or private_extern storage.
static DeclT * getDefinitionOrSelf(DeclT *D)
void setCapturedVLAType(const VariableArrayType *VLAType)
Set the captured variable length array type for this field.
Decl * getLambdaContextDecl() const
Retrieve the declaration that provides additional context for a lambda, when the normal declaration c...
SourceRange getDefaultArgRange() const
Retrieve the source range that covers the entire default argument.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
static BlockDecl * CreateDeserialized(ASTContext &C, unsigned ID)
StringLiteral - This represents a string literal expression, e.g.
Defines the clang::TargetInfo interface.
bool isMicrosoft() const
Is this ABI an MSVC-compatible ABI?
TLS with a known-constant initializer.
SourceRange getSourceRange() const override LLVM_READONLY
Source range that this declaration covers.
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Kind
Lists the kind of concrete classes of Decl.
void setDescribedFunctionTemplate(FunctionTemplateDecl *Template)
SourceLocation getLAngleLoc() const
static bool isRedeclarableImpl(Redeclarable< T > *)
std::string getQualifiedNameAsString() const
VarDecl(Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass SC)
__DEVICE__ int max(int __a, int __b)
static Decl::Kind getKind(const Decl *D)
VarDeclBitfields VarDeclBits
VarDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
The top declaration context.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
NamedDecl * getMostRecentDecl()
bool MSVCFormatting
Use whitespace and punctuation like MSVC does.
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
static bool useInlineVisibilityHidden(const NamedDecl *D)
static DependentFunctionTemplateSpecializationInfo * Create(ASTContext &Context, const UnresolvedSetImpl &Templates, const TemplateArgumentListInfo &TemplateArgs)
bool isStaticDataMember() const
Determines whether this is a static data member.
void setCaptures(ASTContext &Context, ArrayRef< Capture > Captures, bool CapturesCXXThis)
A trivial tuple used to represent a source range.
FunctionDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
This represents a decl that may have a name.
bool isTranslationUnit() const
void mergeMaybeWithVisibility(LinkageInfo other, bool withVis)
Merge linkage and conditionally merge visibility.
static LinkageInfo none()
Represents a C array with a specified size that is not an integer-constant-expression.
bool isInline() const
Whether this variable is (C++1z) inline.
bool hasDefiningAttr() const
Return true if this declaration has an attribute which acts as definition of the entity, such as 'alias' or 'ifunc'.
Represents a #pragma detect_mismatch line.
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
SourceLocation getRAngleLoc() 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.
bool isInStdNamespace() const
static bool hasDirectVisibilityAttribute(const NamedDecl *D, LVComputationKind computation)
Does the given declaration have a direct visibility attribute that would match the given rules...
NestedNameSpecifier * getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) const
Retrieves the "canonical" nested name specifier for a given nested name specifier.
unsigned getNumParams() const
Return the number of parameters this function must have based on its FunctionType.
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
const LangOptions & getLangOpts() const
static LinkageInfo uniqueExternal()
bool isParameterPack() const
Determine whether this parameter is actually a function parameter pack.
static Optional< Visibility > getExplicitVisibilityAux(const NamedDecl *ND, NamedDecl::ExplicitVisibilityKind kind, bool IsMostRecent)
static LVComputationKind forLinkageOnly()
Do an LV computation when we only care about the linkage.
bool isExternCXXContext() const
Determines whether this context or some of its ancestors is a linkage specification context that spec...
This class handles loading and caching of source files into memory.
bool isGlobal() const
Determines whether this is a global function.
Defines enum values for all the target-independent builtin functions.
Declaration of a template function.
bool hasLinkage() const
Determine whether this declaration has linkage.
Attr - This represents one attribute.
SourceLocation getLocation() const
QualType getType() const
Return the type wrapped by this type source info.
EvaluatedStmt * ensureEvaluatedStmt() const
Convert the initializer for this declaration to the elaborated EvaluatedStmt form, which contains extra information on the evaluated value of the initializer.
This is a C++ Modules TS module interface unit.
bool isCXXInstanceMember() const
Determine whether the given declaration is an instance member of a C++ class.
SourceLocation getPointOfInstantiation() const
Retrieve the (first) point of instantiation of a function template specialization or a member of a cl...
CanQualType getSizeType() const
Return the unique type for "size_t" (C99 7.17), defined in <stddef.h>.
Structure used to store a statement, the constant value to which it was evaluated (if any)...
TemplatedKind
The kind of templated function a FunctionDecl can be.