55 #include "llvm/ADT/APSInt.h" 56 #include "llvm/ADT/ArrayRef.h" 57 #include "llvm/ADT/DenseMap.h" 58 #include "llvm/ADT/None.h" 59 #include "llvm/ADT/Optional.h" 60 #include "llvm/ADT/STLExtras.h" 61 #include "llvm/ADT/SmallVector.h" 62 #include "llvm/Support/Casting.h" 63 #include "llvm/Support/ErrorHandling.h" 64 #include "llvm/Support/MemoryBuffer.h" 69 #include <type_traits> 83 std::reverse(Redecls.begin(), Redecls.end());
89 auto FD = cast<FunctionDecl>(D);
90 return getCanonicalForwardRedeclChain<FunctionDecl>(FD);
106 template <
typename ToDeclT>
struct CallOverloadedCreateFun {
107 template <
typename... Args>
108 auto operator()(Args &&... args)
120 template <
typename ToDeclT,
typename FromDeclT,
typename... Args>
121 LLVM_NODISCARD
bool GetImportedOrCreateDecl(ToDeclT *&ToD, FromDeclT *FromD,
126 CallOverloadedCreateFun<ToDeclT> OC;
127 return GetImportedOrCreateSpecialDecl(ToD, OC, FromD,
128 std::forward<Args>(args)...);
135 template <
typename NewDeclT,
typename ToDeclT,
typename FromDeclT,
137 LLVM_NODISCARD
bool GetImportedOrCreateDecl(ToDeclT *&ToD, FromDeclT *FromD,
139 CallOverloadedCreateFun<NewDeclT> OC;
140 return GetImportedOrCreateSpecialDecl(ToD, OC, FromD,
141 std::forward<Args>(args)...);
145 template <
typename ToDeclT,
typename CreateFunT,
typename FromDeclT,
148 GetImportedOrCreateSpecialDecl(ToDeclT *&ToD, CreateFunT CreateFun,
149 FromDeclT *FromD, Args &&... args) {
153 ToD = CreateFun(std::forward<Args>(args)...);
154 InitializeImportedDecl(FromD, ToD);
158 void InitializeImportedDecl(
Decl *FromD,
Decl *ToD) {
277 unsigned NumFromArgs,
280 template <
typename InContainerTy>
284 template<
typename InContainerTy>
287 const InContainerTy &Container,
292 std::tuple<FunctionTemplateDecl *, OptionalTemplateArgsTy>
300 bool Complain =
true);
302 bool Complain =
true);
472 template<
typename IIter,
typename OIter>
477 std::transform(Ibegin, Iend, Obegin,
478 [&ImporterRef](ItemT From) -> ItemT {
479 return ImporterRef.
Import(From);
483 template<
typename IIter,
typename OIter>
489 std::transform(Ibegin, Iend, Obegin,
490 [&ImporterRef, &Failed](ItemT *From) -> ItemT * {
491 auto *To = cast_or_null<ItemT>(ImporterRef.
Import(From));
499 template<
typename InContainerTy,
typename OutContainerTy>
501 OutContainerTy &OutContainer) {
503 OutContainer.begin());
506 template<
typename InContainerTy,
typename OIter>
517 template <
typename InContainerTy>
522 Importer.Import(FromRAngleLoc));
530 bool ASTNodeImporter::ImportTemplateArgumentListInfo<TemplateArgumentListInfo>(
533 From.getLAngleLoc(), From.getRAngleLoc(), From.arguments(),
Result);
541 From.arguments(),
Result);
544 std::tuple<FunctionTemplateDecl *, ASTNodeImporter::OptionalTemplateArgsTy>
550 auto *Template = cast_or_null<FunctionTemplateDecl>(
551 Importer.Import(FTSInfo->getTemplate()));
554 auto TemplArgs = FTSInfo->TemplateArguments->asArray();
560 return std::make_tuple(Template, ToTemplArgs);
569 using namespace clang;
572 Importer.FromDiag(
SourceLocation(), diag::err_unsupported_ast_node)
579 if(UnderlyingType.
isNull())
582 return Importer.getToContext().getAtomicType(UnderlyingType);
587 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 588 case BuiltinType::Id: \ 589 return Importer.getToContext().SingletonId; 590 #include "clang/Basic/OpenCLImageTypes.def" 591 #define SHARED_SINGLETON_TYPE(Expansion) 592 #define BUILTIN_TYPE(Id, SingletonId) \ 593 case BuiltinType::Id: return Importer.getToContext().SingletonId; 594 #include "clang/AST/BuiltinTypes.def" 602 case BuiltinType::Char_U:
606 if (Importer.getToContext().getLangOpts().CharIsSigned)
607 return Importer.getToContext().UnsignedCharTy;
609 return Importer.getToContext().CharTy;
611 case BuiltinType::Char_S:
615 if (!Importer.getToContext().getLangOpts().CharIsSigned)
616 return Importer.getToContext().SignedCharTy;
618 return Importer.getToContext().CharTy;
620 case BuiltinType::WChar_S:
621 case BuiltinType::WChar_U:
624 return Importer.getToContext().WCharTy;
627 llvm_unreachable(
"Invalid BuiltinType Kind!");
635 return Importer.getToContext().getDecayedType(OrigT);
640 if (ToElementType.
isNull())
643 return Importer.getToContext().getComplexType(ToElementType);
648 if (ToPointeeType.
isNull())
651 return Importer.getToContext().getPointerType(ToPointeeType);
657 if (ToPointeeType.
isNull())
660 return Importer.getToContext().getBlockPointerType(ToPointeeType);
667 if (ToPointeeType.
isNull())
670 return Importer.getToContext().getLValueReferenceType(ToPointeeType);
677 if (ToPointeeType.
isNull())
680 return Importer.getToContext().getRValueReferenceType(ToPointeeType);
686 if (ToPointeeType.
isNull())
690 return Importer.getToContext().getMemberPointerType(ToPointeeType,
696 if (ToElementType.
isNull())
699 return Importer.getToContext().getConstantArrayType(ToElementType,
708 if (ToElementType.
isNull())
711 return Importer.getToContext().getIncompleteArrayType(ToElementType,
718 if (ToElementType.
isNull())
726 return Importer.getToContext().getVariableArrayType(ToElementType, Size,
735 if (ToElementType.
isNull())
745 return Importer.getToContext().getDependentSizedArrayType(
752 if (ToElementType.
isNull())
755 return Importer.getToContext().getVectorType(ToElementType,
762 if (ToElementType.
isNull())
765 return Importer.getToContext().getExtVectorType(ToElementType,
774 if (ToResultType.
isNull())
777 return Importer.getToContext().getFunctionNoProtoType(ToResultType,
783 if (ToResultType.
isNull())
789 QualType ArgType = Importer.Import(A);
792 ArgTypes.push_back(ArgType);
798 QualType ExceptionType = Importer.Import(E);
799 if (ExceptionType.
isNull())
801 ExceptionTypes.push_back(ExceptionType);
821 return Importer.getToContext().
getFunctionType(ToResultType, ArgTypes, ToEPI);
827 cast_or_null<UnresolvedUsingTypenameDecl>(Importer.Import(T->
getDecl()));
832 cast_or_null<UnresolvedUsingTypenameDecl>(
837 return Importer.getToContext().getTypeDeclType(ToD, ToPrevD);
845 return Importer.getToContext().getParenType(ToInnerType);
850 dyn_cast_or_null<TypedefNameDecl>(Importer.Import(T->
getDecl()));
854 return Importer.getToContext().getTypeDeclType(ToDecl);
862 return Importer.getToContext().getTypeOfExprType(ToExpr);
867 if (ToUnderlyingType.
isNull())
870 return Importer.getToContext().getTypeOfType(ToUnderlyingType);
880 if (UnderlyingType.
isNull())
883 return Importer.getToContext().getDecltypeType(ToExpr, UnderlyingType);
892 return Importer.getToContext().getUnaryTransformType(ToBaseType,
901 if (!FromDeduced.
isNull()) {
902 ToDeduced = Importer.Import(FromDeduced);
907 return Importer.getToContext().getAutoType(ToDeduced, T->
getKeyword(),
913 auto *D = cast_or_null<CXXRecordDecl>(Importer.Import(T->
getDecl()));
934 auto *ToDecl = dyn_cast_or_null<RecordDecl>(Importer.Import(T->
getDecl()));
938 return Importer.getToContext().getTagDeclType(ToDecl);
942 auto *ToDecl = dyn_cast_or_null<EnumDecl>(Importer.Import(T->
getDecl()));
946 return Importer.getToContext().getTagDeclType(ToDecl);
955 if (!FromModifiedType.
isNull()) {
956 ToModifiedType = Importer.Import(FromModifiedType);
957 if (ToModifiedType.
isNull())
960 if (!FromEquivalentType.
isNull()) {
961 ToEquivalentType = Importer.Import(FromEquivalentType);
962 if (ToEquivalentType.
isNull())
966 return Importer.getToContext().getAttributedType(T->
getAttrKind(),
967 ToModifiedType, ToEquivalentType);
973 cast_or_null<TemplateTypeParmDecl>(Importer.Import(T->
getDecl()));
977 return Importer.getToContext().getTemplateTypeParmType(
983 const auto *Replaced =
984 cast_or_null<TemplateTypeParmType>(Importer.Import(
994 return Importer.getToContext().getSubstTemplateTypeParmType(
995 Replaced, Replacement);
1012 ToCanonType =Importer.Import(FromCanonType);
1013 if (ToCanonType.
isNull())
1016 return Importer.getToContext().getTemplateSpecializationType(ToTemplate,
1031 if (ToNamedType.
isNull())
1039 return Importer.getToContext().getElaboratedType(T->
getKeyword(),
1040 ToQualifier, ToNamedType,
1049 return Importer.getToContext().getPackExpansionType(Pattern,
1068 return Importer.getToContext().getDependentTemplateSpecializationType(
1087 return Importer.getToContext().getDependentNameType(T->
getKeyword(), NNS,
1093 dyn_cast_or_null<ObjCInterfaceDecl>(Importer.Import(T->
getDecl()));
1097 return Importer.getToContext().getObjCInterfaceType(Class);
1107 QualType ImportedTypeArg = Importer.Import(TypeArg);
1108 if (ImportedTypeArg.
isNull())
1111 TypeArgs.push_back(ImportedTypeArg);
1115 for (
auto *
P : T->
quals()) {
1116 auto *Protocol = dyn_cast_or_null<ObjCProtocolDecl>(Importer.Import(
P));
1119 Protocols.push_back(Protocol);
1122 return Importer.getToContext().getObjCObjectType(ToBaseType, TypeArgs,
1130 if (ToPointeeType.
isNull())
1133 return Importer.getToContext().getObjCObjectPointerType(ToPointeeType);
1148 if (isa<RecordDecl>(D) && (FunDecl = dyn_cast<FunctionDecl>(OrigDC)) &&
1156 Importer.FromDiag(D->
getLocation(), diag::err_unsupported_ast_node)
1163 DC = Importer.ImportContext(OrigDC);
1181 ToD = cast_or_null<NamedDecl>(Importer.GetAlreadyImportedOrNull(D));
1190 ToD = Importer.Import(FromD);
1195 if (
auto *FromRecord = dyn_cast<RecordDecl>(FromD)) {
1196 if (
auto *ToRecord = cast_or_null<RecordDecl>(ToD)) {
1197 if (FromRecord->getDefinition() && FromRecord->isCompleteDefinition() && !ToRecord->getDefinition()) {
1204 if (
auto *FromEnum = dyn_cast<EnumDecl>(FromD)) {
1205 if (
auto *ToEnum = cast_or_null<EnumDecl>(ToD)) {
1206 if (FromEnum->getDefinition() && !ToEnum->getDefinition()) {
1246 llvm_unreachable(
"Unknown name kind.");
1250 if (Importer.isMinimalImport() && !ForceImport) {
1251 Importer.ImportContext(FromDC);
1255 for (
auto *From : FromDC->
decls())
1256 Importer.Import(From);
1262 "Import implicit methods to or from non-definition");
1265 if (FromM->isImplicit())
1266 Importer.Import(FromM);
1273 cast_or_null<TypedefNameDecl>(Importer.
Import(FromTypedef));
1274 assert (ToTypedef &&
"Failed to import typedef of an anonymous structure");
1294 if (
auto *ToCXX = dyn_cast<CXXRecordDecl>(To)) {
1295 auto *FromCXX = cast<CXXRecordDecl>(From);
1297 struct CXXRecordDecl::DefinitionData &ToData = ToCXX->data();
1298 struct CXXRecordDecl::DefinitionData &FromData = FromCXX->data();
1299 ToData.UserDeclaredConstructor = FromData.UserDeclaredConstructor;
1300 ToData.UserDeclaredSpecialMembers = FromData.UserDeclaredSpecialMembers;
1301 ToData.Aggregate = FromData.Aggregate;
1302 ToData.PlainOldData = FromData.PlainOldData;
1303 ToData.Empty = FromData.Empty;
1304 ToData.Polymorphic = FromData.Polymorphic;
1305 ToData.Abstract = FromData.Abstract;
1306 ToData.IsStandardLayout = FromData.IsStandardLayout;
1307 ToData.IsCXX11StandardLayout = FromData.IsCXX11StandardLayout;
1308 ToData.HasBasesWithFields = FromData.HasBasesWithFields;
1309 ToData.HasBasesWithNonStaticDataMembers =
1310 FromData.HasBasesWithNonStaticDataMembers;
1311 ToData.HasPrivateFields = FromData.HasPrivateFields;
1312 ToData.HasProtectedFields = FromData.HasProtectedFields;
1313 ToData.HasPublicFields = FromData.HasPublicFields;
1314 ToData.HasMutableFields = FromData.HasMutableFields;
1315 ToData.HasVariantMembers = FromData.HasVariantMembers;
1316 ToData.HasOnlyCMembers = FromData.HasOnlyCMembers;
1317 ToData.HasInClassInitializer = FromData.HasInClassInitializer;
1318 ToData.HasUninitializedReferenceMember
1319 = FromData.HasUninitializedReferenceMember;
1320 ToData.HasUninitializedFields = FromData.HasUninitializedFields;
1321 ToData.HasInheritedConstructor = FromData.HasInheritedConstructor;
1322 ToData.HasInheritedAssignment = FromData.HasInheritedAssignment;
1323 ToData.NeedOverloadResolutionForCopyConstructor
1324 = FromData.NeedOverloadResolutionForCopyConstructor;
1325 ToData.NeedOverloadResolutionForMoveConstructor
1326 = FromData.NeedOverloadResolutionForMoveConstructor;
1327 ToData.NeedOverloadResolutionForMoveAssignment
1328 = FromData.NeedOverloadResolutionForMoveAssignment;
1329 ToData.NeedOverloadResolutionForDestructor
1330 = FromData.NeedOverloadResolutionForDestructor;
1331 ToData.DefaultedCopyConstructorIsDeleted
1332 = FromData.DefaultedCopyConstructorIsDeleted;
1333 ToData.DefaultedMoveConstructorIsDeleted
1334 = FromData.DefaultedMoveConstructorIsDeleted;
1335 ToData.DefaultedMoveAssignmentIsDeleted
1336 = FromData.DefaultedMoveAssignmentIsDeleted;
1337 ToData.DefaultedDestructorIsDeleted = FromData.DefaultedDestructorIsDeleted;
1338 ToData.HasTrivialSpecialMembers = FromData.HasTrivialSpecialMembers;
1339 ToData.HasIrrelevantDestructor = FromData.HasIrrelevantDestructor;
1340 ToData.HasConstexprNonCopyMoveConstructor
1341 = FromData.HasConstexprNonCopyMoveConstructor;
1342 ToData.HasDefaultedDefaultConstructor
1343 = FromData.HasDefaultedDefaultConstructor;
1344 ToData.DefaultedDefaultConstructorIsConstexpr
1345 = FromData.DefaultedDefaultConstructorIsConstexpr;
1346 ToData.HasConstexprDefaultConstructor
1347 = FromData.HasConstexprDefaultConstructor;
1348 ToData.HasNonLiteralTypeFieldsOrBases
1349 = FromData.HasNonLiteralTypeFieldsOrBases;
1351 ToData.UserProvidedDefaultConstructor
1352 = FromData.UserProvidedDefaultConstructor;
1353 ToData.DeclaredSpecialMembers = FromData.DeclaredSpecialMembers;
1354 ToData.ImplicitCopyConstructorCanHaveConstParamForVBase
1355 = FromData.ImplicitCopyConstructorCanHaveConstParamForVBase;
1356 ToData.ImplicitCopyConstructorCanHaveConstParamForNonVBase
1357 = FromData.ImplicitCopyConstructorCanHaveConstParamForNonVBase;
1358 ToData.ImplicitCopyAssignmentHasConstParam
1359 = FromData.ImplicitCopyAssignmentHasConstParam;
1360 ToData.HasDeclaredCopyConstructorWithConstParam
1361 = FromData.HasDeclaredCopyConstructorWithConstParam;
1362 ToData.HasDeclaredCopyAssignmentWithConstParam
1363 = FromData.HasDeclaredCopyAssignmentWithConstParam;
1366 for (
const auto &Base1 : FromCXX->bases()) {
1367 QualType T = Importer.Import(Base1.getType());
1372 if (Base1.isPackExpansion())
1373 EllipsisLoc = Importer.Import(Base1.getEllipsisLoc());
1379 new (Importer.getToContext())
1382 Base1.isBaseOfClass(),
1383 Base1.getAccessSpecifierAsWritten(),
1384 Importer.Import(Base1.getTypeSourceInfo()),
1388 ToCXX->setBases(Bases.data(), Bases.size());
1425 QualType T = Importer.Import(Importer.getFromContext().getTypeDeclType(From));
1430 if (ToPromotionType.
isNull())
1450 Expr *ToRequiresClause;
1452 ToRequiresClause = Importer.Import(R);
1453 if (!ToRequiresClause)
1456 ToRequiresClause =
nullptr;
1488 auto *To = cast_or_null<ValueDecl>(Importer.Import(From.
getAsDecl()));
1490 if (!To || ToType.
isNull())
1531 llvm::makeArrayRef(ToPack).copy(Importer.getToContext()));
1535 llvm_unreachable(
"Invalid template argument kind");
1544 Expr *E = Importer.Import(FromInfo.getAsExpr());
1549 if (
TypeSourceInfo *TSI = Importer.Import(FromInfo.getAsTypeSourceInfo()))
1555 Importer.Import(FromInfo.getTemplateQualifierLoc()),
1556 Importer.Import(FromInfo.getTemplateNameLoc()),
1557 Importer.Import(FromInfo.getTemplateEllipsisLoc()));
1563 unsigned NumFromArgs,
1565 for (
unsigned I = 0; I != NumFromArgs; ++I) {
1570 ToArgs.push_back(To);
1579 template <
typename InContainerTy>
1582 for (
const auto &FromLoc : Container) {
1599 Importer.getFromContext(), Importer.getToContext(),
1609 Decl *ToOrigin = Importer.GetOriginalDecl(ToRecord);
1611 auto *ToOriginRecord = dyn_cast<
RecordDecl>(ToOrigin);
1613 ToRecord = ToOriginRecord;
1618 Importer.getNonEquivalentDecls(),
1627 Importer.getFromContext(), Importer.getToContext(),
1635 Importer.getFromContext(), Importer.getToContext(),
1643 Importer.getFromContext(), Importer.getToContext(),
1651 Importer.getFromContext(), Importer.getToContext(),
1659 const llvm::APSInt &FromVal = FromEC->
getInitVal();
1660 const llvm::APSInt &ToVal = ToEC->
getInitVal();
1662 return FromVal.isSigned() == ToVal.isSigned() &&
1663 FromVal.getBitWidth() == ToVal.getBitWidth() &&
1670 Importer.getToContext(),
1671 Importer.getNonEquivalentDecls(),
1679 Importer.getToContext(),
1680 Importer.getNonEquivalentDecls(),
1686 Importer.FromDiag(D->
getLocation(), diag::err_unsupported_ast_node)
1708 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(), DC, Loc))
1720 Importer.MapImported(D, ToD);
1735 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(), D->
getAccess(),
1762 auto *ToMsg = cast_or_null<StringLiteral>(Importer.Import(FromMsg));
1763 if (!ToMsg && FromMsg)
1767 if (GetImportedOrCreateDecl(
1768 ToD, D, Importer.getToContext(), DC, Loc, AssertExpr, ToMsg,
1793 if (
auto *TU = dyn_cast<TranslationUnitDecl>(DC))
1796 MergeWithNamespace = cast<NamespaceDecl>(DC)->getAnonymousNamespace();
1801 for (
auto *FoundDecl : FoundDecls) {
1805 if (
auto *FoundNS = dyn_cast<NamespaceDecl>(FoundDecl)) {
1806 MergeWithNamespace = FoundNS;
1807 ConflictingDecls.clear();
1811 ConflictingDecls.push_back(FoundDecl);
1814 if (!ConflictingDecls.empty()) {
1816 ConflictingDecls.data(),
1817 ConflictingDecls.size());
1824 if (GetImportedOrCreateDecl(
1825 ToNamespace, D, Importer.getToContext(), DC, D->
isInline(),
1835 if (
auto *TU = dyn_cast<TranslationUnitDecl>(DC))
1836 TU->setAnonymousNamespace(ToNamespace);
1838 cast<NamespaceDecl>(DC)->setAnonymousNamespace(ToNamespace);
1841 Importer.MapImported(D, ToNamespace);
1861 auto *TargetDecl = cast_or_null<NamespaceDecl>(
1875 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(), DC,
1907 for (
auto *FoundDecl : FoundDecls) {
1910 if (
auto *FoundTypedef = dyn_cast<TypedefNameDecl>(FoundDecl)) {
1912 FoundTypedef->getUnderlyingType()))
1913 return Importer.MapImported(D, FoundTypedef);
1916 ConflictingDecls.push_back(FoundDecl);
1919 if (!ConflictingDecls.empty()) {
1920 Name = Importer.HandleNameConflict(Name, DC, IDNS,
1921 ConflictingDecls.data(),
1922 ConflictingDecls.size());
1939 if (GetImportedOrCreateDecl<TypeAliasDecl>(
1940 ToTypedef, D, Importer.getToContext(), DC, StartL, Loc,
1943 }
else if (GetImportedOrCreateDecl<TypedefDecl>(
1944 ToTypedef, D, Importer.getToContext(), DC, StartL, Loc,
1952 TypeAliasDecl *FromAlias = IsAlias ? cast<TypeAliasDecl>(D) :
nullptr;
1986 for (
auto *FoundDecl : FoundDecls) {
1989 if (
auto *FoundAlias = dyn_cast<TypeAliasTemplateDecl>(FoundDecl))
1990 return Importer.MapImported(D, FoundAlias);
1991 ConflictingDecls.push_back(FoundDecl);
1994 if (!ConflictingDecls.empty()) {
1995 Name = Importer.HandleNameConflict(Name, DC, IDNS,
1996 ConflictingDecls.data(),
1997 ConflictingDecls.size());
2008 auto *TemplDecl = cast_or_null<TypeAliasDecl>(
2014 if (GetImportedOrCreateDecl(ToAlias, D, Importer.getToContext(), DC, Loc,
2015 Name, Params, TemplDecl))
2018 TemplDecl->setDescribedAliasTemplate(ToAlias);
2041 ? GetImportedOrCreateDecl(ToLabel, D, Importer.getToContext(), DC,
2045 : GetImportedOrCreateDecl(ToLabel, D, Importer.getToContext(), DC,
2050 auto *
Label = cast_or_null<LabelStmt>(Importer.Import(D->
getStmt()));
2054 ToLabel->setStmt(
Label);
2055 ToLabel->setLexicalDeclContext(LexicalDC);
2077 }
else if (Importer.getToContext().getLangOpts().CPlusPlus)
2085 for (
auto *FoundDecl : FoundDecls) {
2089 Decl *Found = FoundDecl;
2090 if (
auto *Typedef = dyn_cast<TypedefNameDecl>(Found)) {
2091 if (
const auto *Tag = Typedef->getUnderlyingType()->getAs<
TagType>())
2092 Found = Tag->getDecl();
2095 if (
auto *FoundEnum = dyn_cast<EnumDecl>(Found)) {
2097 return Importer.MapImported(D, FoundEnum);
2100 ConflictingDecls.push_back(FoundDecl);
2103 if (!ConflictingDecls.empty()) {
2104 Name = Importer.HandleNameConflict(Name, DC, IDNS,
2105 ConflictingDecls.data(),
2106 ConflictingDecls.size());
2112 if (GetImportedOrCreateDecl(
2113 D2, D, Importer.getToContext(), DC, Importer.Import(D->
getLocStart()),
2126 if (ToIntegerType.
isNull())
2142 if (Definition && Definition != D &&
2149 Decl *ImportedDef = Importer.Import(Definition);
2153 return Importer.MapImported(D, ImportedDef);
2172 }
else if (Importer.getToContext().getLangOpts().CPlusPlus)
2183 if (!FoundDecls.empty()) {
2189 for (
auto *FoundDecl : FoundDecls) {
2193 Decl *Found = FoundDecl;
2194 if (
auto *Typedef = dyn_cast<TypedefNameDecl>(Found)) {
2195 if (
const auto *Tag = Typedef->getUnderlyingType()->getAs<
TagType>())
2196 Found = Tag->getDecl();
2200 if (
auto *Template = dyn_cast<ClassTemplateDecl>(Found))
2201 Found = Template->getTemplatedDecl();
2206 if (
auto *FoundRecord = dyn_cast<RecordDecl>(Found)) {
2212 PrevDecl = FoundRecord;
2218 == FoundDef->isAnonymousStructOrUnion() &&
2225 Importer.MapImported(D, FoundDef);
2226 if (
const auto *DCXX = dyn_cast<CXXRecordDecl>(D)) {
2228 assert(FoundCXX &&
"Record type mismatch");
2244 if (FoundRecord->hasExternalLexicalStorage() &&
2245 !FoundRecord->isCompleteDefinition())
2246 FoundRecord->getASTContext().getExternalSource()->CompleteType(FoundRecord);
2250 if (FoundRecord->isCompleteDefinition() &&
2255 AdoptDecl = FoundRecord;
2257 }
else if (!SearchName) {
2262 ConflictingDecls.push_back(FoundDecl);
2265 if (!ConflictingDecls.empty() && SearchName) {
2266 Name = Importer.HandleNameConflict(Name, DC, IDNS,
2267 ConflictingDecls.data(),
2268 ConflictingDecls.size());
2277 if (
auto *DCXX = dyn_cast<CXXRecordDecl>(D)) {
2278 if (DCXX->isLambda()) {
2279 TypeSourceInfo *TInfo = Importer.Import(DCXX->getLambdaTypeInfo());
2280 if (GetImportedOrCreateSpecialDecl(
2282 DC, TInfo, Loc, DCXX->isDependentLambda(),
2283 DCXX->isGenericLambda(), DCXX->getLambdaCaptureDefault()))
2285 Decl *CDecl = Importer.Import(DCXX->getLambdaContextDecl());
2286 if (DCXX->getLambdaContextDecl() && !CDecl)
2289 }
else if (DCXX->isInjectedClassName()) {
2293 const bool DelayTypeCreation =
true;
2294 if (GetImportedOrCreateDecl(D2CXX, D, Importer.getToContext(),
2299 Importer.getToContext().getTypeDeclType(
2300 D2CXX, dyn_cast<CXXRecordDecl>(DC));
2302 if (GetImportedOrCreateDecl(D2CXX, D, Importer.getToContext(),
2305 cast_or_null<CXXRecordDecl>(PrevDecl)))
2312 if (!DCXX->getDescribedClassTemplate() || DCXX->isImplicit())
2316 DCXX->getDescribedClassTemplate()) {
2317 auto *ToDescribed = cast_or_null<ClassTemplateDecl>(
2318 Importer.Import(FromDescribed));
2322 if (!DCXX->isInjectedClassName()) {
2332 if (Record && Record->isInjectedClassName()) {
2338 Importer.getToContext().getInjectedClassNameType(D2CXX,
2339 ToDescribed->getInjectedClassNameSpecialization());
2342 Importer.getToContext().getTypeDeclType(Injected, D2CXX);
2346 DCXX->getMemberSpecializationInfo()) {
2348 MemberInfo->getTemplateSpecializationKind();
2351 cast_or_null<CXXRecordDecl>(Importer.Import(FromInst));
2352 if (FromInst && !ToInst)
2356 Importer.Import(MemberInfo->getPointOfInstantiation()));
2359 if (GetImportedOrCreateDecl(D2, D, Importer.getToContext(),
2372 Importer.MapImported(D, D2);
2402 for (
auto *FoundDecl : FoundDecls) {
2406 if (
auto *FoundEnumConstant = dyn_cast<EnumConstantDecl>(FoundDecl)) {
2408 return Importer.MapImported(D, FoundEnumConstant);
2411 ConflictingDecls.push_back(FoundDecl);
2414 if (!ConflictingDecls.empty()) {
2415 Name = Importer.HandleNameConflict(Name, DC, IDNS,
2416 ConflictingDecls.data(),
2417 ConflictingDecls.size());
2428 if (GetImportedOrCreateDecl(
2429 ToEnumerator, D, Importer.getToContext(), cast<EnumDecl>(DC), Loc,
2431 return ToEnumerator;
2436 return ToEnumerator;
2447 auto *InstFD = cast_or_null<FunctionDecl>(
2455 ToFD->setInstantiationOfMemberFunction(InstFD, TSK);
2463 std::tie(Template, ToTemplArgs) =
2465 if (!Template || !ToTemplArgs)
2469 Importer.getToContext(), *ToTemplArgs);
2473 const auto *FromTAArgsAsWritten = FTSInfo->TemplateArgumentsAsWritten;
2474 if (FromTAArgsAsWritten)
2478 SourceLocation POI = Importer.Import(FTSInfo->getPointOfInstantiation());
2481 ToFD->setFunctionTemplateSpecialization(
2482 Template, ToTAList,
nullptr,
2483 TSK, FromTAArgsAsWritten ? &ToTAInfo :
nullptr, POI);
2490 unsigned NumTemplates = FromInfo->getNumTemplates();
2491 for (
unsigned I = 0; I < NumTemplates; I++) {
2492 if (
auto *ToFTD = cast_or_null<FunctionTemplateDecl>(
2493 Importer.Import(FromInfo->getTemplate(I))))
2502 FromInfo->getLAngleLoc(), FromInfo->getRAngleLoc(),
2503 llvm::makeArrayRef(FromInfo->getTemplateArgs(),
2504 FromInfo->getNumTemplateArgs()),
2509 TemplDecls, ToTAInfo);
2513 llvm_unreachable(
"All cases should be covered!");
2520 std::tie(Template, ToTemplArgs) =
2522 if (!Template || !ToTemplArgs)
2525 void *InsertPos =
nullptr;
2533 auto RedeclIt = Redecls.begin();
2536 for (; RedeclIt != Redecls.end() && *RedeclIt != D; ++RedeclIt)
2537 if (!Importer.Import(*RedeclIt))
2539 assert(*RedeclIt == D);
2563 FoundFunction->hasBody())
2564 return Importer.Imported(D, FoundFunction);
2565 FoundByLookup = FoundFunction;
2575 for (
auto *FoundDecl : FoundDecls) {
2581 if (
auto *Template = dyn_cast<FunctionTemplateDecl>(FoundDecl))
2582 FoundDecl = Template->getTemplatedDecl();
2587 if (
auto *FoundFunction = dyn_cast<FunctionDecl>(FoundDecl)) {
2588 if (FoundFunction->hasExternalFormalLinkage() &&
2593 FoundFunction->hasBody(Definition)) {
2594 return Importer.MapImported(
2595 D, const_cast<FunctionDecl *>(Definition));
2597 FoundByLookup = FoundFunction;
2605 if (Importer.getToContext().getLangOpts().CPlusPlus)
2609 Importer.ToDiag(Loc, diag::err_odr_function_type_inconsistent)
2610 << Name << D->
getType() << FoundFunction->getType();
2611 Importer.ToDiag(FoundFunction->getLocation(),
2612 diag::note_odr_value_here)
2613 << FoundFunction->getType();
2617 ConflictingDecls.push_back(FoundDecl);
2620 if (!ConflictingDecls.empty()) {
2621 Name = Importer.HandleNameConflict(Name, DC, IDNS,
2622 ConflictingDecls.data(),
2623 ConflictingDecls.size());
2634 bool usedDifferentExceptionSpec =
false;
2646 FromTy = Importer.getFromContext().getFunctionType(
2647 FromFPT->getReturnType(), FromFPT->getParamTypes(), DefaultEPI);
2648 usedDifferentExceptionSpec =
true;
2653 QualType T = Importer.Import(FromTy);
2660 auto *ToP = cast_or_null<ParmVarDecl>(Importer.Import(
P));
2664 Parameters.push_back(ToP);
2674 if (
auto *FromConstructor = dyn_cast<CXXConstructorDecl>(D)) {
2675 if (GetImportedOrCreateDecl<CXXConstructorDecl>(
2676 ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
2677 InnerLocStart, NameInfo, T, TInfo, FromConstructor->isExplicit(),
2680 if (
unsigned NumInitializers = FromConstructor->getNumCtorInitializers()) {
2682 for (
auto *I : FromConstructor->inits()) {
2683 auto *ToI = cast_or_null<CXXCtorInitializer>(Importer.Import(I));
2686 CtorInitializers.push_back(ToI);
2690 std::copy(CtorInitializers.begin(), CtorInitializers.end(), Memory);
2691 auto *ToCtor = cast<CXXConstructorDecl>(ToFunction);
2692 ToCtor->setCtorInitializers(Memory);
2693 ToCtor->setNumCtorInitializers(NumInitializers);
2695 }
else if (isa<CXXDestructorDecl>(D)) {
2696 if (GetImportedOrCreateDecl<CXXDestructorDecl>(
2697 ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
2702 dyn_cast<CXXConversionDecl>(D)) {
2703 if (GetImportedOrCreateDecl<CXXConversionDecl>(
2704 ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
2708 }
else if (
auto *Method = dyn_cast<CXXMethodDecl>(D)) {
2709 if (GetImportedOrCreateDecl<CXXMethodDecl>(
2710 ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
2711 InnerLocStart, NameInfo, T, TInfo, Method->getStorageClass(),
2715 if (GetImportedOrCreateDecl(ToFunction, D, Importer.getToContext(), DC,
2716 InnerLocStart, NameInfo, T, TInfo,
2732 for (
auto *Param : Parameters) {
2733 Param->setOwningFunction(ToFunction);
2736 ToFunction->setParams(Parameters);
2738 if (FoundByLookup) {
2749 for (
unsigned I = 0, N = Parameters.size(); I != N; ++I)
2750 ProtoLoc.setParam(I, Parameters[I]);
2754 if (usedDifferentExceptionSpec) {
2764 if (!Importer.Import(FromFT))
2769 if (
Stmt *ToBody = Importer.Import(FromBody)) {
2795 if (LexicalDC != DC && IsFriend) {
2800 for (++RedeclIt; RedeclIt != Redecls.end(); ++RedeclIt)
2801 if (!Importer.Import(*RedeclIt))
2804 if (
auto *FromCXXMethod = dyn_cast<CXXMethodDecl>(D))
2832 for (
const auto *D : Owner->noload_decls()) {
2836 if (isa<FieldDecl>(*D) || isa<IndirectFieldDecl>(*D))
2857 for (
auto *FoundDecl : FoundDecls) {
2858 if (
auto *FoundField = dyn_cast<FieldDecl>(FoundDecl)) {
2863 if (Importer.IsStructurallyEquivalent(D->
getType(),
2864 FoundField->getType())) {
2865 Importer.MapImported(D, FoundField);
2869 Importer.ToDiag(Loc, diag::err_odr_field_type_inconsistent)
2870 << Name << D->
getType() << FoundField->getType();
2871 Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
2872 << FoundField->getType();
2888 if (GetImportedOrCreateDecl(ToField, D, Importer.getToContext(), DC,
2897 Expr *ToInitializer = Importer.Import(FromInitializer);
2922 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
2923 if (
auto *FoundField = dyn_cast<IndirectFieldDecl>(FoundDecls[I])) {
2928 if (Importer.IsStructurallyEquivalent(D->
getType(),
2929 FoundField->getType(),
2931 Importer.MapImported(D, FoundField);
2936 if (!Name && I < N-1)
2939 Importer.ToDiag(Loc, diag::err_odr_field_type_inconsistent)
2940 << Name << D->
getType() << FoundField->getType();
2941 Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
2942 << FoundField->getType();
2956 for (
auto *PI : D->
chain()) {
2957 Decl *D = Importer.Import(PI);
2960 NamedChain[i++] = cast<NamedDecl>(D);
2965 if (GetImportedOrCreateDecl(ToIndirectField, D, Importer.getToContext(), DC,
2968 return ToIndirectField;
2970 for (
const auto *A : D->
attrs())
2971 ToIndirectField->
addAttr(Importer.Import(A));
2976 return ToIndirectField;
2984 if (!DC || !LexicalDC)
2989 auto *RD = cast<CXXRecordDecl>(DC);
2990 FriendDecl *ImportedFriend = RD->getFirstFriend();
2992 while (ImportedFriend) {
2993 if (D->
getFriendDecl() && ImportedFriend->getFriendDecl()) {
2996 return Importer.MapImported(D, ImportedFriend);
2998 }
else if (D->
getFriendType() && ImportedFriend->getFriendType()) {
2999 if (Importer.IsStructurallyEquivalent(
3001 ImportedFriend->getFriendType()->getType(),
true))
3002 return Importer.MapImported(D, ImportedFriend);
3004 ImportedFriend = ImportedFriend->getNextFriend();
3010 auto *ToFriendD = cast_or_null<NamedDecl>(Importer.Import(FriendD));
3011 if (ToFriendD && FriendD->getFriendObjectKind() !=
Decl::FOK_None &&
3023 for (
unsigned I = 0; I < D->NumTPLists; I++) {
3027 ToTPLists[I] = List;
3031 if (GetImportedOrCreateDecl(FrD, D, Importer.getToContext(), DC,
3056 for (
auto *FoundDecl : FoundDecls) {
3057 if (
auto *FoundIvar = dyn_cast<ObjCIvarDecl>(FoundDecl)) {
3058 if (Importer.IsStructurallyEquivalent(D->
getType(),
3059 FoundIvar->getType())) {
3060 Importer.MapImported(D, FoundIvar);
3064 Importer.ToDiag(Loc, diag::err_odr_ivar_type_inconsistent)
3065 << Name << D->
getType() << FoundIvar->getType();
3066 Importer.ToDiag(FoundIvar->getLocation(), diag::note_odr_value_here)
3067 << FoundIvar->getType();
3083 if (GetImportedOrCreateDecl(
3084 ToIvar, D, Importer.getToContext(), cast<ObjCContainerDecl>(DC),
3109 VarDecl *MergeWithVar =
nullptr;
3114 for (
auto *FoundDecl : FoundDecls) {
3118 if (
auto *FoundVar = dyn_cast<VarDecl>(FoundDecl)) {
3120 if (FoundVar->hasExternalFormalLinkage() &&
3122 if (Importer.IsStructurallyEquivalent(D->
getType(),
3123 FoundVar->getType())) {
3124 MergeWithVar = FoundVar;
3129 = Importer.getToContext().getAsArrayType(FoundVar->getType());
3131 = Importer.getToContext().getAsArrayType(D->
getType());
3132 if (FoundArray && TArray) {
3133 if (isa<IncompleteArrayType>(FoundArray) &&
3134 isa<ConstantArrayType>(TArray)) {
3140 FoundVar->setType(T);
3141 MergeWithVar = FoundVar;
3143 }
else if (isa<IncompleteArrayType>(TArray) &&
3144 isa<ConstantArrayType>(FoundArray)) {
3145 MergeWithVar = FoundVar;
3150 Importer.ToDiag(Loc, diag::err_odr_variable_type_inconsistent)
3151 << Name << D->
getType() << FoundVar->getType();
3152 Importer.ToDiag(FoundVar->getLocation(), diag::note_odr_value_here)
3153 << FoundVar->getType();
3157 ConflictingDecls.push_back(FoundDecl);
3163 Importer.MapImported(D, MergeWithVar);
3168 Importer.ToDiag(ExistingDef->getLocation(),
3169 diag::err_odr_variable_multiple_def)
3171 Importer.FromDiag(DDef->getLocation(), diag::note_odr_defined_here);
3173 Expr *Init = Importer.Import(DDef->getInit());
3175 if (DDef->isInitKnownICE()) {
3178 Eval->
IsICE = DDef->isInitICE();
3183 return MergeWithVar;
3186 if (!ConflictingDecls.empty()) {
3187 Name = Importer.HandleNameConflict(Name, DC, IDNS,
3188 ConflictingDecls.data(),
3189 ConflictingDecls.size());
3203 if (GetImportedOrCreateDecl(ToVar, D, Importer.getToContext(), DC,
3230 DeclContext *DC = Importer.getToContext().getTranslationUnitDecl();
3247 if (GetImportedOrCreateDecl(ToParm, D, Importer.getToContext(), DC, Loc,
3257 DeclContext *DC = Importer.getToContext().getTranslationUnitDecl();
3275 if (GetImportedOrCreateDecl(ToParm, D, Importer.getToContext(), DC,
3286 Expr *ToDefArg =
nullptr;
3287 Expr *FromDefArg =
nullptr;
3290 ToDefArg = Importer.Import(FromDefArg);
3296 ToDefArg = Importer.Import(FromDefArg);
3299 if (FromDefArg && !ToDefArg)
3326 for (
auto *FoundDecl : FoundDecls) {
3327 if (
auto *FoundMethod = dyn_cast<ObjCMethodDecl>(FoundDecl)) {
3333 FoundMethod->getReturnType())) {
3334 Importer.ToDiag(Loc, diag::err_odr_objc_method_result_type_inconsistent)
3336 << FoundMethod->getReturnType();
3337 Importer.ToDiag(FoundMethod->getLocation(),
3338 diag::note_odr_objc_method_here)
3344 if (D->
param_size() != FoundMethod->param_size()) {
3345 Importer.ToDiag(Loc, diag::err_odr_objc_method_num_params_inconsistent)
3347 << D->
param_size() << FoundMethod->param_size();
3348 Importer.ToDiag(FoundMethod->getLocation(),
3349 diag::note_odr_objc_method_here)
3356 PEnd = D->
param_end(), FoundP = FoundMethod->param_begin();
3357 P != PEnd; ++
P, ++FoundP) {
3358 if (!Importer.IsStructurallyEquivalent((*P)->getType(),
3359 (*FoundP)->getType())) {
3360 Importer.FromDiag((*P)->getLocation(),
3361 diag::err_odr_objc_method_param_type_inconsistent)
3363 << (*P)->getType() << (*FoundP)->getType();
3364 Importer.ToDiag((*FoundP)->getLocation(), diag::note_odr_value_here)
3365 << (*FoundP)->getType();
3372 if (D->
isVariadic() != FoundMethod->isVariadic()) {
3373 Importer.ToDiag(Loc, diag::err_odr_objc_method_variadic_inconsistent)
3375 Importer.ToDiag(FoundMethod->getLocation(),
3376 diag::note_odr_objc_method_here)
3382 return Importer.MapImported(D, FoundMethod);
3394 if (GetImportedOrCreateDecl(
3395 ToMethod, D, Importer.getToContext(), Loc,
3408 auto *ToP = cast_or_null<ParmVarDecl>(Importer.Import(FromP));
3412 ToParams.push_back(ToP);
3416 for (
auto *ToParam : ToParams) {
3417 ToParam->setOwningFunction(ToMethod);
3423 for (
auto &Loc : SelLocs)
3424 Loc = Importer.Import(Loc);
3426 ToMethod->
setMethodParams(Importer.getToContext(), ToParams, SelLocs);
3449 if (GetImportedOrCreateDecl(
3450 Result, D, Importer.getToContext(), DC, D->
getVariance(),
3482 if (GetImportedOrCreateDecl(ToCategory, D, Importer.getToContext(), DC,
3505 FromProto != FromProtoEnd;
3506 ++FromProto, ++FromProtoLoc) {
3508 cast_or_null<ObjCProtocolDecl>(Importer.Import(*FromProto));
3511 Protocols.push_back(ToProto);
3512 ProtocolLocs.push_back(Importer.Import(*FromProtoLoc));
3517 ProtocolLocs.data(), Importer.getToContext());
3519 Importer.MapImported(D, ToCategory);
3528 cast_or_null<ObjCCategoryImplDecl>(
3558 FromProto != FromProtoEnd;
3559 ++FromProto, ++FromProtoLoc) {
3560 auto *ToProto = cast_or_null<ObjCProtocolDecl>(Importer.Import(*FromProto));
3563 Protocols.push_back(ToProto);
3564 ProtocolLocs.push_back(Importer.Import(*FromProtoLoc));
3569 ProtocolLocs.data(), Importer.getToContext());
3583 if (Definition && Definition != D) {
3584 Decl *ImportedDef = Importer.Import(Definition);
3588 return Importer.MapImported(D, ImportedDef);
3604 for (
auto *FoundDecl : FoundDecls) {
3608 if ((MergeWithProtocol = dyn_cast<ObjCProtocolDecl>(FoundDecl)))
3614 if (GetImportedOrCreateDecl(ToProto, D, Importer.getToContext(), DC,
3623 Importer.MapImported(D, ToProto);
3641 if (GetImportedOrCreateDecl(ToLinkageSpec, D, Importer.getToContext(), DC,
3643 return ToLinkageSpec;
3653 return ToLinkageSpec;
3671 if (GetImportedOrCreateDecl(ToUsing, D, Importer.getToContext(), DC,
3681 Importer.getFromContext().getInstantiatedFromUsingDecl(D)) {
3682 if (
auto *ToPattern =
3683 dyn_cast_or_null<NamedDecl>(Importer.Import(FromPattern)))
3684 Importer.getToContext().setInstantiatedFromUsingDecl(ToUsing, ToPattern);
3689 for (
auto *FromShadow : D->
shadows()) {
3690 if (
auto *ToShadow =
3691 dyn_cast_or_null<UsingShadowDecl>(Importer.Import(FromShadow)))
3692 ToUsing->addShadowDecl(ToShadow);
3711 auto *ToUsing = dyn_cast_or_null<UsingDecl>(
3716 auto *ToTarget = dyn_cast_or_null<NamedDecl>(
3722 if (GetImportedOrCreateDecl(ToShadow, D, Importer.getToContext(), DC, Loc,
3730 Importer.getFromContext().getInstantiatedFromUsingShadowDecl(D)) {
3731 if (
auto *ToPattern =
3732 dyn_cast_or_null<UsingShadowDecl>(Importer.Import(FromPattern)))
3733 Importer.getToContext().setInstantiatedFromUsingShadowDecl(ToShadow,
3760 auto *ToNominated = cast_or_null<NamespaceDecl>(
3766 if (GetImportedOrCreateDecl(ToUsingDir, D, Importer.getToContext(), DC,
3771 ToNominated, ToComAncestor))
3795 if (GetImportedOrCreateDecl(ToUsingValue, D, Importer.getToContext(), DC,
3799 return ToUsingValue;
3802 ToUsingValue->setLexicalDeclContext(LexicalDC);
3805 return ToUsingValue;
3820 if (GetImportedOrCreateDecl(ToUsing, D, Importer.getToContext(), DC,
3841 FromSuper = cast_or_null<ObjCInterfaceDecl>(Importer.Import(FromSuper));
3847 if ((
bool)FromSuper != (
bool)ToSuper ||
3850 diag::err_odr_objc_superclass_inconsistent)
3857 diag::note_odr_objc_missing_superclass);
3860 diag::note_odr_objc_superclass)
3864 diag::note_odr_objc_missing_superclass);
3892 FromProto != FromProtoEnd;
3893 ++FromProto, ++FromProtoLoc) {
3894 auto *ToProto = cast_or_null<ObjCProtocolDecl>(Importer.Import(*FromProto));
3897 Protocols.push_back(ToProto);
3898 ProtocolLocs.push_back(Importer.Import(*FromProtoLoc));
3903 ProtocolLocs.data(), Importer.getToContext());
3908 Importer.Import(Cat);
3912 auto *Impl = cast_or_null<ObjCImplementationDecl>(
3933 for (
auto fromTypeParam : *list) {
3934 auto *toTypeParam = cast_or_null<ObjCTypeParamDecl>(
3935 Importer.Import(fromTypeParam));
3939 toTypeParams.push_back(toTypeParam);
3943 Importer.Import(list->getLAngleLoc()),
3945 Importer.Import(list->getRAngleLoc()));
3953 if (Definition && Definition != D) {
3954 Decl *ImportedDef = Importer.Import(Definition);
3958 return Importer.MapImported(D, ImportedDef);
3975 for (
auto *FoundDecl : FoundDecls) {
3979 if ((MergeWithIface = dyn_cast<ObjCInterfaceDecl>(FoundDecl)))
3986 if (GetImportedOrCreateDecl(
3987 ToIface, D, Importer.getToContext(), DC,
3995 Importer.MapImported(D, ToIface);
4008 auto *
Category = cast_or_null<ObjCCategoryDecl>(
4020 if (GetImportedOrCreateDecl(
4021 ToImpl, D, Importer.getToContext(), DC,
4037 Category->setImplementation(ToImpl);
4040 Importer.MapImported(D, ToImpl);
4047 auto *Iface = cast_or_null<ObjCInterfaceDecl>(
4055 Super = cast_or_null<ObjCInterfaceDecl>(
4065 if (GetImportedOrCreateDecl(Impl, D, Importer.getToContext(),
4083 Iface->setImplementation(Impl);
4084 Importer.MapImported(D, Iface->getImplementation());
4086 Importer.MapImported(D, Iface->getImplementation());
4095 diag::err_odr_objc_superclass_inconsistent)
4096 << Iface->getDeclName();
4101 diag::note_odr_objc_superclass)
4105 diag::note_odr_objc_missing_superclass);
4108 diag::note_odr_objc_superclass)
4112 diag::note_odr_objc_missing_superclass);
4137 for (
auto *FoundDecl : FoundDecls) {
4138 if (
auto *FoundProp = dyn_cast<ObjCPropertyDecl>(FoundDecl)) {
4140 if (!Importer.IsStructurallyEquivalent(D->
getType(),
4141 FoundProp->getType())) {
4142 Importer.ToDiag(Loc, diag::err_odr_objc_property_type_inconsistent)
4143 << Name << D->
getType() << FoundProp->getType();
4144 Importer.ToDiag(FoundProp->getLocation(), diag::note_odr_value_here)
4145 << FoundProp->getType();
4152 Importer.MapImported(D, FoundProp);
4164 if (GetImportedOrCreateDecl(
4165 ToProperty, D, Importer.getToContext(), DC, Loc,
4191 auto *
Property = cast_or_null<ObjCPropertyDecl>(
4215 Ivar = cast_or_null<ObjCIvarDecl>(
4222 = InImpl->FindPropertyImplDecl(
Property->getIdentifier(),
4225 if (GetImportedOrCreateDecl(ToImpl, D, Importer.getToContext(), DC,
4239 diag::err_odr_objc_property_impl_kind_inconsistent)
4244 diag::note_odr_objc_property_impl_kind)
4254 diag::err_odr_objc_synthesize_ivar_inconsistent)
4259 diag::note_odr_objc_synthesize_ivar_here)
4265 Importer.MapImported(D, ToImpl);
4278 (void)GetImportedOrCreateDecl(
4279 ToD, D, Importer.getToContext(),
4310 (void)GetImportedOrCreateDecl(
4311 ToD, D, Importer.getToContext(),
4332 if (!TemplateParams)
4338 (void)GetImportedOrCreateDecl(
4339 ToD, D, Importer.getToContext(),
4350 if (!ToTemplatedDef)
4354 return TemplateWithDef;
4365 = Importer.Import(Definition->getDescribedClassTemplate());
4369 return Importer.MapImported(D, ImportedDef);
4387 for (
auto *FoundDecl : FoundDecls) {
4391 Decl *Found = FoundDecl;
4392 if (
auto *FoundTemplate = dyn_cast<ClassTemplateDecl>(Found)) {
4400 if (!TemplateWithDef)
4402 FoundTemplate = TemplateWithDef;
4409 FoundTemplate->getTemplatedDecl());
4410 return Importer.MapImported(D, FoundTemplate);
4414 ConflictingDecls.push_back(FoundDecl);
4417 if (!ConflictingDecls.empty()) {
4419 ConflictingDecls.data(),
4420 ConflictingDecls.size());
4430 auto *ToTemplated = cast_or_null<CXXRecordDecl>(
4431 Importer.Import(FromTemplated));
4438 if (!TemplateParams)
4442 if (GetImportedOrCreateDecl(D2, D, Importer.getToContext(), DC, Loc, Name,
4443 TemplateParams, ToTemplated))
4446 ToTemplated->setDescribedClassTemplate(D2);
4453 !ToTemplated->isCompleteDefinition()) {
4466 if (Definition && Definition != D) {
4467 Decl *ImportedDef = Importer.Import(Definition);
4471 return Importer.MapImported(D, ImportedDef);
4474 auto *ClassTemplate =
4475 cast_or_null<ClassTemplateDecl>(Importer.Import(
4481 DeclContext *DC = ClassTemplate->getDeclContext();
4504 void *InsertPos =
nullptr;
4506 = ClassTemplate->findSpecialization(TemplateArgs, InsertPos);
4518 return Importer.MapImported(D, FoundDef);
4523 if (
auto *PartialSpec =
4524 dyn_cast<ClassTemplatePartialSpecializationDecl>(D)) {
4527 const auto &ASTTemplateArgs = *PartialSpec->getTemplateArgsAsWritten();
4531 QualType CanonInjType = Importer.Import(
4532 PartialSpec->getInjectedSpecializationType());
4533 if (CanonInjType.
isNull())
4538 PartialSpec->getTemplateParameters());
4539 if (!ToTPList && PartialSpec->getTemplateParameters())
4542 if (GetImportedOrCreateDecl<ClassTemplatePartialSpecializationDecl>(
4543 D2, D, Importer.getToContext(), D->
getTagKind(), DC, StartLoc,
4544 IdLoc, ToTPList, ClassTemplate,
4545 llvm::makeArrayRef(TemplateArgs.data(), TemplateArgs.size()),
4546 ToTAInfo, CanonInjType,
nullptr))
4550 if (GetImportedOrCreateDecl(
4551 D2, D, Importer.getToContext(), D->
getTagKind(), DC, StartLoc,
4552 IdLoc, ClassTemplate, TemplateArgs,
nullptr))
4559 ClassTemplate->AddSpecialization(D2, InsertPos);
4603 Decl *ImportedDef = Importer.Import(Definition->getDescribedVarTemplate());
4607 return Importer.MapImported(D, ImportedDef);
4622 "Variable templates cannot be declared at function scope");
4626 for (
auto *FoundDecl : FoundDecls) {
4630 Decl *Found = FoundDecl;
4631 if (
auto *FoundTemplate = dyn_cast<VarTemplateDecl>(Found)) {
4635 FoundTemplate->getTemplatedDecl());
4636 return Importer.MapImported(D, FoundTemplate);
4640 ConflictingDecls.push_back(FoundDecl);
4643 if (!ConflictingDecls.empty()) {
4645 ConflictingDecls.data(),
4646 ConflictingDecls.size());
4660 auto *ToTemplated = dyn_cast_or_null<VarDecl>(Importer.Import(DTemplated));
4667 if (!TemplateParams)
4671 if (GetImportedOrCreateDecl(ToVarTD, D, Importer.getToContext(), DC, Loc,
4672 Name, TemplateParams, ToTemplated))
4675 ToTemplated->setDescribedVarTemplate(ToVarTD);
4682 !ToTemplated->isThisDeclarationADefinition()) {
4695 if (Definition && Definition != D) {
4696 Decl *ImportedDef = Importer.Import(Definition);
4700 return Importer.MapImported(D, ImportedDef);
4703 auto *VarTemplate = cast_or_null<VarTemplateDecl>(
4731 void *InsertPos =
nullptr;
4733 TemplateArgs, InsertPos);
4746 return Importer.MapImported(D, FoundDef);
4765 if (
auto *FromPartial = dyn_cast<PartVarSpecDecl>(D)) {
4768 const auto *FromTAArgsAsWritten = FromPartial->getTemplateArgsAsWritten();
4774 FromPartial->getTemplateParameters());
4778 PartVarSpecDecl *ToPartial;
4779 if (GetImportedOrCreateDecl(ToPartial, D, Importer.getToContext(), DC,
4780 StartLoc, IdLoc, ToTPList, VarTemplate, T,
4785 auto *FromInst = FromPartial->getInstantiatedFromMember();
4786 auto *ToInst = cast_or_null<PartVarSpecDecl>(Importer.Import(FromInst));
4787 if (FromInst && !ToInst)
4790 ToPartial->setInstantiatedFromMember(ToInst);
4791 if (FromPartial->isMemberSpecialization())
4792 ToPartial->setMemberSpecialization();
4796 if (GetImportedOrCreateDecl(D2, D, Importer.getToContext(), DC, StartLoc,
4797 IdLoc, VarTemplate, T, TInfo,
4810 VarTemplate->AddSpecialization(D2, InsertPos);
4854 for (
auto *FoundDecl : FoundDecls) {
4858 if (
auto *FoundFunction = dyn_cast<FunctionTemplateDecl>(FoundDecl)) {
4859 if (FoundFunction->hasExternalFormalLinkage() &&
4862 Importer.MapImported(D, FoundFunction);
4864 return FoundFunction;
4882 if (GetImportedOrCreateDecl(ToFunc, D, Importer.getToContext(), DC, Loc, Name,
4883 Params, TemplatedFD))
4886 TemplatedFD->setDescribedFunctionTemplate(ToFunc);
4901 size_t NumDecls = DG.
end() - DG.
begin();
4903 auto &_Importer = this->Importer;
4904 std::transform(DG.
begin(), DG.
end(), ToDecls.begin(),
4906 return _Importer.Import(D);
4914 Importer.FromDiag(S->
getLocStart(), diag::err_unsupported_ast_node)
4927 Names.push_back(ToII);
4929 for (
unsigned I = 0, E = S->
getNumInputs(); I != E; I++) {
4935 Names.push_back(ToII);
4940 auto *Clobber = cast_or_null<StringLiteral>(
4944 Clobbers.push_back(Clobber);
4949 auto *Output = cast_or_null<StringLiteral>(
4953 Constraints.push_back(Output);
4956 for (
unsigned I = 0, E = S->
getNumInputs(); I != E; I++) {
4957 auto *Input = cast_or_null<StringLiteral>(
4961 Constraints.push_back(Input);
4971 auto *AsmStr = cast_or_null<StringLiteral>(
4976 return new (Importer.getToContext())
GCCAsmStmt(
4977 Importer.getToContext(),
4994 for (
auto *ToD : ToDG) {
5000 return new (Importer.getToContext())
DeclStmt(ToDG, ToStartLoc, ToEndLoc);
5005 return new (Importer.getToContext())
NullStmt(ToSemiLoc,
5026 if (!ToRHS && S->
getRHS())
5034 auto *ToStmt =
new (Importer.getToContext())
5035 CaseStmt(ToLHS, ToRHS, ToCaseLoc, ToEllipsisLoc, ToColonLoc);
5046 return new (Importer.getToContext())
DefaultStmt(ToDefaultLoc, ToColonLoc,
5052 auto *ToLabelDecl = cast_or_null<LabelDecl>(Importer.Import(S->
getDecl()));
5053 if (!ToLabelDecl && S->
getDecl())
5058 return new (Importer.getToContext())
LabelStmt(ToIdentLoc, ToLabelDecl,
5072 ToAttrs, ToSubStmt);
5080 VarDecl *ToConditionVariable =
nullptr;
5082 ToConditionVariable =
5083 dyn_cast_or_null<VarDecl>(Importer.Import(FromConditionVariable));
5084 if (!ToConditionVariable)
5087 Expr *ToCondition = Importer.Import(S->
getCond());
5088 if (!ToCondition && S->
getCond())
5091 if (!ToThenStmt && S->
getThen())
5095 if (!ToElseStmt && S->
getElse())
5097 return new (Importer.getToContext())
IfStmt(Importer.getToContext(),
5100 ToConditionVariable,
5101 ToCondition, ToThenStmt,
5102 ToElseLoc, ToElseStmt);
5109 VarDecl *ToConditionVariable =
nullptr;
5111 ToConditionVariable =
5112 dyn_cast_or_null<VarDecl>(Importer.Import(FromConditionVariable));
5113 if (!ToConditionVariable)
5116 Expr *ToCondition = Importer.Import(S->
getCond());
5117 if (!ToCondition && S->
getCond())
5119 auto *ToStmt =
new (Importer.getToContext())
SwitchStmt(
5120 Importer.getToContext(), ToInit,
5121 ToConditionVariable, ToCondition);
5125 ToStmt->setBody(ToBody);
5126 ToStmt->setSwitchLoc(Importer.Import(S->
getSwitchLoc()));
5131 auto *ToSC = dyn_cast_or_null<SwitchCase>(Importer.Import(SC));
5134 if (LastChainedSwitchCase)
5137 ToStmt->setSwitchCaseList(ToSC);
5138 LastChainedSwitchCase = ToSC;
5144 VarDecl *ToConditionVariable =
nullptr;
5146 ToConditionVariable =
5147 dyn_cast_or_null<VarDecl>(Importer.Import(FromConditionVariable));
5148 if (!ToConditionVariable)
5151 Expr *ToCondition = Importer.Import(S->
getCond());
5152 if (!ToCondition && S->
getCond())
5158 return new (Importer.getToContext())
WhileStmt(Importer.getToContext(),
5159 ToConditionVariable,
5160 ToCondition, ToBody,
5168 Expr *ToCondition = Importer.Import(S->
getCond());
5169 if (!ToCondition && S->
getCond())
5174 return new (Importer.getToContext())
DoStmt(ToBody, ToCondition,
5175 ToDoLoc, ToWhileLoc,
5183 Expr *ToCondition = Importer.Import(S->
getCond());
5184 if (!ToCondition && S->
getCond())
5186 VarDecl *ToConditionVariable =
nullptr;
5188 ToConditionVariable =
5189 dyn_cast_or_null<VarDecl>(Importer.Import(FromConditionVariable));
5190 if (!ToConditionVariable)
5194 if (!ToInc && S->
getInc())
5202 return new (Importer.getToContext())
ForStmt(Importer.getToContext(),
5203 ToInit, ToCondition,
5204 ToConditionVariable,
5206 ToForLoc, ToLParenLoc,
5213 ToLabel = dyn_cast_or_null<LabelDecl>(Importer.Import(FromLabel));
5219 return new (Importer.getToContext())
GotoStmt(ToLabel,
5220 ToGotoLoc, ToLabelLoc);
5229 return new (Importer.getToContext())
IndirectGotoStmt(ToGotoLoc, ToStarLoc,
5235 return new (Importer.getToContext())
ContinueStmt(ToContinueLoc);
5240 return new (Importer.getToContext())
BreakStmt(ToBreakLoc);
5249 auto *ToNRVOCandidate = cast_or_null<VarDecl>(Importer.Import(NRVOCandidate));
5250 if (!ToNRVOCandidate && NRVOCandidate)
5252 return new (Importer.getToContext())
ReturnStmt(ToRetLoc, ToRetExpr,
5258 VarDecl *ToExceptionDecl =
nullptr;
5261 dyn_cast_or_null<VarDecl>(Importer.Import(FromExceptionDecl));
5262 if (!ToExceptionDecl)
5268 return new (Importer.getToContext())
CXXCatchStmt(ToCatchLoc,
5279 for (
unsigned HI = 0, HE = S->
getNumHandlers(); HI != HE; ++HI) {
5281 if (
Stmt *ToHandler = Importer.Import(FromHandler))
5282 ToHandlers[HI] = ToHandler;
5292 dyn_cast_or_null<DeclStmt>(Importer.Import(S->
getRangeStmt()));
5296 dyn_cast_or_null<DeclStmt>(Importer.Import(S->
getBeginStmt()));
5300 dyn_cast_or_null<DeclStmt>(Importer.Import(S->
getEndStmt()));
5307 if (!ToInc && S->
getInc())
5310 dyn_cast_or_null<DeclStmt>(Importer.Import(S->
getLoopVarStmt()));
5320 return new (Importer.getToContext())
CXXForRangeStmt(ToRange, ToBegin, ToEnd,
5323 ToForLoc, ToCoawaitLoc,
5324 ToColonLoc, ToRParenLoc);
5348 VarDecl *ToExceptionDecl =
nullptr;
5351 dyn_cast_or_null<VarDecl>(Importer.Import(FromExceptionDecl));
5352 if (!ToExceptionDecl)
5381 if (
Stmt *ToCatchStmt = Importer.Import(FromCatchStmt))
5382 ToCatchStmts[CI] = ToCatchStmt;
5390 ToAtTryLoc, ToAtTryStmt,
5391 ToCatchStmts.begin(), ToCatchStmts.size(),
5406 ToAtSynchronizedLoc, ToSynchExpr, ToSynchBody);
5414 return new (Importer.getToContext())
ObjCAtThrowStmt(ToAtThrowLoc, ToThrow);
5431 Importer.FromDiag(E->
getLocStart(), diag::err_unsupported_ast_node)
5449 return new (Importer.getToContext())
VAArgExpr(
5468 auto *SL = cast_or_null<StringLiteral>(Importer.Import(E->
getFunctionName()));
5477 auto *ToD = cast_or_null<ValueDecl>(Importer.Import(E->
getDecl()));
5483 FoundD = cast_or_null<NamedDecl>(Importer.Import(E->
getFoundDecl()));
5497 ResInfo = &ToTAInfo;
5543 auto *Init = cast_or_null<Expr>(Importer.Import(DIE->
getInit()));
5550 if (
auto *Arg = cast_or_null<Expr>(Importer.Import(DIE->
getSubExpr(I))))
5551 IndexExprs[I - 1] = Arg;
5557 llvm::transform(DIE->
designators(), Designators.begin(),
5563 if (D.isFieldDesignator() && !D.getFieldName())
5567 Importer.getToContext(), Designators,
5577 return new (Importer.getToContext())
5621 Locations.data(), Locations.size());
5653 return new (Importer.getToContext())
AtomicExpr(
5663 auto *ToLabel = cast_or_null<LabelDecl>(Importer.Import(E->
getLabel()));
5677 return new (Importer.getToContext())
5689 Importer.getToContext(), Importer.Import(E->
getLParenLoc()),
5698 auto *ToSubStmt = cast_or_null<CompoundStmt>(
5703 return new (Importer.getToContext())
StmtExpr(ToSubStmt, T,
5741 SubExpr, ResultType,
5803 auto *OpaqueValue = cast_or_null<OpaqueValueExpr>(
5817 Common, OpaqueValue, Cond, TrueExpr, FalseExpr,
5892 if (CompLHSType.
isNull())
5896 if (CompResultType.
isNull())
5907 return new (Importer.getToContext())
5911 CompLHSType, CompResultType,
5919 Path.push_back(Spec);
5961 case Stmt::CStyleCastExprClass: {
5962 auto *CCE = cast<CStyleCastExpr>(E);
5965 SubExpr, &BasePath, TInfo,
5966 Importer.Import(CCE->getLParenLoc()),
5967 Importer.Import(CCE->getRParenLoc()));
5970 case Stmt::CXXFunctionalCastExprClass: {
5971 auto *FCE = cast<CXXFunctionalCastExpr>(E);
5975 Importer.Import(FCE->getLParenLoc()),
5976 Importer.Import(FCE->getRParenLoc()));
5979 case Stmt::ObjCBridgedCastExprClass: {
5980 auto *OCE = cast<ObjCBridgedCastExpr>(E);
5982 Importer.Import(OCE->getLParenLoc()), OCE->getBridgeKind(),
5983 E->
getCastKind(), Importer.Import(OCE->getBridgeKeywordLoc()),
5990 auto *Named = cast<CXXNamedCastExpr>(E);
5991 SourceLocation ExprLoc = Importer.Import(Named->getOperatorLoc()),
5992 RParenLoc = Importer.Import(Named->getRParenLoc());
5993 SourceRange Brackets = Importer.Import(Named->getAngleBrackets());
5996 case Stmt::CXXStaticCastExprClass:
5999 SubExpr, &BasePath, TInfo,
6000 ExprLoc, RParenLoc, Brackets);
6002 case Stmt::CXXDynamicCastExprClass:
6005 SubExpr, &BasePath, TInfo,
6006 ExprLoc, RParenLoc, Brackets);
6008 case Stmt::CXXReinterpretCastExprClass:
6011 SubExpr, &BasePath, TInfo,
6012 ExprLoc, RParenLoc, Brackets);
6014 case Stmt::CXXConstCastExprClass:
6017 RParenLoc, Brackets);
6019 llvm_unreachable(
"Cast expression of unsupported type!");
6048 auto *FD = cast_or_null<FieldDecl>(Importer.Import(Node.
getField()));
6071 Exprs[I] = ToIndexExpr;
6080 TInfo, Nodes, Exprs,
6100 T, Operand, CanThrow,
6119 auto *Param = cast_or_null<ParmVarDecl>(Importer.Import(E->
getParam()));
6124 Importer.getToContext(), Importer.Import(E->
getUsedLocation()), Param);
6145 auto *Dtor = cast_or_null<CXXDestructorDecl>(
6146 Importer.Import(const_cast<CXXDestructorDecl *>(
6169 auto *Ctor = cast_or_null<CXXConstructorDecl>(
6175 Importer.getToContext(), Ctor, T, TInfo, Args,
6191 auto *ExtendedBy = cast_or_null<ValueDecl>(
6219 auto *Pack = cast_or_null<NamedDecl>(Importer.Import(E->
getPack()));
6237 Importer.getToContext(), Importer.Import(E->
getOperatorLoc()), Pack,
6239 Length, PartialArguments);
6251 auto *OperatorNewDecl = cast_or_null<FunctionDecl>(
6256 auto *OperatorDeleteDecl = cast_or_null<FunctionDecl>(
6273 return new (Importer.getToContext())
CXXNewExpr(
6274 Importer.getToContext(),
6276 OperatorNewDecl, OperatorDeleteDecl,
6291 auto *OperatorDeleteDecl = cast_or_null<FunctionDecl>(
6316 dyn_cast_or_null<CXXConstructorDecl>(Importer.Import(E->
getConstructor()));
6343 cast_or_null<BlockDecl>(Importer.Import(EWC->
getObject(I))))
6367 Importer.getToContext(), ToFn, ToArgs, T, E->
getValueKind(),
6376 return new (Importer.getToContext())
6385 return new (Importer.getToContext())
6424 ToMember, ToFoundDecl, ToMemberNameInfo,
6454 Importer.getToContext(), BaseE, E->
isArrow(),
6465 Base = Importer.Import(E->
getBase());
6479 ResInfo = &ToTAInfo;
6494 Importer.getToContext(), Base, BaseType, E->
isArrow(),
6498 cast_or_null<NamedDecl>(ToFQ), MemberNameInfo, ResInfo);
6516 ResInfo = &ToTAInfo;
6534 Importer.Import(CE->
getLParenLoc()), llvm::makeArrayRef(ToArgs),
6540 cast_or_null<CXXRecordDecl>(Importer.Import(E->
getNamingClass()));
6553 for (
auto *D : E->
decls()) {
6554 if (
auto *To = cast_or_null<NamedDecl>(Importer.Import(D)))
6565 ResInfo = &ToTAInfo;
6570 Importer.getToContext(), NamingClass,
6573 ResInfo, ToDecls.begin(), ToDecls.end());
6576 Importer.getToContext(), NamingClass,
6595 if (
NamedDecl *To = cast_or_null<NamedDecl>(Importer.Import(D)))
6606 ResInfo = &ToTAInfo;
6636 auto **ToArgs_Copied =
new (Importer.getToContext())
Expr*[NumArgs];
6638 for (
unsigned ai = 0, ae = NumArgs; ai != ae; ++ai)
6639 ToArgs_Copied[ai] = ToArgs[ai];
6641 if (
const auto *OCE = dyn_cast<CXXOperatorCallExpr>(E)) {
6643 Importer.getToContext(), OCE->getOperator(), ToCallee, ToArgs, T,
6644 OCE->getValueKind(), Importer.Import(OCE->getRParenLoc()),
6645 OCE->getFPFeatures());
6648 return new (Importer.getToContext())
6649 CallExpr(Importer.getToContext(), ToCallee,
6650 llvm::makeArrayRef(ToArgs_Copied, NumArgs), T, E->
getValueKind(),
6658 Var = cast_or_null<VarDecl>(Importer.Import(From.
getCapturedVar()));
6672 auto *ToClass = dyn_cast_or_null<CXXRecordDecl>(Importer.Import(FromClass));
6679 if (ToClass->isBeingDefined()) {
6680 for (
auto FromField : FromClass->
fields()) {
6681 auto *ToField = cast_or_null<FieldDecl>(Importer.Import(FromField));
6687 auto *ToCallOp = dyn_cast_or_null<CXXMethodDecl>(
6692 ToClass->completeDefinition();
6696 Captures.reserve(NumCaptures);
6697 for (
const auto &FromCapture : LE->
captures()) {
6699 Captures.push_back(*ToCapture);
6743 auto *ToFD = cast_or_null<FieldDecl>(Importer.Import(FromFD));
6750 auto *ToSyntForm = cast_or_null<InitListExpr>(Importer.Import(SyntForm));
6782 auto *Ctor = cast_or_null<CXXConstructorDecl>(Importer.Import(
6805 return new (Importer.getToContext())
6817 auto *ToField = dyn_cast_or_null<FieldDecl>(Importer.Import(DIE->
getField()));
6822 Importer.getToContext(), Importer.Import(DIE->
getLocStart()), ToField);
6842 if (isa<CXXStaticCastExpr>(E)) {
6844 Importer.getToContext(), ToType, VK, CK, ToOp, &BasePath,
6845 ToWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
6846 }
else if (isa<CXXDynamicCastExpr>(E)) {
6848 Importer.getToContext(), ToType, VK, CK, ToOp, &BasePath,
6849 ToWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
6850 }
else if (isa<CXXReinterpretCastExpr>(E)) {
6852 Importer.getToContext(), ToType, VK, CK, ToOp, &BasePath,
6853 ToWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
6865 auto *Param = cast_or_null<NonTypeTemplateParmDecl>(
6890 bool ToValue =
false;
6895 Importer.getToContext(), ToType, Importer.Import(E->
getLocStart()),
6909 return new (Importer.getToContext())
6917 return new (Importer.getToContext())
6925 cast<CXXMethodDecl>(Importer.Import(const_cast<CXXMethodDecl*>(
6926 FromOverriddenMethod))));
6932 : ToContext(ToContext), FromContext(FromContext),
6933 ToFileManager(ToFileManager), FromFileManager(FromFileManager),
6948 llvm::DenseMap<const Type *, const Type *>::iterator Pos
6949 = ImportedTypes.find(fromTy);
6950 if (Pos != ImportedTypes.end())
6980 Attr *ToAttr = FromAttr->
clone(ToContext);
6986 llvm::DenseMap<Decl *, Decl *>::iterator Pos = ImportedDecls.find(FromD);
6987 if (Pos != ImportedDecls.end()) {
6988 Decl *ToD = Pos->second;
7012 ToD = Importer.
Visit(FromD);
7026 auto *ToDC = cast_or_null<DeclContext>(
Import(cast<Decl>(FromDC)));
7032 if (
auto *ToRecord = dyn_cast<RecordDecl>(ToDC)) {
7033 auto *FromRecord = cast<RecordDecl>(FromDC);
7034 if (ToRecord->isCompleteDefinition()) {
7036 }
else if (FromRecord->isCompleteDefinition()) {
7042 }
else if (
auto *ToEnum = dyn_cast<EnumDecl>(ToDC)) {
7043 auto *FromEnum = cast<EnumDecl>(FromDC);
7044 if (ToEnum->isCompleteDefinition()) {
7046 }
else if (FromEnum->isCompleteDefinition()) {
7052 }
else if (
auto *ToClass = dyn_cast<ObjCInterfaceDecl>(ToDC)) {
7053 auto *FromClass = cast<ObjCInterfaceDecl>(FromDC);
7054 if (ToClass->getDefinition()) {
7062 }
else if (
auto *ToProto = dyn_cast<ObjCProtocolDecl>(ToDC)) {
7063 auto *FromProto = cast<ObjCProtocolDecl>(FromDC);
7064 if (ToProto->getDefinition()) {
7081 return cast_or_null<Expr>(
Import(cast<Stmt>(FromE)));
7089 llvm::DenseMap<Stmt *, Stmt *>::iterator Pos = ImportedStmts.find(FromS);
7090 if (Pos != ImportedStmts.end())
7095 Stmt *ToS = Importer.Visit(FromS);
7100 ImportedStmts[FromS] = ToS;
7145 bool bTemplate = FromNNS->
getKind() ==
7154 llvm_unreachable(
"Invalid nested name specifier kind");
7165 NestedNames.push_back(NNS);
7171 while (!NestedNames.empty()) {
7172 NNS = NestedNames.pop_back_val();
7231 if (
auto *ToTemplate =
7240 for (
auto *I : *FromStorage) {
7241 if (
auto *To = cast_or_null<NamedDecl>(
Import(I)))
7256 if (
auto *ToTemplate =
7288 if (replacement.
isNull())
7298 cast_or_null<TemplateTemplateParmDecl>(
7313 llvm_unreachable(
"Invalid template name kind");
7335 llvm::DenseMap<FileID, FileID>::iterator Pos = ImportedFileIDs.find(FromID);
7336 if (Pos != ImportedFileIDs.end())
7349 unsigned TokenLen = FromSM.getFileIDSize(FromID);
7364 if (Cache->OrigEntry && Cache->OrigEntry->getDir()) {
7370 ToFileManager.
getFile(Cache->OrigEntry->getName());
7377 const llvm::MemoryBuffer *FromBuf =
7379 std::unique_ptr<llvm::MemoryBuffer> ToBuf =
7380 llvm::MemoryBuffer::getMemBufferCopy(FromBuf->getBuffer(),
7381 FromBuf->getBufferIdentifier());
7387 ImportedFileIDs[FromID] = ToID;
7393 if (!ToExpr && From->
getInit())
7415 auto *ToIField = cast_or_null<IndirectFieldDecl>(
7428 return new (ToContext)
7437 auto Pos = ImportedCXXBaseSpecifiers.find(BaseSpec);
7438 if (Pos != ImportedCXXBaseSpecifiers.end())
7447 ImportedCXXBaseSpecifiers[BaseSpec] =
Imported;
7456 if (
auto *FromDC = cast<DeclContext>(From)) {
7459 if (
auto *ToRecord = dyn_cast<RecordDecl>(To)) {
7460 if (!ToRecord->getDefinition()) {
7467 if (
auto *ToEnum = dyn_cast<EnumDecl>(To)) {
7468 if (!ToEnum->getDefinition()) {
7475 if (
auto *ToIFace = dyn_cast<ObjCInterfaceDecl>(To)) {
7476 if (!ToIFace->getDefinition()) {
7483 if (
auto *ToProto = dyn_cast<ObjCProtocolDecl>(To)) {
7484 if (!ToProto->getDefinition()) {
7527 auto *Template = cast_or_null<TemplateDecl>(
7556 llvm_unreachable(
"Invalid DeclarationName Kind!");
7577 for (
unsigned I = 1, N = FromSel.
getNumArgs(); I < N; ++I)
7586 unsigned NumDecls) {
7591 if (LastDiagFromFrom)
7594 LastDiagFromFrom =
false;
7599 if (!LastDiagFromFrom)
7602 LastDiagFromFrom =
true;
7607 if (
auto *
ID = dyn_cast<ObjCInterfaceDecl>(D)) {
7608 if (!
ID->getDefinition())
7609 ID->startDefinition();
7611 else if (
auto *PD = dyn_cast<ObjCProtocolDecl>(D)) {
7612 if (!PD->getDefinition())
7613 PD->startDefinition();
7615 else if (
auto *TD = dyn_cast<TagDecl>(D)) {
7616 if (!TD->getDefinition() && !TD->isBeingDefined()) {
7617 TD->startDefinition();
7618 TD->setCompleteDefinition(
true);
7622 assert(0 &&
"CompleteDecl called on a Decl that can't be completed");
7627 llvm::DenseMap<Decl *, Decl *>::iterator Pos = ImportedDecls.find(From);
7628 assert((Pos == ImportedDecls.end() || Pos->second == To) &&
7629 "Try to import an already imported Decl");
7630 if (Pos != ImportedDecls.end())
7632 ImportedDecls[From] = To;
7638 llvm::DenseMap<const Type *, const Type *>::iterator Pos
SourceLocation getRParenLoc() const
VarTemplateDecl * getDescribedVarTemplate() const
Retrieves the variable template that is described by this variable declaration.
A call to an overloaded operator written using operator syntax.
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
bool hasArrayFiller() const
Return true if this is an array initializer and its array "filler" has been set.
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
Represents a single C99 designator.
SourceLocation getGetterNameLoc() const
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
void setValueDependent(bool VD)
Set whether this expression is value-dependent or not.
QualType getPattern() const
Retrieve the pattern of this pack expansion, which is the type that will be repeatedly instantiated w...
const internal::VariadicAllOfMatcher< Type > type
Matches Types in the clang AST.
SourceLocation getRBracLoc() const
Defines the clang::ASTContext interface.
QualType getDeducedType() const
Get the type deduced for this placeholder type, or null if it's either not been deduced or was deduce...
IdentifierInfo * getInputIdentifier(unsigned i) const
Decl * VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D)
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
TemplateParameterList * ImportTemplateParameterList(TemplateParameterList *Params)
Stmt * VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S)
Expr * VisitCXXMemberCallExpr(CXXMemberCallExpr *E)
VarDecl * getCapturedVar() const
Retrieve the declaration of the local variable being captured.
SourceLocation getRParenLoc() const
NamedDecl * getTargetDecl() const
Gets the underlying declaration which has been brought into the local scope.
The null pointer literal (C++11 [lex.nullptr])
const CXXDestructorDecl * getDestructor() const
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
Expr * VisitConditionalOperator(ConditionalOperator *E)
static unsigned getFieldIndex(Decl *F)
This represents a GCC inline-assembly statement extension.
void setImplicit(bool I=true)
Decl * VisitCXXMethodDecl(CXXMethodDecl *D)
Represents a function declaration or definition.
SourceLocation getForLoc() const
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
QualType VisitVectorType(const VectorType *T)
bool isImplicit() const
Determine whether this was an implicit capture (not written between the square brackets introducing t...
Decl * VisitEnumDecl(EnumDecl *D)
void localUncachedLookup(DeclarationName Name, SmallVectorImpl< NamedDecl *> &Results)
A simplistic name lookup mechanism that performs name lookup into this declaration context without co...
Expr * getInit() const
Get the initializer.
bool isKindOfTypeAsWritten() const
Whether this is a "__kindof" type as written.
bool hasExplicitTemplateArgs() const
Determines whether this expression had explicit template arguments.
const Stmt * getElse() const
unsigned getNumInputs() const
SourceLocation getRParenLoc() const
void setArrayFiller(Expr *filler)
Stmt * VisitDoStmt(DoStmt *S)
Smart pointer class that efficiently represents Objective-C method names.
This is a discriminated union of FileInfo and ExpansionInfo.
SourceLocation getForLoc() const
void setAnonymousStructOrUnion(bool Anon)
PointerType - C99 6.7.5.1 - Pointer Declarators.
ArrayRef< QualType > getTypeArgsAsWritten() const
Retrieve the type arguments of this object type as they were written.
QualType getPointeeType() const
llvm::iterator_range< arg_iterator > placement_arguments()
SourceLocation getUsedLocation() const
Retrieve the location where this default argument was actually used.
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
bool hasTemplateKeyword() const
Whether the template name was prefixed by the "template" keyword.
Stores the type being destroyed by a pseudo-destructor expression.
A (possibly-)qualified type.
uint64_t getValue() const
QualType VisitDecltypeType(const DecltypeType *T)
Decl * VisitUsingShadowDecl(UsingShadowDecl *D)
ArrayRef< TemplateArgumentLoc > template_arguments() const
const char * getDeclKindName() const
StringKind getKind() const
OverloadedOperatorKind getOperator() const
Return the overloaded operator to which this template name refers.
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary class pattern.
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
void setTemplateKeywordLoc(SourceLocation Loc)
Sets the location of the template keyword.
unsigned param_size() const
Stmt * VisitCaseStmt(CaseStmt *S)
ObjCInterfaceDecl * getClassInterface()
QualType getInjectedSpecializationType() const
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
Implements support for file system lookup, file system caching, and directory search management...
SourceRange getCXXOperatorNameRange() const
getCXXOperatorNameRange - Gets the range of the operator name (without the operator keyword)...
void startDefinition()
Starts the definition of this Objective-C class, taking it from a forward declaration (@class) to a d...
SourceLocation getSpellingLoc() const
SourceLocation getEllipsisLoc() const
SourceLocation getLParen() const
Get the location of the left parentheses '('.
ObjCTypeParamList * ImportObjCTypeParamList(ObjCTypeParamList *list)
const Expr * getSubExpr() const
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
static ClassTemplateDecl * getDefinition(ClassTemplateDecl *D)
SourceLocation getLParenLoc() const
QualType VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *T)
SourceRange getSourceRange() const LLVM_READONLY
Retrieve the source range covering the entirety of this nested-name-specifier.
bool isThisDeclarationADefinition() const
Determine whether this particular declaration of this class is actually also a definition.
Defines the clang::FileManager interface and associated types.
ObjCIvarDecl * getPropertyIvarDecl() const
static CXXDependentScopeMemberExpr * Create(const ASTContext &C, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierFoundInScope, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs)
bool isObjCMethodParameter() const
FunctionDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
A type trait used in the implementation of various C++11 and Library TR1 trait templates.
Stmt * VisitObjCAtCatchStmt(ObjCAtCatchStmt *S)
CompoundStmt * getSubStmt()
Decl * VisitDecl(Decl *D)
InClassInitStyle getInClassInitStyle() const
Get the kind of (C++11) default member initializer that this field has.
Expr * getUnderlyingExpr() const
Stmt * VisitContinueStmt(ContinueStmt *S)
static UnresolvedLookupExpr * Create(const ASTContext &C, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool ADL, bool Overloaded, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
SourceLocation getRParenLoc() const
bool hasExplicitResultType() const
Whether this lambda had its result type explicitly specified.
bool isThrownVariableInScope() const
Determines whether the variable thrown by this expression (if any!) is within the innermost try block...
Stmt - This represents one statement.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Expr * getDimensionExpression() const
const ObjCAtFinallyStmt * getFinallyStmt() const
Retrieve the @finally statement, if any.
SourceLocation getLocStart() const LLVM_READONLY
Expr * getBitWidth() const
void setPreviousDecl(decl_type *PrevDecl)
Set the previous declaration.
CXXCatchStmt * getHandler(unsigned i)
bool IsICE
Whether this statement is an integral constant expression, or in C++11, whether the statement is a co...
bool isArrayFormAsWritten() const
IfStmt - This represents an if/then/else.
VarDecl * getTemplatedDecl() const
Get the underlying variable declarations of the template.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
SourceLocation getLocation() const
Expr * VisitImplicitCastExpr(ImplicitCastExpr *E)
Expr * VisitExpressionTraitExpr(ExpressionTraitExpr *E)
An instance of this object exists for each enum constant that is defined.
static CXXDynamicCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind, Expr *Op, const CXXCastPath *Path, TypeSourceInfo *Written, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
SourceLocation getSuperClassLoc() const
Retrieve the starting location of the superclass.
Expr * VisitCXXConstructExpr(CXXConstructExpr *E)
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Decl * VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D)
void setTypedefNameForAnonDecl(TypedefNameDecl *TDD)
Represents the declaration of a typedef-name via the 'typedef' type specifier.
C Language Family Type Representation.
unsigned getNumOutputs() const
Defines the SourceManager interface.
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in...
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
Expr * VisitBinaryOperator(BinaryOperator *E)
bool isExpansionTokenRange() const
Represents a qualified type name for which the type name is dependent.
SourceLocation getRBracketLoc() const
The template argument is an expression, and we've not resolved it to one of the other forms yet...
unsigned size() const
Retrieve the number of template arguments in this template argument list.
const StringLiteral * getAsmString() const
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
TypeSourceInfo * getTypeSourceInfo() const
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
Decl - This represents one declaration (or definition), e.g.
void setRangeEnd(SourceLocation E)
SourceLocation getLocStart() const LLVM_READONLY
bool hasLeadingEmptyMacro() const
Stmt * getHandlerBlock() const
DeclGroupRef ImportDeclGroup(DeclGroupRef DG)
Expr * VisitPackExpansionExpr(PackExpansionExpr *E)
llvm::APFloat getValue() const
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
FunctionDecl * getOperatorNew() const
VarDecl * getDefinition(ASTContext &)
Get the real (not just tentative) definition for this declaration.
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
Selector getObjCSelector() const
getObjCSelector - Get the Objective-C selector stored in this declaration name.
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
NestedNameSpecifier * getPrefix() const
Return the prefix of this nested name specifier.
const Expr * getSubExpr() const
Defines the C++ template declaration subclasses.
Represents a C++11 auto or C++14 decltype(auto) type.
unsigned getNumSubExprs() const
Retrieve the total number of subexpressions in this designated initializer expression, including the actual initialized value and any expressions that occur within array and array-range designators.
SourceLocation getIdentLoc() const
void setPure(bool P=true)
Represents an attribute applied to a statement.
bool hasWrittenPrototype() const
ParenExpr - This represents a parethesized expression, e.g.
known_categories_range known_categories() const
Decl * getPreviousDecl()
Retrieve the previous declaration that declares the same entity as this declaration, or NULL if there is no previous declaration.
NamedDecl * getDecl() const
SourceLocation getColonLoc() const
The location of the colon following the access specifier.
SourceLocation getLocStart() const LLVM_READONLY
The base class of the type hierarchy.
Represents an empty-declaration.
Represents Objective-C's @throw statement.
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called...
Each ExpansionInfo encodes the expansion location - where the token was ultimately expanded...
DiagnosticsEngine & getDiagnostics() const
QualType VisitTemplateSpecializationType(const TemplateSpecializationType *T)
DiagnosticBuilder Report(SourceLocation Loc, unsigned DiagID)
Issue the message to the client.
bool hasExplicitTemplateArgs() const
Determines whether this declaration reference was followed by an explicit template argument list...
SourceLocation getLocation() const
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Declaration of a variable template.
SourceLocation getRParenLoc() const
The template argument is a declaration that was provided for a pointer, reference, or pointer to member non-type template parameter.
Represent a C++ namespace.
Expr * VisitOffsetOfExpr(OffsetOfExpr *OE)
Represents a call to a C++ constructor.
RetTy Visit(const Type *T)
Performs the operation associated with this visitor object.
TypeSourceInfo * getTypeInfoAsWritten() const
getTypeInfoAsWritten - Returns the type source info for the type that this expression is casting to...
protocol_iterator protocol_begin() const
FPOptions getFPFeatures() const
An Embarcadero array type trait, as used in the implementation of __array_rank and __array_extent...
void setSpecializationKind(TemplateSpecializationKind TSK)
virtual void completeDefinition()
Note that the definition of this type is now complete.
Decl * VisitFieldDecl(FieldDecl *D)
A container of type source information.
RefQualifierKind RefQualifier
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
bool isEmpty() const
Evaluates true when this declaration name is empty.
Decl * VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D)
static AttributedStmt * Create(const ASTContext &C, SourceLocation Loc, ArrayRef< const Attr *> Attrs, Stmt *SubStmt)
Expr * VisitTypeTraitExpr(TypeTraitExpr *E)
static StringLiteral * Create(const ASTContext &C, StringRef Str, StringKind Kind, bool Pascal, QualType Ty, const SourceLocation *Loc, unsigned NumStrs)
This is the "fully general" constructor that allows representation of strings formed from multiple co...
bool ImportTemplateArgumentListInfo(const InContainerTy &Container, TemplateArgumentListInfo &ToTAInfo)
QualType VisitInjectedClassNameType(const InjectedClassNameType *T)
SourceLocation getGotoLoc() const
void setTemplateArgsInfo(const TemplateArgumentListInfo &ArgsInfo)
static CXXFunctionalCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, TypeSourceInfo *Written, CastKind Kind, Expr *Op, const CXXCastPath *Path, SourceLocation LPLoc, SourceLocation RPLoc)
SourceLocation getOperatorLoc() const
Determine the location of the 'sizeof' keyword.
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getRParenLoc() const
const Expr * getAnyInitializer() const
Get the initializer for this variable, no matter which declaration it is attached to...
bool isPackExpansion() const
Determine whether this capture is a pack expansion, which captures a function parameter pack...
SourceLocation getColonLoc() const
Retrieve the location of the ':' separating the type parameter name from the explicitly-specified bou...
Decl * VisitNamespaceAliasDecl(NamespaceAliasDecl *D)
Describes the capture of a variable or of this, or of a C++1y init-capture.
param_const_iterator param_end() const
TemplateTypeParmDecl * getDecl() const
Represents a C++ constructor within a class.
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
A template template parameter that has been substituted for some other template name.
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
bool isPackExpansion() const
Determine whether this initializer is a pack expansion.
SourceLocation getTargetNameLoc() const
Returns the location of the identifier in the named namespace.
QualType getElementType() const
bool isCompleteDefinition() const
Return true if this decl has its body fully specified.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "while" statement, if any.
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
SourceLocation getCoawaitLoc() const
Expr * getIndexExpr(unsigned Idx)
bool isIndirectMemberInitializer() const
An identifier, stored as an IdentifierInfo*.
Expr * VisitStringLiteral(StringLiteral *E)
SourceRange getSourceRange() const LLVM_READONLY
unsigned getDepth() const
Get the nesting depth of the template parameter.
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
QualType VisitPointerType(const PointerType *T)
Represents a variable declaration or definition.
void setImplementation(ObjCCategoryImplDecl *ImplD)
const VarDecl * getNRVOCandidate() const
Retrieve the variable that might be used for the named return value optimization. ...
SourceLocation getLParenLoc() const
static NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
QualType getBaseType() const
CompoundLiteralExpr - [C99 6.5.2.5].
void setCXXLiteralOperatorNameLoc(SourceLocation Loc)
setCXXLiteralOperatorNameLoc - Sets the location of the literal operator name (not the operator keywo...
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation getOperatorLoc() const
Retrieve the location of the '.' or '->' operator.
QualType getCXXNameType() const
getCXXNameType - If this name is one of the C++ names (of a constructor, destructor, or conversion function), return the type associated with that name.
Stmt * VisitLabelStmt(LabelStmt *S)
bool isFixed() const
Returns true if this is an Objective-C, C++11, or Microsoft-style enumeration with a fixed underlying...
OpaqueValueExpr * getCommonExpr() const
Get the common subexpression shared by all initializations (the source array).
const T * getAs() const
Member-template getAs<specific type>'.
bool hasDefaultArg() const
Determines whether this parameter has a default argument, either parsed or not.
ObjCCategoryImplDecl * getImplementation() const
Expr * VisitIntegerLiteral(IntegerLiteral *E)
unsigned getNumArgs() const
Determine the number of arguments to this type trait.
Represents an empty template argument, e.g., one that has not been deduced.
SourceLocation getExternLoc() const
Gets the location of the extern keyword, if present.
Extra information about a function prototype.
bool hasInheritedDefaultArg() const
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
SourceLocation getColonLoc() const
QualifiedTemplateName * getAsQualifiedTemplateName() const
Retrieve the underlying qualified template name structure, if any.
Represents a variable template specialization, which refers to a variable template with a given set o...
SourceLocation getLocStart() const LLVM_READONLY
ObjCMethodDecl - Represents an instance or class method declaration.
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
SourceLocation getLAngleLoc() const
Decl * VisitVarDecl(VarDecl *D)
Represents an explicit template argument list in C++, e.g., the "<int>" in "sort<int>".
A namespace, stored as a NamespaceDecl*.
DeclarationName getName() const
Gets the name looked up.
DiagnosticBuilder ToDiag(SourceLocation Loc, unsigned DiagID)
Report a diagnostic in the "to" context.
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
llvm::PointerUnion< NamedDecl *, TypeSourceInfo * > FriendUnion
SourceLocation getIfLoc() const
Expr * VisitUnaryOperator(UnaryOperator *E)
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getNumPlacementArgs() const
Expr * VisitAtomicExpr(AtomicExpr *E)
TypeSourceInfo * getArgumentTypeInfo() const
bool isMemberInitializer() const
Determine whether this initializer is initializing a non-static data member.
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
TemplateName getSubstTemplateTemplateParm(TemplateTemplateParmDecl *param, TemplateName replacement) const
Defines the Objective-C statement AST node classes.
SourceLocation getEllipsisLoc() const
unsigned getNumExpressions() const
SourceLocation getLocation() const
Retrieve the location of the literal.
SpecifierKind getKind() const
Determine what kind of nested name specifier is stored.
Expr * VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *CE)
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
QualType Import(QualType FromT)
Import the given type from the "from" context into the "to" context.
A C++ throw-expression (C++ [except.throw]).
Expr * getExprOperand() const
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Represents a parameter to a function.
bool ImportTemplateArguments(const TemplateArgument *FromArgs, unsigned NumFromArgs, SmallVectorImpl< TemplateArgument > &ToArgs)
Represents the result of substituting a type for a template type parameter.
DeclarationNameInfo getNameInfo() const
Defines the clang::Expr interface and subclasses for C++ expressions.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "switch" statement, if any.
SourceLocation getRParenLoc() const
QualType getIntegralType() const
Retrieve the type of the integral value.
BoundNodesTreeBuilder Nodes
std::tuple< FunctionTemplateDecl *, OptionalTemplateArgsTy > ImportFunctionTemplateWithTemplateArgsFromSpecialization(FunctionDecl *FromFD)
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
const ObjCInterfaceDecl * getSuperClass() const
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
Decl * VisitStaticAssertDecl(StaticAssertDecl *D)
const Stmt * getSubStmt() const
void setTemplateSpecializationKind(TemplateSpecializationKind TSK)
Set the kind of specialization or template instantiation this is.
const char * getStmtClassName() const
IdentifierInfo * getIdentifier() const
Get the identifier that names this declaration, if there is one.
SourceLocation getRParenLoc() const
Retrieve the location of the closing parenthesis.
LabelStmt - Represents a label, which has a substatement.
SourceLocation getDotLoc() const
Represents a struct/union/class.
Represents a C99 designated initializer expression.
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
SourceLocation getVarianceLoc() const
Retrieve the location of the variance keyword.
Decl * VisitObjCCategoryDecl(ObjCCategoryDecl *D)
QualType VisitBlockPointerType(const BlockPointerType *T)
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
virtual DeclarationName HandleNameConflict(DeclarationName Name, DeclContext *DC, unsigned IDNS, NamedDecl **Decls, unsigned NumDecls)
Cope with a name conflict when importing a declaration into the given context.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Provides common interface for the Decls that can be redeclared.
QualType getOriginalType() const
TypeSourceInfo * getScopeTypeInfo() const
Retrieve the scope type in a qualified pseudo-destructor expression.
FunctionType::ExtInfo ExtInfo
SourceLocation getColonLoc() const
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...
void setIntegerType(QualType T)
Set the underlying integer type.
Expr * GetTemporaryExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue...
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
unsigned getDepth() const
Retrieve the depth of the template parameter.
SourceLocation getTildeLoc() const
Retrieve the location of the '~'.
Decl * VisitTypedefDecl(TypedefDecl *D)
FieldDecl * getField() const
For a field offsetof node, returns the field.
DiagnosticBuilder FromDiag(SourceLocation Loc, unsigned DiagID)
Report a diagnostic in the "from" context.
SourceLocation getRParenLoc() const
StringLiteral * getMessage()
bool cleanupsHaveSideEffects() const
Designator ImportDesignator(const Designator &D)
QualType getComputationResultType() const
Decl * VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl *D)
bool isArrayRangeDesignator() const
Expr * VisitCompoundAssignOperator(CompoundAssignOperator *E)
SourceLocation getIvarLBraceLoc() const
Represents a class type in Objective C.
SourceLocation getRParen() const
Get the location of the right parentheses ')'.
QualType getPointeeType() const
Expr * getAsExpr() const
Retrieve the template argument as an expression.
void setUninstantiatedDefaultArg(Expr *arg)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A C++ nested-name-specifier augmented with source location information.
Expr * getInit() const
Retrieve the initializer value.
bool isInline() const
Returns true if this is an inline namespace declaration.
Represents a dependent template name that cannot be resolved prior to template instantiation.
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
bool CheckedICE
Whether we already checked whether this statement was an integral constant expression.
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
bool ImportArrayChecked(IIter Ibegin, IIter Iend, OIter Obegin)
Decl * VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D)
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
QualType VisitMemberPointerType(const MemberPointerType *T)
static CXXConstructExpr * Create(const ASTContext &C, QualType T, SourceLocation Loc, CXXConstructorDecl *Ctor, bool Elidable, ArrayRef< Expr *> Args, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization, ConstructionKind ConstructKind, SourceRange ParenOrBraceRange)
TemplateDecl * getAsTemplateDecl() const
Retrieve the underlying template declaration that this template name refers to, if known...
RecordDecl * getDefinition() const
Returns the RecordDecl that actually defines this struct/union/class.
QualType VisitDecayedType(const DecayedType *T)
SourceLocation getLocStart() const LLVM_READONLY
field_range fields() const
SourceLocation getAmpAmpLoc() const
SourceLocation getEndLoc() const
Represents a member of a struct/union/class.
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
const Type * getAsType() const
Retrieve the type stored in this nested name specifier.
void setTypeParamList(ObjCTypeParamList *TPL)
Set the type parameters of this class.
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
QualType VisitParenType(const ParenType *T)
protocol_iterator protocol_begin() const
SubstTemplateTemplateParmPackStorage * getAsSubstTemplateTemplateParmPack() const
Retrieve the substituted template template parameter pack, if known.
Expr * getBase()
Retrieve the base object of this member expressions, e.g., the x in x.m.
const llvm::APSInt & getInitVal() const
Defines the ExceptionSpecificationType enumeration and various utility functions. ...
This declaration is a friend function.
NonTypeTemplateParmDecl * getParameter() const
const DeclarationNameInfo & getNameInfo() const
Gets the full name info.
static DesignatedInitExpr * Create(const ASTContext &C, llvm::ArrayRef< Designator > Designators, ArrayRef< Expr *> IndexExprs, SourceLocation EqualOrColonLoc, bool GNUSyntax, Expr *Init)
unsigned getFunctionScopeIndex() const
Returns the index of this parameter in its prototype or method scope.
bool isArrayDesignator() const
One instance of this struct is kept for every file loaded or used.
unsigned getArrayExprIndex() const
For an array element node, returns the index into the array of expressions.
const Expr * getRetValue() const
SourceLocation getLabelLoc() const
void startDefinition()
Starts the definition of this tag declaration.
bool hasExplicitTemplateArgs() const
Determines whether the member name was followed by an explicit template argument list.
static TemplateArgumentList * CreateCopy(ASTContext &Context, ArrayRef< TemplateArgument > Args)
Create a new template argument list that copies the given set of template arguments.
void setSuperClass(TypeSourceInfo *superClass)
SourceLocation getOperatorLoc() const
GNUNullExpr - Implements the GNU __null extension, which is a name for a null pointer constant that h...
Optional< unsigned > getNumTemplateExpansions() const
Retrieve the number of expansions that a template template argument expansion will produce...
ObjCMethodDecl * getSetterMethodDecl() const
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
Expr * VisitCXXTypeidExpr(CXXTypeidExpr *E)
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
ObjCTypeParamList * getTypeParamListAsWritten() const
Retrieve the type parameters written on this particular declaration of the class. ...
TagDecl * getOwnedTagDecl() const
Return the (re)declaration of this type owned by this occurrence of this type, or nullptr if none...
bool isInIdentifierNamespace(unsigned NS) const
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
static DeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *D, bool RefersToEnclosingVariableOrCapture, SourceLocation NameLoc, QualType T, ExprValueKind VK, NamedDecl *FoundD=nullptr, const TemplateArgumentListInfo *TemplateArgs=nullptr)
TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, UnresolvedSetIterator End) const
Retrieve the template name that corresponds to a non-empty lookup.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
protocol_iterator protocol_end() const
const DeclGroupRef getDeclGroup() const
Expr * VisitExpr(Expr *E)
Decl * VisitObjCImplementationDecl(ObjCImplementationDecl *D)
Represents an access specifier followed by colon ':'.
void startDefinition()
Starts the definition of this Objective-C protocol.
SourceLocation getQuestionLoc() const
static CXXRecordDecl * CreateLambda(const ASTContext &C, DeclContext *DC, TypeSourceInfo *Info, SourceLocation Loc, bool DependentLambda, bool IsGeneric, LambdaCaptureDefault CaptureDefault)
Optional< LambdaCapture > ImportLambdaCapture(const LambdaCapture &From)
SourceLocation getTemplateLoc() const
TemplateName getReplacement() const
QualType VisitObjCInterfaceType(const ObjCInterfaceType *T)
LambdaCaptureDefault getCaptureDefault() const
Determine the default capture kind for this lambda.
unsigned getIndex() const
Retrieve the index into its type parameter list.
ArrayRef< TemplateArgumentLoc > template_arguments() const
QualType getParamTypeForDecl() const
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name...
QualType VisitComplexType(const ComplexType *T)
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
bool hadArrayRangeDesignator() const
Decl * VisitFriendDecl(FriendDecl *D)
SourceLocation getCatchLoc() const
ArrayRef< ParmVarDecl * > parameters() const
Represents Objective-C's @catch statement.
SourceLocation getComposedLoc(FileID FID, unsigned Offset) const
Form a SourceLocation from a FileID and Offset pair.
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
IndirectGotoStmt - This represents an indirect goto.
SourceLocation getMemberLoc() const
Describes an C or C++ initializer list.
A C++ typeid expression (C++ [expr.typeid]), which gets the type_info that corresponds to the supplie...
Represents a C++ using-declaration.
QualType VisitVariableArrayType(const VariableArrayType *T)
Stmt * VisitBreakStmt(BreakStmt *S)
bool ImportArrayChecked(const InContainerTy &InContainer, OIter Obegin)
Decl * VisitCXXConstructorDecl(CXXConstructorDecl *D)
SourceLocation getIvarRBraceLoc() const
An rvalue reference type, per C++11 [dcl.ref].
CXXRecordDecl * getAsRecordDecl() const
Retrieve the record declaration stored in this nested name specifier.
UnresolvedUsingTypenameDecl * getDecl() const
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
Decl * VisitUsingDecl(UsingDecl *D)
ForStmt - This represents a 'for (init;cond;inc)' stmt.
A qualified template name, where the qualification is kept to describe the source code as written...
unsigned getFirstExprIndex() const
QualType VisitElaboratedType(const ElaboratedType *T)
Stmt * getBody(const FunctionDecl *&Definition) const
Retrieve the body (definition) of the function.
FunctionDecl * getOperatorDelete() const
static DeclAccessPair make(NamedDecl *D, AccessSpecifier AS)
bool isElidable() const
Whether this construction is elidable.
Expr * getOperand() const
const Expr * getThrowExpr() const
Stmt * VisitAttributedStmt(AttributedStmt *S)
bool isBaseVirtual() const
Returns whether the base is virtual or not.
DesignatedInitExpr::Designator Designator
TagKind getTagKind() const
Namespaces, declared with 'namespace foo {}'.
void setCXXOperatorNameRange(SourceRange R)
setCXXOperatorNameRange - Sets the range of the operator name (without the operator keyword)...
A convenient class for passing around template argument information.
static void setTypedefNameForAnonDecl(TagDecl *From, TagDecl *To, ASTImporter &Importer)
bool isKNRPromoted() const
True if the value passed to this parameter must undergo K&R-style default argument promotion: ...
const FileInfo & getFile() const
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
void setRange(SourceRange R)
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
LabelDecl * getDecl() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
SourceLocation getLBracLoc() const
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
SourceLocation getLocEnd() const LLVM_READONLY
ArrayRef< NamedDecl * > chain() const
SourceLocation getRParenLoc() const
QualType getNullPtrType() const
Retrieve the type for null non-type template argument.
Expr * getInitializer()
The initializer of this new-expression.
ExprValueKind getValueKind() const
getValueKind - The value kind that this expression produces.
path_iterator path_begin()
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
PropertyAttributeKind getPropertyAttributes() const
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
QualType VisitTemplateTypeParmType(const TemplateTypeParmType *T)
Decl * VisitObjCPropertyDecl(ObjCPropertyDecl *D)
Represents a typeof (or typeof) expression (a GCC extension).
Expr * VisitCharacterLiteral(CharacterLiteral *E)
A builtin binary operation expression such as "x + y" or "x <= y".
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
unsigned getNumPositiveBits() const
Returns the width in bits required to store all the non-negative enumerators of this enum...
bool constructsVBase() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
void setLambdaMangling(unsigned ManglingNumber, Decl *ContextDecl)
Set the mangling number and context declaration for a lambda class.
tokloc_iterator tokloc_end() const
static CompoundStmt * Create(const ASTContext &C, ArrayRef< Stmt *> Stmts, SourceLocation LB, SourceLocation RB)
Decl * VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D)
SourceLocation getThrowLoc() const
const StringLiteral * getInputConstraintLiteral(unsigned i) const
const Type * getClass() const
CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for statement, represented as 'for (ra...
Stmt * VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S)
CXXRecordDecl * getDecl() const
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.
ObjCProtocolDecl * getDefinition()
Retrieve the definition of this protocol, if any.
SourceLocation getEqualOrColonLoc() const
Retrieve the location of the '=' that precedes the initializer value itself, if present.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
SourceLocation getLocStart() const LLVM_READONLY
void setSpecializationKind(TemplateSpecializationKind TSK)
Expr * getSizeExpr() const
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
const TemplateArgument * getArgs() const
Retrieve the template arguments.
SourceLocation getLocalEndLoc() const
Retrieve the location of the end of this component of the nested-name-specifier.
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
bool hasUnparsedDefaultArg() const
Determines whether this parameter has a default argument that has not yet been parsed.
Decl * VisitObjCProtocolDecl(ObjCProtocolDecl *D)
SourceLocation getContinueLoc() const
const Expr * getInitExpr() const
SourceLocation getPropertyIvarDeclLoc() const
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
FieldDecl * getField()
Get the field whose initializer will be used.
Helper class for OffsetOfExpr.
SourceLocation getExternLoc() const
Represents an Objective-C protocol declaration.
Represents binding an expression to a temporary.
bool IsStructurallyEquivalent(QualType From, QualType To, bool Complain=true)
Determine whether the given types are structurally equivalent.
StringLiteral * getClobberStringLiteral(unsigned i)
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
TemplateTemplateParmDecl * getParameter() const
SourceLocation getBuiltinLoc() const
CXXTemporary * getTemporary()
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
static IntegerLiteral * Create(const ASTContext &C, const llvm::APInt &V, QualType type, SourceLocation l)
Returns a new integer literal with value 'V' and type 'type'.
NestedNameSpecifierLoc getQualifierLoc() const
If the name was qualified, retrieves the nested-name-specifier that precedes the name, with source-location information.
Stmt * VisitNullStmt(NullStmt *S)
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
PropertyControl getPropertyImplementation() const
Stmt * VisitCXXCatchStmt(CXXCatchStmt *S)
const TemplateArgument * data() const
Retrieve a pointer to the template argument list.
DeclarationName getDeclName() const
Retrieve the name that this expression refers to.
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.
Represents a C++ member access expression where the actual member referenced could not be resolved be...
SourceLocation getLocStart() const LLVM_READONLY
Represents an ObjC class declaration.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "for" statement, if any.
FieldDecl * getMember() const
If this is a member initializer, returns the declaration of the non-static data member being initiali...
Represents a linkage specification.
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
QualType getReturnType() const
SourceLocation getIncludeLoc() const
Stmt * VisitCXXTryStmt(CXXTryStmt *S)
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
bool ImportDefinition(RecordDecl *From, RecordDecl *To, ImportDefinitionKind Kind=IDK_Default)
ASTImporter(ASTContext &ToContext, FileManager &ToFileManager, ASTContext &FromContext, FileManager &FromFileManager, bool MinimalImport)
Create a new AST importer.
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this function is an instantiation of a member function of a class template specialization, retrieves the member specialization information.
TypeSourceInfo * getTypeSourceInfo() const
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
Expr * getSizeExpr() const
A default argument (C++ [dcl.fct.default]).
bool isMacroArgExpansion() const
Expr * VisitGNUNullExpr(GNUNullExpr *E)
void setMethodParams(ASTContext &C, ArrayRef< ParmVarDecl *> Params, ArrayRef< SourceLocation > SelLocs=llvm::None)
Sets the method's parameters and selector source locations.
QualType getPointeeTypeAsWritten() const
Expr * VisitSubstNonTypeTemplateParmExpr(SubstNonTypeTemplateParmExpr *E)
SourceLocation getAtStartLoc() const
Import the default subset of the definition, which might be nothing (if minimal import is set) or mig...
QualType VisitUnresolvedUsingType(const UnresolvedUsingType *T)
void addDeclInternal(Decl *D)
Add the declaration D into this context, but suppress searches for external declarations with the sam...
Stmt * VisitDeclStmt(DeclStmt *S)
ASTContext & getToContext() const
Retrieve the context that AST nodes are being imported into.
bool isAnonymousStructOrUnion() const
Whether this is an anonymous struct or union.
NamedDecl * getFirstQualifierFoundInScope() const
Retrieve the first part of the nested-name-specifier that was found in the scope of the member access...
Represents the this expression in C++.
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
TypeSourceInfo * getAllocatedTypeSourceInfo() const
NestedNameSpecifierLoc getQualifierLoc() const
If the member name was qualified, retrieves the nested-name-specifier that precedes the member name...
Class that aids in the construction of nested-name-specifiers along with source-location information ...
SourceLocation getRParenLoc() const
TypeSourceInfo * getQueriedTypeSourceInfo() const
void getSelectorLocs(SmallVectorImpl< SourceLocation > &SelLocs) const
const ObjCAtCatchStmt * getCatchStmt(unsigned I) const
Retrieve a @catch statement.
Represents a K&R-style 'int foo()' function, which has no information available about its arguments...
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
SourceLocation getOperatorLoc() const LLVM_READONLY
SourceLocation getEllipsisLoc() const
Decl * MapImported(Decl *From, Decl *To)
Store and assign the imported declaration to its counterpart.
Decl * VisitTypedefNameDecl(TypedefNameDecl *D, bool IsAlias)
bool hasBraces() const
Determines whether this linkage specification had braces in its syntactic form.
const FileEntry * getFile(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Lookup, cache, and verify the specified file (real or virtual).
void completeDefinition(QualType NewType, QualType PromotionType, unsigned NumPositiveBits, unsigned NumNegativeBits)
When created, the EnumDecl corresponds to a forward-declared enum.
Decl * VisitCXXDestructorDecl(CXXDestructorDecl *D)
ConditionalOperator - The ?: ternary operator.
QualType getBaseType() const
Gets the base type of this object type.
SourceLocation getLocStart() const LLVM_READONLY
QualType VisitObjCObjectType(const ObjCObjectType *T)
const ValueDecl * getExtendingDecl() const
Get the declaration which triggered the lifetime-extension of this temporary, if any.
TypeSourceInfo * getTypeSourceInfo() const
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
Represents a C++ pseudo-destructor (C++ [expr.pseudo]).
Represents the declaration of a typedef-name via a C++11 alias-declaration.
A little helper class used to produce diagnostics.
CompoundStmt - This represents a group of statements like { stmt stmt }.
Represents a prototype with parameter type info, e.g.
bool isFileVarDecl() const
Returns true for file scoped variable declaration.
Decl * VisitRecordDecl(RecordDecl *D)
bool isMicrosoftABI() const
Returns whether this is really a Win64 ABI va_arg expression.
SourceLocation getLocStart() const LLVM_READONLY
Decl * VisitCXXConversionDecl(CXXConversionDecl *D)
This declaration is a C++ operator declared in a non-class context.
bool ImportTemplateInformation(FunctionDecl *FromFD, FunctionDecl *ToFD)
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
QualType getComputationLHSType() const
SourceLocation getTypenameLoc() const
Returns the source location of the 'typename' keyword.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine whether this particular class is a specialization or instantiation of a class template or m...
CastKind
CastKind - The kind of operation required for a conversion.
QualType getPromotionType() const
Return the integer type that enumerators should promote to.
bool isDelegatingInitializer() const
Determine whether this initializer is creating a delegating constructor.
static ImplicitCastExpr * Create(const ASTContext &Context, QualType T, CastKind Kind, Expr *Operand, const CXXCastPath *BasePath, ExprValueKind Cat)
DeclarationNameTable DeclarationNames
A dependent template name that has not been resolved to a template (or set of templates).
OverloadedOperatorKind getCXXOverloadedOperator() const
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e...
Expr * VisitArrayInitLoopExpr(ArrayInitLoopExpr *E)
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
bool isParameterPack() const
Whether this parameter is a non-type template parameter pack.
SourceLocation getTryLoc() const
Stmt * VisitObjCForCollectionStmt(ObjCForCollectionStmt *S)
SourceLocation getLocation() const
SourceLocation getLocation() const
void setTypeParamList(ObjCTypeParamList *TPL)
Set the type parameters of this category.
QualType VisitDependentSizedArrayType(const DependentSizedArrayType *T)
const FunctionType * getFunctionType(bool BlocksToo=true) const
Looks through the Decl's underlying type to extract a FunctionType when possible. ...
ArrayRef< TypeSourceInfo * > getArgs() const
Retrieve the argument types.
ImportDefinitionKind
What we should import from the definition.
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param)
Represents a call to the builtin function __builtin_va_arg.
TypeSourceInfo * getTrivialTypeSourceInfo(QualType T, SourceLocation Loc=SourceLocation()) const
Allocate a TypeSourceInfo where all locations have been initialized to a given location, which defaults to the empty location.
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
TypeSourceInfo * getTypeSourceInfo() const
SourceLocation getLabelLoc() const
void setInClassInitializer(Expr *Init)
Set the C++11 in-class initializer for this member.
SourceLocation getThrowLoc() const LLVM_READONLY
CharacteristicKind getFileCharacteristic() const
Return whether this is a system header or not.
static unsigned getNumSubExprs(AtomicOp Op)
Determine the number of arguments the specified atomic builtin should have.
unsigned getValue() const
static NestedNameSpecifier * SuperSpecifier(const ASTContext &Context, CXXRecordDecl *RD)
Returns the nested name specifier representing the __super scope for the given CXXRecordDecl.
Represents an array type in C++ whose size is a value-dependent expression.
Expr * VisitParenExpr(ParenExpr *E)
SourceLocation getDestroyedTypeLoc() const
Retrieve the starting location of the type being destroyed.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
QualType getElementType() const
void setGetterMethodDecl(ObjCMethodDecl *gDecl)
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Optional< TemplateArgsTy > OptionalTemplateArgsTy
unsigned getNumArgs() const
Retrieve the number of template arguments.
Pepresents a block literal declaration, which is like an unnamed FunctionDecl.
unsigned getFunctionScopeDepth() const
llvm::MutableArrayRef< Designator > designators()
NamespaceDecl * getAsNamespace() const
Retrieve the namespace stored in this nested name specifier.
DeclAccessPair getFoundDecl() const
Retrieves the declaration found by lookup.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Expr - This represents one expression.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Defines the clang::LangOptions interface.
Stmt * VisitGotoStmt(GotoStmt *S)
SourceLocation getElseLoc() const
Decl * VisitEnumConstantDecl(EnumConstantDecl *D)
static TypeTraitExpr * Create(const ASTContext &C, QualType T, SourceLocation Loc, TypeTrait Kind, ArrayRef< TypeSourceInfo *> Args, SourceLocation RParenLoc, bool Value)
Create a new type trait expression.
unsigned getChainingSize() const
SourceLocation getAliasLoc() const
Returns the location of the alias name, i.e.
ExprValueKind
The categorization of expression values, currently following the C++11 scheme.
Selector getSetterName() const
SourceLocation getCaptureDefaultLoc() const
Retrieve the location of this lambda's capture-default, if any.
Stmt * VisitCXXForRangeStmt(CXXForRangeStmt *S)
IdentifierInfo * getFieldName() const
For a field or identifier offsetof node, returns the name of the field.
CXXBaseSpecifier * getBase() const
For a base class node, returns the base specifier.
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '...
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Decl * VisitEmptyDecl(EmptyDecl *D)
TypeSourceInfo * getSuperClassTInfo() const
Declaration of a template type parameter.
void setSetterMethodDecl(ObjCMethodDecl *gDecl)
SourceLocation getDefaultLoc() const
unsigned getIndex() const
FileID createFileID(const FileEntry *SourceFile, SourceLocation IncludePos, SrcMgr::CharacteristicKind FileCharacter, int LoadedID=0, unsigned LoadedOffset=0)
Create a new FileID that represents the specified file being #included from the specified IncludePosi...
bool isImplicitAccess() const
True if this is an implicit access, i.e., one in which the member being accessed was not written in t...
SourceLocation getWhileLoc() const
TypeSourceInfo * getTypeSourceInfo() const
DeclarationNameInfo getNameInfo() const
Expr * VisitDeclRefExpr(DeclRefExpr *E)
unsigned getPackLength() const
Retrieve the length of the parameter pack.
void setSyntacticForm(InitListExpr *Init)
Represents a C++ functional cast expression that builds a temporary object.
The template argument is a null pointer or null pointer to member that was provided for a non-type te...
const Stmt * getThen() const
SourceLocation getLocation() const
T getAs() const
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired...
Represents a C++ destructor within a class.
bool hasRelatedResultType() const
Determine whether this method has a result type that is related to the message receiver's type...
static CXXUnresolvedConstructExpr * Create(const ASTContext &C, TypeSourceInfo *Type, SourceLocation LParenLoc, ArrayRef< Expr *> Args, SourceLocation RParenLoc)
SourceLocation createMacroArgExpansionLoc(SourceLocation Loc, SourceLocation ExpansionLoc, unsigned TokLength)
Return a new SourceLocation that encodes the fact that a token from SpellingLoc should actually be re...
VarDecl * getExceptionDecl() const
IdentifierInfo * getDestroyedTypeIdentifier() const
In a dependent pseudo-destructor expression for which we do not have full type information on the des...
bool isFieldDesignator() const
unsigned getNumInits() const
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
bool isImplicitAccess() const
True if this is an implicit access, i.e.
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Expr * getSubExpr() const
Get the initializer to use for each array element.
const Expr * getCallee() const
void setRBraceLoc(SourceLocation L)
const char * getTypeClassName() const
Stmt * VisitIfStmt(IfStmt *S)
static CXXStaticCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *Path, TypeSourceInfo *Written, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
Decl * VisitLinkageSpecDecl(LinkageSpecDecl *D)
bool isArrow() const
Determine whether this pseudo-destructor expression was written using an '->' (otherwise, it used a '.
ClassTemplateDecl * getSpecializedTemplate() const
Retrieve the template that this specialization specializes.
Expr * VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E)
overridden_method_range overridden_methods() const
Expr * VisitAddrLabelExpr(AddrLabelExpr *E)
const CompoundStmt * getSynchBody() const
Expr * VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E)
DeclContext * getDeclContext()
SourceLocation getLParenLoc() const
Decl * VisitAccessSpecDecl(AccessSpecDecl *D)
A structure for storing the information associated with a substituted template template parameter...
CXXRecordDecl * getDefinition() const
QualType VisitFunctionNoProtoType(const FunctionNoProtoType *T)
lookup_result noload_lookup(DeclarationName Name)
Find the declarations with the given name that are visible within this context; don't attempt to retr...
const IdentifierInfo * getIdentifier() const
Retrieve the type named by the typename specifier as an identifier.
Represents Objective-C's @synchronized statement.
ObjCInterfaceDecl * getSuperClass() const
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
TypeSourceInfo * getTypeSourceInfo() const
NestedNameSpecifierLoc getPrefix() const
Return the prefix of this nested-name-specifier.
static ObjCTypeParamList * create(ASTContext &ctx, SourceLocation lAngleLoc, ArrayRef< ObjCTypeParamDecl *> typeParams, SourceLocation rAngleLoc)
Create a new Objective-C type parameter list.
unsigned size() const
Returns the number of designators in this initializer.
Represents an expression that computes the length of a parameter pack.
CXXTryStmt - A C++ try block, including all handlers.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
SourceLocation getAtTryLoc() const
Retrieve the location of the @ in the @try.
Expr * VisitPredefinedExpr(PredefinedExpr *E)
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
bool refersToEnclosingVariableOrCapture() const
Does this DeclRefExpr refer to an enclosing local or a captured variable?
static FloatingLiteral * Create(const ASTContext &C, const llvm::APFloat &V, bool isexact, QualType Type, SourceLocation L)
Represents a C++ template name within the type system.
static DependentScopeDeclRefExpr * Create(const ASTContext &C, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
Represents the type decltype(expr) (C++11).
QualType VisitConstantArrayType(const ConstantArrayType *T)
ArrayTypeTrait getTrait() const
EnumDecl * getDefinition() const
Defines the clang::TypeLoc interface and its subclasses.
bool isIdentifier() const
Determine whether this template name refers to an identifier.
A namespace alias, stored as a NamespaceAliasDecl*.
ParmVarDecl *const * param_iterator
protocol_loc_iterator protocol_loc_begin() const
bool containsDeclAndLoad(Decl *D) const
Checks whether a declaration is in this context.
DependentFunctionTemplateSpecializationInfo * getDependentSpecializationInfo() const
llvm::SmallVector< Decl *, 2 > getCanonicalForwardRedeclChain(Decl *D)
ArrayRef< Expr * > inits()
IdentifierInfo * getAsIdentifierInfo() const
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn't a simple identifier.
void setImplementation(ObjCImplementationDecl *ImplD)
void setConstexpr(bool IC)
Expr * VisitCXXDeleteExpr(CXXDeleteExpr *E)
SourceRange getAngleBrackets() const LLVM_READONLY
Kind getKind() const
Determine what kind of offsetof node this is.
Stmt * VisitObjCAtTryStmt(ObjCAtTryStmt *S)
bool hasBody(const FunctionDecl *&Definition) const
Returns true if the function has a body.
FunctionDecl * FindFunctionTemplateSpecialization(FunctionDecl *FromFD)
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
bool isFunctionOrMethod() const
Expr * VisitCXXThisExpr(CXXThisExpr *E)
Optional< TemplateArgumentLoc > ImportTemplateArgumentLoc(const TemplateArgumentLoc &TALoc)
static LambdaExpr * Create(const ASTContext &C, CXXRecordDecl *Class, SourceRange IntroducerRange, LambdaCaptureDefault CaptureDefault, SourceLocation CaptureDefaultLoc, ArrayRef< LambdaCapture > Captures, bool ExplicitParams, bool ExplicitResultType, ArrayRef< Expr *> CaptureInits, SourceLocation ClosingBrace, bool ContainsUnexpandedParameterPack)
Construct a new lambda expression.
SourceLocation getSwitchLoc() const
Declaration of an alias template.
void ImportDeclarationNameLoc(const DeclarationNameInfo &From, DeclarationNameInfo &To)
LabelDecl * getLabel() const
const Stmt * getTryBody() const
Retrieve the @try body.
Decl * GetAlreadyImportedOrNull(Decl *FromD)
Return the copy of the given declaration in the "to" context if it has already been imported from the...
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
void setPointOfInstantiation(SourceLocation Loc)
SourceLocation getDoLoc() const
Expr * VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E)
SourceLocation getAtLoc() const
SourceLocation getLBracketLoc() const
SourceLocation getRBracketLoc() const
SourceLocation getEnd() const
UnaryOperator - This represents the unary-expression's (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
bool isInstanceMethod() const
Represents a GCC generic vector type.
ArraySizeModifier getSizeModifier() const
bool usesGNUSyntax() const
Determines whether this designated initializer used the deprecated GNU syntax for designated initiali...
static bool CanThrow(Expr *E, ASTContext &Ctx)
MemberSpecializationInfo * getMemberSpecializationInfo() const
If this class is an instantiation of a member class of a class template specialization, retrieves the member specialization information.
An lvalue reference type, per C++11 [dcl.ref].
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
Stmt * VisitReturnStmt(ReturnStmt *S)
Represents a reference to a non-type template parameter that has been substituted with a template arg...
bool isBaseOfClass() const
Determine whether this base class is a base of a class declared with the 'class' keyword (vs...
const OffsetOfNode & getComponent(unsigned Idx) const
unsigned getNumArgs() const
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression which will be evaluated if the condition evaluates to true; th...
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
void setDescribedClassTemplate(ClassTemplateDecl *Template)
SourceLocation getRParenLoc() const
Represents a C++ conversion function within a class.
The result type of a method or function.
bool isTrivial() const
Whether this function is "trivial" in some specialized C++ senses.
SourceLocation getForLoc() const
const Expr * getSubExpr() const
const Expr * getSubExpr() const
SourceLocation getPackLoc() const
Determine the location of the parameter pack.
CXXMethodDecl * getCallOperator() const
Retrieve the function call operator associated with this lambda expression.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
A type, stored as a Type*.
Expr * getLHS()
An array access can be written A[4] or 4[A] (both are equivalent).
bool hadMultipleCandidates() const
Returns true if this expression refers to a function that was resolved from an overloaded set having ...
QualType VisitDependentTemplateSpecializationType(const DependentTemplateSpecializationType *T)
const ExpansionInfo & getExpansion() const
Expr * VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E)
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl *> Params, SourceLocation RAngleLoc, Expr *RequiresClause)
Expr * getUnderlyingExpr() const
Decl * VisitObjCMethodDecl(ObjCMethodDecl *D)
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
ObjCProtocolList::iterator protocol_iterator
ExprObjectKind getObjectKind() const
getObjectKind - The object kind that this expression produces.
DoStmt - This represents a 'do/while' stmt.
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
unsigned getBuiltinID() const
Return a value indicating whether this is a builtin function.
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
QualType VisitEnumType(const EnumType *T)
TypeSourceInfo * getReturnTypeSourceInfo() const
RecordDecl * getDecl() const
bool capturesVariable() const
Determine whether this capture handles a variable.
SpecifierKind
The kind of specifier that completes this nested name specifier.
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getExpansionLocEnd() const
SourceLocation getUsingLoc() const
Return the location of the using keyword.
void setTypeForDecl(const Type *TD)
NestedNameSpecifier * getQualifier() const
Return the nested name specifier that qualifies this name.
Expr * VisitParenListExpr(ParenListExpr *E)
A template template parameter pack that has been substituted for a template template argument pack...
CanThrowResult
Possible results from evaluation of a noexcept expression.
SourceLocation getUsingLoc() const
Returns the source location of the 'using' keyword.
IdentifierInfo * getCXXLiteralIdentifier() const
getCXXLiteralIdentifier - If this name is the name of a literal operator, retrieve the identifier ass...
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template.
Expr * VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E)
void makeDeclVisibleInContext(NamedDecl *D)
Makes a declaration visible within this context.
SourceLocation getLocEnd() const LLVM_READONLY
TemplateName getDependentTemplateName(NestedNameSpecifier *NNS, const IdentifierInfo *Name) const
Retrieve the template name that represents a dependent template name such as MetaFun::template apply...
SourceLocation getLParenLoc() const
SelectorTable & Selectors
static CXXConstCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, Expr *Op, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
static CXXBindTemporaryExpr * Create(const ASTContext &C, CXXTemporary *Temp, Expr *SubExpr)
A field in a dependent type, known only by its name.
QualType getCanonicalType() const
Represents a call to an inherited base class constructor from an inheriting constructor.
Decl * VisitIndirectFieldDecl(IndirectFieldDecl *D)
ExpressionTrait getTrait() const
ExceptionSpecificationType Type
The kind of exception specification this is.
bool isInstantiationDependent() const
Whether this expression is instantiation-dependent, meaning that it depends in some way on a template...
TypeLoc IgnoreParens() const
param_type_range param_types() const
IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
ElaboratedTypeKeyword getKeyword() const
ExtProtoInfo getExtProtoInfo() const
const ContentCache * getContentCache() const
void setKNRPromoted(bool promoted)
Decl * VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D)
SourceLocation getLocStart() const LLVM_READONLY
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis for a capture that is a pack expansion.
SourceLocation getNameLoc() const
Gets the location of the name.
bool inheritedFromVBase() const
Determine whether the inherited constructor is inherited from a virtual base of the object we constru...
unsigned getNumExprs() const
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
bool isParameterPack() const
Returns whether this is a parameter pack.
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Encodes a location in the source.
bool getSynthesize() const
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
Sugar for parentheses used when specifying types.
IdentifierInfo & get(StringRef Name)
Return the identifier token info for the specified named identifier.
QualType getReturnType() const
bool isPure() const
Whether this virtual function is pure, i.e.
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of enums...
SourceLocation getOperatorLoc() const
QualType VisitFunctionProtoType(const FunctionProtoType *T)
ObjCProtocolList::iterator protocol_iterator
const Stmt * getCatchBody() const
unsigned getNumHandlers() const
SourceLocation createExpansionLoc(SourceLocation Loc, SourceLocation ExpansionLocStart, SourceLocation ExpansionLocEnd, unsigned TokLength, bool ExpansionIsTokenRange=true, int LoadedID=0, unsigned LoadedOffset=0)
Return a new SourceLocation that encodes the fact that a token from SpellingLoc should actually be re...
Expr * getSubExpr() const
SourceLocation getSuperClassLoc() const
Represents a C++ temporary.
bool hasExplicitTemplateArgs() const
Determines whether this member expression actually had a C++ template argument list explicitly specif...
Represents typeof(type), a GCC extension.
Interfaces are the core concept in Objective-C for object oriented design.
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
QualType VisitDependentNameType(const DependentNameType *T)
Attr * clone(ASTContext &C) const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieves the nested-name-specifier that qualifies the type name, with source-location information...
QualType VisitBuiltinType(const BuiltinType *T)
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
bool hasUnresolvedUsing() const
Determine whether the lookup results contain an unresolved using declaration.
CastKind getCastKind() const
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameter list associated with this category or extension.
SourceLocation getLocStart() const LLVM_READONLY
Expr * getSubExpr(unsigned Idx) const
A structure for storing an already-substituted template template parameter pack.
const SwitchCase * getSwitchCaseList() const
SourceLocation getOperatorLoc() const
Retrieve the location of the cast operator keyword, e.g., static_cast.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
void setExternLoc(SourceLocation Loc)
Sets the location of the extern keyword.
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
DeclarationName getName() const
getName - Returns the embedded declaration name.
ArrayRef< const Attr * > getAttrs() const
Represents the declaration of a struct/union/class/enum.
SourceLocation getUsingLoc() const
Return the source location of the 'using' keyword.
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis that describes this pack expansion.
static SizeOfPackExpr * Create(ASTContext &Context, SourceLocation OperatorLoc, NamedDecl *Pack, SourceLocation PackLoc, SourceLocation RParenLoc, Optional< unsigned > Length=None, ArrayRef< TemplateArgument > PartialArgs=None)
SourceLocation getCategoryNameLoc() const
Represents a call to a member function that may be written either with member call syntax (e...
TypeAliasTemplateDecl * getDescribedAliasTemplate() const
ASTContext & getASTContext() const LLVM_READONLY
llvm::iterator_range< capture_init_iterator > capture_inits()
Retrieve the initialization expressions for this lambda's captures.
SourceLocation getLocStart() const LLVM_READONLY
ObjCCategoryDecl * getCategoryDecl() const
QualType getElementType() const
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
Decl * VisitTranslationUnitDecl(TranslationUnitDecl *D)
Represents the declaration of a label.
void setPropertyAttributesAsWritten(PropertyAttributeKind PRVal)
Represents a dependent using declaration which was not marked with typename.
Cached information about one file (either on disk or in the virtual file system). ...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Expr * getInClassInitializer() const
Get the C++11 default member initializer for this member, or null if one has not been set...
Decl * VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D)
Expr * VisitMemberExpr(MemberExpr *E)
static OffsetOfExpr * Create(const ASTContext &C, QualType type, SourceLocation OperatorLoc, TypeSourceInfo *tsi, ArrayRef< OffsetOfNode > comps, ArrayRef< Expr *> exprs, SourceLocation RParenLoc)
SourceLocation getLocStart() const LLVM_READONLY
Represents a static or instance method of a struct/union/class.
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
bool shouldForceImportDeclContext(ImportDefinitionKind IDK)
Expr * VisitUnresolvedLookupExpr(UnresolvedLookupExpr *E)
StmtVisitor - This class implements a simple visitor for Stmt subclasses.
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
SourceLocation getRParenLoc() const
Expr * getRequiresClause()
The constraint-expression of the associated requires-clause.
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
void addOverriddenMethod(const CXXMethodDecl *MD)
SourceLocation getIdentLocation() const
Returns the location of this using declaration's identifier.
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
void MakeGlobal(ASTContext &Context, SourceLocation ColonColonLoc)
Turn this (empty) nested-name-specifier into the global nested-name-specifier '::'.
void ImportImplicitMethods(const CXXRecordDecl *From, CXXRecordDecl *To)
bool isBoundToLvalueReference() const
Determine whether this materialized temporary is bound to an lvalue reference; otherwise, it's bound to an rvalue reference.
bool isParameterPack() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
Decl * VisitFunctionDecl(FunctionDecl *D)
ObjCCategoryDecl - Represents a category declaration.
unsigned pack_size() const
The number of template arguments in the given template argument pack.
QualType getEquivalentType() const
AtomicExpr - Variadic atomic builtins: __atomic_exchange, __atomic_fetch_*, __atomic_load, __atomic_store, and __atomic_compare_exchange_*, for the similarly-named C++11 instructions, and __c11 variants for <stdatomic.h>, and corresponding __opencl_atomic_* for OpenCL 2.0.
unsigned capture_size() const
Determine the number of captures in this lambda.
UnaryExprOrTypeTrait getKind() const
TemplateSpecializationKind getSpecializationKind() const
Determine the kind of specialization that this declaration represents.
bool hasExternalLexicalStorage() const
Whether this DeclContext has external storage containing additional declarations that are lexically i...
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
void addDecl(NamedDecl *D)
QualType VisitTypedefType(const TypedefType *T)
Expr * VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E)
bool isValueDependent() const
isValueDependent - Determines whether this expression is value-dependent (C++ [temp.dep.constexpr]).
const TemplateArgumentListInfo & getTemplateArgsInfo() const
QualType getInnerType() const
SourceLocation getLParenLoc() const
SourceLocation getGotoLoc() const
SourceLocation getAtFinallyLoc() const
AccessSpecifier getAccess() const
void setPointOfInstantiation(SourceLocation Loc)
StringLiteral * getFunctionName()
StructuralEquivalenceKind
Whether to perform a normal or minimal equivalence check.
bool isMinimalImport() const
Whether the importer will perform a minimal import, creating to-be-completed forward declarations whe...
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
static CXXDefaultInitExpr * Create(const ASTContext &C, SourceLocation Loc, FieldDecl *Field)
Field is the non-static data member whose default initializer is used by this expression.
Represents one property declaration in an Objective-C interface.
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
SourceLocation getLocEnd() const LLVM_READONLY
ASTNodeImporter(ASTImporter &Importer)
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Stmt * VisitForStmt(ForStmt *S)
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
SourceLocation getAtCatchLoc() const
A simple visitor class that helps create declaration visitors.
CharacterKind getKind() const
bool hasUninstantiatedDefaultArg() const
AutoTypeKeyword getKeyword() const
Expr * VisitLambdaExpr(LambdaExpr *LE)
QualType VisitRecordType(const RecordType *T)
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required...
Decl * VisitVarTemplateDecl(VarTemplateDecl *D)
IdentType getIdentType() const
Stmt * VisitCompoundStmt(CompoundStmt *S)
Stmt * VisitIndirectGotoStmt(IndirectGotoStmt *S)
virtual Decl * Imported(Decl *From, Decl *To)
Subclasses can override this function to observe all of the From -> To declaration mappings as they a...
TypeSourceInfo * getTypeAsWritten() const
Gets the type of this specialization as it was written by the user, if it was so written.
An expression trait intrinsic.
Decl * VisitImplicitParamDecl(ImplicitParamDecl *D)
SourceLocation getRAngleLoc() const
SourceLocation getMemberLocation() const
bool isImplicitInterfaceDecl() const
isImplicitInterfaceDecl - check that this is an implicitly declared ObjCInterfaceDecl node...
EnumDecl * getDecl() const
Expr * VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E)
ArrayRef< Expr * > exprs()
DeclarationNameInfo getNameInfo() const
Represents a C++11 static_assert declaration.
SourceLocation getExpansionLocStart() const
Stmt * VisitWhileStmt(WhileStmt *S)
StmtExpr - This is the GNU Statement Expression extension: ({int X=4; X;}).
SourceRange getBracketsRange() const
bool isArgumentType() const
ArrayRef< TemplateArgumentLoc > template_arguments() const
ObjCImplementationDecl * getImplementation() const
SourceLocation getRBraceLoc() const
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
Expr * VisitCallExpr(CallExpr *E)
Expr * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
Decl * VisitLabelDecl(LabelDecl *D)
TypeSourceInfo * getTypeSourceInfo() const
Retrieves the type and source location of the base class.
SourceLocation getStarLoc() const
QualType VisitObjCObjectPointerType(const ObjCObjectPointerType *T)
void setHasInheritedDefaultArg(bool I=true)
bool passAlignment() const
Indicates whether the required alignment should be implicitly passed to the allocation function...
void sawArrayRangeDesignator(bool ARD=true)
DependentTemplateName * getAsDependentTemplateName() const
Retrieve the underlying dependent template name structure, if any.
void addArgument(const TemplateArgumentLoc &Loc)
FunctionDecl * getOperatorDelete() const
static CXXReinterpretCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind Kind, Expr *Op, const CXXCastPath *Path, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation RParenLoc, SourceRange AngleBrackets)
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
SourceLocation getIvarLBraceLoc() const
static MemberExpr * Create(const ASTContext &C, Expr *base, bool isarrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *memberdecl, DeclAccessPair founddecl, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *targs, QualType ty, ExprValueKind VK, ExprObjectKind OK)
Represents a pointer type decayed from an array or function type.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
The injected class name of a C++ class template or class template partial specialization.
A qualified reference to a name whose declaration cannot yet be resolved.
void setVirtualAsWritten(bool V)
const Expr * getInitializer() const
Represents a pack expansion of types.
InitializationStyle getInitializationStyle() const
The kind of initializer this new-expression has.
CompoundAssignOperator - For compound assignments (e.g.
SourceLocation getLocation() const LLVM_READONLY
Defines various enumerations that describe declaration and type specifiers.
A POD class for pairing a NamedDecl* with an access specifier.
ObjCDeclQualifier getObjCDeclQualifier() const
StringRef getName() const
Return the actual identifier string.
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier (with source-location information) that qualifies the name of this...
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
void updateFlags(const Decl *From, Decl *To)
SourceRange getRange() const
AddrLabelExpr - The GNU address of label extension, representing &&label.
An Objective-C "bridged" cast expression, which casts between Objective-C pointers and C pointers...
Base class for declarations which introduce a typedef-name.
ast_type_traits::DynTypedNode Node
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Represents a template argument.
OpaqueValueExpr * getOpaqueValue() const
getOpaqueValue - Return the opaque value placeholder.
LabelStmt * getStmt() const
unsigned getManglingNumber() const
bool ImportDeclParts(NamedDecl *D, DeclContext *&DC, DeclContext *&LexicalDC, DeclarationName &Name, NamedDecl *&ToD, SourceLocation &Loc)
TypeSourceInfo * getDestroyedTypeInfo() const
Retrieve the source location information for the type being destroyed.
VarDecl * getConditionVariable() const
Retrieve the variable declared in this "if" statement, if any.
static DeclGroupRef Create(ASTContext &C, Decl **Decls, unsigned NumDecls)
SourceLocation getTemplateKeywordLoc() const
Gets the location of the template keyword, if present.
Represents a template name that was expressed as a qualified name.
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression which will be evaluated if the condnition evaluates to false;...
protocol_iterator protocol_end() const
NullStmt - This is the null statement ";": C99 6.8.3p3.
const ObjCInterfaceDecl * getClassInterface() const
bool isTypeOperand() const
NamespaceDecl * getNominatedNamespace()
Returns the namespace nominated by this using-directive.
Expr * VisitCXXNamedCastExpr(CXXNamedCastExpr *E)
virtual void CompleteDecl(Decl *D)
Called for ObjCInterfaceDecl, ObjCProtocolDecl, and TagDecl.
SourceLocation getLocation() const
bool isNull() const
Determine whether this template name is NULL.
Dataflow Directional Tag Classes.
void setExtendingDecl(const ValueDecl *ExtendedBy, unsigned ManglingNumber)
TemplateName getSubstTemplateTemplateParmPack(TemplateTemplateParmDecl *Param, const TemplateArgument &ArgPack) const
NestedNameSpecifier * getNestedNameSpecifier() const
Retrieve the nested-name-specifier to which this instance refers.
bool isValid() const
Return true if this is a valid SourceLocation object.
tokloc_iterator tokloc_begin() const
void ImportDeclContext(DeclContext *FromDC, bool ForceImport=false)
ExtInfo getExtInfo() const
const TemplateArgument & getArgument() const
[C99 6.4.2.2] - A predefined identifier such as func.
DeclarationNameInfo getMemberNameInfo() const
Retrieve the member declaration name info.
void setGetterName(Selector Sel, SourceLocation Loc=SourceLocation())
NestedNameSpecifier * getQualifier() const
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
IdentifierInfo * getOutputIdentifier(unsigned i) const
PropertyAttributeKind getPropertyAttributesAsWritten() const
SourceLocation getStartLoc() const LLVM_READONLY
TemplateArgument ImportTemplateArgument(const TemplateArgument &From)
Kind getPropertyImplementation() const
QualType VisitIncompleteArrayType(const IncompleteArrayType *T)
const Stmt * getFinallyBody() const
SourceLocation getLocStart() const LLVM_READONLY
The template argument is a pack expansion of a template name that was provided for a template templat...
SourceLocation getAtLoc() const
QualType VisitAttributedType(const AttributedType *T)
const TemplateArgument * getArgs() const
Retrieve the template arguments.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
Represents a field injected from an anonymous union/struct into the parent scope. ...
QualType getUnderlyingType() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
DeclContext * getCommonAncestor()
Returns the common ancestor context of this using-directive and its nominated namespace.
TypeSourceInfo * getTypeSourceInfo() const
Retrieve the type source information for the type being constructed.
AccessSpecifier getAccess() const
ObjCInterfaceDecl * getDefinition()
Retrieve the definition of this class, or NULL if this class has been forward-declared (with @class) ...
QualType getUnderlyingType() const
bool isExplicitInstantiationOrSpecialization() const
True if this declaration is an explicit specialization, explicit instantiation declaration, or explicit instantiation definition.
LambdaCaptureKind getCaptureKind() const
Determine the kind of capture.
IdentifierNamespace
IdentifierNamespace - The different namespaces in which declarations may appear.
unsigned getIndex() const
Retrieve the index of the template parameter.
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
SourceLocation getLBraceLoc() const
Represents a dependent using declaration which was marked with typename.
SourceLocation getSemiLoc() const
DeclarationName - The name of a declaration.
StmtClass getStmtClass() const
VectorKind getVectorKind() const
Represents the declaration of an Objective-C type parameter.
ArrayRef< QualType > exceptions() const
SourceRange getIntroducerRange() const
Retrieve the source range covering the lambda introducer, which contains the explicit capture list su...
Expr * VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E)
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
Expr * VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E)
void setDependentTemplateSpecialization(ASTContext &Context, const UnresolvedSetImpl &Templates, const TemplateArgumentListInfo &TemplateArgs)
Specifies that this function declaration is actually a dependent function template specialization...
Represents a C++11 pack expansion that produces a sequence of expressions.
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
CXXRecordDecl * getInstantiatedFromMemberClass() const
If this record is an instantiation of a member class, retrieves the member class from which it was in...
Decl * VisitClassTemplateDecl(ClassTemplateDecl *D)
SourceLocation getLocEnd() const LLVM_READONLY
void setInstantiationDependent(bool ID)
Set whether this expression is instantiation-dependent or not.
SourceLocation getLocStart() const LLVM_READONLY
const Expr * getSynchExpr() const
void ImportArray(IIter Ibegin, IIter Iend, OIter Obegin)
A pointer to member type per C++ 8.3.3 - Pointers to members.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
Expr * VisitExplicitCastExpr(ExplicitCastExpr *E)
Expr * VisitImplicitValueInitExpr(ImplicitValueInitExpr *ILE)
ExplicitCastExpr - An explicit cast written in the source code.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
Tags, declared with 'struct foo;' and referenced with 'struct foo'.
void setInitializedFieldInUnion(FieldDecl *FD)
Decl * VisitFunctionTemplateDecl(FunctionTemplateDecl *D)
A type that was preceded by the 'template' keyword, stored as a Type*.
ExternalASTSource * getExternalSource() const
Retrieve a pointer to the external AST source associated with this AST context, if any...
pack_iterator pack_begin() const
Iterator referencing the first argument of a template argument pack.
const TemplateTypeParmType * getReplacedParameter() const
Gets the template parameter that was substituted for.
SourceLocation getSetterNameLoc() const
Decl * VisitObjCIvarDecl(ObjCIvarDecl *D)
bool isNull() const
Determine whether this template argument has no value.
Expr * VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *CE)
void setObjectOfFriendDecl(bool PerformFriendInjection=false)
Changes the namespace of this declaration to reflect that it's the object of a friend declaration...
TypeSourceInfo * getTypeOperandSourceInfo() const
Retrieve source information for the type operand.
const Stmt * getBody() const
Decl * VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D)
llvm::APInt getValue() const
CXXRecordDecl * getNamingClass() const
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
QualType getModifiedType() const
LabelDecl * getLabel() const
QualType VisitLValueReferenceType(const LValueReferenceType *T)
Represents a pointer to an Objective C object.
Represents a C++11 noexcept expression (C++ [expr.unary.noexcept]).
SwitchStmt - This represents a 'switch' stmt.
UsingDecl * getUsingDecl() const
Gets the using declaration to which this declaration is tied.
bool IsEquivalent(Decl *D1, Decl *D2)
Determine whether the two declarations are structurally equivalent.
SourceLocation getColonColonLoc() const
Retrieve the location of the '::' in a qualified pseudo-destructor expression.
SourceLocation getFieldLoc() const
void ImportOverrides(CXXMethodDecl *ToMethod, CXXMethodDecl *FromMethod)
Expr * VisitFloatingLiteral(FloatingLiteral *E)
FileID getFileID(SourceLocation SpellingLoc) const
Return the FileID for a SourceLocation.
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source location information.
SourceLocation getRParenLoc() const
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Complex values, per C99 6.2.5p11.
Location wrapper for a TemplateArgument.
void setIsUsed()
Set whether the declaration is used, in the sense of odr-use.
unsigned getIndexTypeCVRQualifiers() const
unsigned getNumArgs() const
Retrieve the number of template arguments.
void setUnparsedDefaultArg()
Specify that this parameter has an unparsed default argument.
Expr * getUninstantiatedDefaultArg()
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
SourceLocation getLocEnd() const LLVM_READONLY
Imports selected nodes from one AST context into another context, merging AST nodes where appropriate...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
QualType getCanonicalTypeInternal() const
Represents Objective-C's collection statement.
Represents a C++ base or member initializer.
Expr * VisitCXXNoexceptExpr(CXXNoexceptExpr *E)
Expr * VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E)
unsigned getNumObjects() const
IndirectFieldDecl * getIndirectMember() const
void setQualifierInfo(NestedNameSpecifierLoc QualifierLoc)
SourceLocation getLocation() const
Retrieve the location of this expression.
SourceLocation getRParenLoc() const
Determine the location of the right parenthesis.
Selector getSelector(unsigned NumArgs, IdentifierInfo **IIV)
Can create any sort of selector.
bool IsStructuralMatch(Decl *From, Decl *To, bool Complain)
static CStyleCastExpr * Create(const ASTContext &Context, QualType T, ExprValueKind VK, CastKind K, Expr *Op, const CXXCastPath *BasePath, TypeSourceInfo *WrittenTy, SourceLocation L, SourceLocation R)
An implicit indirection through a C++ base class, when the field found is in a base class...
const llvm::APInt & getSize() const
Expr * getCond() const
getCond - Return the condition expression; this is defined in terms of the opaque value...
protocol_iterator protocol_begin() const
Expr * getReplacement() const
void setBuiltinID(unsigned ID)
TypeSourceInfo * getTypeSourceInfo() const
bool doesUsualArrayDeleteWantSize() const
Answers whether the usual array deallocation function for the allocated type expects the size of the ...
ExtVectorType - Extended vector type.
SourceRange getDirectInitRange() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the member name, with source location information...
virtual void CompleteType(TagDecl *Tag)
Gives the external AST source an opportunity to complete an incomplete type.
param_const_iterator param_begin() const
SourceRange getBracketsRange() const
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.
ObjCInterfaceDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this Objective-C class.
StringRef getBytes() const
Allow access to clients that need the byte representation, such as ASTWriterStmt::VisitStringLiteral(...
Represents Objective-C's @finally statement.
The template argument is a type.
QualType getUnderlyingType() const
void setInstantiationOfMemberClass(CXXRecordDecl *RD, TemplateSpecializationKind TSK)
Specify that this record is an instantiation of the member class RD.
void setSetterName(Selector Sel, SourceLocation Loc=SourceLocation())
bool ImportContainerChecked(const InContainerTy &InContainer, OutContainerTy &OutContainer)
The template argument is actually a parameter pack.
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '...
Represents a base class of a C++ class.
Decl * VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D)
QualType VisitUnaryTransformType(const UnaryTransformType *T)
bool hasTypename() const
Return true if the using declaration has 'typename'.
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
unsigned getNumClobbers() const
Decl * VisitObjCTypeParamDecl(ObjCTypeParamDecl *D)
SourceLocation getRParenLoc() const
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
SourceManager & getSourceManager()
void setObjCMethodScopeInfo(unsigned parameterIndex)
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof...
Expr * VisitCXXNewExpr(CXXNewExpr *CE)
DeclStmt * getRangeStmt()
Stmt * VisitObjCAtThrowStmt(ObjCAtThrowStmt *S)
unsigned arg_size() const
Retrieve the number of arguments.
ImplementationControl getImplementationControl() const
SourceLocation getLocEnd() const LLVM_READONLY
llvm::iterator_range< decls_iterator > decls() const
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
CanQualType getCanonicalType(QualType T) const
Return the canonical (structural) type corresponding to the specified potentially non-canonical type ...
SourceLocation getAsmLoc() const
GotoStmt - This represents a direct goto.
void ImportDefinition(Decl *From)
Import the definition of the given declaration, including all of the declarations it contains...
A use of a default initializer in a constructor or in aggregate initialization.
void setHadMultipleCandidates(bool V=true)
Sets the flag telling whether this expression refers to a function that was resolved from an overload...
A template argument list.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
SourceLocation getCXXLiteralOperatorNameLoc() const
getCXXLiteralOperatorNameLoc - Returns the location of the literal operator name (not the operator ke...
ClassTemplateDecl * getDescribedClassTemplate() const
Retrieves the class template that is described by this class declaration.
TypedefNameDecl * getDecl() const
const SwitchCase * getNextSwitchCase() const
Decl * VisitTypeAliasDecl(TypeAliasDecl *D)
static UnresolvedMemberExpr * Create(const ASTContext &C, bool HasUnresolvedUsing, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
ArrayRef< TemplateArgumentLoc > template_arguments() const
Expr * VisitInitListExpr(InitListExpr *E)
ArgKind getKind() const
Return the kind of stored template argument.
shadow_range shadows() const
unsigned getDepth() const
An attributed type is a type to which a type attribute has been applied.
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
TranslationUnitDecl * getTranslationUnitDecl() const
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Decl * VisitUsingDirectiveDecl(UsingDirectiveDecl *D)
SourceLocation getWhileLoc() const
Defines the clang::SourceLocation class and associated facilities.
SourceLocation getCategoryNameLoc() const
NestedNameSpecifierLoc getWithLocInContext(ASTContext &Context) const
Retrieve a nested-name-specifier with location information, copied into the given AST context...
TypedefNameDecl * getTypedefNameForAnonDecl() const
void setDefaultArg(Expr *defarg)
bool isMutable() const
Determines whether this field is mutable (C++ only).
Represents a C++ struct/union/class.
Represents a template specialization type whose template cannot be resolved, e.g. ...
ContinueStmt - This represents a continue.
Expr * VisitDesignatedInitExpr(DesignatedInitExpr *E)
Represents a loop initializing the elements of an array.
Expr * VisitUnresolvedMemberExpr(UnresolvedMemberExpr *E)
The template argument is a template name that was provided for a template template parameter...
static CXXTryStmt * Create(const ASTContext &C, SourceLocation tryLoc, Stmt *tryBlock, ArrayRef< Stmt *> handlers)
SourceLocation getColonLoc() const
Represents a C array with an unspecified size.
TemplateArgumentLocInfo getLocInfo() const
SourceLocation getEllipsisLoc() const
For a pack expansion, determine the location of the ellipsis.
SourceLocation getAttrLoc() const
static CXXTemporary * Create(const ASTContext &C, const CXXDestructorDecl *Destructor)
BinaryConditionalOperator - The GNU extension to the conditional operator which allows the middle ope...
CXXCatchStmt - This represents a C++ catch block.
unsigned getNumNegativeBits() const
Returns the width in bits required to store all the negative enumerators of this enum.
ObjCIvarDecl - Represents an ObjC instance variable.
ObjCIvarDecl * getPropertyIvarDecl() const
Provides information a specialization of a member of a class template, which may be a member function...
QualType getNamedType() const
Retrieve the type named by the qualified-id.
WhileStmt - This represents a 'while' stmt.
A structure for storing the information associated with an overloaded template name.
static StructuralEquivalenceKind getStructuralEquivalenceKind(const ASTImporter &Importer)
SourceRange getParenOrBraceRange() const
CleanupObject getObject(unsigned i) const
unsigned getNumConcatenated() const
getNumConcatenated - Get the number of string literal tokens that were concatenated in translation ph...
Expr * VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E)
bool isNull() const
Determine whether this is the empty selector.
QualType getReplacementType() const
Gets the type that was substituted for the template parameter.
Location information for a TemplateArgument.
bool containsUnexpandedParameterPack() const
Whether this expression contains an unexpanded parameter pack (for C++11 variadic templates)...
Declaration of a class template.
SourceLocation getAtSynchronizedLoc() const
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Stmt * VisitSwitchStmt(SwitchStmt *S)
This class is used for builtin types like 'int'.
Optional< unsigned > getNumExpansions() const
Determine the number of expansions that will be produced when this pack expansion is instantiated...
CompoundStmt * getTryBlock()
bool ImportCastPath(CastExpr *E, CXXCastPath &Path)
SourceLocation getBreakLoc() const
SourceLocation getCaseLoc() const
capture_range captures() const
Retrieve this lambda's captures.
void setPropertyAttributes(PropertyAttributeKind PRVal)
Expr * VisitArraySubscriptExpr(ArraySubscriptExpr *E)
Represents Objective-C's @try ... @catch ... @finally statement.
protocol_iterator protocol_end() const
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
bool isGlobalDelete() const
Expr * VisitVAArgExpr(VAArgExpr *E)
SourceLocation getLocation() const
Retrieve the source location of the capture.
unsigned getNumCatchStmts() const
Retrieve the number of @catch statements in this try-catch-finally block.
Expr * getBase() const
Retrieve the base object of this member expressions, e.g., the x in x.m.
StringLiteral - This represents a string literal expression, e.g.
bool hasExplicitParameters() const
Determine whether this lambda has an explicit parameter list vs.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Expr * VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E)
Expr * VisitArrayInitIndexExpr(ArrayInitIndexExpr *E)
SourceRange getTypeIdParens() const
QualType getIntegerType() const
Return the integer type this enum decl corresponds to.
Expr * getPattern()
Retrieve the pattern of the pack expansion.
bool doesThisDeclarationHaveABody() const
Returns whether this specific declaration of the function has a body.
Expr * VisitOpaqueValueExpr(OpaqueValueExpr *E)
Stmt * VisitDefaultStmt(DefaultStmt *S)
Import only the bare bones needed to establish a valid DeclContext.
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
Abstract class common to all of the C++ "named"/"keyword" casts.
unsigned getNumElements() const
QualType VisitExtVectorType(const ExtVectorType *T)
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
void setNextSwitchCase(SwitchCase *SC)
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
The top declaration context.
void ImportDefinitionIfNeeded(Decl *FromD, Decl *ToD=nullptr)
unsigned getNumComponents() const
const ParmVarDecl * getParam() const
QualType getAsType() const
Retrieve the type for a type template argument.
QualType VisitTypeOfExprType(const TypeOfExprType *T)
A reference to a declared variable, function, enum, etc.
Expr * VisitBinaryConditionalOperator(BinaryConditionalOperator *E)
Represents a type template specialization; the template must be a class template, a type alias templa...
ObjCPropertyDecl * getPropertyDecl() const
ObjCTypeParamVariance getVariance() const
Determine the variance of this type parameter.
SourceLocation getColonLoc() const
NestedNameSpecifierLoc getQualifierLoc() const
Fetches the nested-name qualifier with source-location information, if one was given.
BreakStmt - This represents a break.
TemplatedKind getTemplatedKind() const
What kind of templated function this is.
void Extend(ASTContext &Context, SourceLocation TemplateKWLoc, TypeLoc TL, SourceLocation ColonColonLoc)
Extend the current nested-name-specifier by another nested-name-specifier component of the form 'type...
SourceLocation getUsingLoc() const
Returns the source location of the 'using' keyword.
const VarDecl * getCatchParamDecl() const
SourceLocation getLocation() const
void setObjCDeclQualifier(ObjCDeclQualifier QTVal)
Expr * VisitExprWithCleanups(ExprWithCleanups *EWC)
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding the member name, if any.
Expr * VisitCompoundLiteralExpr(CompoundLiteralExpr *E)
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition.
bool hadMultipleCandidates() const
Whether the referred constructor was resolved from an overloaded set having size greater than 1...
NamespaceDecl * getAnonymousNamespace() const
Retrieve the anonymous namespace nested inside this namespace, if any.
SourceLocation getNamespaceLoc() const
Returns the location of the namespace keyword.
Expr * VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E)
DeclStmt * getLoopVarStmt()
AccessSpecifier getAccessSpecifierAsWritten() const
Retrieves the access specifier as written in the source code (which may mean that no access specifier...
TemplateArgument getArgumentPack() const
Retrieve the template template argument pack with which this parameter was substituted.
unsigned getNumArgs() const
protocol_loc_iterator protocol_loc_begin() const
A set of overloaded template declarations.
const Expr * getCond() const
A trivial tuple used to represent a source range.
void setLexicalDeclContext(DeclContext *DC)
ObjCMethodDecl * getGetterMethodDecl() const
This represents a decl that may have a name.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding the member name, if any.
A boolean literal, per ([C++ lex.bool] Boolean literals).
Expr * VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E)
static DeclarationName getUsingDirectiveName()
getUsingDirectiveName - Return name for all using-directives.
OffsetOfExpr - [C99 7.17] - This represents an expression of the form offsetof(record-type, member-designator).
protocol_loc_iterator protocol_loc_begin() const
void setAccess(AccessSpecifier AS)
SourceLocation getLocEnd() const LLVM_READONLY
Represents a C array with a specified size that is not an integer-constant-expression.
Expr * VisitSizeOfPackExpr(SizeOfPackExpr *E)
Expr * getQueriedExpression() const
Decl * VisitNamespaceDecl(NamespaceDecl *D)
Represents a C++ namespace alias.
Decl * VisitObjCInterfaceDecl(ObjCInterfaceDecl *D)
SourceLocation getBuiltinLoc() const
Stmt * VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S)
TemplateDecl * getDescribedTemplate() const
If this is a declaration that describes some template, this method returns that template declaration...
QualType VisitAtomicType(const AtomicType *T)
SourceRange getSourceRange() const LLVM_READONLY
Retrieves the source range that contains the entire base specifier.
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
AccessControl getAccessControl() const
SourceLocation getIvarRBraceLoc() const
Expr * getCommon() const
getCommon - Return the common expression, written to the left of the condition.
bool isPropertyAccessor() const
TypeSourceInfo * getWrittenTypeInfo() const
Selector getGetterName() const
ImplicitParamKind getParameterKind() const
Returns the implicit parameter kind.
Represents C++ using-directive.
DeclStmt * getBeginStmt()
SourceLocation getLParenLoc() const
SourceLocation getPointOfInstantiation() const
Retrieve the first point of instantiation of this member.
const Expr * getCond() const
void setTypeAsWritten(TypeSourceInfo *T)
Sets the type of this specialization as it was written by the user.
SourceLocation getPointOfInstantiation() const
Get the point of instantiation (if any), or null if none.
void setPointOfInstantiation(SourceLocation POI)
Set the first point of instantiation.
The global specifier '::'. There is no stored value.
ObjCProtocolList::iterator protocol_iterator
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
void setType(QualType newType)
SourceLocation getBegin() const
TranslationUnitDecl * getTranslationUnitDecl()
SourceLocation ColonLoc
Location of ':'.
SourceLocation getRParenLoc() const
Return the location of the right parentheses.
Decl * VisitParmVarDecl(ParmVarDecl *D)
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
NamedDecl * getPack() const
Retrieve the parameter pack.
QualType VisitRValueReferenceType(const RValueReferenceType *T)
Represents Objective-C's @autoreleasepool Statement.
Stmt * VisitGCCAsmStmt(GCCAsmStmt *S)
QualType VisitAutoType(const AutoType *T)
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
IdentifierInfo * getFieldName() const
This class handles loading and caching of source files into memory.
Represents the canonical version of C arrays with a specified constant size.
ExceptionSpecInfo ExceptionSpec
QualType VisitType(const Type *T)
DeclContext * ImportContext(DeclContext *FromDC)
Import the given declaration context from the "from" AST context into the "to" AST context...
InitListExpr * getSyntacticForm() const
Declaration of a template function.
void setPropertyIvarDecl(ObjCIvarDecl *Ivar)
Represents an implicitly-generated value initialization of an object of a given type.
static ObjCAtTryStmt * Create(const ASTContext &Context, SourceLocation atTryLoc, Stmt *atTryStmt, Stmt **CatchStmts, unsigned NumCatchStmts, Stmt *atFinallyStmt)
SourceLocation getReturnLoc() const
TemplateName getQualifiedTemplateName(NestedNameSpecifier *NNS, bool TemplateKeyword, TemplateDecl *Template) const
Retrieve the template name that represents a qualified template name such as std::vector.
Expr * VisitCXXThrowExpr(CXXThrowExpr *E)
Stmt * VisitStmt(Stmt *S)
Attr - This represents one attribute.
SourceLocation getLocation() const
QualType VisitTypeOfType(const TypeOfType *T)
QualType getPointeeType() const
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
QualType getType() const
Return the type wrapped by this type source info.
TypeTrait getTrait() const
Determine which type trait this expression uses.
A single template declaration.
bool isBeingDefined() const
Return true if this decl is currently being defined.
std::pair< FileID, unsigned > getDecomposedLoc(SourceLocation Loc) const
Decompose the specified location into a raw FileID + Offset pair.
Defines the LambdaCapture class.
const DeclarationNameInfo & getMemberNameInfo() const
Retrieve the name of the member that this expression refers to.
ArrayRef< ParmVarDecl * > parameters() const
Expr * VisitStmtExpr(StmtExpr *E)
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.
const IdentifierInfo * getIdentifier() const
static OMPLinearClause * Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation LParenLoc, OpenMPLinearClauseKind Modifier, SourceLocation ModifierLoc, SourceLocation ColonLoc, SourceLocation EndLoc, ArrayRef< Expr *> VL, ArrayRef< Expr *> PL, ArrayRef< Expr *> IL, Expr *Step, Expr *CalcStep, Stmt *PreInit, Expr *PostUpdate)
Creates clause with a list of variables VL and a linear step Step.
bool hasExternalFormalLinkage() const
True if this decl has external linkage.
ConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
Structure used to store a statement, the constant value to which it was evaluated (if any)...
QualType VisitPackExpansionType(const PackExpansionType *T)
QualType getPointeeType() const
Gets the type pointed to by this ObjC pointer.
method_range methods() const
static NestedNameSpecifier * GlobalSpecifier(const ASTContext &Context)
Returns the nested name specifier representing the global scope.
bool isOverloaded() const
True if this lookup is overloaded.
void notePriorDiagnosticFrom(const DiagnosticsEngine &Other)
Note that the prior diagnostic was emitted by some other DiagnosticsEngine, and we may be attaching a...