52 #include "llvm/ADT/APSInt.h" 53 #include "llvm/ADT/ArrayRef.h" 54 #include "llvm/ADT/None.h" 55 #include "llvm/ADT/Optional.h" 56 #include "llvm/ADT/STLExtras.h" 57 #include "llvm/ADT/SmallVector.h" 58 #include "llvm/ADT/StringSwitch.h" 59 #include "llvm/ADT/StringRef.h" 60 #include "llvm/ADT/Triple.h" 61 #include "llvm/Support/Casting.h" 62 #include "llvm/Support/ErrorHandling.h" 63 #include "llvm/Support/raw_ostream.h" 71 #include <type_traits> 73 using namespace clang;
84 TranslationUnitDecl::TranslationUnitDecl(
ASTContext &ctx)
155 "asking for explicit visibility when we shouldn't be");
162 return isa<TypeDecl>(D) ||
163 isa<ClassTemplateDecl>(D) ||
164 isa<ObjCInterfaceDecl>(D);
169 template <
class T>
static typename 170 std::enable_if<!std::is_base_of<RedeclarableTemplateDecl, T>::value,
bool>
::type 173 D->getMemberSpecializationInfo()) {
174 return member->isExplicitSpecialization();
190 switch (attr->getVisibility()) {
198 llvm_unreachable(
"bad visibility kind");
207 if (
const auto *A = D->
getAttr<TypeVisibilityAttr>()) {
213 if (
const auto *A = D->
getAttr<VisibilityAttr>()) {
224 return getTypeLinkageAndVisibility(&T);
230 LinkageInfo LinkageComputer::getLVForTemplateParameterList(
236 if (isa<TemplateTypeParmDecl>(
P))
243 if (
const auto *NTTP = dyn_cast<NonTypeTemplateParmDecl>(
P)) {
245 if (!NTTP->isExpandedParameterPack()) {
246 if (!NTTP->getType()->isDependentType()) {
247 LV.
merge(getLVForType(*NTTP->getType(), computation));
253 for (
unsigned i = 0, n = NTTP->getNumExpansionTypes(); i != n; ++i) {
256 LV.
merge(getTypeLinkageAndVisibility(type));
263 const auto *TTP = cast<TemplateTemplateParmDecl>(
P);
266 if (!TTP->isExpandedParameterPack()) {
267 LV.
merge(getLVForTemplateParameterList(TTP->getTemplateParameters(),
273 for (
unsigned i = 0, n = TTP->getNumExpansionTemplateParameters();
275 LV.
merge(getLVForTemplateParameterList(
276 TTP->getExpansionTemplateParameters(i), computation));
284 const Decl *Ret =
nullptr;
286 while (DC->
getDeclKind() != Decl::TranslationUnit) {
287 if (isa<FunctionDecl>(DC) || isa<BlockDecl>(DC))
288 Ret = cast<Decl>(DC);
305 switch (Arg.getKind()) {
312 LV.
merge(getLVForType(*Arg.getAsType(), computation));
316 if (
const auto *ND = dyn_cast<NamedDecl>(Arg.getAsDecl())) {
318 LV.
merge(getLVForDecl(ND, computation));
323 LV.
merge(getTypeLinkageAndVisibility(Arg.getNullPtrType()));
329 Arg.getAsTemplateOrTemplatePattern().getAsTemplateDecl())
330 LV.
merge(getLVForDecl(Template, computation));
334 LV.
merge(getLVForTemplateArgumentList(Arg.getPackAsArray(), computation));
337 llvm_unreachable(
"bad template argument kind");
346 return getLVForTemplateArgumentList(TArgs.
asArray(), computation);
358 return !fn->
hasAttr<VisibilityAttr>();
368 void LinkageComputer::mergeTemplateLV(
372 bool considerVisibility =
383 LinkageInfo argsLV = getLVForTemplateArgumentList(templateArgs, computation);
436 void LinkageComputer::mergeTemplateLV(
454 LinkageInfo argsLV = getLVForTemplateArgumentList(templateArgs, computation);
455 if (considerVisibility)
488 void LinkageComputer::mergeTemplateLV(
LinkageInfo &LV,
506 LinkageInfo argsLV = getLVForTemplateArgumentList(templateArgs, computation);
507 if (considerVisibility)
515 if (!Opts.CPlusPlus || !Opts.InlineVisibilityHidden)
524 = FD->getTemplateSpecializationInfo()) {
527 FD->getMemberSpecializationInfo()) {
528 TSK = MSI->getTemplateSpecializationKind();
541 const T *First = D->getFirstDecl();
542 return First->isInExternCContext();
546 if (
const auto *SD = dyn_cast<LinkageSpecDecl>(D.
getDeclContext()))
547 if (!SD->hasBraces())
563 llvm_unreachable(
"unexpected module ownership kind");
593 LinkageComputer::getLVForNamespaceScopeDecl(
const NamedDecl *D,
595 bool IgnoreVarTypeLinkage) {
597 "Not a name having namespace scope");
606 if (
const auto *Var = dyn_cast<VarDecl>(D)) {
616 if (Context.getLangOpts().CPlusPlus &&
617 Var->getType().isConstQualified() &&
618 !Var->getType().isVolatileQualified() &&
623 return getLVForDecl(PrevVar, computation);
625 if (Var->getStorageClass() !=
SC_Extern &&
634 Var->getStorageClass() ==
SC_None)
635 return getDeclLinkageAndVisibility(PrevVar);
637 if (PrevVar->getStorageClass() ==
SC_Static)
646 if (Function->getCanonicalDecl()->getStorageClass() ==
SC_Static)
648 }
else if (
const auto *IFD = dyn_cast<IndirectFieldDecl>(D)) {
650 const VarDecl *VD = IFD->getVarDecl();
651 assert(VD &&
"Expected a VarDecl in this IndirectFieldDecl!");
652 return getLVForNamespaceScopeDecl(VD, computation, IgnoreVarTypeLinkage);
654 assert(!isa<FieldDecl>(D) &&
"Didn't expect a FieldDecl!");
657 const auto *Var = dyn_cast<
VarDecl>(D);
686 !isa<TranslationUnitDecl>(DC);
702 ? Context.getLangOpts().getValueVisibilityMode()
703 : Context.getLangOpts().getTypeVisibilityMode();
719 if (
const auto *Var = dyn_cast<VarDecl>(D)) {
742 !IgnoreVarTypeLinkage) {
743 LinkageInfo TypeLV = getLVForType(*Var->getType(), computation);
760 if (
const auto *spec = dyn_cast<VarTemplateSpecializationDecl>(Var)) {
761 mergeTemplateLV(LV, spec, computation);
765 }
else if (
const auto *Function = dyn_cast<FunctionDecl>(D)) {
785 QualType TypeAsWritten = Function->getType();
787 TypeAsWritten = TSI->getType();
796 = Function->getTemplateSpecializationInfo()) {
797 mergeTemplateLV(LV, Function, specInfo, computation);
806 }
else if (
const auto *Tag = dyn_cast<TagDecl>(D)) {
808 if (!Tag->hasNameForLinkage())
814 if (
const auto *spec = dyn_cast<ClassTemplateSpecializationDecl>(Tag)) {
815 mergeTemplateLV(LV, spec, computation);
819 }
else if (isa<EnumConstantDecl>(D)) {
828 }
else if (
const auto *temp = dyn_cast<TemplateDecl>(D)) {
831 getLVForTemplateParameterList(temp->getTemplateParameters(), computation);
838 }
else if (isa<NamespaceDecl>(D)) {
843 }
else if (isa<ObjCInterfaceDecl>(D)) {
846 }
else if (
auto *TD = dyn_cast<TypedefNameDecl>(D)) {
849 if (!TD->getAnonDeclWithTypedefName(
true))
866 LinkageComputer::getLVForClassMember(
const NamedDecl *D,
868 bool IgnoreVarTypeLinkage) {
879 if (!(isa<CXXMethodDecl>(D) ||
882 isa<IndirectFieldDecl>(D) ||
884 isa<TemplateDecl>(D)))
910 getLVForDecl(cast<RecordDecl>(D->
getDeclContext()), classComputation);
922 const NamedDecl *explicitSpecSuppressor =
nullptr;
924 if (
const auto *MD = dyn_cast<CXXMethodDecl>(D)) {
927 QualType TypeAsWritten = MD->getType();
929 TypeAsWritten = TSI->getType();
936 = MD->getTemplateSpecializationInfo()) {
937 mergeTemplateLV(LV, MD, spec, computation);
939 explicitSpecSuppressor = MD;
941 explicitSpecSuppressor = spec->getTemplate()->getTemplatedDecl();
944 explicitSpecSuppressor = MD;
947 }
else if (
const auto *RD = dyn_cast<CXXRecordDecl>(D)) {
948 if (
const auto *spec = dyn_cast<ClassTemplateSpecializationDecl>(RD)) {
949 mergeTemplateLV(LV, spec, computation);
951 explicitSpecSuppressor = spec;
959 explicitSpecSuppressor = RD;
963 }
else if (
const auto *VD = dyn_cast<VarDecl>(D)) {
964 if (
const auto *spec = dyn_cast<VarTemplateSpecializationDecl>(VD))
965 mergeTemplateLV(LV, spec, computation);
969 if (!IgnoreVarTypeLinkage) {
970 LinkageInfo typeLV = getLVForType(*VD->getType(), computation);
979 explicitSpecSuppressor = VD;
983 }
else if (
const auto *temp = dyn_cast<TemplateDecl>(D)) {
984 bool considerVisibility =
989 getLVForTemplateParameterList(temp->getTemplateParameters(), computation);
992 if (
const auto *redeclTemp = dyn_cast<RedeclarableTemplateDecl>(temp)) {
994 explicitSpecSuppressor = temp->getTemplatedDecl();
1000 assert(!explicitSpecSuppressor || !isa<TemplateDecl>(explicitSpecSuppressor));
1004 bool considerClassVisibility =
true;
1005 if (explicitSpecSuppressor &&
1010 considerClassVisibility =
false;
1018 void NamedDecl::anchor() {}
1031 StringRef name = getName();
1034 if (name.front() ==
'C')
1035 if (name ==
"CFStringCreateWithFormat" ||
1036 name ==
"CFStringCreateWithFormatAndArguments" ||
1037 name ==
"CFStringAppendFormat" ||
1038 name ==
"CFStringAppendFormatAndArguments")
1058 bool IsMostRecent) {
1067 if (
const auto *RD = dyn_cast<CXXRecordDecl>(ND)) {
1069 if (InstantiatedFrom)
1076 if (
const auto *spec = dyn_cast<ClassTemplateSpecializationDecl>(ND))
1081 if (!IsMostRecent && !isa<NamespaceDecl>(ND)) {
1083 if (MostRecent != ND)
1087 if (
const auto *Var = dyn_cast<VarDecl>(ND)) {
1088 if (Var->isStaticDataMember()) {
1090 if (InstantiatedFrom)
1094 if (
const auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(Var))
1095 return getVisibilityOf(VTSD->getSpecializedTemplate()->getTemplatedDecl(),
1101 if (
const auto *fn = dyn_cast<FunctionDecl>(ND)) {
1106 return getVisibilityOf(templateInfo->getTemplate()->getTemplatedDecl(),
1112 if (InstantiatedFrom)
1119 if (
const auto *TD = dyn_cast<TemplateDecl>(ND))
1137 else if (isa<ParmVarDecl>(ContextDecl))
1141 Owner = cast<NamedDecl>(ContextDecl);
1150 auto *VD = dyn_cast<
VarDecl>(Owner);
1152 VD && VD->getType()->getContainedDeducedType()
1153 ? computeLVForDecl(Owner, computation,
true)
1154 : getLVForDecl(Owner, computation);
1161 OwnerLV.isVisibilityExplicit());
1166 if (
const auto *Function = dyn_cast<FunctionDecl>(D)) {
1167 if (Function->isInAnonymousNamespace() &&
1172 if (Function->getCanonicalDecl()->getStorageClass() ==
SC_Static)
1189 if (
const auto *Var = dyn_cast<VarDecl>(D)) {
1190 if (Var->hasExternalStorage()) {
1203 LinkageInfo PrevLV = getLVForDecl(Prev, computation);
1212 if (!Var->isStaticLocal())
1225 if (
const auto *BD = dyn_cast<BlockDecl>(OuterD)) {
1226 if (!BD->getBlockManglingNumber())
1229 LV = getLVForClosure(BD->getDeclContext()->getRedeclContext(),
1230 BD->getBlockManglingContextDecl(), computation);
1232 const auto *FD = cast<FunctionDecl>(OuterD);
1233 if (!FD->isInlined() &&
1237 LV = getLVForDecl(FD, computation);
1248 while (Record && Record->
isLambda()) {
1252 Record = dyn_cast_or_null<CXXRecordDecl>(
1260 bool IgnoreVarTypeLinkage) {
1262 if (D->
hasAttr<InternalLinkageAttr>())
1277 case Decl::ImplicitParam:
1279 case Decl::NamespaceAlias:
1282 case Decl::UsingShadow:
1283 case Decl::UsingDirective:
1286 case Decl::EnumConstant:
1289 return getLVForDecl(cast<EnumDecl>(D->
getDeclContext()), computation);
1293 case Decl::TypeAlias:
1296 if (!cast<TypedefNameDecl>(D)
1297 ->getAnonDeclWithTypedefName(
true))
1301 case Decl::TemplateTemplateParm:
1302 case Decl::NonTypeTemplateParm:
1303 case Decl::ObjCAtDefsField:
1304 case Decl::ObjCCategory:
1305 case Decl::ObjCCategoryImpl:
1306 case Decl::ObjCCompatibleAlias:
1307 case Decl::ObjCImplementation:
1308 case Decl::ObjCMethod:
1309 case Decl::ObjCProperty:
1310 case Decl::ObjCPropertyImpl:
1311 case Decl::ObjCProtocol:
1314 case Decl::CXXRecord: {
1315 const auto *Record = cast<CXXRecordDecl>(D);
1316 if (Record->isLambda()) {
1317 if (!Record->getLambdaManglingNumber()) {
1337 return getLVForClosure(
1348 return getLVForNamespaceScopeDecl(D, computation, IgnoreVarTypeLinkage);
1358 return getLVForClassMember(D, computation, IgnoreVarTypeLinkage);
1372 return getLVForLocalDecl(D, computation);
1383 if (D->
hasAttr<InternalLinkageAttr>())
1392 LinkageInfo LV = computeLVForDecl(D, computation);
1397 cache(D, computation, LV);
1404 if (!Opts.CPlusPlus || Opts.MicrosoftExt)
1412 auto *T = cast<NamedDecl>(I);
1415 if (!T->isInvalidDecl() && T->hasCachedLinkage()) {
1427 return getLVForDecl(D,
1454 if (
auto *ND = dyn_cast<NamedDecl>(
this))
1455 InternalLinkage = !ND->hasExternalFormalLinkage();
1458 InternalLinkage = (NSD && NSD->isAnonymousNamespace()) ||
1461 return InternalLinkage ? M->
Parent :
nullptr;
1465 llvm_unreachable(
"unknown module kind");
1473 std::string QualName;
1474 llvm::raw_string_ostream OS(QualName);
1475 printQualifiedName(OS,
getASTContext().getPrintingPolicy());
1480 printQualifiedName(OS,
getASTContext().getPrintingPolicy());
1488 if (
auto *MD = dyn_cast<ObjCMethodDecl>(
this))
1489 if (
auto *
ID = MD->getClassInterface())
1498 ContextsTy Contexts;
1501 while (Ctx && isa<NamedDecl>(Ctx)) {
1502 Contexts.push_back(Ctx);
1506 for (
const DeclContext *DC : llvm::reverse(Contexts)) {
1507 if (
const auto *Spec = dyn_cast<ClassTemplateSpecializationDecl>(DC)) {
1508 OS << Spec->getName();
1511 }
else if (
const auto *ND = dyn_cast<NamespaceDecl>(DC)) {
1513 (ND->isAnonymousNamespace() || ND->isInline()))
1515 if (ND->isAnonymousNamespace()) {
1517 :
"(anonymous namespace)");
1521 }
else if (
const auto *RD = dyn_cast<RecordDecl>(DC)) {
1522 if (!RD->getIdentifier())
1523 OS <<
"(anonymous " << RD->getKindName() <<
')';
1526 }
else if (
const auto *FD = dyn_cast<FunctionDecl>(DC)) {
1528 if (FD->hasWrittenPrototype())
1529 FT = dyn_cast<FunctionProtoType>(FD->getType()->castAs<
FunctionType>());
1534 for (
unsigned i = 0; i < NumParams; ++i) {
1537 OS << FD->getParamDecl(i)->getType().stream(P);
1547 }
else if (
const auto *ED = dyn_cast<EnumDecl>(DC)) {
1560 OS << *cast<NamedDecl>(DC);
1565 if (getDeclName() || isa<DecompositionDecl>(
this))
1568 OS <<
"(anonymous)";
1573 bool Qualified)
const {
1575 printQualifiedName(OS, Policy);
1586 #define DECL(Type, Base) \ 1588 return isRedeclarableImpl((Type##Decl *)nullptr); 1589 #define ABSTRACT_DECL(DECL) 1590 #include "clang/AST/DeclNodes.inc" 1592 llvm_unreachable(
"unknown decl kind");
1596 assert(getDeclName() == OldD->
getDeclName() &&
"Declaration name mismatch");
1608 if (isa<ObjCMethodDecl>(
this))
1613 if (isa<ParmVarDecl>(
this))
1625 if (
auto *UD = dyn_cast<UsingDecl>(
this)) {
1629 cast<UsingDecl>(OldD)->getQualifier());
1631 if (
auto *UUVD = dyn_cast<UnresolvedUsingValueDecl>(
this)) {
1635 cast<UnresolvedUsingValueDecl>(OldD)->getQualifier());
1675 NamedDecl *NamedDecl::getUnderlyingDeclImpl() {
1677 while (
auto *UD = dyn_cast<UsingShadowDecl>(ND))
1678 ND = UD->getTargetDecl();
1680 if (
auto *AD = dyn_cast<ObjCCompatibleAliasDecl>(ND))
1681 return AD->getClassInterface();
1683 if (
auto *AD = dyn_cast<NamespaceAliasDecl>(ND))
1684 return AD->getNamespace();
1690 if (!isCXXClassMember())
1694 if (isa<UsingShadowDecl>(D))
1695 D = cast<UsingShadowDecl>(D)->getTargetDecl();
1697 if (isa<FieldDecl>(D) || isa<IndirectFieldDecl>(D) || isa<MSPropertyDecl>(D))
1699 if (
const auto *MD = dyn_cast_or_null<CXXMethodDecl>(D->
getAsFunction()))
1700 return MD->isInstance();
1708 template <
typename DeclT>
1710 if (decl->getNumTemplateParameterLists() > 0)
1711 return decl->getTemplateParameterList(0)->getTemplateLoc();
1713 return decl->getInnerLocStart();
1725 if (!hasExtInfo()) {
1731 getExtInfo()->TInfo = savedTInfo;
1734 getExtInfo()->QualifierLoc = QualifierLoc;
1738 if (getExtInfo()->NumTemplParamLists == 0) {
1744 DeclInfo = savedTInfo;
1747 getExtInfo()->QualifierLoc = QualifierLoc;
1754 assert(!TPLists.empty());
1756 if (!hasExtInfo()) {
1762 getExtInfo()->TInfo = savedTInfo;
1765 getExtInfo()->setTemplateParameterListsInfo(Context, TPLists);
1781 QT = cast<PointerType>(
T)->getPointeeType();
1783 case Type::BlockPointer:
1784 QT = cast<BlockPointerType>(
T)->getPointeeType();
1786 case Type::MemberPointer:
1787 QT = cast<MemberPointerType>(
T)->getPointeeType();
1789 case Type::LValueReference:
1790 case Type::RValueReference:
1791 QT = cast<ReferenceType>(
T)->getPointeeType();
1793 case Type::PackExpansion:
1794 QT = cast<PackExpansionType>(
T)->getPattern();
1797 case Type::ConstantArray:
1798 case Type::DependentSizedArray:
1799 case Type::IncompleteArray:
1800 case Type::VariableArray:
1801 case Type::FunctionProto:
1802 case Type::FunctionNoProto:
1814 RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();
1822 if (NumTemplParamLists > 0) {
1824 TemplParamLists =
nullptr;
1825 NumTemplParamLists = 0;
1828 if (!TPLists.empty()) {
1830 NumTemplParamLists = TPLists.size();
1831 std::copy(TPLists.begin(), TPLists.end(), TemplParamLists);
1849 llvm_unreachable(
"Invalid storage class");
1858 static_assert(
sizeof(VarDeclBitfields) <=
sizeof(
unsigned),
1859 "VarDeclBitfields too large!");
1861 "ParmVarDeclBitfields too large!");
1863 "NonParmVarDeclBitfields too large!");
1873 return new (
C, DC)
VarDecl(Var, C, DC, StartL, IdL, Id, T, TInfo, S);
1890 if (!hasAttr<ThreadAttr>() &&
1893 hasAttr<OMPThreadPrivateDeclAttr>()))
1895 return ((
getASTContext().getLangOpts().isCompatibleWithMSVC(
1897 hasAttr<OMPThreadPrivateDeclAttr>())
1906 llvm_unreachable(
"Unknown thread storage class specifier!");
1920 template<
typename T>
1924 if (!D.hasExternalFormalLinkage())
1948 template<
typename T>
1954 assert(D.getASTContext().getLangOpts().CPlusPlus);
2009 isa<VarTemplatePartialSpecializationDecl>(
this)))
2029 if (
const auto *SAA = getAttr<SelectAnyAttr>())
2030 if (!SAA->isInherited())
2036 if (
auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(
this)) {
2038 !isa<VarTemplatePartialSpecializationDecl>(VTSD) &&
2039 !VTSD->IsCompleteDefinition)
2071 VarDecl *LastTentative =
nullptr;
2073 for (
auto I : First->
redecls()) {
2074 Kind = I->isThisDeclarationADefinition();
2080 return LastTentative;
2085 for (
auto I : First->
redecls()) {
2086 if (I->isThisDeclarationADefinition(C) ==
Definition)
2096 for (
auto I : First->
redecls()) {
2097 Kind =
std::max(Kind, I->isThisDeclarationADefinition(C));
2107 if (
auto Expr = I->getInit()) {
2116 if (
auto *
P = dyn_cast<ParmVarDecl>(
this))
2117 if (
P->hasUnparsedDefaultArg() ||
P->hasUninstantiatedDefaultArg())
2120 return !
Init.isNull();
2127 if (
auto *S =
Init.dyn_cast<
Stmt *>())
2128 return cast<Expr>(S);
2137 return Init.getAddrOfPtr1();
2151 return VD->isOutOfLine();
2158 Eval->~EvaluatedStmt();
2168 if (!Lang.CPlusPlus)
2173 if (Lang.CPlusPlus11 &&
getType()->isReferenceType())
2179 if (!
getType().isConstQualified() ||
getType().isVolatileQualified())
2184 if (
getType()->isIntegralOrEnumerationType())
2224 const auto *
Init = cast<Expr>(Eval->
Value);
2225 assert(!
Init->isValueDependent());
2230 Eval->
IsICE =
false;
2254 Eval->
IsICE = Result && Notes.empty();
2257 return Result ? &Eval->
Evaluated :
nullptr;
2262 if (Eval->WasEvaluated)
2263 return &Eval->Evaluated;
2270 return Eval->CheckedICE;
2277 "Check whether we already know that the initializer is an ICE");
2292 const auto *
Init = cast<Expr>(Eval->
Value);
2293 assert(!
Init->isValueDependent());
2317 template<
typename DeclT>
2320 if (
auto *Def = D->getDefinition())
2328 if (
auto *VDTemplSpec = dyn_cast<VarTemplateSpecializationDecl>(
this)) {
2329 auto From = VDTemplSpec->getInstantiatedFrom();
2331 while (
auto *NewVTD = VTD->getInstantiatedFromMemberTemplate()) {
2332 if (NewVTD->isMemberSpecialization())
2340 while (
auto *NewVTPSD = VTPSD->getInstantiatedFromMember()) {
2341 if (NewVTPSD->isMemberSpecialization())
2345 return getDefinitionOrSelf<VarDecl>(VTPSD);
2359 while (VarTemplate->getInstantiatedFromMemberTemplate()) {
2360 if (VarTemplate->isMemberSpecialization())
2362 VarTemplate = VarTemplate->getInstantiatedFromMemberTemplate();
2372 return cast<VarDecl>(MSI->getInstantiatedFrom());
2378 if (
const auto *Spec = dyn_cast<VarTemplateSpecializationDecl>(
this))
2379 return Spec->getSpecializationKind();
2382 return MSI->getTemplateSpecializationKind();
2388 if (
const auto *Spec = dyn_cast<VarTemplateSpecializationDecl>(
this))
2389 return Spec->getPointOfInstantiation();
2392 return MSI->getPointOfInstantiation();
2417 assert((isa<VarTemplateSpecializationDecl>(
this) ||
2419 "not a variable or static data member template specialization");
2422 dyn_cast<VarTemplateSpecializationDecl>(
this)) {
2423 Spec->setSpecializationKind(TSK);
2425 Spec->getPointOfInstantiation().isInvalid()) {
2426 Spec->setPointOfInstantiation(PointOfInstantiation);
2428 L->InstantiationRequested(
this);
2433 MSI->setTemplateSpecializationKind(TSK);
2435 MSI->getPointOfInstantiation().isInvalid()) {
2436 MSI->setPointOfInstantiation(PointOfInstantiation);
2438 L->InstantiationRequested(
this);
2446 assert(
getASTContext().getTemplateOrSpecializationInfo(
this).isNull() &&
2447 "Previous template or instantiation?");
2460 return new (
C, DC)
ParmVarDecl(ParmVar, C, DC, StartLoc, IdLoc, Id, T, TInfo,
2467 if (
const auto *DT = dyn_cast<DecayedType>(T))
2468 return DT->getOriginalType();
2479 if (!hasInheritedDefaultArg()) {
2494 assert(!hasUnparsedDefaultArg() &&
"Default argument is not yet parsed!");
2495 assert(!hasUninstantiatedDefaultArg() &&
2496 "Default argument is not yet instantiated!");
2499 if (
auto *E = dyn_cast_or_null<ExprWithCleanups>(Arg))
2500 return E->getSubExpr();
2518 return getUninstantiatedDefaultArg()->getSourceRange();
2522 return E->getSourceRange();
2527 llvm_unreachable(
"Invalid default argument kind.");
2536 assert(hasUninstantiatedDefaultArg() &&
2537 "Wrong kind of initialization expression!");
2538 return cast_or_null<Expr>(
Init.get<
Stmt *>());
2545 return hasUnparsedDefaultArg() || hasUninstantiatedDefaultArg() ||
2550 return isa<PackExpansionType>(
getType());
2553 void ParmVarDecl::setParameterIndexLarge(
unsigned parameterIndex) {
2558 unsigned ParmVarDecl::getParameterIndexLarge()
const {
2567 raw_ostream &OS,
const PrintingPolicy &Policy,
bool Qualified)
const {
2575 if (
const auto *FT =
getType()->getAs<FunctionProtoType>())
2576 return FT->isVariadic();
2582 if (I->doesThisDeclarationHaveABody()) {
2600 if (isa<CompoundStmt>(S) && cast<CompoundStmt>(S)->body_empty())
2607 if (I->isThisDeclarationADefinition()) {
2620 if (Definition->Body)
2636 Parent->markedVirtualFunctionPure();
2639 template<std::
size_t Len>
2642 return II && II->
isStr(Str);
2670 return llvm::StringSwitch<bool>(
getName())
2682 assert(
getDeclName().getCXXOverloadedOperator() == OO_New ||
2683 getDeclName().getCXXOverloadedOperator() == OO_Delete ||
2684 getDeclName().getCXXOverloadedOperator() == OO_Array_New ||
2685 getDeclName().getCXXOverloadedOperator() == OO_Array_Delete);
2691 if (proto->getNumParams() != 2 || proto->isVariadic())
2700 return (proto->getParamType(1).getCanonicalType() == Context.
VoidPtrTy);
2706 if (
getDeclName().getCXXOverloadedOperator() != OO_New &&
2707 getDeclName().getCXXOverloadedOperator() != OO_Delete &&
2708 getDeclName().getCXXOverloadedOperator() != OO_Array_New &&
2709 getDeclName().getCXXOverloadedOperator() != OO_Array_Delete)
2720 if (FPT->getNumParams() == 0 || FPT->getNumParams() > 3 || FPT->isVariadic())
2725 if (FPT->getNumParams() == 1)
2728 unsigned Params = 1;
2729 QualType Ty = FPT->getParamType(Params);
2732 auto Consume = [&] {
2734 Ty = Params < FPT->getNumParams() ? FPT->getParamType(Params) :
QualType();
2738 bool IsSizedDelete =
false;
2743 IsSizedDelete =
true;
2766 return Params == FPT->getNumParams();
2774 if (!isa<CXXMethodDecl>(
this) || getOverloadedOperator() != OO_Delete ||
2778 auto *RD = getParamDecl(1)->getType()->getAsCXXRecordDecl();
2779 return RD && RD->isInStdNamespace() && RD->getIdentifier() &&
2780 RD->getIdentifier()->isStr(
"destroying_delete_t");
2800 if (
const auto *Method = dyn_cast<CXXMethodDecl>(
this))
2801 return Method->isStatic();
2809 if (
const auto *Namespace = cast<NamespaceDecl>(DC)) {
2810 if (!Namespace->getDeclName())
2820 if (hasAttr<NoReturnAttr>() || hasAttr<CXX11NoReturnAttr>() ||
2821 hasAttr<C11NoReturnAttr>())
2824 if (
auto *FnTy =
getType()->getAs<FunctionType>())
2825 return FnTy->getNoReturnAttr();
2837 assert((!PrevDecl || PrevFunTmpl) &&
"Function/function template mismatch");
2838 FunTmpl->setPreviousDecl(PrevFunTmpl);
2841 if (PrevDecl && PrevDecl->IsInline)
2866 const auto *LinkageDecl =
2873 if (BuiltinID == Builtin::BI__GetExceptionInfo &&
2875 return Builtin::BI__GetExceptionInfo;
2884 if (hasAttr<OverloadableAttr>())
2917 assert(!ParamInfo &&
"Already has param info!");
2918 assert(NewParamInfo.size() == getNumParams() &&
"Parameter count mismatch!");
2921 if (!NewParamInfo.empty()) {
2923 std::copy(NewParamInfo.begin(), NewParamInfo.end(), ParamInfo);
2933 return getNumParams();
2935 unsigned NumRequiredArgs = 0;
2936 for (
auto *Param : parameters())
2937 if (!Param->isParameterPack() && !Param->hasDefaultArg())
2939 return NumRequiredArgs;
2948 assert(isInlined() &&
"expected to get called on an inlined function!");
2952 !hasAttr<DLLExportAttr>())
2957 if (!FD->isImplicit() && FD->getStorageClass() ==
SC_Extern)
2969 if (!FD->isImplicit() && FD->getStorageClass() ==
SC_Extern)
2998 assert(!doesThisDeclarationHaveABody() &&
2999 "Must have a declaration without a body.");
3010 if (Context.
getLangOpts().GNUInline || hasAttr<GNUInlineAttr>()) {
3020 bool FoundBody =
false;
3022 FoundBody |= Prev->Body.
isValid();
3048 bool FoundBody =
false;
3050 FoundBody |= Prev->Body.
isValid();
3090 QualType RetType = getReturnType();
3092 if (
const auto *Ret =
3093 dyn_cast_or_null<RecordDecl>(RetType->
getAsTagDecl())) {
3094 if (
const auto *R = Ret->getAttr<WarnUnusedResultAttr>())
3098 if (
const EnumDecl *ED = ET->getDecl()) {
3099 if (
const auto *R = ED->getAttr<WarnUnusedResultAttr>())
3103 return getAttr<WarnUnusedResultAttr>();
3124 assert((doesThisDeclarationHaveABody() || willHaveBody()) &&
3125 "Must be a function definition");
3126 assert(isInlined() &&
"Function must be inline");
3129 if (Context.
getLangOpts().GNUInline || hasAttr<GNUInlineAttr>()) {
3141 for (
auto Redecl :
redecls()) {
3142 if (Redecl->isInlineSpecified() &&
3152 "should not use C inline rules in C++");
3158 for (
auto Redecl :
redecls()) {
3189 if (TemplateOrSpecialization.isNull())
3190 return TK_NonTemplate;
3192 return TK_FunctionTemplate;
3194 return TK_MemberSpecialization;
3196 return TK_FunctionTemplateSpecialization;
3197 if (TemplateOrSpecialization.is
3199 return TK_DependentFunctionTemplateSpecialization;
3201 llvm_unreachable(
"Did we miss a TemplateOrSpecialization type?");
3206 return cast<FunctionDecl>(Info->getInstantiatedFrom());
3216 FunctionDecl::setInstantiationOfMemberFunction(
ASTContext &C,
3219 assert(TemplateOrSpecialization.isNull() &&
3220 "Member function is already a specialization");
3223 TemplateOrSpecialization = Info;
3231 TemplateOrSpecialization = Template;
3250 return getClassScopeSpecializationPattern() !=
nullptr;
3259 bool HasPattern =
false;
3261 HasPattern = PatternDecl->
hasBody(PatternDecl);
3267 if (!HasPattern || !PatternDecl)
3283 llvm_unreachable(
"All TSK values handled.");
3289 if (
auto *Spec = getClassScopeSpecializationPattern())
3304 dyn_cast<CXXMethodDecl>(
this))) {
3305 assert(getPrimaryTemplate() &&
"not a generic lambda call operator?");
3310 while (Primary->getInstantiatedFromMemberTemplate()) {
3313 if (Primary->isMemberSpecialization())
3315 Primary = Primary->getInstantiatedFromMemberTemplate();
3321 if (
auto *MFD = getInstantiatedFromMemberFunction())
3329 = TemplateOrSpecialization
3330 .dyn_cast<FunctionTemplateSpecializationInfo*>()) {
3331 return Info->Template.getPointer();
3342 return TemplateOrSpecialization
3349 = TemplateOrSpecialization
3350 .dyn_cast<FunctionTemplateSpecializationInfo*>()) {
3351 return Info->TemplateArguments;
3359 = TemplateOrSpecialization
3360 .dyn_cast<FunctionTemplateSpecializationInfo*>()) {
3361 return Info->TemplateArgumentsAsWritten;
3367 FunctionDecl::setFunctionTemplateSpecialization(
ASTContext &C,
3375 "Must specify the type of function template specialization");
3381 TemplateArgsAsWritten,
3382 PointOfInstantiation);
3383 TemplateOrSpecialization = Info;
3391 assert(TemplateOrSpecialization.isNull());
3395 TemplateOrSpecialization = Info;
3400 return TemplateOrSpecialization
3409 totalSizeToAlloc<TemplateArgumentLoc, FunctionTemplateDecl *>(
3414 DependentFunctionTemplateSpecializationInfo::
3418 NumTemplates = Ts.
size();
3419 NumArgs = TArgs.
size();
3422 for (
unsigned I = 0, E = Ts.
size(); I != E; ++I)
3426 for (
unsigned I = 0, E = TArgs.
size(); I != E; ++I)
3450 = TemplateOrSpecialization.dyn_cast<
3452 FTSInfo->setTemplateSpecializationKind(TSK);
3454 PointOfInstantiation.
isValid() &&
3455 FTSInfo->getPointOfInstantiation().isInvalid()) {
3456 FTSInfo->setPointOfInstantiation(PointOfInstantiation);
3458 L->InstantiationRequested(
this);
3462 MSInfo->setTemplateSpecializationKind(TSK);
3464 PointOfInstantiation.
isValid() &&
3465 MSInfo->getPointOfInstantiation().isInvalid()) {
3466 MSInfo->setPointOfInstantiation(PointOfInstantiation);
3468 L->InstantiationRequested(
this);
3471 llvm_unreachable(
"Function cannot have a template specialization kind");
3476 = TemplateOrSpecialization.dyn_cast<
3478 return FTSInfo->getPointOfInstantiation();
3481 return MSInfo->getPointOfInstantiation();
3492 if (
FunctionDecl *FD = getInstantiatedFromMemberFunction()) {
3502 if (FunTmpl->getTemplatedDecl()->hasBody(Definition))
3520 switch (getBuiltinID()) {
3521 case Builtin::BI__builtin_memset:
3522 case Builtin::BI__builtin___memset_chk:
3523 case Builtin::BImemset:
3524 return Builtin::BImemset;
3526 case Builtin::BI__builtin_memcpy:
3527 case Builtin::BI__builtin___memcpy_chk:
3528 case Builtin::BImemcpy:
3529 return Builtin::BImemcpy;
3531 case Builtin::BI__builtin_memmove:
3532 case Builtin::BI__builtin___memmove_chk:
3533 case Builtin::BImemmove:
3534 return Builtin::BImemmove;
3536 case Builtin::BIstrlcpy:
3537 case Builtin::BI__builtin___strlcpy_chk:
3538 return Builtin::BIstrlcpy;
3540 case Builtin::BIstrlcat:
3541 case Builtin::BI__builtin___strlcat_chk:
3542 return Builtin::BIstrlcat;
3544 case Builtin::BI__builtin_memcmp:
3545 case Builtin::BImemcmp:
3546 return Builtin::BImemcmp;
3548 case Builtin::BI__builtin_strncpy:
3549 case Builtin::BI__builtin___strncpy_chk:
3550 case Builtin::BIstrncpy:
3551 return Builtin::BIstrncpy;
3553 case Builtin::BI__builtin_strncmp:
3554 case Builtin::BIstrncmp:
3555 return Builtin::BIstrncmp;
3557 case Builtin::BI__builtin_strncasecmp:
3558 case Builtin::BIstrncasecmp:
3559 return Builtin::BIstrncasecmp;
3561 case Builtin::BI__builtin_strncat:
3562 case Builtin::BI__builtin___strncat_chk:
3563 case Builtin::BIstrncat:
3564 return Builtin::BIstrncat;
3566 case Builtin::BI__builtin_strndup:
3567 case Builtin::BIstrndup:
3568 return Builtin::BIstrndup;
3570 case Builtin::BI__builtin_strlen:
3571 case Builtin::BIstrlen:
3572 return Builtin::BIstrlen;
3574 case Builtin::BI__builtin_bzero:
3575 case Builtin::BIbzero:
3576 return Builtin::BIbzero;
3580 if (FnInfo->
isStr(
"memset"))
3581 return Builtin::BImemset;
3582 else if (FnInfo->
isStr(
"memcpy"))
3583 return Builtin::BImemcpy;
3584 else if (FnInfo->
isStr(
"memmove"))
3585 return Builtin::BImemmove;
3586 else if (FnInfo->
isStr(
"memcmp"))
3587 return Builtin::BImemcmp;
3588 else if (FnInfo->
isStr(
"strncpy"))
3589 return Builtin::BIstrncpy;
3590 else if (FnInfo->
isStr(
"strncmp"))
3591 return Builtin::BIstrncmp;
3592 else if (FnInfo->
isStr(
"strncasecmp"))
3593 return Builtin::BIstrncasecmp;
3594 else if (FnInfo->
isStr(
"strncat"))
3595 return Builtin::BIstrncat;
3596 else if (FnInfo->
isStr(
"strndup"))
3597 return Builtin::BIstrndup;
3598 else if (FnInfo->
isStr(
"strlen"))
3599 return Builtin::BIstrlen;
3600 else if (FnInfo->
isStr(
"bzero"))
3601 return Builtin::BIbzero;
3636 return new (
C, DC)
FieldDecl(Decl::Field, DC, StartLoc, IdLoc, Id, T, TInfo,
3637 BW, Mutable, InitStyle);
3650 if (
const auto *Record =
getType()->getAs<RecordType>())
3651 return Record->getDecl()->isAnonymousStructOrUnion();
3657 assert(isBitField() &&
"not a bitfield");
3658 return getBitWidth()->EvaluateKnownConstInt(Ctx).getZExtValue();
3663 if (Canonical !=
this)
3666 if (CachedFieldIndex)
return CachedFieldIndex - 1;
3670 assert(RD &&
"requested index for field of struct with no definition");
3672 for (
auto *Field : RD->
fields()) {
3673 Field->getCanonicalDecl()->CachedFieldIndex = Index + 1;
3677 assert(CachedFieldIndex &&
"failed to find field in parent");
3678 return CachedFieldIndex - 1;
3682 const Expr *FinalExpr = getInClassInitializer();
3684 FinalExpr = getBitWidth();
3691 assert((getParent()->isLambda() || getParent()->isCapturedRecord()) &&
3692 "capturing type in non-lambda or captured record.");
3693 assert(InitStorage.getInt() == ISK_NoInit &&
3694 InitStorage.getPointer() ==
nullptr &&
3695 "bit width, initializer or captured type already set");
3696 InitStorage.setPointerAndInt(const_cast<VariableArrayType *>(VLAType),
3697 ISK_CapturedVLAType);
3717 TypedefNameDeclOrQualifier = TDD;
3718 if (
const Type *T = getTypeForDecl()) {
3726 IsBeingDefined =
true;
3728 if (
auto *D = dyn_cast<CXXRecordDecl>(
this)) {
3729 struct CXXRecordDecl::DefinitionData *Data =
3730 new (
getASTContext())
struct CXXRecordDecl::DefinitionData(D);
3732 cast<CXXRecordDecl>(I)->DefinitionData = Data;
3737 assert((!isa<CXXRecordDecl>(
this) ||
3739 "definition completed but not started");
3741 IsCompleteDefinition =
true;
3742 IsBeingDefined =
false;
3745 L->CompletedTagDefinition(
this);
3749 if (isCompleteDefinition())
3750 return const_cast<TagDecl *
>(
this);
3753 if (MayHaveOutOfDateDef) {
3755 if (II->isOutOfDate()) {
3761 if (
const auto *CXXRD = dyn_cast<CXXRecordDecl>(
this))
3762 return CXXRD->getDefinition();
3765 if (R->isCompleteDefinition())
3781 if (getExtInfo()->NumTemplParamLists == 0) {
3786 getExtInfo()->QualifierLoc = QualifierLoc;
3793 assert(!TPLists.empty());
3806 void EnumDecl::anchor() {}
3812 bool IsScopedUsingClassTag,
bool IsFixed) {
3813 auto *Enum =
new (
C, DC)
EnumDecl(C, DC, StartLoc, IdLoc, Id, PrevDecl,
3814 IsScoped, IsScopedUsingClassTag, IsFixed);
3815 Enum->MayHaveOutOfDateDef = C.
getLangOpts().Modules;
3823 nullptr,
nullptr,
false,
false,
false);
3830 return TI->getTypeLoc().getSourceRange();
3836 unsigned NumPositiveBits,
3837 unsigned NumNegativeBits) {
3838 assert(!isCompleteDefinition() &&
"Cannot redefine enums!");
3841 PromotionType = NewPromotionType;
3842 setNumPositiveBits(NumPositiveBits);
3843 setNumNegativeBits(NumNegativeBits);
3848 if (
const auto *A = getAttr<EnumExtensibilityAttr>())
3849 return A->getExtensibility() == EnumExtensibilityAttr::Closed;
3854 return isClosed() && hasAttr<FlagEnumAttr>();
3858 return isClosed() && !hasAttr<FlagEnumAttr>();
3863 return MSI->getTemplateSpecializationKind();
3871 assert(MSI &&
"Not an instantiated member enumeration?");
3874 PointOfInstantiation.
isValid() &&
3882 EnumDecl *ED = getInstantiatedFromMemberEnum();
3890 "couldn't find pattern for enum instantiation");
3895 if (SpecializationInfo)
3896 return cast<EnumDecl>(SpecializationInfo->getInstantiatedFrom());
3903 assert(!SpecializationInfo &&
"Member enum is already a specialization");
3915 :
TagDecl(DK, TK, C, DC, IdLoc, Id, PrevDecl, StartLoc),
3916 HasFlexibleArrayMember(
false), AnonymousStructOrUnion(
false),
3917 HasObjectMember(
false), HasVolatileMember(
false),
3918 LoadedFieldsFromExternalStorage(
false) {
3919 assert(
classof(static_cast<Decl*>(
this)) &&
"Invalid Kind!");
3926 StartLoc, IdLoc, Id, PrevDecl);
3947 if (
auto RD = dyn_cast<CXXRecordDecl>(
this))
3948 return RD->isLambda();
3953 return hasAttr<CapturedRecordAttr>();
3962 LoadFieldsFromExternalStorage();
3978 return hasAttr<MSStructAttr>() || C.
getLangOpts().MSBitfields == 1;
3981 void RecordDecl::LoadFieldsFromExternalStorage()
const {
3989 LoadedFieldsFromExternalStorage =
true;
3996 for (
unsigned i=0, e=Decls.size(); i != e; ++i)
3997 assert(isa<FieldDecl>(Decls[i]) || isa<IndirectFieldDecl>(Decls[i]));
4010 (SanitizerKind::Address | SanitizerKind::KernelAddress);
4011 if (!EnabledAsanMask || !Context.
getLangOpts().SanitizeAddressFieldPadding)
4016 int ReasonToReject = -1;
4017 if (!CXXRD || CXXRD->isExternCContext())
4019 else if (CXXRD->hasAttr<PackedAttr>())
4021 else if (CXXRD->isUnion())
4023 else if (CXXRD->isTriviallyCopyable())
4025 else if (CXXRD->hasTrivialDestructor())
4027 else if (CXXRD->isStandardLayout())
4029 else if (Blacklist.isBlacklistedLocation(EnabledAsanMask,
getLocation(),
4032 else if (Blacklist.isBlacklistedType(EnabledAsanMask,
4038 if (ReasonToReject >= 0)
4041 diag::remark_sanitize_address_insert_extra_padding_rejected)
4046 diag::remark_sanitize_address_insert_extra_padding_accepted)
4049 return ReasonToReject < 0;
4053 for (
const auto *I :
fields()) {
4054 if (I->getIdentifier())
4057 if (
const auto *RT = I->getType()->getAs<
RecordType>())
4059 RT->getDecl()->findFirstNamedDataMember())
4060 return NamedDataMember;
4072 assert(!ParamInfo &&
"Already has param info!");
4075 if (!NewParamInfo.empty()) {
4076 NumParams = NewParamInfo.size();
4078 std::copy(NewParamInfo.begin(), NewParamInfo.end(), ParamInfo);
4083 bool CapturesCXXThis) {
4084 this->CapturesCXXThis = CapturesCXXThis;
4085 this->NumCaptures = Captures.size();
4087 if (Captures.empty()) {
4088 this->Captures =
nullptr;
4092 this->Captures = Captures.copy(Context).data();
4096 for (
const auto &I : captures())
4098 if (I.getVariable() == variable)
4112 void TranslationUnitDecl::anchor() {}
4118 void PragmaCommentDecl::anchor() {}
4126 new (
C, DC, additionalSizeToAlloc<char>(Arg.size() + 1))
4128 memcpy(PCD->getTrailingObjects<
char>(), Arg.data(), Arg.size());
4129 PCD->getTrailingObjects<
char>()[Arg.size()] =
'\0';
4136 return new (
C,
ID, additionalSizeToAlloc<char>(ArgSize + 1))
4140 void PragmaDetectMismatchDecl::anchor() {}
4146 size_t ValueStart = Name.size() + 1;
4148 new (
C, DC, additionalSizeToAlloc<char>(ValueStart + Value.size() + 1))
4150 memcpy(PDMD->getTrailingObjects<
char>(), Name.data(), Name.size());
4151 PDMD->getTrailingObjects<
char>()[Name.size()] =
'\0';
4152 memcpy(PDMD->getTrailingObjects<
char>() + ValueStart, Value.data(),
4154 PDMD->getTrailingObjects<
char>()[ValueStart + Value.size()] =
'\0';
4160 unsigned NameValueSize) {
4161 return new (
C,
ID, additionalSizeToAlloc<char>(NameValueSize + 1))
4165 void ExternCContextDecl::anchor() {}
4172 void LabelDecl::anchor() {}
4176 return new (
C, DC)
LabelDecl(DC, IdentL, II,
nullptr, IdentL);
4182 assert(GnuLabelL != IdentL &&
"Use this only for GNU local labels");
4183 return new (
C, DC)
LabelDecl(DC, IdentL, II,
nullptr, GnuLabelL);
4192 char *Buffer =
new (
getASTContext(), 1)
char[Name.size() + 1];
4193 memcpy(Buffer, Name.data(), Name.size());
4194 Buffer[Name.size()] =
'\0';
4198 void ValueDecl::anchor() {}
4201 for (
const auto *I :
attrs())
4202 if (isa<WeakAttr>(I) || isa<WeakRefAttr>(I))
4208 void ImplicitParamDecl::anchor() {}
4232 bool isInlineSpecified,
4233 bool hasWrittenPrototype,
4234 bool isConstexprSpecified) {
4236 new (
C, DC)
FunctionDecl(Function, C, DC, StartLoc, NameInfo, T, TInfo,
4237 SC, isInlineSpecified, isConstexprSpecified);
4238 New->HasWrittenPrototype = hasWrittenPrototype;
4256 CapturedDecl::CapturedDecl(
DeclContext *DC,
unsigned NumParams)
4258 NumParams(NumParams), ContextParam(0), BodyAndNothrow(
nullptr,
false) {}
4261 unsigned NumParams) {
4262 return new (
C, DC, additionalSizeToAlloc<ImplicitParamDecl *>(NumParams))
4267 unsigned NumParams) {
4268 return new (
C,
ID, additionalSizeToAlloc<ImplicitParamDecl *>(NumParams))
4281 Expr *E,
const llvm::APSInt &V) {
4288 QualType(),
nullptr, llvm::APSInt());
4291 void IndirectFieldDecl::anchor() {}
4297 :
ValueDecl(IndirectField, DC, L, N, T), Chaining(CH.data()),
4298 ChainingSize(CH.size()) {
4321 End = Init->getLocEnd();
4325 void TypeDecl::anchor() {}
4330 return new (
C, DC)
TypedefDecl(C, DC, StartLoc, IdLoc, Id, TInfo);
4333 void TypedefNameDecl::anchor() {}
4336 if (
auto *TT = getTypeSourceInfo()->getType()->getAs<TagType>()) {
4338 auto *ThisTypedef =
this;
4339 if (AnyRedecl && OwningTypedef) {
4343 if (OwningTypedef == ThisTypedef)
4344 return TT->getDecl();
4350 bool TypedefNameDecl::isTransparentTagSlow()
const {
4351 auto determineIsTransparent = [&]() {
4353 if (
auto *TD = TT->getDecl()) {
4354 if (TD->getName() !=
getName())
4367 bool isTransparent = determineIsTransparent();
4368 CacheIsTransparentTag = 1;
4370 CacheIsTransparentTag |= 0x2;
4371 return isTransparent;
4383 return new (
C, DC)
TypeAliasDecl(C, DC, StartLoc, IdLoc, Id, TInfo);
4395 RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();
4403 RangeEnd = TInfo->getTypeLoc().getSourceRange().getEnd();
4407 void FileScopeAsmDecl::anchor() {}
4422 void EmptyDecl::anchor() {}
4450 :
Decl(Import, DC, StartLoc), ImportedAndComplete(Imported,
true) {
4452 auto *StoredLocs = getTrailingObjects<SourceLocation>();
4453 std::uninitialized_copy(IdentifierLocs.begin(), IdentifierLocs.end(),
4459 :
Decl(Import, DC, StartLoc), ImportedAndComplete(Imported,
false) {
4460 *getTrailingObjects<SourceLocation>() = EndLoc;
4467 additionalSizeToAlloc<SourceLocation>(IdentifierLocs.size()))
4468 ImportDecl(DC, StartLoc, Imported, IdentifierLocs);
4475 ImportDecl *Import =
new (
C, DC, additionalSizeToAlloc<SourceLocation>(1))
4482 unsigned NumLocations) {
4483 return new (
C,
ID, additionalSizeToAlloc<SourceLocation>(NumLocations))
4488 if (!ImportedAndComplete.getInt())
4491 const auto *StoredLocs = getTrailingObjects<SourceLocation>();
4492 return llvm::makeArrayRef(StoredLocs,
4497 if (!ImportedAndComplete.getInt())
4507 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.
void setImplicit(bool I=true)
An instance of this class is created to represent 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).
void AddFunctionDecl(const FunctionDecl *Function)
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
getDefinition - 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.
EnumConstantDecl - 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)
TypedefDecl - 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 isRecordType() const
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
getFieldIndex - Returns the index of this field within its record, as appropriate for passing to ASTR...
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.
NamespaceDecl - 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()
completeDefinition - Notes that the definition of this type is now complete.
const TargetInfo & getTargetInfo() const
A container of type source information.
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
getOuterLocStart - Return SourceLocation representing start of source range taking into account any o...
void setTemplateParameterListsInfo(ASTContext &Context, ArrayRef< TemplateParameterList *> TPLists)
setTemplateParameterListsInfo - Sets info about "outer" template parameter lists. ...
const Expr * getAnyInitializer() const
getAnyInitializer - Get the initializer for this variable, no matter which declaration it is attached...
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
isCompleteDefinition - 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.
VarDecl - An instance of this class is created to represent 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
hasDefaultArg - 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.
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.
ParmVarDecl - Represents a parameter to a function.
Linkage
Describes the different kinds of linkage (C++ [basic.link], C99 6.2.2) that an entity may have...
Defines the clang::Expr interface and subclasses for C++ expressions.
LinkageInfo getLVForDecl(const NamedDecl *D, LVComputationKind computation)
getLVForDecl - Get the linkage and visibility for the given declaration.
Provides information about a dependent function-template specialization declaration.
bool isAnonymousStructOrUnion() const
isAnonymousStructOrUnion - Determines whether this field is a representative for an anonymous struct ...
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
getIdentifier - Get the identifier that names this declaration, if there is one.
Defines the clang::SanitizerKind enum.
RecordDecl - Represents a struct/union/class.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
DeclarationName getDeclName() const
getDeclName - 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
getOuterLocStart - Return SourceLocation representing start of source range taking into account any o...
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 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
getDefinition - 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)
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
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.
bool Equals(const DeclContext *DC) const
Determine whether this declaration context is equivalent to the declaration context DC...
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.
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
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...
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)
This 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 ...
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)
TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x 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
isFileVarDecl - 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.
SourceLocation getLocEnd() const LLVM_READONLY
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.
BlockDecl - This represents a block literal declaration, which is like an unnamed FunctionDecl...
const FieldDecl * findFirstNamedDataMember() const
Finds the first data member which has a name.
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
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 FunctionProtoType * T
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...
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.
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 (definition).
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)
TagDecl * getAsTagDecl() const
Retrieves the TagDecl that this type refers to, either because the type is a TagType or because it is...
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
printQualifiedName - Returns human-readable qualified name for declaration, like A::B::i, for i being member of namespace A::B.
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.
QualifierInfo - A struct with extended info about a syntactic name qualifier, to be used for the case...
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...
TagDecl - Represents the declaration of a struct/union/class/enum.
LanguageLinkage
Describes the different kinds of language linkage (C++ [dcl.link]) that an entity may have...
ASTContext & getASTContext() const LLVM_READONLY
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)
LabelDecl - 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.
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.
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.
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)
getStorageClassSpecifierString - 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.
IndirectFieldDecl - An instance of this class is created to represent a field injected from an anonym...
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
EnumDecl - Represents an enum.
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.
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...
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
char __ovld __cnfn max(char x, char y)
Returns y if x < y, otherwise it returns x.
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
getName - 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)
VarDeclBitfields VarDeclBits
VarDecl * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
TranslationUnitDecl - 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.
NamedDecl - This represents a decl with 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
getInnerLocStart - Return SourceLocation representing start of source range ignoring outer template d...
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.