56 #include "llvm/ADT/APSInt.h" 57 #include "llvm/ADT/ArrayRef.h" 58 #include "llvm/ADT/DenseMap.h" 59 #include "llvm/ADT/None.h" 60 #include "llvm/ADT/Optional.h" 61 #include "llvm/ADT/ScopeExit.h" 62 #include "llvm/ADT/STLExtras.h" 63 #include "llvm/ADT/SmallVector.h" 64 #include "llvm/Support/Casting.h" 65 #include "llvm/Support/ErrorHandling.h" 66 #include "llvm/Support/MemoryBuffer.h" 71 #include <type_traits> 76 using llvm::make_error;
90 return "NameConflict";
92 return "UnsupportedConstruct";
94 return "Unknown error";
96 llvm_unreachable(
"Invalid error code.");
97 return "Invalid error code.";
105 llvm_unreachable(
"Function not implemented.");
116 Redecls.push_back(R);
119 std::reverse(Redecls.begin(), Redecls.end());
124 if (
auto *FD = dyn_cast<FunctionDecl>(D))
125 return getCanonicalForwardRedeclChain<FunctionDecl>(FD);
126 if (
auto *VD = dyn_cast<VarDecl>(D))
127 return getCanonicalForwardRedeclChain<VarDecl>(VD);
128 if (
auto *TD = dyn_cast<TagDecl>(D))
129 return getCanonicalForwardRedeclChain<TagDecl>(TD);
130 llvm_unreachable(
"Bad declaration kind");
142 public StmtVisitor<ASTNodeImporter, ExpectedStmt> {
146 template <
typename ImportT>
147 LLVM_NODISCARD
Error importInto(ImportT &To,
const ImportT &From) {
152 template <
typename ImportT>
153 LLVM_NODISCARD
Error importInto(ImportT *&To, ImportT *From) {
154 auto ToOrErr = Importer.
Import(From);
156 To = cast_or_null<ImportT>(*ToOrErr);
157 return ToOrErr.takeError();
162 template <
typename T>
164 auto ToOrErr = Importer.
Import(From);
166 return ToOrErr.takeError();
167 return cast_or_null<T>(*ToOrErr);
170 template <
typename T>
172 return import(
const_cast<T *
>(From));
176 template <
typename T>
178 return Importer.
Import(From);
186 return import(*From);
191 importSeq(
const T &From) {
194 return ToOrErr.takeError();
195 return std::make_tuple<T>(std::move(*ToOrErr));
202 template <
class THead,
class... TTail>
203 Expected<std::tuple<THead, TTail...>>
204 importSeq(
const THead &FromHead,
const TTail &...FromTail) {
207 return ToHeadOrErr.takeError();
208 Expected<std::tuple<TTail...>> ToTailOrErr = importSeq(FromTail...);
210 return ToTailOrErr.takeError();
211 return std::tuple_cat(*ToHeadOrErr, *ToTailOrErr);
215 template <
typename ToDeclT>
struct CallOverloadedCreateFun {
216 template <
typename... Args>
217 auto operator()(Args &&... args)
229 template <
typename ToDeclT,
typename FromDeclT,
typename... Args>
230 LLVM_NODISCARD
bool GetImportedOrCreateDecl(ToDeclT *&ToD, FromDeclT *FromD,
235 CallOverloadedCreateFun<ToDeclT> OC;
236 return GetImportedOrCreateSpecialDecl(ToD, OC, FromD,
237 std::forward<Args>(args)...);
244 template <
typename NewDeclT,
typename ToDeclT,
typename FromDeclT,
246 LLVM_NODISCARD
bool GetImportedOrCreateDecl(ToDeclT *&ToD, FromDeclT *FromD,
248 CallOverloadedCreateFun<NewDeclT> OC;
249 return GetImportedOrCreateSpecialDecl(ToD, OC, FromD,
250 std::forward<Args>(args)...);
254 template <
typename ToDeclT,
typename CreateFunT,
typename FromDeclT,
257 GetImportedOrCreateSpecialDecl(ToDeclT *&ToD, CreateFunT CreateFun,
258 FromDeclT *FromD, Args &&... args) {
266 ToD = CreateFun(std::forward<Args>(args)...);
269 InitializeImportedDecl(FromD, ToD);
273 void InitializeImportedDecl(
Decl *FromD,
Decl *ToD) {
279 auto ToAttrOrErr =
import(FromAttr);
283 llvm::consumeError(ToAttrOrErr.takeError());
296 FoundFunction->
hasBody(Definition))
297 return Importer.
MapImported(D, const_cast<FunctionDecl *>(Definition));
301 void addDeclToContexts(
Decl *FromD,
Decl *ToD) {
317 bool Visible =
false;
330 if (
auto *FromNamed = dyn_cast<NamedDecl>(FromD)) {
331 auto *ToNamed = cast<NamedDecl>(ToD);
333 FromDC->
lookup(FromNamed->getDeclName());
335 if (ND == FromNamed) {
399 Error ImportDeclParts(
402 Error ImportDefinitionIfNeeded(
Decl *FromD,
Decl *ToD =
nullptr);
403 Error ImportDeclarationNameLoc(
406 Error ImportDeclContext(
428 return IDK == IDK_Everything ||
433 Error ImportDefinition(
436 Error ImportDefinition(
439 Error ImportDefinition(
442 Error ImportDefinition(
445 Error ImportTemplateArguments(
451 template <
typename InContainerTy>
452 Error ImportTemplateArgumentListInfo(
455 template<
typename InContainerTy>
456 Error ImportTemplateArgumentListInfo(
462 std::tuple<FunctionTemplateDecl *, TemplateArgsTy>;
464 ImportFunctionTemplateWithTemplateArgsFromSpecialization(
476 template <
typename T>
477 bool hasSameVisibilityContext(T *Found, T *From);
479 bool IsStructuralMatch(
Decl *From,
Decl *To,
bool Complain);
481 bool Complain =
true);
483 bool Complain =
true);
660 template<
typename IIter,
typename OIter>
663 for (; Ibegin != Iend; ++Ibegin, ++Obegin) {
666 return ToOrErr.takeError();
669 return Error::success();
676 template<
typename InContainerTy,
typename OutContainerTy>
678 const InContainerTy &InContainer, OutContainerTy &OutContainer) {
679 return ImportArrayChecked(
680 InContainer.begin(), InContainer.end(), OutContainer.begin());
683 template<
typename InContainerTy,
typename OIter>
685 return ImportArrayChecked(InContainer.begin(), InContainer.end(), Obegin);
700 template <
typename InContainerTy>
704 auto ToLAngleLocOrErr =
import(FromLAngleLoc);
705 if (!ToLAngleLocOrErr)
706 return ToLAngleLocOrErr.takeError();
707 auto ToRAngleLocOrErr =
import(FromRAngleLoc);
708 if (!ToRAngleLocOrErr)
709 return ToRAngleLocOrErr.takeError();
712 if (
auto Err = ImportTemplateArgumentListInfo(Container, ToTAInfo))
715 return Error::success();
719 Error ASTNodeImporter::ImportTemplateArgumentListInfo<TemplateArgumentListInfo>(
721 return ImportTemplateArgumentListInfo(
722 From.getLAngleLoc(), From.getRAngleLoc(), From.arguments(),
Result);
730 return ImportTemplateArgumentListInfo(
731 From.LAngleLoc, From.RAngleLoc, From.arguments(),
Result);
743 if (
Error Err = importInto(std::get<0>(Result), FTSInfo->getTemplate()))
744 return std::move(Err);
747 auto TemplArgs = FTSInfo->TemplateArguments->asArray();
748 if (
Error Err = ImportTemplateArguments(TemplArgs.data(), TemplArgs.size(),
750 return std::move(Err);
759 if (
Error Err = ImportContainerChecked(*From, To))
760 return std::move(Err);
763 if (!ToRequiresClause)
764 return ToRequiresClause.takeError();
767 if (!ToTemplateLocOrErr)
768 return ToTemplateLocOrErr.takeError();
770 if (!ToLAngleLocOrErr)
771 return ToLAngleLocOrErr.takeError();
773 if (!ToRAngleLocOrErr)
774 return ToRAngleLocOrErr.takeError();
777 Importer.getToContext(),
795 return ToTypeOrErr.takeError();
802 return ToTypeOrErr.takeError();
809 return ToOrErr.takeError();
812 return ToTypeOrErr.takeError();
819 return ToTypeOrErr.takeError();
825 if (!ToTemplateOrErr)
826 return ToTemplateOrErr.takeError();
834 if (!ToTemplateOrErr)
835 return ToTemplateOrErr.takeError();
845 return ToExpr.takeError();
850 if (
Error Err = ImportTemplateArguments(
852 return std::move(Err);
855 llvm::makeArrayRef(ToPack).copy(Importer.getToContext()));
859 llvm_unreachable(
"Invalid template argument kind");
867 return ArgOrErr.takeError();
876 return E.takeError();
882 return TSIOrErr.takeError();
884 auto ToTemplateQualifierLocOrErr =
886 if (!ToTemplateQualifierLocOrErr)
887 return ToTemplateQualifierLocOrErr.takeError();
889 if (!ToTemplateNameLocOrErr)
890 return ToTemplateNameLocOrErr.takeError();
891 auto ToTemplateEllipsisLocOrErr =
893 if (!ToTemplateEllipsisLocOrErr)
894 return ToTemplateEllipsisLocOrErr.takeError();
897 *ToTemplateQualifierLocOrErr,
898 *ToTemplateNameLocOrErr,
899 *ToTemplateEllipsisLocOrErr);
909 size_t NumDecls = DG.
end() - DG.
begin();
911 ToDecls.reserve(NumDecls);
912 for (
Decl *FromD : DG) {
913 if (
auto ToDOrErr =
import(FromD))
914 ToDecls.push_back(*ToDOrErr);
916 return ToDOrErr.takeError();
931 return ToDotLocOrErr.takeError();
934 if (!ToFieldLocOrErr)
935 return ToFieldLocOrErr.takeError();
937 return Designator(ToFieldName, *ToDotLocOrErr, *ToFieldLocOrErr);
941 if (!ToLBracketLocOrErr)
942 return ToLBracketLocOrErr.takeError();
945 if (!ToRBracketLocOrErr)
946 return ToRBracketLocOrErr.takeError();
950 *ToLBracketLocOrErr, *ToRBracketLocOrErr);
953 if (!ToEllipsisLocOrErr)
954 return ToEllipsisLocOrErr.takeError();
959 *ToRBracketLocOrErr);
969 return VarOrErr.takeError();
974 return LocationOrErr.takeError();
979 return std::move(Err);
986 template <
typename T>
988 if (From->hasExternalFormalLinkage())
989 return Found->hasExternalFormalLinkage();
990 if (Importer.GetFromTU(Found) != From->getTranslationUnitDecl())
992 if (From->isInAnonymousNamespace())
993 return Found->isInAnonymousNamespace();
995 return !Found->isInAnonymousNamespace() &&
996 !Found->hasExternalFormalLinkage();
1013 using namespace clang;
1016 Importer.FromDiag(
SourceLocation(), diag::err_unsupported_ast_node)
1023 if (!UnderlyingTypeOrErr)
1024 return UnderlyingTypeOrErr.takeError();
1026 return Importer.getToContext().getAtomicType(*UnderlyingTypeOrErr);
1031 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ 1032 case BuiltinType::Id: \ 1033 return Importer.getToContext().SingletonId; 1034 #include "clang/Basic/OpenCLImageTypes.def" 1035 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ 1036 case BuiltinType::Id: \ 1037 return Importer.getToContext().Id##Ty; 1038 #include "clang/Basic/OpenCLExtensionTypes.def" 1039 #define SVE_TYPE(Name, Id, SingletonId) \ 1040 case BuiltinType::Id: \ 1041 return Importer.getToContext().SingletonId; 1042 #include "clang/Basic/AArch64SVEACLETypes.def" 1043 #define SHARED_SINGLETON_TYPE(Expansion) 1044 #define BUILTIN_TYPE(Id, SingletonId) \ 1045 case BuiltinType::Id: return Importer.getToContext().SingletonId; 1046 #include "clang/AST/BuiltinTypes.def" 1054 case BuiltinType::Char_U:
1058 if (Importer.getToContext().getLangOpts().CharIsSigned)
1059 return Importer.getToContext().UnsignedCharTy;
1061 return Importer.getToContext().CharTy;
1063 case BuiltinType::Char_S:
1067 if (!Importer.getToContext().getLangOpts().CharIsSigned)
1068 return Importer.getToContext().SignedCharTy;
1070 return Importer.getToContext().CharTy;
1072 case BuiltinType::WChar_S:
1073 case BuiltinType::WChar_U:
1076 return Importer.getToContext().WCharTy;
1079 llvm_unreachable(
"Invalid BuiltinType Kind!");
1084 if (!ToOriginalTypeOrErr)
1085 return ToOriginalTypeOrErr.takeError();
1087 return Importer.getToContext().getDecayedType(*ToOriginalTypeOrErr);
1092 if (!ToElementTypeOrErr)
1093 return ToElementTypeOrErr.takeError();
1095 return Importer.getToContext().getComplexType(*ToElementTypeOrErr);
1100 if (!ToPointeeTypeOrErr)
1101 return ToPointeeTypeOrErr.takeError();
1103 return Importer.getToContext().getPointerType(*ToPointeeTypeOrErr);
1109 if (!ToPointeeTypeOrErr)
1110 return ToPointeeTypeOrErr.takeError();
1112 return Importer.getToContext().getBlockPointerType(*ToPointeeTypeOrErr);
1119 if (!ToPointeeTypeOrErr)
1120 return ToPointeeTypeOrErr.takeError();
1122 return Importer.getToContext().getLValueReferenceType(*ToPointeeTypeOrErr);
1129 if (!ToPointeeTypeOrErr)
1130 return ToPointeeTypeOrErr.takeError();
1132 return Importer.getToContext().getRValueReferenceType(*ToPointeeTypeOrErr);
1139 if (!ToPointeeTypeOrErr)
1140 return ToPointeeTypeOrErr.takeError();
1143 if (!ClassTypeOrErr)
1144 return ClassTypeOrErr.takeError();
1146 return Importer.getToContext().getMemberPointerType(
1147 *ToPointeeTypeOrErr, (*ClassTypeOrErr).getTypePtr());
1153 const Expr *ToSizeExpr;
1155 std::tie(ToElementType, ToSizeExpr) = *Imp;
1157 return Imp.takeError();
1159 return Importer.getToContext().getConstantArrayType(
1167 if (!ToElementTypeOrErr)
1168 return ToElementTypeOrErr.takeError();
1170 return Importer.getToContext().getIncompleteArrayType(*ToElementTypeOrErr,
1180 if (
auto Imp = importSeq(
1182 std::tie(ToElementType, ToSizeExpr, ToBracketsRange) = *Imp;
1184 return Imp.takeError();
1186 return Importer.getToContext().getVariableArrayType(
1196 if (
auto Imp = importSeq(
1198 std::tie(ToElementType, ToSizeExpr, ToBracketsRange) = *Imp;
1200 return Imp.takeError();
1204 return Importer.getToContext().getDependentSizedArrayType(
1211 if (!ToElementTypeOrErr)
1212 return ToElementTypeOrErr.takeError();
1214 return Importer.getToContext().getVectorType(*ToElementTypeOrErr,
1221 if (!ToElementTypeOrErr)
1222 return ToElementTypeOrErr.takeError();
1224 return Importer.getToContext().getExtVectorType(*ToElementTypeOrErr,
1233 if (!ToReturnTypeOrErr)
1234 return ToReturnTypeOrErr.takeError();
1236 return Importer.getToContext().getFunctionNoProtoType(*ToReturnTypeOrErr,
1243 if (!ToReturnTypeOrErr)
1244 return ToReturnTypeOrErr.takeError();
1251 return TyOrErr.takeError();
1252 ArgTypes.push_back(*TyOrErr);
1260 return TyOrErr.takeError();
1261 ExceptionTypes.push_back(*TyOrErr);
1267 auto Imp = importSeq(
1272 return Imp.takeError();
1286 return Importer.getToContext().getFunctionType(
1287 *ToReturnTypeOrErr, ArgTypes, ToEPI);
1295 std::tie(ToD, ToPrevD) = *Imp;
1297 return Imp.takeError();
1299 return Importer.getToContext().getTypeDeclType(
1300 ToD, cast_or_null<TypeDecl>(ToPrevD));
1305 if (!ToInnerTypeOrErr)
1306 return ToInnerTypeOrErr.takeError();
1308 return Importer.getToContext().getParenType(*ToInnerTypeOrErr);
1314 return ToDeclOrErr.takeError();
1316 return Importer.getToContext().getTypeDeclType(*ToDeclOrErr);
1322 return ToExprOrErr.takeError();
1324 return Importer.getToContext().getTypeOfExprType(*ToExprOrErr);
1329 if (!ToUnderlyingTypeOrErr)
1330 return ToUnderlyingTypeOrErr.takeError();
1332 return Importer.getToContext().getTypeOfType(*ToUnderlyingTypeOrErr);
1339 return ToExprOrErr.takeError();
1342 if (!ToUnderlyingTypeOrErr)
1343 return ToUnderlyingTypeOrErr.takeError();
1345 return Importer.getToContext().getDecltypeType(
1346 *ToExprOrErr, *ToUnderlyingTypeOrErr);
1352 if (!ToBaseTypeOrErr)
1353 return ToBaseTypeOrErr.takeError();
1356 if (!ToUnderlyingTypeOrErr)
1357 return ToUnderlyingTypeOrErr.takeError();
1359 return Importer.getToContext().getUnaryTransformType(
1360 *ToBaseTypeOrErr, *ToUnderlyingTypeOrErr, T->
getUTTKind());
1366 if (!ToDeducedTypeOrErr)
1367 return ToDeducedTypeOrErr.takeError();
1370 if (!ToTypeConstraintConcept)
1371 return ToTypeConstraintConcept.takeError();
1375 if (
Error Err = ImportTemplateArguments(FromTemplateArgs.data(),
1376 FromTemplateArgs.size(),
1378 return std::move(Err);
1380 return Importer.getToContext().getAutoType(
1382 false, cast_or_null<ConceptDecl>(*ToTypeConstraintConcept),
1390 return ToDeclOrErr.takeError();
1393 if (!ToInjTypeOrErr)
1394 return ToInjTypeOrErr.takeError();
1411 return ToDeclOrErr.takeError();
1413 return Importer.getToContext().getTagDeclType(*ToDeclOrErr);
1419 return ToDeclOrErr.takeError();
1421 return Importer.getToContext().getTagDeclType(*ToDeclOrErr);
1426 if (!ToModifiedTypeOrErr)
1427 return ToModifiedTypeOrErr.takeError();
1429 if (!ToEquivalentTypeOrErr)
1430 return ToEquivalentTypeOrErr.takeError();
1432 return Importer.getToContext().getAttributedType(T->
getAttrKind(),
1433 *ToModifiedTypeOrErr, *ToEquivalentTypeOrErr);
1440 return ToDeclOrErr.takeError();
1442 return Importer.getToContext().getTemplateTypeParmType(
1450 return ReplacedOrErr.takeError();
1452 cast<TemplateTypeParmType>((*ReplacedOrErr).getTypePtr());
1455 if (!ToReplacementTypeOrErr)
1456 return ToReplacementTypeOrErr.takeError();
1458 return Importer.getToContext().getSubstTemplateTypeParmType(
1459 Replaced, (*ToReplacementTypeOrErr).getCanonicalType());
1465 if (!ToTemplateOrErr)
1466 return ToTemplateOrErr.takeError();
1469 if (
Error Err = ImportTemplateArguments(
1471 return std::move(Err);
1474 if (!
QualType(T, 0).isCanonical()) {
1478 ToCanonType = *TyOrErr;
1480 return TyOrErr.takeError();
1482 return Importer.getToContext().getTemplateSpecializationType(*ToTemplateOrErr,
1490 if (!ToQualifierOrErr)
1491 return ToQualifierOrErr.takeError();
1494 if (!ToNamedTypeOrErr)
1495 return ToNamedTypeOrErr.takeError();
1498 if (!ToOwnedTagDeclOrErr)
1499 return ToOwnedTagDeclOrErr.takeError();
1501 return Importer.getToContext().getElaboratedType(T->
getKeyword(),
1504 *ToOwnedTagDeclOrErr);
1510 if (!ToPatternOrErr)
1511 return ToPatternOrErr.takeError();
1513 return Importer.getToContext().getPackExpansionType(*ToPatternOrErr,
1520 if (!ToQualifierOrErr)
1521 return ToQualifierOrErr.takeError();
1527 if (
Error Err = ImportTemplateArguments(
1529 return std::move(Err);
1531 return Importer.getToContext().getDependentTemplateSpecializationType(
1532 T->
getKeyword(), *ToQualifierOrErr, ToName, ToPack);
1538 if (!ToQualifierOrErr)
1539 return ToQualifierOrErr.takeError();
1548 return TyOrErr.takeError();
1551 return Importer.getToContext().getDependentNameType(T->
getKeyword(),
1560 return ToDeclOrErr.takeError();
1562 return Importer.getToContext().getObjCInterfaceType(*ToDeclOrErr);
1567 if (!ToBaseTypeOrErr)
1568 return ToBaseTypeOrErr.takeError();
1573 TypeArgs.push_back(*TyOrErr);
1575 return TyOrErr.takeError();
1579 for (
auto *
P : T->
quals()) {
1581 Protocols.push_back(*ProtocolOrErr);
1583 return ProtocolOrErr.takeError();
1587 return Importer.getToContext().getObjCObjectType(*ToBaseTypeOrErr, TypeArgs,
1595 if (!ToPointeeTypeOrErr)
1596 return ToPointeeTypeOrErr.takeError();
1598 return Importer.getToContext().getObjCObjectPointerType(*ToPointeeTypeOrErr);
1615 if (isa<RecordDecl>(D) && (FunDecl = dyn_cast<FunctionDecl>(OrigDC)) &&
1617 auto getLeafPointeeType = [](
const Type *T) {
1618 while (T->isPointerType() || T->isArrayType()) {
1619 T = T->getPointeeOrArrayElementType();
1625 getLeafPointeeType(
P->getType().getCanonicalType().getTypePtr());
1627 if (RT && RT->getDecl() == D) {
1628 Importer.FromDiag(D->
getLocation(), diag::err_unsupported_ast_node)
1636 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
1647 ToD = cast_or_null<NamedDecl>(Importer.GetAlreadyImportedOrNull(D));
1652 return Error::success();
1657 return Error::success();
1660 if (
Error Err = importInto(ToD, FromD))
1663 if (
RecordDecl *FromRecord = dyn_cast<RecordDecl>(FromD)) {
1664 if (
RecordDecl *ToRecord = cast<RecordDecl>(ToD)) {
1665 if (FromRecord->getDefinition() && FromRecord->isCompleteDefinition() &&
1666 !ToRecord->getDefinition()) {
1667 if (
Error Err = ImportDefinition(FromRecord, ToRecord))
1671 return Error::success();
1674 if (
EnumDecl *FromEnum = dyn_cast<EnumDecl>(FromD)) {
1675 if (
EnumDecl *ToEnum = cast<EnumDecl>(ToD)) {
1676 if (FromEnum->getDefinition() && !ToEnum->getDefinition()) {
1677 if (
Error Err = ImportDefinition(FromEnum, ToEnum))
1681 return Error::success();
1684 return Error::success();
1699 return Error::success();
1705 return ToRangeOrErr.takeError();
1706 return Error::success();
1712 return LocOrErr.takeError();
1713 return Error::success();
1721 return ToTInfoOrErr.takeError();
1722 return Error::success();
1725 llvm_unreachable(
"Unknown name kind.");
1730 if (Importer.isMinimalImport() && !ForceImport) {
1731 auto ToDCOrErr = Importer.ImportContext(FromDC);
1732 return ToDCOrErr.takeError();
1744 bool AccumulateChildErrors = isa<TagDecl>(FromDC);
1746 Error ChildErrors = Error::success();
1747 for (
auto *From : FromDC->
decls()) {
1754 if (ImportedOrErr) {
1755 FieldDecl *FieldFrom = dyn_cast_or_null<FieldDecl>(From);
1756 Decl *ImportedDecl = (
Decl*)*ImportedOrErr;
1757 FieldDecl *FieldTo = dyn_cast_or_null<FieldDecl>(ImportedDecl);
1758 if (FieldFrom && FieldTo) {
1761 if (RecordFrom && RecordTo) {
1763 RecordDecl *ToRecordDecl = RecordTo->getDecl();
1767 Error Err = ImportDefinition(FromRecordDecl, ToRecordDecl);
1769 if (Err && AccumulateChildErrors)
1770 ChildErrors = joinErrors(std::move(ChildErrors), std::move(Err));
1772 consumeError(std::move(Err));
1777 if (AccumulateChildErrors)
1779 joinErrors(std::move(ChildErrors), ImportedOrErr.takeError());
1781 consumeError(ImportedOrErr.takeError());
1808 const auto *FromRD = dyn_cast<
RecordDecl>(FromDC);
1812 auto ToDCOrErr = Importer.ImportContext(FromDC);
1814 consumeError(std::move(ChildErrors));
1815 return ToDCOrErr.takeError();
1821 for (
auto *D : FromRD->decls()) {
1822 if (isa<FieldDecl>(D) || isa<IndirectFieldDecl>(D) || isa<FriendDecl>(D)) {
1823 assert(D &&
"DC contains a null decl");
1824 Decl *ToD = Importer.GetAlreadyImportedOrNull(D);
1843 auto ToDCOrErr = Importer.ImportContext(FromD->
getDeclContext());
1845 return ToDCOrErr.takeError();
1849 auto ToLexicalDCOrErr = Importer.ImportContext(
1851 if (!ToLexicalDCOrErr)
1852 return ToLexicalDCOrErr.takeError();
1853 ToLexicalDC = *ToLexicalDCOrErr;
1857 return Error::success();
1863 "Import implicit methods to or from non-definition");
1866 if (FromM->isImplicit()) {
1869 return ToMOrErr.takeError();
1872 return Error::success();
1881 return ToTypedefOrErr.takeError();
1883 return Error::success();
1888 auto DefinitionCompleter = [To]() {
1900 if (Kind == IDK_Everything ||
1905 (To->
isLambda() && shouldForceImportDeclContext(Kind))) {
1909 DefinitionCompleter();
1913 return Error::success();
1920 auto DefinitionCompleterScopeExit =
1921 llvm::make_scope_exit(DefinitionCompleter);
1929 if (ToCXX && FromCXX && ToCXX->dataPtr() && FromCXX->dataPtr()) {
1931 struct CXXRecordDecl::DefinitionData &ToData = ToCXX->data();
1932 struct CXXRecordDecl::DefinitionData &FromData = FromCXX->data();
1934 #define FIELD(Name, Width, Merge) \ 1935 ToData.Name = FromData.Name; 1936 #include "clang/AST/CXXRecordDeclDefinitionBits.def" 1939 ToCXX->setArgPassingRestrictions(FromCXX->getArgPassingRestrictions());
1942 for (
const auto &Base1 : FromCXX->bases()) {
1945 return TyOrErr.takeError();
1948 if (Base1.isPackExpansion()) {
1949 if (
ExpectedSLoc LocOrErr =
import(Base1.getEllipsisLoc()))
1950 EllipsisLoc = *LocOrErr;
1952 return LocOrErr.takeError();
1957 ImportDefinitionIfNeeded(Base1.getType()->getAsCXXRecordDecl()))
1960 auto RangeOrErr =
import(Base1.getSourceRange());
1962 return RangeOrErr.takeError();
1964 auto TSIOrErr =
import(Base1.getTypeSourceInfo());
1966 return TSIOrErr.takeError();
1972 Base1.isBaseOfClass(),
1973 Base1.getAccessSpecifierAsWritten(),
1978 ToCXX->setBases(Bases.data(), Bases.size());
1981 if (shouldForceImportDeclContext(Kind))
1982 if (
Error Err = ImportDeclContext(From,
true))
1985 return Error::success();
1990 return Error::success();
1994 return Error::success();
1998 return ToInitOrErr.takeError();
2008 return Error::success();
2014 if (Kind == IDK_Everything)
2015 return ImportDeclContext(From,
true);
2016 return Error::success();
2025 import(Importer.getFromContext().getTypeDeclType(From));
2027 return ToTypeOrErr.takeError();
2030 if (!ToPromotionTypeOrErr)
2031 return ToPromotionTypeOrErr.takeError();
2033 if (shouldForceImportDeclContext(Kind))
2034 if (
Error Err = ImportDeclContext(From,
true))
2042 return Error::success();
2048 for (
unsigned I = 0; I != NumFromArgs; ++I) {
2049 if (
auto ToOrErr =
import(FromArgs[I]))
2050 ToArgs.push_back(*ToOrErr);
2052 return ToOrErr.takeError();
2055 return Error::success();
2061 return import(From);
2064 template <
typename InContainerTy>
2067 for (
const auto &FromLoc : Container) {
2068 if (
auto ToLocOrErr =
import(FromLoc))
2071 return ToLocOrErr.takeError();
2073 return Error::success();
2084 Importer.getFromContext(), Importer.getToContext(),
2094 Decl *ToOrigin = Importer.GetOriginalDecl(ToRecord);
2096 auto *ToOriginRecord = dyn_cast<
RecordDecl>(ToOrigin);
2098 ToRecord = ToOriginRecord;
2103 Importer.getNonEquivalentDecls(),
2112 Importer.getFromContext(), Importer.getToContext(),
2121 if (
Decl *ToOrigin = Importer.GetOriginalDecl(ToEnum))
2122 if (
auto *ToOriginEnum = dyn_cast<EnumDecl>(ToOrigin))
2123 ToEnum = ToOriginEnum;
2126 Importer.getFromContext(), Importer.getToContext(),
2134 Importer.getFromContext(), Importer.getToContext(),
2142 Importer.getFromContext(), Importer.getToContext(),
2153 return FromVal.isSigned() == ToVal.isSigned() &&
2154 FromVal.getBitWidth() == ToVal.getBitWidth() &&
2161 Importer.getToContext(),
2162 Importer.getNonEquivalentDecls(),
2170 Importer.getToContext(),
2171 Importer.getNonEquivalentDecls(),
2177 Importer.FromDiag(D->
getLocation(), diag::err_unsupported_ast_node)
2183 Importer.FromDiag(D->
getLocation(), diag::err_unsupported_ast_node)
2191 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
2192 return std::move(Err);
2197 return LocOrErr.takeError();
2200 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(), DC, *LocOrErr))
2212 Importer.MapImported(D, ToD);
2220 return LocOrErr.takeError();
2223 return ColonLocOrErr.takeError();
2228 return DCOrErr.takeError();
2232 if (GetImportedOrCreateDecl(ToD, D, Importer.getToContext(), D->
getAccess(),
2233 DC, *LocOrErr, *ColonLocOrErr))
2247 return DCOrErr.takeError();
2254 if (
auto Imp = importSeq(
2256 std::tie(ToLocation, ToAssertExpr, ToMessage, ToRParenLoc) = *Imp;
2258 return Imp.takeError();
2261 if (GetImportedOrCreateDecl(
2262 ToD, D, Importer.getToContext(), DC, ToLocation, ToAssertExpr, ToMessage,
2277 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2278 return std::move(Err);
2287 if (
auto *TU = dyn_cast<TranslationUnitDecl>(DC))
2290 MergeWithNamespace = cast<NamespaceDecl>(DC)->getAnonymousNamespace();
2293 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
2294 for (
auto *FoundDecl : FoundDecls) {
2298 if (
auto *FoundNS = dyn_cast<NamespaceDecl>(FoundDecl)) {
2299 MergeWithNamespace = FoundNS;
2300 ConflictingDecls.clear();
2304 ConflictingDecls.push_back(FoundDecl);
2307 if (!ConflictingDecls.empty()) {
2310 ConflictingDecls.size());
2312 Name = NameOrErr.get();
2314 return NameOrErr.takeError();
2320 return BeginLocOrErr.takeError();
2322 if (!RBraceLocOrErr)
2323 return RBraceLocOrErr.takeError();
2328 if (GetImportedOrCreateDecl(
2329 ToNamespace, D, Importer.getToContext(), DC, D->
isInline(),
2340 if (
auto *TU = dyn_cast<TranslationUnitDecl>(DC))
2341 TU->setAnonymousNamespace(ToNamespace);
2343 cast<NamespaceDecl>(DC)->setAnonymousNamespace(ToNamespace);
2346 Importer.MapImported(D, ToNamespace);
2348 if (
Error Err = ImportDeclContext(D))
2349 return std::move(Err);
2360 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, LookupD, Loc))
2361 return std::move(Err);
2370 if (
auto Imp = importSeq(
2374 ToNamespaceLoc, ToAliasLoc, ToQualifierLoc, ToTargetNameLoc,
2375 ToNamespace) = *Imp;
2377 return Imp.takeError();
2381 if (GetImportedOrCreateDecl(
2382 ToD, D, Importer.getToContext(), DC, ToNamespaceLoc, ToAliasLoc,
2383 ToIdentifier, ToQualifierLoc, ToTargetNameLoc, ToNamespace))
2399 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2400 return std::move(Err);
2413 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
2414 for (
auto *FoundDecl : FoundDecls) {
2417 if (
auto *FoundTypedef = dyn_cast<TypedefNameDecl>(FoundDecl)) {
2418 if (!hasSameVisibilityContext(FoundTypedef, D))
2422 QualType FoundUT = FoundTypedef->getUnderlyingType();
2423 if (Importer.IsStructurallyEquivalent(FromUT, FoundUT)) {
2427 return Importer.MapImported(D, FoundTypedef);
2431 ConflictingDecls.push_back(FoundDecl);
2436 if (!ConflictingDecls.empty()) {
2438 Name, DC, IDNS, ConflictingDecls.data(), ConflictingDecls.size());
2440 Name = NameOrErr.get();
2442 return NameOrErr.takeError();
2449 if (
auto Imp = importSeq(
2451 std::tie(ToUnderlyingType, ToTypeSourceInfo, ToBeginLoc) = *Imp;
2453 return Imp.takeError();
2459 if (GetImportedOrCreateDecl<TypeAliasDecl>(
2460 ToTypedef, D, Importer.getToContext(), DC, ToBeginLoc, Loc,
2463 }
else if (GetImportedOrCreateDecl<TypedefDecl>(
2464 ToTypedef, D, Importer.getToContext(), DC, ToBeginLoc, Loc,
2472 TypeAliasDecl *FromAlias = IsAlias ? cast<TypeAliasDecl>(D) :
nullptr;
2480 return VisitTypedefNameDecl(D,
false);
2484 return VisitTypedefNameDecl(D,
true);
2494 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, FoundD, Loc))
2495 return std::move(Err);
2505 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
2506 for (
auto *FoundDecl : FoundDecls) {
2509 if (
auto *FoundAlias = dyn_cast<TypeAliasTemplateDecl>(FoundDecl))
2510 return Importer.MapImported(D, FoundAlias);
2511 ConflictingDecls.push_back(FoundDecl);
2514 if (!ConflictingDecls.empty()) {
2516 Name, DC, IDNS, ConflictingDecls.data(), ConflictingDecls.size());
2518 Name = NameOrErr.get();
2520 return NameOrErr.takeError();
2527 std::tie(ToTemplateParameters, ToTemplatedDecl) = *Imp;
2529 return Imp.takeError();
2532 if (GetImportedOrCreateDecl(ToAlias, D, Importer.getToContext(), DC, Loc,
2533 Name, ToTemplateParameters, ToTemplatedDecl))
2550 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2551 return std::move(Err);
2561 return BeginLocOrErr.takeError();
2562 if (GetImportedOrCreateDecl(ToLabel, D, Importer.getToContext(), DC, Loc,
2567 if (GetImportedOrCreateDecl(ToLabel, D, Importer.getToContext(), DC, Loc,
2575 return ToStmtOrErr.takeError();
2577 ToLabel->setStmt(*ToStmtOrErr);
2578 ToLabel->setLexicalDeclContext(LexicalDC);
2589 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2590 return std::move(Err);
2598 if (
Error Err = importInto(
2600 return std::move(Err);
2602 }
else if (Importer.getToContext().getLangOpts().CPlusPlus)
2609 Importer.findDeclsInToCtx(DC, SearchName);
2610 for (
auto *FoundDecl : FoundDecls) {
2614 if (
auto *Typedef = dyn_cast<TypedefNameDecl>(FoundDecl)) {
2615 if (
const auto *Tag = Typedef->getUnderlyingType()->getAs<
TagType>())
2616 FoundDecl = Tag->getDecl();
2619 if (
auto *FoundEnum = dyn_cast<EnumDecl>(FoundDecl)) {
2620 if (!hasSameVisibilityContext(FoundEnum, D))
2622 if (IsStructuralMatch(D, FoundEnum))
2623 return Importer.MapImported(D, FoundEnum);
2624 ConflictingDecls.push_back(FoundDecl);
2628 if (!ConflictingDecls.empty()) {
2630 SearchName, DC, IDNS, ConflictingDecls.data(),
2631 ConflictingDecls.size());
2633 Name = NameOrErr.get();
2635 return NameOrErr.takeError();
2645 std::tie(ToBeginLoc, ToQualifierLoc, ToIntegerType, ToBraceRange) = *Imp;
2647 return Imp.takeError();
2651 if (GetImportedOrCreateDecl(
2652 D2, D, Importer.getToContext(), DC, ToBeginLoc,
2666 if (
Error Err = ImportDefinition(D, D2))
2667 return std::move(Err);
2673 bool IsFriendTemplate =
false;
2674 if (
auto *DCXX = dyn_cast<CXXRecordDecl>(D)) {
2676 DCXX->getDescribedClassTemplate() &&
2677 DCXX->getDescribedClassTemplate()->getFriendObjectKind() !=
2686 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2687 return std::move(Err);
2695 if (
Error Err = importInto(
2697 return std::move(Err);
2699 }
else if (Importer.getToContext().getLangOpts().CPlusPlus)
2707 Importer.findDeclsInToCtx(DC, SearchName);
2708 if (!FoundDecls.empty()) {
2715 for (
auto *FoundDecl : FoundDecls) {
2719 Decl *Found = FoundDecl;
2720 if (
auto *Typedef = dyn_cast<TypedefNameDecl>(Found)) {
2721 if (
const auto *Tag = Typedef->getUnderlyingType()->getAs<
TagType>())
2722 Found = Tag->getDecl();
2725 if (
auto *FoundRecord = dyn_cast<RecordDecl>(Found)) {
2736 if (!IsStructuralMatch(D, FoundRecord,
false))
2739 if (!hasSameVisibilityContext(FoundRecord, D))
2742 if (IsStructuralMatch(D, FoundRecord)) {
2747 Importer.MapImported(D, FoundDef);
2748 if (
const auto *DCXX = dyn_cast<CXXRecordDecl>(D)) {
2750 assert(FoundCXX &&
"Record type mismatch");
2752 if (!Importer.isMinimalImport())
2755 if (
Error Err = ImportImplicitMethods(DCXX, FoundCXX))
2756 return std::move(Err);
2762 ConflictingDecls.push_back(FoundDecl);
2766 if (!ConflictingDecls.empty() && SearchName) {
2768 SearchName, DC, IDNS, ConflictingDecls.data(),
2769 ConflictingDecls.size());
2771 Name = NameOrErr.get();
2773 return NameOrErr.takeError();
2779 return BeginLocOrErr.takeError();
2784 if (
auto *DCXX = dyn_cast<CXXRecordDecl>(D)) {
2785 if (DCXX->isLambda()) {
2786 auto TInfoOrErr =
import(DCXX->getLambdaTypeInfo());
2788 return TInfoOrErr.takeError();
2789 if (GetImportedOrCreateSpecialDecl(
2791 DC, *TInfoOrErr, Loc, DCXX->isDependentLambda(),
2792 DCXX->isGenericLambda(), DCXX->getLambdaCaptureDefault()))
2794 ExpectedDecl CDeclOrErr =
import(DCXX->getLambdaContextDecl());
2796 return CDeclOrErr.takeError();
2798 DCXX->hasKnownLambdaInternalLinkage());
2799 }
else if (DCXX->isInjectedClassName()) {
2802 const bool DelayTypeCreation =
true;
2803 if (GetImportedOrCreateDecl(
2804 D2CXX, D, Importer.getToContext(), D->
getTagKind(), DC,
2806 cast_or_null<CXXRecordDecl>(PrevDecl), DelayTypeCreation))
2808 Importer.getToContext().getTypeDeclType(
2809 D2CXX, dyn_cast<CXXRecordDecl>(DC));
2811 if (GetImportedOrCreateDecl(D2CXX, D, Importer.getToContext(),
2814 cast_or_null<CXXRecordDecl>(PrevDecl)))
2821 addDeclToContexts(D, D2);
2824 DCXX->getDescribedClassTemplate()) {
2826 if (
Error Err = importInto(ToDescribed, FromDescribed))
2827 return std::move(Err);
2829 if (!DCXX->isInjectedClassName() && !IsFriendTemplate) {
2839 if (Record && Record->isInjectedClassName()) {
2847 for (
auto *R : Redecls) {
2848 auto *RI = cast<CXXRecordDecl>(R);
2849 RI->setTypeForDecl(
nullptr);
2853 Importer.getToContext().getInjectedClassNameType(
2859 Importer.getToContext().getTypeDeclType(Injected, D2CXX);
2863 DCXX->getMemberSpecializationInfo()) {
2865 MemberInfo->getTemplateSpecializationKind();
2871 return ToInstOrErr.takeError();
2874 import(MemberInfo->getPointOfInstantiation()))
2878 return POIOrErr.takeError();
2882 if (GetImportedOrCreateDecl(D2, D, Importer.getToContext(),
2887 addDeclToContexts(D, D2);
2893 return BraceRangeOrErr.takeError();
2897 return QualifierLocOrErr.takeError();
2903 if (
Error Err = ImportDefinition(D, D2, IDK_Default))
2904 return std::move(Err);
2915 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
2916 return std::move(Err);
2925 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
2926 for (
auto *FoundDecl : FoundDecls) {
2930 if (
auto *FoundEnumConstant = dyn_cast<EnumConstantDecl>(FoundDecl)) {
2931 if (IsStructuralMatch(D, FoundEnumConstant))
2932 return Importer.MapImported(D, FoundEnumConstant);
2933 ConflictingDecls.push_back(FoundDecl);
2937 if (!ConflictingDecls.empty()) {
2939 Name, DC, IDNS, ConflictingDecls.data(), ConflictingDecls.size());
2941 Name = NameOrErr.get();
2943 return NameOrErr.takeError();
2949 return TypeOrErr.takeError();
2953 return InitOrErr.takeError();
2956 if (GetImportedOrCreateDecl(
2957 ToEnumerator, D, Importer.getToContext(), cast<EnumDecl>(DC), Loc,
2959 return ToEnumerator;
2964 return ToEnumerator;
2971 return Error::success();
2973 for (
unsigned int I = 0; I < Num; ++I)
2976 ToTPLists[I] = *ToTPListOrErr;
2978 return ToTPListOrErr.takeError();
2980 return Error::success();
2988 return Error::success();
2995 ToFD->setInstantiationOfMemberFunction(*InstFDOrErr, TSK);
2997 return InstFDOrErr.takeError();
3003 return POIOrErr.takeError();
3005 return Error::success();
3009 auto FunctionAndArgsOrErr =
3010 ImportFunctionTemplateWithTemplateArgsFromSpecialization(FromFD);
3011 if (!FunctionAndArgsOrErr)
3012 return FunctionAndArgsOrErr.takeError();
3015 Importer.getToContext(), std::get<1>(*FunctionAndArgsOrErr));
3019 const auto *FromTAArgsAsWritten = FTSInfo->TemplateArgumentsAsWritten;
3020 if (FromTAArgsAsWritten)
3021 if (
Error Err = ImportTemplateArgumentListInfo(
3022 *FromTAArgsAsWritten, ToTAInfo))
3025 ExpectedSLoc POIOrErr =
import(FTSInfo->getPointOfInstantiation());
3027 return POIOrErr.takeError();
3029 if (
Error Err = ImportTemplateParameterLists(FromFD, ToFD))
3033 ToFD->setFunctionTemplateSpecialization(
3034 std::get<0>(*FunctionAndArgsOrErr), ToTAList,
nullptr,
3035 TSK, FromTAArgsAsWritten ? &ToTAInfo :
nullptr, *POIOrErr);
3036 return Error::success();
3042 unsigned NumTemplates = FromInfo->getNumTemplates();
3043 for (
unsigned I = 0; I < NumTemplates; I++) {
3045 import(FromInfo->getTemplate(I)))
3046 TemplDecls.
addDecl(*ToFTDOrErr);
3048 return ToFTDOrErr.takeError();
3053 if (
Error Err = ImportTemplateArgumentListInfo(
3054 FromInfo->getLAngleLoc(), FromInfo->getRAngleLoc(),
3056 FromInfo->getTemplateArgs(), FromInfo->getNumTemplateArgs()),
3061 TemplDecls, ToTAInfo);
3062 return Error::success();
3065 llvm_unreachable(
"All cases should be covered!");
3070 auto FunctionAndArgsOrErr =
3071 ImportFunctionTemplateWithTemplateArgsFromSpecialization(FromFD);
3072 if (!FunctionAndArgsOrErr)
3073 return FunctionAndArgsOrErr.takeError();
3077 std::tie(Template, ToTemplArgs) = *FunctionAndArgsOrErr;
3078 void *InsertPos =
nullptr;
3089 return ToBodyOrErr.takeError();
3091 return Error::success();
3109 assert(FromFPT &&
"Must be called on FunctionProtoType");
3111 QualType DeducedT = AutoT->getDeducedType();
3137 auto RedeclIt = Redecls.begin();
3140 for (; RedeclIt != Redecls.end() && *RedeclIt != D; ++RedeclIt) {
3143 return ToRedeclOrErr.takeError();
3145 assert(*RedeclIt == D);
3152 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3153 return std::move(Err);
3167 auto FoundFunctionOrErr = FindFunctionTemplateSpecialization(D);
3168 if (!FoundFunctionOrErr)
3169 return FoundFunctionOrErr.takeError();
3170 if (
FunctionDecl *FoundFunction = *FoundFunctionOrErr) {
3171 if (
Decl *Def = FindAndMapDefinition(D, FoundFunction))
3173 FoundByLookup = FoundFunction;
3181 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
3182 for (
auto *FoundDecl : FoundDecls) {
3186 if (
auto *FoundFunction = dyn_cast<FunctionDecl>(FoundDecl)) {
3187 if (!hasSameVisibilityContext(FoundFunction, D))
3190 if (IsStructuralMatch(D, FoundFunction)) {
3191 if (
Decl *Def = FindAndMapDefinition(D, FoundFunction))
3193 FoundByLookup = FoundFunction;
3200 if (Importer.getToContext().getLangOpts().CPlusPlus)
3204 Importer.ToDiag(Loc, diag::warn_odr_function_type_inconsistent)
3205 << Name << D->
getType() << FoundFunction->getType();
3206 Importer.ToDiag(FoundFunction->getLocation(), diag::note_odr_value_here)
3207 << FoundFunction->getType();
3208 ConflictingDecls.push_back(FoundDecl);
3212 if (!ConflictingDecls.empty()) {
3214 Name, DC, IDNS, ConflictingDecls.data(), ConflictingDecls.size());
3216 Name = NameOrErr.get();
3218 return NameOrErr.takeError();
3228 if (FoundByLookup) {
3229 if (isa<CXXMethodDecl>(FoundByLookup)) {
3238 "Templated function mapped to non-templated?");
3239 Importer.MapImported(DescribedD,
3242 return Importer.MapImported(D, FoundByLookup);
3254 return std::move(Err);
3262 bool UsedDifferentProtoType =
false;
3264 QualType FromReturnTy = FromFPT->getReturnType();
3270 if (hasAutoReturnTypeDeclaredInside(D)) {
3271 FromReturnTy = Importer.getFromContext().VoidTy;
3272 UsedDifferentProtoType =
true;
3283 FromEPI = DefaultEPI;
3284 UsedDifferentProtoType =
true;
3286 FromTy = Importer.getFromContext().getFunctionType(
3287 FromReturnTy, FromFPT->getParamTypes(), FromEPI);
3294 Expr *TrailingRequiresClause;
3295 if (
auto Imp = importSeq(
3298 std::tie(T, TInfo, ToInnerLocStart, ToQualifierLoc, ToEndLoc,
3299 TrailingRequiresClause) = *Imp;
3301 return Imp.takeError();
3307 Parameters.push_back(*ToPOrErr);
3309 return ToPOrErr.takeError();
3314 if (
auto *FromConstructor = dyn_cast<CXXConstructorDecl>(D)) {
3315 Expr *ExplicitExpr =
nullptr;
3316 if (FromConstructor->getExplicitSpecifier().getExpr()) {
3317 auto Imp = importSeq(FromConstructor->getExplicitSpecifier().getExpr());
3319 return Imp.takeError();
3320 std::tie(ExplicitExpr) = *Imp;
3322 if (GetImportedOrCreateDecl<CXXConstructorDecl>(
3323 ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
3324 ToInnerLocStart, NameInfo, T, TInfo,
3327 FromConstructor->getExplicitSpecifier().getKind()),
3331 TrailingRequiresClause))
3336 importSeq(const_cast<FunctionDecl *>(FromDtor->getOperatorDelete()),
3337 FromDtor->getOperatorDeleteThisArg());
3340 return Imp.takeError();
3344 std::tie(ToOperatorDelete, ToThisArg) = *Imp;
3346 if (GetImportedOrCreateDecl<CXXDestructorDecl>(
3347 ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
3356 dyn_cast<CXXConversionDecl>(D)) {
3357 Expr *ExplicitExpr =
nullptr;
3358 if (FromConversion->getExplicitSpecifier().getExpr()) {
3359 auto Imp = importSeq(FromConversion->getExplicitSpecifier().getExpr());
3361 return Imp.takeError();
3362 std::tie(ExplicitExpr) = *Imp;
3364 if (GetImportedOrCreateDecl<CXXConversionDecl>(
3365 ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
3368 FromConversion->getExplicitSpecifier().getKind()),
3371 }
else if (
auto *Method = dyn_cast<CXXMethodDecl>(D)) {
3372 if (GetImportedOrCreateDecl<CXXMethodDecl>(
3373 ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
3374 ToInnerLocStart, NameInfo, T, TInfo, Method->getStorageClass(),
3379 if (GetImportedOrCreateDecl(
3380 ToFunction, D, Importer.getToContext(), DC, ToInnerLocStart,
3383 TrailingRequiresClause))
3388 if (FoundByLookup) {
3411 for (
auto *Param : Parameters) {
3412 Param->setOwningFunction(ToFunction);
3415 ToFunction->setParams(Parameters);
3422 for (
unsigned I = 0, N = Parameters.size(); I != N; ++I)
3423 ProtoLoc.setParam(I, Parameters[I]);
3429 auto ToFTOrErr =
import(FromFT);
3431 return ToFTOrErr.takeError();
3435 if (
auto *FromConstructor = dyn_cast<CXXConstructorDecl>(D)) {
3436 if (
unsigned NumInitializers = FromConstructor->getNumCtorInitializers()) {
3439 if (
Error Err = ImportContainerChecked(
3440 FromConstructor->inits(), CtorInitializers))
3441 return std::move(Err);
3444 std::copy(CtorInitializers.begin(), CtorInitializers.end(), Memory);
3445 auto *ToCtor = cast<CXXConstructorDecl>(ToFunction);
3446 ToCtor->setCtorInitializers(Memory);
3447 ToCtor->setNumCtorInitializers(NumInitializers);
3452 Error Err = ImportFunctionDeclBody(D, ToFunction);
3455 return std::move(Err);
3459 if (UsedDifferentProtoType) {
3461 ToFunction->
setType(*TyOrErr);
3463 return TyOrErr.takeError();
3469 if (
Error Err = ImportTemplateInformation(D, ToFunction))
3470 return std::move(Err);
3472 addDeclToContexts(D, ToFunction);
3474 if (
auto *FromCXXMethod = dyn_cast<CXXMethodDecl>(D))
3475 if (
Error Err = ImportOverriddenMethods(cast<CXXMethodDecl>(ToFunction),
3477 return std::move(Err);
3480 for (++RedeclIt; RedeclIt != Redecls.end(); ++RedeclIt) {
3483 return ToRedeclOrErr.takeError();
3490 return VisitFunctionDecl(D);
3494 return VisitCXXMethodDecl(D);
3498 return VisitCXXMethodDecl(D);
3502 return VisitCXXMethodDecl(D);
3511 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3512 return std::move(Err);
3517 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
3518 for (
auto *FoundDecl : FoundDecls) {
3519 if (
FieldDecl *FoundField = dyn_cast<FieldDecl>(FoundDecl)) {
3526 if (Importer.IsStructurallyEquivalent(D->
getType(),
3527 FoundField->getType())) {
3528 Importer.MapImported(D, FoundField);
3535 if (FoundField->hasInClassInitializer() &&
3536 !FoundField->getInClassInitializer()) {
3537 if (
ExpectedExpr ToInitializerOrErr =
import(FromInitializer))
3538 FoundField->setInClassInitializer(*ToInitializerOrErr);
3543 consumeError(ToInitializerOrErr.takeError());
3552 Importer.ToDiag(Loc, diag::warn_odr_field_type_inconsistent)
3553 << Name << D->
getType() << FoundField->getType();
3554 Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
3555 << FoundField->getType();
3565 Expr *ToInitializer;
3566 if (
auto Imp = importSeq(
3570 ToType, ToTInfo, ToBitWidth, ToInnerLocStart, ToInitializer) = *Imp;
3572 return Imp.takeError();
3575 if (GetImportedOrCreateDecl(ToField, D, Importer.getToContext(), DC,
3577 ToType, ToTInfo, ToBitWidth, D->
isMutable(),
3596 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3597 return std::move(Err);
3602 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
3603 for (
unsigned I = 0, N = FoundDecls.size(); I != N; ++I) {
3604 if (
auto *FoundField = dyn_cast<IndirectFieldDecl>(FoundDecls[I])) {
3611 if (Importer.IsStructurallyEquivalent(D->
getType(),
3612 FoundField->getType(),
3614 Importer.MapImported(D, FoundField);
3619 if (!Name && I < N-1)
3623 Importer.ToDiag(Loc, diag::warn_odr_field_type_inconsistent)
3624 << Name << D->
getType() << FoundField->getType();
3625 Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here)
3626 << FoundField->getType();
3633 auto TypeOrErr =
import(D->
getType());
3635 return TypeOrErr.takeError();
3641 for (
auto *PI : D->
chain())
3643 NamedChain[i++] = *ToD;
3645 return ToD.takeError();
3649 if (GetImportedOrCreateDecl(ToIndirectField, D, Importer.getToContext(), DC,
3652 return ToIndirectField;
3657 return ToIndirectField;
3663 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
3664 return std::move(Err);
3668 auto *RD = cast<CXXRecordDecl>(DC);
3669 FriendDecl *ImportedFriend = RD->getFirstFriend();
3671 while (ImportedFriend) {
3672 if (D->
getFriendDecl() && ImportedFriend->getFriendDecl()) {
3673 if (IsStructuralMatch(D->
getFriendDecl(), ImportedFriend->getFriendDecl(),
3675 return Importer.MapImported(D, ImportedFriend);
3677 }
else if (D->
getFriendType() && ImportedFriend->getFriendType()) {
3678 if (Importer.IsStructurallyEquivalent(
3680 ImportedFriend->getFriendType()->getType(),
true))
3681 return Importer.MapImported(D, ImportedFriend);
3683 ImportedFriend = ImportedFriend->getNextFriend();
3690 if (
Error Err = importInto(ToFriendD, FriendD))
3691 return std::move(Err);
3702 return TSIOrErr.takeError();
3707 for (
unsigned I = 0; I < D->NumTPLists; I++) {
3708 if (
auto ListOrErr =
import(FromTPLists[I]))
3709 ToTPLists[I] = *ListOrErr;
3711 return ListOrErr.takeError();
3716 return LocationOrErr.takeError();
3718 if (!FriendLocOrErr)
3719 return FriendLocOrErr.takeError();
3722 if (GetImportedOrCreateDecl(FrD, D, Importer.getToContext(), DC,
3723 *LocationOrErr, ToFU,
3724 *FriendLocOrErr, ToTPLists))
3739 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3740 return std::move(Err);
3745 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
3746 for (
auto *FoundDecl : FoundDecls) {
3747 if (
ObjCIvarDecl *FoundIvar = dyn_cast<ObjCIvarDecl>(FoundDecl)) {
3748 if (Importer.IsStructurallyEquivalent(D->
getType(),
3749 FoundIvar->getType())) {
3750 Importer.MapImported(D, FoundIvar);
3754 Importer.ToDiag(Loc, diag::warn_odr_ivar_type_inconsistent)
3755 << Name << D->
getType() << FoundIvar->getType();
3756 Importer.ToDiag(FoundIvar->getLocation(), diag::note_odr_value_here)
3757 << FoundIvar->getType();
3767 if (
auto Imp = importSeq(
3769 std::tie(ToType, ToTypeSourceInfo, ToBitWidth, ToInnerLocStart) = *Imp;
3771 return Imp.takeError();
3774 if (GetImportedOrCreateDecl(
3775 ToIvar, D, Importer.getToContext(), cast<ObjCContainerDecl>(DC),
3777 ToType, ToTypeSourceInfo,
3789 auto RedeclIt = Redecls.begin();
3792 for (; RedeclIt != Redecls.end() && *RedeclIt != D; ++RedeclIt) {
3795 return RedeclOrErr.takeError();
3797 assert(*RedeclIt == D);
3804 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
3805 return std::move(Err);
3811 VarDecl *FoundByLookup =
nullptr;
3815 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
3816 for (
auto *FoundDecl : FoundDecls) {
3820 if (
auto *FoundVar = dyn_cast<VarDecl>(FoundDecl)) {
3821 if (!hasSameVisibilityContext(FoundVar, D))
3823 if (Importer.IsStructurallyEquivalent(D->
getType(),
3824 FoundVar->getType())) {
3832 return Importer.MapImported(D, FoundDef);
3836 const VarDecl *FoundDInit =
nullptr;
3837 if (D->
getInit() && FoundVar->getAnyInitializer(FoundDInit))
3839 return Importer.MapImported(D, const_cast<VarDecl*>(FoundDInit));
3841 FoundByLookup = FoundVar;
3846 = Importer.getToContext().getAsArrayType(FoundVar->getType());
3848 = Importer.getToContext().getAsArrayType(D->
getType());
3849 if (FoundArray && TArray) {
3850 if (isa<IncompleteArrayType>(FoundArray) &&
3851 isa<ConstantArrayType>(TArray)) {
3853 if (
auto TyOrErr =
import(D->
getType()))
3854 FoundVar->setType(*TyOrErr);
3856 return TyOrErr.takeError();
3858 FoundByLookup = FoundVar;
3860 }
else if (isa<IncompleteArrayType>(TArray) &&
3861 isa<ConstantArrayType>(FoundArray)) {
3862 FoundByLookup = FoundVar;
3867 Importer.ToDiag(Loc, diag::warn_odr_variable_type_inconsistent)
3868 << Name << D->
getType() << FoundVar->getType();
3869 Importer.ToDiag(FoundVar->getLocation(), diag::note_odr_value_here)
3870 << FoundVar->getType();
3871 ConflictingDecls.push_back(FoundDecl);
3875 if (!ConflictingDecls.empty()) {
3877 Name, DC, IDNS, ConflictingDecls.data(), ConflictingDecls.size());
3879 Name = NameOrErr.get();
3881 return NameOrErr.takeError();
3889 if (
auto Imp = importSeq(
3892 std::tie(ToType, ToTypeSourceInfo, ToInnerLocStart, ToQualifierLoc) = *Imp;
3894 return Imp.takeError();
3898 if (GetImportedOrCreateDecl(ToVar, D, Importer.getToContext(), DC,
3899 ToInnerLocStart, Loc,
3901 ToType, ToTypeSourceInfo,
3909 if (FoundByLookup) {
3914 if (
Error Err = ImportInitializer(D, ToVar))
3915 return std::move(Err);
3920 addDeclToContexts(D, ToVar);
3923 for (++RedeclIt; RedeclIt != Redecls.end(); ++RedeclIt) {
3926 return RedeclOrErr.takeError();
3935 DeclContext *DC = Importer.getToContext().getTranslationUnitDecl();
3941 std::tie(ToDeclName, ToLocation, ToType) = *Imp;
3943 return Imp.takeError();
3947 if (GetImportedOrCreateDecl(ToParm, D, Importer.getToContext(), DC,
3963 return ToDefArgOrErr.takeError();
3967 if (
auto ToDefArgOrErr =
import(FromParam->
getDefaultArg()))
3970 return ToDefArgOrErr.takeError();
3973 return Error::success();
3979 DeclContext *DC = Importer.getToContext().getTranslationUnitDecl();
3985 if (
auto Imp = importSeq(
3989 ToDeclName, ToLocation, ToType, ToInnerLocStart,
3990 ToTypeSourceInfo) = *Imp;
3992 return Imp.takeError();
3995 if (GetImportedOrCreateDecl(ToParm, D, Importer.getToContext(), DC,
3996 ToInnerLocStart, ToLocation,
4005 if (
Error Err = ImportDefaultArgOfParmVarDecl(D, ToParm))
4006 return std::move(Err);
4025 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4026 return std::move(Err);
4030 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
4031 for (
auto *FoundDecl : FoundDecls) {
4032 if (
auto *FoundMethod = dyn_cast<ObjCMethodDecl>(FoundDecl)) {
4038 FoundMethod->getReturnType())) {
4039 Importer.ToDiag(Loc, diag::warn_odr_objc_method_result_type_inconsistent)
4041 << FoundMethod->getReturnType();
4042 Importer.ToDiag(FoundMethod->getLocation(),
4043 diag::note_odr_objc_method_here)
4050 if (D->
param_size() != FoundMethod->param_size()) {
4051 Importer.ToDiag(Loc, diag::warn_odr_objc_method_num_params_inconsistent)
4053 << D->
param_size() << FoundMethod->param_size();
4054 Importer.ToDiag(FoundMethod->getLocation(),
4055 diag::note_odr_objc_method_here)
4063 PEnd = D->
param_end(), FoundP = FoundMethod->param_begin();
4064 P != PEnd; ++
P, ++FoundP) {
4065 if (!Importer.IsStructurallyEquivalent((*P)->getType(),
4066 (*FoundP)->getType())) {
4067 Importer.FromDiag((*P)->getLocation(),
4068 diag::warn_odr_objc_method_param_type_inconsistent)
4070 << (*P)->getType() << (*FoundP)->getType();
4071 Importer.ToDiag((*FoundP)->getLocation(), diag::note_odr_value_here)
4072 << (*FoundP)->getType();
4080 if (D->
isVariadic() != FoundMethod->isVariadic()) {
4081 Importer.ToDiag(Loc, diag::warn_odr_objc_method_variadic_inconsistent)
4083 Importer.ToDiag(FoundMethod->getLocation(),
4084 diag::note_odr_objc_method_here)
4091 return Importer.MapImported(D, FoundMethod);
4098 if (
auto Imp = importSeq(
4100 std::tie(ToEndLoc, ToReturnType, ToReturnTypeSourceInfo) = *Imp;
4102 return Imp.takeError();
4105 if (GetImportedOrCreateDecl(
4106 ToMethod, D, Importer.getToContext(), Loc, ToEndLoc,
4120 ToParams.push_back(*ToPOrErr);
4122 return ToPOrErr.takeError();
4126 for (
auto *ToParam : ToParams) {
4127 ToParam->setOwningFunction(ToMethod);
4134 if (
Error Err = ImportContainerChecked(FromSelLocs, ToSelLocs))
4135 return std::move(Err);
4137 ToMethod->
setMethodParams(Importer.getToContext(), ToParams, ToSelLocs);
4158 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4159 return std::move(Err);
4165 if (
auto Imp = importSeq(
4168 std::tie(ToVarianceLoc, ToLocation, ToColonLoc, ToTypeSourceInfo) = *Imp;
4170 return Imp.takeError();
4173 if (GetImportedOrCreateDecl(
4174 Result, D, Importer.getToContext(), DC, D->
getVariance(),
4177 ToColonLoc, ToTypeSourceInfo))
4190 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4191 return std::move(Err);
4197 return std::move(Err);
4206 if (
auto Imp = importSeq(
4210 ToAtStartLoc, ToCategoryNameLoc,
4211 ToIvarLBraceLoc, ToIvarRBraceLoc) = *Imp;
4213 return Imp.takeError();
4215 if (GetImportedOrCreateDecl(ToCategory, D, Importer.getToContext(), DC,
4231 return PListOrErr.takeError();
4240 FromProto != FromProtoEnd;
4241 ++FromProto, ++FromProtoLoc) {
4243 Protocols.push_back(*ToProtoOrErr);
4245 return ToProtoOrErr.takeError();
4247 if (
ExpectedSLoc ToProtoLocOrErr =
import(*FromProtoLoc))
4248 ProtocolLocs.push_back(*ToProtoLocOrErr);
4250 return ToProtoLocOrErr.takeError();
4255 ProtocolLocs.data(), Importer.getToContext());
4258 Importer.MapImported(D, ToCategory);
4262 if (
Error Err = ImportDeclContext(D))
4263 return std::move(Err);
4271 return ToImplOrErr.takeError();
4280 if (shouldForceImportDeclContext(Kind))
4281 if (
Error Err = ImportDeclContext(From))
4283 return Error::success();
4296 FromProto != FromProtoEnd;
4297 ++FromProto, ++FromProtoLoc) {
4299 Protocols.push_back(*ToProtoOrErr);
4301 return ToProtoOrErr.takeError();
4303 if (
ExpectedSLoc ToProtoLocOrErr =
import(*FromProtoLoc))
4304 ProtocolLocs.push_back(*ToProtoLocOrErr);
4306 return ToProtoLocOrErr.takeError();
4312 ProtocolLocs.data(), Importer.getToContext());
4314 if (shouldForceImportDeclContext(Kind)) {
4316 if (
Error Err = ImportDeclContext(From,
true))
4319 return Error::success();
4327 if (Definition && Definition != D) {
4328 if (
ExpectedDecl ImportedDefOrErr =
import(Definition))
4329 return Importer.MapImported(D, *ImportedDefOrErr);
4331 return ImportedDefOrErr.takeError();
4339 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4340 return std::move(Err);
4345 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
4346 for (
auto *FoundDecl : FoundDecls) {
4350 if ((MergeWithProtocol = dyn_cast<ObjCProtocolDecl>(FoundDecl)))
4357 if (!ToAtBeginLocOrErr)
4358 return ToAtBeginLocOrErr.takeError();
4360 if (GetImportedOrCreateDecl(ToProto, D, Importer.getToContext(), DC,
4369 Importer.MapImported(D, ToProto);
4372 if (
Error Err = ImportDefinition(D, ToProto))
4373 return std::move(Err);
4380 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
4381 return std::move(Err);
4384 if (!ExternLocOrErr)
4385 return ExternLocOrErr.takeError();
4389 return LangLocOrErr.takeError();
4394 if (GetImportedOrCreateDecl(ToLinkageSpec, D, Importer.getToContext(), DC,
4395 *ExternLocOrErr, *LangLocOrErr,
4397 return ToLinkageSpec;
4401 if (!RBraceLocOrErr)
4402 return RBraceLocOrErr.takeError();
4409 return ToLinkageSpec;
4417 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4418 return std::move(Err);
4424 if (
auto Imp = importSeq(
4426 std::tie(ToLoc, ToUsingLoc, ToQualifierLoc) = *Imp;
4428 return Imp.takeError();
4432 return std::move(Err);
4435 if (GetImportedOrCreateDecl(ToUsing, D, Importer.getToContext(), DC,
4436 ToUsingLoc, ToQualifierLoc, NameInfo,
4444 Importer.getFromContext().getInstantiatedFromUsingDecl(D)) {
4446 Importer.getToContext().setInstantiatedFromUsingDecl(
4447 ToUsing, *ToPatternOrErr);
4449 return ToPatternOrErr.takeError();
4458 return ToShadowOrErr.takeError();
4468 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4469 return std::move(Err);
4475 return ToUsingOrErr.takeError();
4479 return ToTargetOrErr.takeError();
4482 if (GetImportedOrCreateDecl(ToShadow, D, Importer.getToContext(), DC, Loc,
4483 *ToUsingOrErr, *ToTargetOrErr))
4490 Importer.getFromContext().getInstantiatedFromUsingShadowDecl(D)) {
4492 Importer.getToContext().setInstantiatedFromUsingShadowDecl(
4493 ToShadow, *ToPatternOrErr);
4497 return ToPatternOrErr.takeError();
4510 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4511 return std::move(Err);
4516 if (!ToComAncestorOrErr)
4517 return ToComAncestorOrErr.takeError();
4520 SourceLocation ToUsingLoc, ToNamespaceKeyLocation, ToIdentLocation;
4522 if (
auto Imp = importSeq(
4527 ToNominatedNamespace, ToUsingLoc, ToNamespaceKeyLocation,
4528 ToQualifierLoc, ToIdentLocation) = *Imp;
4530 return Imp.takeError();
4533 if (GetImportedOrCreateDecl(ToUsingDir, D, Importer.getToContext(), DC,
4535 ToNamespaceKeyLocation,
4538 ToNominatedNamespace, *ToComAncestorOrErr))
4553 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4554 return std::move(Err);
4560 if (
auto Imp = importSeq(
4563 std::tie(ToLoc, ToUsingLoc, ToQualifierLoc, ToEllipsisLoc) = *Imp;
4565 return Imp.takeError();
4569 return std::move(Err);
4572 if (GetImportedOrCreateDecl(ToUsingValue, D, Importer.getToContext(), DC,
4573 ToUsingLoc, ToQualifierLoc, NameInfo,
4575 return ToUsingValue;
4581 return ToUsingValue;
4590 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4591 return std::move(Err);
4597 if (
auto Imp = importSeq(
4600 std::tie(ToUsingLoc, ToTypenameLoc, ToQualifierLoc, ToEllipsisLoc) = *Imp;
4602 return Imp.takeError();
4605 if (GetImportedOrCreateDecl(ToUsing, D, Importer.getToContext(), DC,
4606 ToUsingLoc, ToTypenameLoc,
4607 ToQualifierLoc, Loc, Name, ToEllipsisLoc))
4618 Decl* ToD =
nullptr;
4621 ToD = Importer.getToContext().getMakeIntegerSeqDecl();
4624 ToD = Importer.getToContext().getTypePackElementDecl();
4627 assert(ToD &&
"BuiltinTemplateDecl of unsupported kind!");
4628 Importer.MapImported(D, ToD);
4638 if (
auto FromSuperOrErr =
import(FromSuper))
4639 FromSuper = *FromSuperOrErr;
4641 return FromSuperOrErr.takeError();
4645 if ((
bool)FromSuper != (
bool)ToSuper ||
4648 diag::warn_odr_objc_superclass_inconsistent)
4655 diag::note_odr_objc_missing_superclass);
4658 diag::note_odr_objc_superclass)
4662 diag::note_odr_objc_missing_superclass);
4665 if (shouldForceImportDeclContext(Kind))
4666 if (
Error Err = ImportDeclContext(From))
4668 return Error::success();
4679 return SuperTInfoOrErr.takeError();
4690 FromProto != FromProtoEnd;
4691 ++FromProto, ++FromProtoLoc) {
4693 Protocols.push_back(*ToProtoOrErr);
4695 return ToProtoOrErr.takeError();
4697 if (
ExpectedSLoc ToProtoLocOrErr =
import(*FromProtoLoc))
4698 ProtocolLocs.push_back(*ToProtoLocOrErr);
4700 return ToProtoLocOrErr.takeError();
4706 ProtocolLocs.data(), Importer.getToContext());
4711 auto ToCatOrErr =
import(Cat);
4713 return ToCatOrErr.takeError();
4722 return ToImplOrErr.takeError();
4725 if (shouldForceImportDeclContext(Kind)) {
4727 if (
Error Err = ImportDeclContext(From,
true))
4730 return Error::success();
4739 for (
auto *fromTypeParam : *list) {
4740 if (
auto toTypeParamOrErr =
import(fromTypeParam))
4741 toTypeParams.push_back(*toTypeParamOrErr);
4743 return toTypeParamOrErr.takeError();
4746 auto LAngleLocOrErr =
import(list->getLAngleLoc());
4747 if (!LAngleLocOrErr)
4748 return LAngleLocOrErr.takeError();
4750 auto RAngleLocOrErr =
import(list->getRAngleLoc());
4751 if (!RAngleLocOrErr)
4752 return RAngleLocOrErr.takeError();
4765 if (Definition && Definition != D) {
4766 if (
ExpectedDecl ImportedDefOrErr =
import(Definition))
4767 return Importer.MapImported(D, *ImportedDefOrErr);
4769 return ImportedDefOrErr.takeError();
4777 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4778 return std::move(Err);
4784 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
4785 for (
auto *FoundDecl : FoundDecls) {
4789 if ((MergeWithIface = dyn_cast<ObjCInterfaceDecl>(FoundDecl)))
4797 if (!AtBeginLocOrErr)
4798 return AtBeginLocOrErr.takeError();
4800 if (GetImportedOrCreateDecl(
4801 ToIface, D, Importer.getToContext(), DC,
4809 Importer.MapImported(D, ToIface);
4812 if (
auto ToPListOrErr =
4816 return ToPListOrErr.takeError();
4819 if (
Error Err = ImportDefinition(D, ToIface))
4820 return std::move(Err);
4829 return std::move(Err);
4834 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
4835 return std::move(Err);
4838 if (
auto Imp = importSeq(
4840 std::tie(ToLocation, ToAtStartLoc, ToCategoryNameLoc) = *Imp;
4842 return Imp.takeError();
4844 if (GetImportedOrCreateDecl(
4845 ToImpl, D, Importer.getToContext(), DC,
4847 ToLocation, ToAtStartLoc, ToCategoryNameLoc))
4855 Importer.MapImported(D, ToImpl);
4856 if (
Error Err = ImportDeclContext(D))
4857 return std::move(Err);
4867 return std::move(Err);
4872 return std::move(Err);
4879 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
4880 return std::move(Err);
4884 if (
auto Imp = importSeq(
4888 ToLocation, ToAtStartLoc, ToSuperClassLoc,
4889 ToIvarLBraceLoc, ToIvarRBraceLoc) = *Imp;
4891 return Imp.takeError();
4893 if (GetImportedOrCreateDecl(Impl, D, Importer.getToContext(),
4905 Iface->setImplementation(Impl);
4906 Importer.MapImported(D, Iface->getImplementation());
4917 diag::warn_odr_objc_superclass_inconsistent)
4923 diag::note_odr_objc_superclass)
4927 diag::note_odr_objc_missing_superclass);
4930 diag::note_odr_objc_superclass)
4934 diag::note_odr_objc_missing_superclass);
4941 if (
Error Err = ImportDeclContext(D))
4942 return std::move(Err);
4953 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
4954 return std::move(Err);
4959 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
4960 for (
auto *FoundDecl : FoundDecls) {
4961 if (
auto *FoundProp = dyn_cast<ObjCPropertyDecl>(FoundDecl)) {
4963 if (!Importer.IsStructurallyEquivalent(D->
getType(),
4964 FoundProp->getType())) {
4965 Importer.ToDiag(Loc, diag::warn_odr_objc_property_type_inconsistent)
4966 << Name << D->
getType() << FoundProp->getType();
4967 Importer.ToDiag(FoundProp->getLocation(), diag::note_odr_value_here)
4968 << FoundProp->getType();
4976 Importer.MapImported(D, FoundProp);
4984 if (
auto Imp = importSeq(
4986 std::tie(ToType, ToTypeSourceInfo, ToAtLoc, ToLParenLoc) = *Imp;
4988 return Imp.takeError();
4992 if (GetImportedOrCreateDecl(
4993 ToProperty, D, Importer.getToContext(), DC, Loc,
4995 ToLParenLoc, ToType,
4999 Selector ToGetterName, ToSetterName;
5003 if (
auto Imp = importSeq(
5009 ToGetterName, ToSetterName,
5010 ToGetterNameLoc, ToSetterNameLoc,
5011 ToGetterMethodDecl, ToSetterMethodDecl,
5012 ToPropertyIvarDecl) = *Imp;
5014 return Imp.takeError();
5034 return std::move(Err);
5037 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
5038 return std::move(Err);
5040 auto *InImpl = cast<ObjCImplDecl>(LexicalDC);
5045 return std::move(Err);
5052 if (
auto Imp = importSeq(
5054 std::tie(ToBeginLoc, ToLocation, ToPropertyIvarDeclLoc) = *Imp;
5056 return Imp.takeError();
5058 if (GetImportedOrCreateDecl(ToImpl, D, Importer.getToContext(), DC,
5062 ToPropertyIvarDeclLoc))
5072 diag::warn_odr_objc_property_impl_kind_inconsistent)
5077 diag::note_odr_objc_property_impl_kind)
5088 diag::warn_odr_objc_synthesize_ivar_inconsistent)
5091 << Ivar->getDeclName();
5093 diag::note_odr_objc_synthesize_ivar_here)
5100 Importer.MapImported(D, ToImpl);
5116 return BeginLocOrErr.takeError();
5120 return LocationOrErr.takeError();
5123 if (GetImportedOrCreateDecl(
5124 ToD, D, Importer.getToContext(),
5126 *BeginLocOrErr, *LocationOrErr,
5140 if (
auto Imp = importSeq(TC->getNestedNameSpecifierLoc(),
5141 TC->getConceptNameInfo().getName(), TC->getConceptNameInfo().getLoc(),
5142 TC->getFoundDecl(), TC->getNamedConcept(),
5143 TC->getImmediatelyDeclaredConstraint()))
5144 std::tie(ToNNS, ToName, ToNameLoc, ToFoundDecl, ToNamedConcept,
5147 return Imp.takeError();
5150 const auto *ASTTemplateArgs = TC->getTemplateArgsAsWritten();
5151 if (ASTTemplateArgs)
5152 if (
Error Err = ImportTemplateArgumentListInfo(*ASTTemplateArgs,
5154 return std::move(Err);
5157 ToFoundDecl, ToNamedConcept,
5160 ToTAInfo) :
nullptr,
5173 if (
auto Imp = importSeq(
5177 ToDeclName, ToLocation, ToType, ToTypeSourceInfo,
5178 ToInnerLocStart) = *Imp;
5180 return Imp.takeError();
5185 (void)GetImportedOrCreateDecl(
5186 ToD, D, Importer.getToContext(),
5188 ToInnerLocStart, ToLocation, D->
getDepth(),
5199 return NameOrErr.takeError();
5204 return LocationOrErr.takeError();
5208 if (!TemplateParamsOrErr)
5209 return TemplateParamsOrErr.takeError();
5214 (void)GetImportedOrCreateDecl(
5215 ToD, D, Importer.getToContext(),
5218 (*NameOrErr).getAsIdentifierInfo(),
5219 *TemplateParamsOrErr);
5226 assert(D->getTemplatedDecl() &&
"Should be called on templates only");
5227 auto *ToTemplatedDef = D->getTemplatedDecl()->getDefinition();
5228 if (!ToTemplatedDef)
5230 auto *TemplateWithDef = ToTemplatedDef->getDescribedTemplate();
5231 return cast_or_null<T>(TemplateWithDef);
5241 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5242 return std::move(Err);
5251 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
5252 for (
auto *FoundDecl : FoundDecls) {
5257 Decl *Found = FoundDecl;
5259 if (FoundTemplate) {
5260 if (!hasSameVisibilityContext(FoundTemplate, D))
5263 if (IsStructuralMatch(D, FoundTemplate)) {
5267 return Importer.MapImported(D, TemplateWithDef);
5269 FoundByLookup = FoundTemplate;
5274 ConflictingDecls.push_back(FoundDecl);
5278 if (!ConflictingDecls.empty()) {
5281 ConflictingDecls.size());
5283 Name = NameOrErr.get();
5285 return NameOrErr.takeError();
5293 if (
Error Err = importInto(ToTemplated, FromTemplated))
5294 return std::move(Err);
5298 if (!TemplateParamsOrErr)
5299 return TemplateParamsOrErr.takeError();
5302 if (GetImportedOrCreateDecl(D2, D, Importer.getToContext(), DC, Loc, Name,
5303 *TemplateParamsOrErr, ToTemplated))
5311 addDeclToContexts(D, D2);
5313 if (FoundByLookup) {
5327 "Found decl must have its templated decl set");
5330 if (ToTemplated != PrevTemplated)
5349 return std::move(Err);
5353 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
5354 return std::move(Err);
5358 if (
Error Err = ImportTemplateArguments(
5360 return std::move(Err);
5363 void *InsertPos =
nullptr;
5374 return ToTPListOrErr.takeError();
5375 ToTPList = *ToTPListOrErr;
5383 if (IsStructuralMatch(D, PrevDecl)) {
5388 for (
auto *FromField : D->
fields()) {
5389 auto ToOrErr =
import(FromField);
5391 return ToOrErr.takeError();
5397 auto ToOrErr =
import(FromM);
5399 return ToOrErr.takeError();
5418 return BeginLocOrErr.takeError();
5421 return IdLocOrErr.takeError();
5429 if (
Error Err = ImportTemplateArgumentListInfo(ASTTemplateArgs, ToTAInfo))
5430 return std::move(Err);
5433 if (
Error Err = importInto(
5435 return std::move(Err);
5438 if (GetImportedOrCreateDecl<ClassTemplatePartialSpecializationDecl>(
5439 D2, D, Importer.getToContext(), D->
getTagKind(), DC,
5440 *BeginLocOrErr, *IdLocOrErr, ToTPList, ClassTemplate,
5441 llvm::makeArrayRef(TemplateArgs.data(), TemplateArgs.size()),
5442 ToTAInfo, CanonInjType,
5443 cast_or_null<ClassTemplatePartialSpecializationDecl>(PrevDecl)))
5448 auto *PartSpec2 = cast<ClassTemplatePartialSpecializationDecl>(D2);
5449 if (!ClassTemplate->findPartialSpecialization(TemplateArgs, ToTPList,
5452 ClassTemplate->AddPartialSpecialization(PartSpec2, InsertPos);
5455 if (GetImportedOrCreateDecl(
5456 D2, D, Importer.getToContext(), D->
getTagKind(), DC,
5457 *BeginLocOrErr, *IdLocOrErr, ClassTemplate, TemplateArgs,
5463 if (!ClassTemplate->findSpecialization(TemplateArgs, InsertPos))
5465 ClassTemplate->AddSpecialization(D2, InsertPos);
5481 return BraceRangeOrErr.takeError();
5487 return LocOrErr.takeError();
5490 if (
auto TInfoOrErr =
import(TSI))
5493 return TInfoOrErr.takeError();
5498 return LocOrErr.takeError();
5503 return LocOrErr.takeError();
5510 return POIOrErr.takeError();
5516 if (
Error Err = ImportDefinition(D, D2))
5517 return std::move(Err);
5531 Definition->getDescribedVarTemplate()))
5532 return Importer.MapImported(D, *ImportedDefOrErr);
5534 return ImportedDefOrErr.takeError();
5542 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5543 return std::move(Err);
5549 "Variable templates cannot be declared at function scope");
5551 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
5552 for (
auto *FoundDecl : FoundDecls) {
5556 Decl *Found = FoundDecl;
5557 if (
VarTemplateDecl *FoundTemplate = dyn_cast<VarTemplateDecl>(Found)) {
5558 if (IsStructuralMatch(D, FoundTemplate)) {
5561 FoundTemplate->getTemplatedDecl());
5562 return Importer.MapImported(D, FoundTemplate);
5564 ConflictingDecls.push_back(FoundDecl);
5568 if (!ConflictingDecls.empty()) {
5571 ConflictingDecls.size());
5573 Name = NameOrErr.get();
5575 return NameOrErr.takeError();
5584 return TypeOrErr.takeError();
5588 if (
Error Err = importInto(ToTemplated, DTemplated))
5589 return std::move(Err);
5593 if (!TemplateParamsOrErr)
5594 return TemplateParamsOrErr.takeError();
5597 if (GetImportedOrCreateDecl(ToVarTD, D, Importer.getToContext(), DC, Loc,
5598 Name, *TemplateParamsOrErr, ToTemplated))
5621 if (Definition && Definition != D) {
5622 if (
ExpectedDecl ImportedDefOrErr =
import(Definition))
5623 return Importer.MapImported(D, *ImportedDefOrErr);
5625 return ImportedDefOrErr.takeError();
5630 return std::move(Err);
5634 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
5635 return std::move(Err);
5640 return BeginLocOrErr.takeError();
5644 return IdLocOrErr.takeError();
5648 if (
Error Err = ImportTemplateArguments(
5650 return std::move(Err);
5653 void *InsertPos =
nullptr;
5655 TemplateArgs, InsertPos);
5664 IsStructuralMatch(D, FoundDef)) {
5668 return Importer.MapImported(D, FoundDef);
5675 return std::move(Err);
5679 return TInfoOrErr.takeError();
5682 if (
Error Err = ImportTemplateArgumentListInfo(
5684 return std::move(Err);
5688 if (
auto *FromPartial = dyn_cast<PartVarSpecDecl>(D)) {
5691 const auto *FromTAArgsAsWritten = FromPartial->getTemplateArgsAsWritten();
5693 if (
Error Err = ImportTemplateArgumentListInfo(
5694 *FromTAArgsAsWritten, ArgInfos))
5695 return std::move(Err);
5697 auto ToTPListOrErr =
import(FromPartial->getTemplateParameters());
5699 return ToTPListOrErr.takeError();
5701 PartVarSpecDecl *ToPartial;
5702 if (GetImportedOrCreateDecl(ToPartial, D, Importer.getToContext(), DC,
5703 *BeginLocOrErr, *IdLocOrErr, *ToTPListOrErr,
5704 VarTemplate, T, *TInfoOrErr,
5709 FromPartial->getInstantiatedFromMember()))
5710 ToPartial->setInstantiatedFromMember(*ToInstOrErr);
5712 return ToInstOrErr.takeError();
5714 if (FromPartial->isMemberSpecialization())
5715 ToPartial->setMemberSpecialization();
5720 if (GetImportedOrCreateDecl(D2, D, Importer.getToContext(), DC,
5721 *BeginLocOrErr, *IdLocOrErr, VarTemplate,
5731 return POIOrErr.takeError();
5744 return LocOrErr.takeError();
5756 if (
Error Err = ImportInitializer(D, D2))
5757 return std::move(Err);
5769 if (
Error Err = ImportDeclParts(D, DC, LexicalDC, Name, ToD, Loc))
5770 return std::move(Err);
5782 auto FoundDecls = Importer.findDeclsInToCtx(DC, Name);
5783 for (
auto *FoundDecl : FoundDecls) {
5787 if (
auto *FoundTemplate = dyn_cast<FunctionTemplateDecl>(FoundDecl)) {
5788 if (!hasSameVisibilityContext(FoundTemplate, D))
5790 if (IsStructuralMatch(D, FoundTemplate)) {
5794 return Importer.MapImported(D, TemplateWithDef);
5796 FoundByLookup = FoundTemplate;
5806 return ParamsOrErr.takeError();
5810 return std::move(Err);
5813 if (GetImportedOrCreateDecl(ToFunc, D, Importer.getToContext(), DC, Loc, Name,
5814 *ParamsOrErr, TemplatedFD))
5823 if (FoundByLookup) {
5828 "Found decl must have its templated decl set");
5829 auto *PrevTemplated =
5831 if (TemplatedFD != PrevTemplated)
5845 Importer.FromDiag(S->
getBeginLoc(), diag::err_unsupported_ast_node)
5852 if (Importer.returnWithErrorInTest())
5859 Names.push_back(ToII);
5862 for (
unsigned I = 0, E = S->
getNumInputs(); I != E; I++) {
5866 Names.push_back(ToII);
5872 Clobbers.push_back(*ClobberOrErr);
5874 return ClobberOrErr.takeError();
5881 Constraints.push_back(*OutputOrErr);
5883 return OutputOrErr.takeError();
5886 for (
unsigned I = 0, E = S->
getNumInputs(); I != E; I++) {
5888 Constraints.push_back(*InputOrErr);
5890 return InputOrErr.takeError();
5895 if (
Error Err = ImportContainerChecked(S->
outputs(), Exprs))
5896 return std::move(Err);
5900 return std::move(Err);
5902 if (
Error Err = ImportArrayChecked(
5904 return std::move(Err);
5908 return AsmLocOrErr.takeError();
5911 return AsmStrOrErr.takeError();
5913 if (!RParenLocOrErr)
5914 return RParenLocOrErr.takeError();
5916 return new (Importer.getToContext())
GCCAsmStmt(
5917 Importer.getToContext(),
5936 return Imp.takeError();
5940 std::tie(ToDG, ToBeginLoc, ToEndLoc) = *Imp;
5942 return new (Importer.getToContext())
DeclStmt(ToDG, ToBeginLoc, ToEndLoc);
5947 if (!ToSemiLocOrErr)
5948 return ToSemiLocOrErr.takeError();
5949 return new (Importer.getToContext())
NullStmt(
5956 if (
Error Err = ImportContainerChecked(S->
body(), ToStmts))
5957 return std::move(Err);
5960 if (!ToLBracLocOrErr)
5961 return ToLBracLocOrErr.takeError();
5964 if (!ToRBracLocOrErr)
5965 return ToRBracLocOrErr.takeError();
5968 Importer.getToContext(), ToStmts,
5969 *ToLBracLocOrErr, *ToRBracLocOrErr);
5973 auto Imp = importSeq(
5977 return Imp.takeError();
5979 Expr *ToLHS, *ToRHS;
5982 std::tie(ToLHS, ToRHS, ToSubStmt, ToCaseLoc, ToEllipsisLoc, ToColonLoc) =
5986 ToCaseLoc, ToEllipsisLoc, ToColonLoc);
5995 return Imp.takeError();
5999 std::tie(ToDefaultLoc, ToColonLoc, ToSubStmt) = *Imp;
6002 ToDefaultLoc, ToColonLoc, ToSubStmt);
6008 return Imp.takeError();
6013 std::tie(ToIdentLoc, ToLabelDecl, ToSubStmt) = *Imp;
6015 return new (Importer.getToContext())
LabelStmt(
6016 ToIdentLoc, ToLabelDecl, ToSubStmt);
6021 if (!ToAttrLocOrErr)
6022 return ToAttrLocOrErr.takeError();
6025 if (
Error Err = ImportContainerChecked(FromAttrs, ToAttrs))
6026 return std::move(Err);
6028 if (!ToSubStmtOrErr)
6029 return ToSubStmtOrErr.takeError();
6032 Importer.getToContext(), *ToAttrLocOrErr, ToAttrs, *ToSubStmtOrErr);
6036 auto Imp = importSeq(
6040 return Imp.takeError();
6043 Stmt *ToInit, *ToThen, *ToElse;
6047 ToIfLoc, ToInit, ToConditionVariable, ToCond, ToThen, ToElseLoc, ToElse) =
6051 ToInit, ToConditionVariable, ToCond, ToThen, ToElseLoc,
6056 auto Imp = importSeq(
6060 return Imp.takeError();
6062 Stmt *ToInit, *ToBody;
6066 std::tie(ToInit, ToConditionVariable, ToCond, ToBody, ToSwitchLoc) = *Imp;
6069 ToConditionVariable, ToCond);
6071 ToStmt->setSwitchLoc(ToSwitchLoc);
6079 return ToSCOrErr.takeError();
6080 if (LastChainedSwitchCase)
6083 ToStmt->setSwitchCaseList(*ToSCOrErr);
6084 LastChainedSwitchCase = *ToSCOrErr;
6091 auto Imp = importSeq(
6094 return Imp.takeError();
6100 std::tie(ToConditionVariable, ToCond, ToBody, ToWhileLoc) = *Imp;
6103 ToBody, ToWhileLoc);
6107 auto Imp = importSeq(
6111 return Imp.takeError();
6116 std::tie(ToBody, ToCond, ToDoLoc, ToWhileLoc, ToRParenLoc) = *Imp;
6118 return new (Importer.getToContext())
DoStmt(
6119 ToBody, ToCond, ToDoLoc, ToWhileLoc, ToRParenLoc);
6123 auto Imp = importSeq(
6127 return Imp.takeError();
6130 Expr *ToCond, *ToInc;
6135 ToInit, ToCond, ToConditionVariable, ToInc, ToBody, ToForLoc,
6136 ToLParenLoc, ToRParenLoc) = *Imp;
6138 return new (Importer.getToContext())
ForStmt(
6139 Importer.getToContext(),
6140 ToInit, ToCond, ToConditionVariable, ToInc, ToBody, ToForLoc, ToLParenLoc,
6147 return Imp.takeError();
6151 std::tie(ToLabel, ToGotoLoc, ToLabelLoc) = *Imp;
6153 return new (Importer.getToContext())
GotoStmt(
6154 ToLabel, ToGotoLoc, ToLabelLoc);
6160 return Imp.takeError();
6164 std::tie(ToGotoLoc, ToStarLoc, ToTarget) = *Imp;
6167 ToGotoLoc, ToStarLoc, ToTarget);
6172 if (!ToContinueLocOrErr)
6173 return ToContinueLocOrErr.takeError();
6174 return new (Importer.getToContext())
ContinueStmt(*ToContinueLocOrErr);
6179 if (!ToBreakLocOrErr)
6180 return ToBreakLocOrErr.takeError();
6181 return new (Importer.getToContext())
BreakStmt(*ToBreakLocOrErr);
6185 auto Imp = importSeq(
6188 return Imp.takeError();
6192 const VarDecl *ToNRVOCandidate;
6193 std::tie(ToReturnLoc, ToRetValue, ToNRVOCandidate) = *Imp;
6200 auto Imp = importSeq(
6203 return Imp.takeError();
6207 Stmt *ToHandlerBlock;
6208 std::tie(ToCatchLoc, ToExceptionDecl, ToHandlerBlock) = *Imp;
6211 ToCatchLoc, ToExceptionDecl, ToHandlerBlock);
6217 return ToTryLocOrErr.takeError();
6220 if (!ToTryBlockOrErr)
6221 return ToTryBlockOrErr.takeError();
6224 for (
unsigned HI = 0, HE = S->
getNumHandlers(); HI != HE; ++HI) {
6226 if (
auto ToHandlerOrErr =
import(FromHandler))
6227 ToHandlers[HI] = *ToHandlerOrErr;
6229 return ToHandlerOrErr.takeError();
6233 Importer.getToContext(), *ToTryLocOrErr,*ToTryBlockOrErr, ToHandlers);
6237 auto Imp1 = importSeq(
6241 return Imp1.takeError();
6242 auto Imp2 = importSeq(
6245 return Imp2.takeError();
6247 DeclStmt *ToRangeStmt, *ToBeginStmt, *ToEndStmt, *ToLoopVarStmt;
6248 Expr *ToCond, *ToInc;
6249 Stmt *ToInit, *ToBody;
6251 ToInit, ToRangeStmt, ToBeginStmt, ToEndStmt, ToCond, ToInc, ToLoopVarStmt,
6254 std::tie(ToForLoc, ToCoawaitLoc, ToColonLoc, ToRParenLoc) = *Imp2;
6257 ToInit, ToRangeStmt, ToBeginStmt, ToEndStmt, ToCond, ToInc, ToLoopVarStmt,
6258 ToBody, ToForLoc, ToCoawaitLoc, ToColonLoc, ToRParenLoc);
6263 auto Imp = importSeq(
6267 return Imp.takeError();
6269 Stmt *ToElement, *ToBody;
6272 std::tie(ToElement, ToCollection, ToBody, ToForLoc, ToRParenLoc) = *Imp;
6282 auto Imp = importSeq(
6286 return Imp.takeError();
6291 std::tie(ToAtCatchLoc, ToRParenLoc, ToCatchParamDecl, ToCatchBody) = *Imp;
6294 ToAtCatchLoc, ToRParenLoc, ToCatchParamDecl, ToCatchBody);
6299 if (!ToAtFinallyLocOrErr)
6300 return ToAtFinallyLocOrErr.takeError();
6302 if (!ToAtFinallyStmtOrErr)
6303 return ToAtFinallyStmtOrErr.takeError();
6305 *ToAtFinallyStmtOrErr);
6309 auto Imp = importSeq(
6312 return Imp.takeError();
6315 Stmt *ToTryBody, *ToFinallyStmt;
6316 std::tie(ToAtTryLoc, ToTryBody, ToFinallyStmt) = *Imp;
6321 if (
ExpectedStmt ToCatchStmtOrErr =
import(FromCatchStmt))
6322 ToCatchStmts[CI] = *ToCatchStmtOrErr;
6324 return ToCatchStmtOrErr.takeError();
6328 ToAtTryLoc, ToTryBody,
6329 ToCatchStmts.begin(), ToCatchStmts.size(),
6335 auto Imp = importSeq(
6338 return Imp.takeError();
6343 std::tie(ToAtSynchronizedLoc, ToSynchExpr, ToSynchBody) = *Imp;
6346 ToAtSynchronizedLoc, ToSynchExpr, ToSynchBody);
6351 if (!ToThrowLocOrErr)
6352 return ToThrowLocOrErr.takeError();
6354 if (!ToThrowExprOrErr)
6355 return ToThrowExprOrErr.takeError();
6357 *ToThrowLocOrErr, *ToThrowExprOrErr);
6364 return ToAtLocOrErr.takeError();
6366 if (!ToSubStmtOrErr)
6367 return ToSubStmtOrErr.takeError();
6376 Importer.FromDiag(E->
getBeginLoc(), diag::err_unsupported_ast_node)
6382 auto Imp = importSeq(
6386 return Imp.takeError();
6392 std::tie(ToBuiltinLoc, ToSubExpr, ToWrittenTypeInfo, ToRParenLoc, ToType) =
6395 return new (Importer.getToContext())
VAArgExpr(
6396 ToBuiltinLoc, ToSubExpr, ToWrittenTypeInfo, ToRParenLoc, ToType,
6404 return Imp.takeError();
6411 std::tie(ToCond, ToLHS, ToRHS, ToBuiltinLoc, ToRParenLoc, ToType) = *Imp;
6423 return new (Importer.getToContext())
6424 ChooseExpr(ToBuiltinLoc, ToCond, ToLHS, ToRHS, ToType, VK, OK,
6425 ToRParenLoc, CondIsTrue, TypeDependent, ValueDependent);
6431 return TypeOrErr.takeError();
6435 return BeginLocOrErr.takeError();
6437 return new (Importer.getToContext())
GNUNullExpr(*TypeOrErr, *BeginLocOrErr);
6441 auto Imp = importSeq(
6444 return Imp.takeError();
6449 std::tie(ToBeginLoc, ToType, ToFunctionName) = *Imp;
6456 auto Imp = importSeq(
6460 return Imp.takeError();
6466 std::tie(ToQualifierLoc, ToTemplateKeywordLoc, ToDecl, ToLocation, ToType) =
6473 return FoundDOrErr.takeError();
6474 ToFoundD = *FoundDOrErr;
6483 return std::move(Err);
6484 ToResInfo = &ToTAInfo;
6488 Importer.getToContext(), ToQualifierLoc, ToTemplateKeywordLoc, ToDecl,
6499 return TypeOrErr.takeError();
6507 return ToInitOrErr.takeError();
6510 if (!ToEqualOrColonLocOrErr)
6511 return ToEqualOrColonLocOrErr.takeError();
6517 ToIndexExprs[I - 1] = *ToArgOrErr;
6519 return ToArgOrErr.takeError();
6524 return std::move(Err);
6527 Importer.getToContext(), ToDesignators,
6528 ToIndexExprs, *ToEqualOrColonLocOrErr,
6536 return ToTypeOrErr.takeError();
6539 if (!ToLocationOrErr)
6540 return ToLocationOrErr.takeError();
6543 *ToTypeOrErr, *ToLocationOrErr);
6549 return ToTypeOrErr.takeError();
6552 if (!ToLocationOrErr)
6553 return ToLocationOrErr.takeError();
6556 Importer.getToContext(), E->
getValue(), *ToTypeOrErr, *ToLocationOrErr);
6563 return ToTypeOrErr.takeError();
6566 if (!ToLocationOrErr)
6567 return ToLocationOrErr.takeError();
6571 *ToTypeOrErr, *ToLocationOrErr);
6575 auto ToTypeOrErr =
import(E->
getType());
6577 return ToTypeOrErr.takeError();
6580 if (!ToSubExprOrErr)
6581 return ToSubExprOrErr.takeError();
6584 *ToSubExprOrErr, *ToTypeOrErr);
6590 return ToTypeOrErr.takeError();
6593 if (!ToLocationOrErr)
6594 return ToLocationOrErr.takeError();
6603 return ToTypeOrErr.takeError();
6606 if (
Error Err = ImportArrayChecked(
6608 return std::move(Err);
6612 *ToTypeOrErr, ToLocations.data(), ToLocations.size());
6616 auto Imp = importSeq(
6620 return Imp.takeError();
6625 Expr *ToInitializer;
6626 std::tie(ToLParenLoc, ToTypeSourceInfo, ToType, ToInitializer) = *Imp;
6629 ToLParenLoc, ToTypeSourceInfo, ToType, E->
getValueKind(),
6634 auto Imp = importSeq(
6637 return Imp.takeError();
6641 std::tie(ToBuiltinLoc, ToType, ToRParenLoc) = *Imp;
6644 if (
Error Err = ImportArrayChecked(
6647 return std::move(Err);
6649 return new (Importer.getToContext())
AtomicExpr(
6650 ToBuiltinLoc, ToExprs, ToType, E->
getOp(), ToRParenLoc);
6654 auto Imp = importSeq(
6657 return Imp.takeError();
6662 std::tie(ToAmpAmpLoc, ToLabelLoc, ToLabel, ToType) = *Imp;
6665 ToAmpAmpLoc, ToLabelLoc, ToLabel, ToType);
6671 return Imp.takeError();
6674 std::tie(ToSubExpr) = *Imp;
6689 return Imp.takeError();
6693 std::tie(ToLParen, ToRParen, ToSubExpr) = *Imp;
6695 return new (Importer.getToContext())
6696 ParenExpr(ToLParen, ToRParen, ToSubExpr);
6701 if (
Error Err = ImportContainerChecked(E->
exprs(), ToExprs))
6702 return std::move(Err);
6705 if (!ToLParenLocOrErr)
6706 return ToLParenLocOrErr.takeError();
6709 if (!ToRParenLocOrErr)
6710 return ToRParenLocOrErr.takeError();
6713 ToExprs, *ToRParenLocOrErr);
6717 auto Imp = importSeq(
6720 return Imp.takeError();
6725 std::tie(ToSubStmt, ToType, ToLParenLoc, ToRParenLoc) = *Imp;
6727 return new (Importer.getToContext())
StmtExpr(
6728 ToSubStmt, ToType, ToLParenLoc, ToRParenLoc);
6732 auto Imp = importSeq(
6735 return Imp.takeError();
6740 std::tie(ToSubExpr, ToType, ToOperatorLoc) = *Imp;
6751 return Imp.takeError();
6755 std::tie(ToType, ToOperatorLoc, ToRParenLoc) = *Imp;
6760 if (!ToArgumentTypeInfoOrErr)
6761 return ToArgumentTypeInfoOrErr.takeError();
6764 E->
getKind(), *ToArgumentTypeInfoOrErr, ToType, ToOperatorLoc,
6769 if (!ToArgumentExprOrErr)
6770 return ToArgumentExprOrErr.takeError();
6773 E->
getKind(), *ToArgumentExprOrErr, ToType, ToOperatorLoc, ToRParenLoc);
6777 auto Imp = importSeq(
6780 return Imp.takeError();
6782 Expr *ToLHS, *ToRHS;
6785 std::tie(ToLHS, ToRHS, ToType, ToOperatorLoc) = *Imp;
6793 auto Imp = importSeq(
6797 return Imp.takeError();
6799 Expr *ToCond, *ToLHS, *ToRHS;
6802 std::tie(ToCond, ToQuestionLoc, ToLHS, ToColonLoc, ToRHS, ToType) = *Imp;
6805 ToCond, ToQuestionLoc, ToLHS, ToColonLoc, ToRHS, ToType,
6811 auto Imp = importSeq(
6815 return Imp.takeError();
6817 Expr *ToCommon, *ToCond, *ToTrueExpr, *ToFalseExpr;
6822 ToCommon, ToOpaqueValue, ToCond, ToTrueExpr, ToFalseExpr, ToQuestionLoc,
6823 ToColonLoc, ToType) = *Imp;
6826 ToCommon, ToOpaqueValue, ToCond, ToTrueExpr, ToFalseExpr,
6832 auto Imp = importSeq(
6836 return Imp.takeError();
6840 Expr *ToDimensionExpression;
6843 ToBeginLoc, ToQueriedTypeSourceInfo, ToDimensionExpression, ToEndLoc,
6848 ToDimensionExpression, ToEndLoc, ToType);
6852 auto Imp = importSeq(
6855 return Imp.takeError();
6858 Expr *ToQueriedExpression;
6860 std::tie(ToBeginLoc, ToQueriedExpression, ToEndLoc, ToType) = *Imp;
6868 auto Imp = importSeq(
6871 return Imp.takeError();
6876 std::tie(ToLocation, ToType, ToSourceExpr) = *Imp;
6883 auto Imp = importSeq(
6886 return Imp.takeError();
6888 Expr *ToLHS, *ToRHS;
6891 std::tie(ToLHS, ToRHS, ToType, ToRBracketLoc) = *Imp;
6900 auto Imp = importSeq(
6904 return Imp.takeError();
6906 Expr *ToLHS, *ToRHS;
6907 QualType ToType, ToComputationLHSType, ToComputationResultType;
6909 std::tie(ToLHS, ToRHS, ToType, ToComputationLHSType, ToComputationResultType,
6910 ToOperatorLoc) = *Imp;
6914 E->
getObjectKind(), ToComputationLHSType, ToComputationResultType,
6922 if (
auto SpecOrErr =
import(*I))
6923 Path.push_back(*SpecOrErr);
6925 return SpecOrErr.takeError();
6933 return ToTypeOrErr.takeError();
6936 if (!ToSubExprOrErr)
6937 return ToSubExprOrErr.takeError();
6940 if (!ToBasePathOrErr)
6941 return ToBasePathOrErr.takeError();
6944 Importer.getToContext(), *ToTypeOrErr, E->
getCastKind(), *ToSubExprOrErr,
6949 auto Imp1 = importSeq(
6952 return Imp1.takeError();
6957 std::tie(ToType, ToSubExpr, ToTypeInfoAsWritten) = *Imp1;
6960 if (!ToBasePathOrErr)
6961 return ToBasePathOrErr.takeError();
6965 case Stmt::CStyleCastExprClass: {
6966 auto *CCE = cast<CStyleCastExpr>(E);
6967 ExpectedSLoc ToLParenLocOrErr =
import(CCE->getLParenLoc());
6968 if (!ToLParenLocOrErr)
6969 return ToLParenLocOrErr.takeError();
6970 ExpectedSLoc ToRParenLocOrErr =
import(CCE->getRParenLoc());
6971 if (!ToRParenLocOrErr)
6972 return ToRParenLocOrErr.takeError();
6975 ToSubExpr, ToBasePath, ToTypeInfoAsWritten, *ToLParenLocOrErr,
6979 case Stmt::CXXFunctionalCastExprClass: {
6980 auto *FCE = cast<CXXFunctionalCastExpr>(E);
6981 ExpectedSLoc ToLParenLocOrErr =
import(FCE->getLParenLoc());
6982 if (!ToLParenLocOrErr)
6983 return ToLParenLocOrErr.takeError();
6984 ExpectedSLoc ToRParenLocOrErr =
import(FCE->getRParenLoc());
6985 if (!ToRParenLocOrErr)
6986 return ToRParenLocOrErr.takeError();
6988 Importer.getToContext(), ToType, E->
getValueKind(), ToTypeInfoAsWritten,
6989 E->
getCastKind(), ToSubExpr, ToBasePath, *ToLParenLocOrErr,
6993 case Stmt::ObjCBridgedCastExprClass: {
6994 auto *OCE = cast<ObjCBridgedCastExpr>(E);
6995 ExpectedSLoc ToLParenLocOrErr =
import(OCE->getLParenLoc());
6996 if (!ToLParenLocOrErr)
6997 return ToLParenLocOrErr.takeError();
6998 ExpectedSLoc ToBridgeKeywordLocOrErr =
import(OCE->getBridgeKeywordLoc());
6999 if (!ToBridgeKeywordLocOrErr)
7000 return ToBridgeKeywordLocOrErr.takeError();
7002 *ToLParenLocOrErr, OCE->getBridgeKind(), E->
getCastKind(),
7003 *ToBridgeKeywordLocOrErr, ToTypeInfoAsWritten, ToSubExpr);
7006 llvm_unreachable(
"Cast expression of unsupported type!");
7020 return Imp.takeError();
7021 std::tie(ToBeginLoc, ToEndLoc) = *Imp;
7030 auto ToBSOrErr =
import(FromNode.
getBase());
7032 return ToBSOrErr.takeError();
7037 auto ToFieldOrErr =
import(FromNode.
getField());
7039 return ToFieldOrErr.takeError();
7040 ToNodes.push_back(
OffsetOfNode(ToBeginLoc, *ToFieldOrErr, ToEndLoc));
7045 ToNodes.push_back(
OffsetOfNode(ToBeginLoc, ToII, ToEndLoc));
7054 if (!ToIndexExprOrErr)
7055 return ToIndexExprOrErr.takeError();
7056 ToExprs[I] = *ToIndexExprOrErr;
7059 auto Imp = importSeq(
7063 return Imp.takeError();
7068 std::tie(ToType, ToTypeSourceInfo, ToOperatorLoc, ToRParenLoc) = *Imp;
7071 Importer.getToContext(), ToType, ToOperatorLoc, ToTypeSourceInfo, ToNodes,
7072 ToExprs, ToRParenLoc);
7076 auto Imp = importSeq(
7079 return Imp.takeError();
7084 std::tie(ToType, ToOperand, ToBeginLoc, ToEndLoc) = *Imp;
7093 ToType, ToOperand, ToCanThrow, ToBeginLoc, ToEndLoc);
7099 return Imp.takeError();
7104 std::tie(ToSubExpr, ToType, ToThrowLoc) = *Imp;
7112 if (!ToUsedLocOrErr)
7113 return ToUsedLocOrErr.takeError();
7115 auto ToParamOrErr =
import(E->
getParam());
7117 return ToParamOrErr.takeError();
7119 auto UsedContextOrErr = Importer.ImportContext(E->
getUsedContext());
7120 if (!UsedContextOrErr)
7121 return UsedContextOrErr.takeError();
7132 assert(FromParam &&
"ParmVarDecl was not imported?");
7134 if (
Error Err = ImportDefaultArgOfParmVarDecl(*FromParam, ToParam))
7135 return std::move(Err);
7139 *ToParamOrErr, *UsedContextOrErr);
7144 auto Imp = importSeq(
7147 return Imp.takeError();
7152 std::tie(ToType, ToTypeSourceInfo, ToRParenLoc) = *Imp;
7155 ToType, ToTypeSourceInfo, ToRParenLoc);
7161 if (!ToSubExprOrErr)
7162 return ToSubExprOrErr.takeError();
7166 return ToDtorOrErr.takeError();
7175 auto Imp = importSeq(
7179 return Imp.takeError();
7185 std::tie(ToConstructor, ToType, ToTypeSourceInfo, ToParenOrBraceRange) = *Imp;
7189 return std::move(Err);
7192 Importer.getToContext(), ToConstructor, ToType, ToTypeSourceInfo, ToArgs,
7201 if (
Error Err = ImportDeclContext(D, DC, LexicalDC))
7202 return std::move(Err);
7207 return Imp.takeError();
7211 std::tie(Temporary, ExtendingDecl) = *Imp;
7215 if (GetImportedOrCreateDecl(To, D, Temporary, ExtendingDecl,
7226 auto Imp = importSeq(E->
getType(),
7231 return Imp.takeError();
7234 Expr *ToTemporaryExpr;
7236 std::tie(ToType, ToTemporaryExpr, ToMaterializedDecl) = *Imp;
7237 if (!ToTemporaryExpr)
7242 ToMaterializedDecl);
7248 auto Imp = importSeq(
7251 return Imp.takeError();
7256 std::tie(ToType, ToPattern, ToEllipsisLoc) = *Imp;
7263 auto Imp = importSeq(
7266 return Imp.takeError();
7270 std::tie(ToOperatorLoc, ToPack, ToPackLoc, ToRParenLoc) = *Imp;
7278 if (
Error Err = ImportTemplateArguments(
7281 ToPartialArguments))
7282 return std::move(Err);
7286 Importer.getToContext(), ToOperatorLoc, ToPack, ToPackLoc, ToRParenLoc,
7287 Length, ToPartialArguments);
7292 auto Imp = importSeq(
7298 return Imp.takeError();
7301 SourceRange ToTypeIdParens, ToSourceRange, ToDirectInitRange;
7303 Expr *ToInitializer;
7307 ToOperatorNew, ToOperatorDelete, ToTypeIdParens, ToArraySize, ToInitializer,
7308 ToType, ToAllocatedTypeSourceInfo, ToSourceRange, ToDirectInitRange) = *Imp;
7313 return std::move(Err);
7316 Importer.getToContext(), E->
isGlobalNew(), ToOperatorNew,
7319 ToInitializer, ToType, ToAllocatedTypeSourceInfo, ToSourceRange,
7324 auto Imp = importSeq(
7327 return Imp.takeError();
7333 std::tie(ToType, ToOperatorDelete, ToArgument, ToBeginLoc) = *Imp;
7342 auto Imp = importSeq(
7346 return Imp.takeError();
7352 std::tie(ToType, ToLocation, ToConstructor, ToParenOrBraceRange) = *Imp;
7356 return std::move(Err);
7359 Importer.getToContext(), ToType, ToLocation, ToConstructor,
7363 ToParenOrBraceRange);
7368 if (!ToSubExprOrErr)
7369 return ToSubExprOrErr.takeError();
7373 return std::move(Err);
7381 auto Imp = importSeq(
7384 return Imp.takeError();
7389 std::tie(ToCallee, ToType, ToRParenLoc) = *Imp;
7393 return std::move(Err);
7402 return ToTypeOrErr.takeError();
7405 if (!ToLocationOrErr)
7406 return ToLocationOrErr.takeError();
7409 *ToLocationOrErr, *ToTypeOrErr, E->
isImplicit());
7415 return ToTypeOrErr.takeError();
7418 if (!ToLocationOrErr)
7419 return ToLocationOrErr.takeError();
7422 E->
getValue(), *ToTypeOrErr, *ToLocationOrErr);
7426 auto Imp1 = importSeq(
7430 return Imp1.takeError();
7438 ToBase, ToOperatorLoc, ToQualifierLoc, ToTemplateKeywordLoc, ToMemberDecl,
7441 auto Imp2 = importSeq(
7445 return Imp2.takeError();
7449 std::tie(ToDecl, ToName, ToLoc, ToLAngleLoc, ToRAngleLoc) = *Imp2;
7461 return std::move(Err);
7462 ResInfo = &ToTAInfo;
7466 ToOperatorLoc, ToQualifierLoc, ToTemplateKeywordLoc,
7467 ToMemberDecl, ToFoundDecl, ToMemberNameInfo,
7474 auto Imp = importSeq(
7478 return Imp.takeError();
7485 ToBase, ToOperatorLoc, ToQualifierLoc, ToScopeTypeInfo, ToColonColonLoc,
7492 if (!ToDestroyedTypeLocOrErr)
7493 return ToDestroyedTypeLocOrErr.takeError();
7499 return ToTIOrErr.takeError();
7503 Importer.getToContext(), ToBase, E->
isArrow(), ToOperatorLoc,
7504 ToQualifierLoc, ToScopeTypeInfo, ToColonColonLoc, ToTildeLoc, Storage);
7509 auto Imp = importSeq(
7513 return Imp.takeError();
7518 NamedDecl *ToFirstQualifierFoundInScope;
7520 ToType, ToOperatorLoc, ToQualifierLoc, ToTemplateKeywordLoc,
7521 ToFirstQualifierFoundInScope) = *Imp;
7523 Expr *ToBase =
nullptr;
7526 ToBase = *ToBaseOrErr;
7528 return ToBaseOrErr.takeError();
7533 if (
Error Err = ImportTemplateArgumentListInfo(
7536 return std::move(Err);
7537 ResInfo = &ToTAInfo;
7541 if (!ToMemberNameInfoOrErr)
7542 return ToMemberNameInfoOrErr.takeError();
7544 std::get<0>(*ToMemberNameInfoOrErr), std::get<1>(*ToMemberNameInfoOrErr));
7546 if (
Error Err = ImportDeclarationNameLoc(
7548 return std::move(Err);
7551 Importer.getToContext(), ToBase, ToType, E->
isArrow(), ToOperatorLoc,
7552 ToQualifierLoc, ToTemplateKeywordLoc, ToFirstQualifierFoundInScope,
7553 ToMemberNameInfo, ResInfo);
7562 return Imp.takeError();
7565 SourceLocation ToTemplateKeywordLoc, ToNameLoc, ToLAngleLoc, ToRAngleLoc;
7567 std::tie(ToQualifierLoc, ToTemplateKeywordLoc, ToDeclName, ToNameLoc,
7568 ToLAngleLoc, ToRAngleLoc) = *Imp;
7572 return std::move(Err);
7579 return std::move(Err);
7580 ResInfo = &ToTAInfo;
7584 Importer.getToContext(), ToQualifierLoc, ToTemplateKeywordLoc,
7585 ToNameInfo, ResInfo);
7590 auto Imp = importSeq(
7593 return Imp.takeError();
7597 std::tie(ToLParenLoc, ToRParenLoc, ToTypeSourceInfo) = *Imp;
7602 return std::move(Err);
7605 Importer.getToContext(), ToTypeSourceInfo, ToLParenLoc,
7606 llvm::makeArrayRef(ToArgs), ToRParenLoc);
7612 if (!ToNamingClassOrErr)
7613 return ToNamingClassOrErr.takeError();
7616 if (!ToQualifierLocOrErr)
7617 return ToQualifierLocOrErr.takeError();
7620 if (!ToNameInfoOrErr)
7621 return ToNameInfoOrErr.takeError();
7623 std::get<0>(*ToNameInfoOrErr), std::get<1>(*ToNameInfoOrErr));
7626 return std::move(Err);
7629 for (
auto *D : E->
decls())
7630 if (
auto ToDOrErr =
import(D))
7631 ToDecls.
addDecl(cast<NamedDecl>(*ToDOrErr));
7633 return ToDOrErr.takeError();
7637 if (
Error Err = ImportTemplateArgumentListInfo(
7640 return std::move(Err);
7643 if (!ToTemplateKeywordLocOrErr)
7644 return ToTemplateKeywordLocOrErr.takeError();
7647 Importer.getToContext(), *ToNamingClassOrErr, *ToQualifierLocOrErr,
7648 *ToTemplateKeywordLocOrErr, ToNameInfo, E->
requiresADL(), &ToTAInfo,
7653 Importer.getToContext(), *ToNamingClassOrErr, *ToQualifierLocOrErr,
7660 auto Imp1 = importSeq(
7664 return Imp1.takeError();
7669 std::tie(ToType, ToOperatorLoc, ToQualifierLoc, ToTemplateKeywordLoc) = *Imp1;
7673 return Imp2.takeError();
7677 return std::move(Err);
7681 if (
auto ToDOrErr =
import(D))
7682 ToDecls.
addDecl(cast<NamedDecl>(*ToDOrErr));
7684 return ToDOrErr.takeError();
7691 if (
Error Err = ImportTemplateArgumentListInfo(FromTAInfo, ToTAInfo))
7692 return std::move(Err);
7693 ResInfo = &ToTAInfo;
7696 Expr *ToBase =
nullptr;
7699 ToBase = *ToBaseOrErr;
7701 return ToBaseOrErr.takeError();
7706 E->
isArrow(), ToOperatorLoc, ToQualifierLoc, ToTemplateKeywordLoc,
7707 ToNameInfo, ResInfo, ToDecls.
begin(), ToDecls.
end());
7713 return Imp.takeError();
7718 std::tie(ToCallee, ToType, ToRParenLoc) = *Imp;
7723 return std::move(Err);
7725 if (
const auto *OCE = dyn_cast<CXXOperatorCallExpr>(E)) {
7727 Importer.getToContext(), OCE->getOperator(), ToCallee, ToArgs, ToType,
7728 OCE->getValueKind(), ToRParenLoc, OCE->getFPFeatures(),
7729 OCE->getADLCallKind());
7739 auto ToClassOrErr =
import(FromClass);
7741 return ToClassOrErr.takeError();
7746 return ToCallOpOrErr.takeError();
7750 for (
const auto &FromCapture : E->
captures()) {
7751 if (
auto ToCaptureOrErr =
import(FromCapture))
7752 ToCaptures.push_back(*ToCaptureOrErr);
7754 return ToCaptureOrErr.takeError();
7759 return std::move(Err);
7761 auto Imp = importSeq(
7764 return Imp.takeError();
7768 std::tie(ToIntroducerRange, ToCaptureDefaultLoc, ToEndLoc) = *Imp;
7771 Importer.getToContext(), ToClass, ToIntroducerRange,
7781 return Imp.takeError();
7785 std::tie(ToLBraceLoc, ToRBraceLoc, ToType) = *Imp;
7788 if (
Error Err = ImportContainerChecked(E->
inits(), ToExprs))
7789 return std::move(Err);
7793 ToCtx, ToLBraceLoc, ToExprs, ToRBraceLoc);
7800 return ToFillerOrErr.takeError();
7804 if (
auto ToFDOrErr =
import(FromFD))
7807 return ToFDOrErr.takeError();
7811 if (
auto ToSyntFormOrErr =
import(SyntForm))
7814 return ToSyntFormOrErr.takeError();
7828 return ToTypeOrErr.takeError();
7831 if (!ToSubExprOrErr)
7832 return ToSubExprOrErr.takeError();
7835 *ToTypeOrErr, *ToSubExprOrErr);
7842 return Imp.takeError();
7847 std::tie(ToLocation, ToType, ToConstructor) = *Imp;
7857 return Imp.takeError();
7860 Expr *ToCommonExpr, *ToSubExpr;
7861 std::tie(ToType, ToCommonExpr, ToSubExpr) = *Imp;
7864 ToType, ToCommonExpr, ToSubExpr);
7870 return ToTypeOrErr.takeError();
7876 if (!ToBeginLocOrErr)
7877 return ToBeginLocOrErr.takeError();
7879 auto ToFieldOrErr =
import(E->
getField());
7881 return ToFieldOrErr.takeError();
7883 auto UsedContextOrErr = Importer.ImportContext(E->
getUsedContext());
7884 if (!UsedContextOrErr)
7885 return UsedContextOrErr.takeError();
7888 Importer.getToContext(), *ToBeginLocOrErr, *ToFieldOrErr, *UsedContextOrErr);
7892 auto Imp = importSeq(
7896 return Imp.takeError();
7904 ToType, ToSubExpr, ToTypeInfoAsWritten, ToOperatorLoc, ToRParenLoc,
7905 ToAngleBrackets) = *Imp;
7909 auto ToBasePathOrErr = ImportCastPath(E);
7910 if (!ToBasePathOrErr)
7911 return ToBasePathOrErr.takeError();
7913 if (isa<CXXStaticCastExpr>(E)) {
7915 Importer.getToContext(), ToType, VK, CK, ToSubExpr, &(*ToBasePathOrErr),
7916 ToTypeInfoAsWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
7917 }
else if (isa<CXXDynamicCastExpr>(E)) {
7919 Importer.getToContext(), ToType, VK, CK, ToSubExpr, &(*ToBasePathOrErr),
7920 ToTypeInfoAsWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
7921 }
else if (isa<CXXReinterpretCastExpr>(E)) {
7923 Importer.getToContext(), ToType, VK, CK, ToSubExpr, &(*ToBasePathOrErr),
7924 ToTypeInfoAsWritten, ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
7925 }
else if (isa<CXXConstCastExpr>(E)) {
7927 Importer.getToContext(), ToType, VK, ToSubExpr, ToTypeInfoAsWritten,
7928 ToOperatorLoc, ToRParenLoc, ToAngleBrackets);
7930 llvm_unreachable(
"Unknown cast type");
7931 return make_error<ImportError>();
7937 auto Imp = importSeq(
7940 return Imp.takeError();
7945 Expr *ToReplacement;
7946 std::tie(ToType, ToExprLoc, ToParameter, ToReplacement) = *Imp;
7949 ToType, E->
getValueKind(), ToExprLoc, ToParameter, ToReplacement);
7953 auto Imp = importSeq(
7956 return Imp.takeError();
7960 std::tie(ToType, ToBeginLoc, ToEndLoc) = *Imp;
7963 if (
Error Err = ImportContainerChecked(E->
getArgs(), ToArgs))
7964 return std::move(Err);
7971 Importer.getToContext(), ToType, ToBeginLoc, E->
getTrait(), ToArgs,
7978 return ToTypeOrErr.takeError();
7981 if (!ToSourceRangeOrErr)
7982 return ToSourceRangeOrErr.takeError();
7987 *ToTypeOrErr, *ToTSIOrErr, *ToSourceRangeOrErr);
7989 return ToTSIOrErr.takeError();
7993 if (!ToExprOperandOrErr)
7994 return ToExprOperandOrErr.takeError();
7997 *ToTypeOrErr, *ToExprOperandOrErr, *ToSourceRangeOrErr);
8002 Error ImportErrors = Error::success();
8004 if (
auto ImportedOrErr =
import(FromOverriddenMethod))
8006 (*ImportedOrErr)->getCanonicalDecl()));
8009 joinErrors(std::move(ImportErrors), ImportedOrErr.takeError());
8011 return ImportErrors;
8017 std::shared_ptr<ASTImporterSharedState> SharedState)
8018 : SharedState(SharedState), ToContext(ToContext), FromContext(FromContext),
8019 ToFileManager(ToFileManager), FromFileManager(FromFileManager),
8024 this->SharedState = std::make_shared<ASTImporterSharedState>();
8034 assert(F && (isa<FieldDecl>(*F) || isa<IndirectFieldDecl>(*F)) &&
8035 "Try to get field index for non-field.");
8042 for (
const auto *D : Owner->decls()) {
8046 if (isa<FieldDecl>(*D) || isa<IndirectFieldDecl>(*D))
8050 llvm_unreachable(
"Field was not found in its parent context.");
8065 if (SharedState->getLookupTable()) {
8067 SharedState->getLookupTable()->lookup(ReDC, Name);
8068 return FoundDeclsTy(LookupResult.begin(), LookupResult.end());
8088 void ASTImporter::AddToLookupTable(
Decl *ToD) {
8089 SharedState->addDeclToLookup(ToD);
8095 return Importer.
Visit(FromD);
8109 llvm::DenseMap<const Type *, const Type *>::iterator Pos
8110 = ImportedTypes.find(FromTy);
8111 if (Pos != ImportedTypes.end())
8118 return ToTOrErr.takeError();
8121 ImportedTypes[FromTy] = (*ToTOrErr).getTypePtr();
8134 return TOrErr.takeError();
8137 return BeginLocOrErr.takeError();
8143 Attr *ToAttr = FromAttr->
clone(ToContext);
8147 return ToRangeOrErr.takeError();
8153 auto Pos = ImportedDecls.find(FromD);
8154 if (Pos != ImportedDecls.end())
8161 auto FromDPos = ImportedFromDecls.find(ToD);
8162 if (FromDPos == ImportedFromDecls.end())
8164 return FromDPos->second->getTranslationUnitDecl();
8172 ImportPath.
push(FromD);
8173 auto ImportPathBuilder =
8174 llvm::make_scope_exit([
this]() { ImportPath.
pop(); });
8179 return make_error<ImportError>(*
Error);
8185 if (
auto Error = SharedState->getImportDeclErrorIfAny(ToD)) {
8187 return make_error<ImportError>(*Error);
8204 auto Pos = ImportedDecls.find(FromD);
8205 if (Pos != ImportedDecls.end()) {
8208 auto *ToD = Pos->second;
8209 ImportedDecls.erase(Pos);
8221 auto PosF = ImportedFromDecls.find(ToD);
8222 if (PosF != ImportedFromDecls.end()) {
8223 SharedState->removeDeclFromLookup(ToD);
8224 ImportedFromDecls.erase(PosF);
8236 handleAllErrors(ToDOrErr.takeError(),
8240 if (Pos != ImportedDecls.end())
8241 SharedState->setImportDeclError(Pos->second, ErrOut);
8245 for (
const auto &Path : SavedImportPaths[FromD])
8246 for (
Decl *FromDi : Path) {
8250 auto Ii = ImportedDecls.find(FromDi);
8251 if (Ii != ImportedDecls.end())
8252 SharedState->setImportDeclError(Ii->second, ErrOut);
8256 SavedImportPaths[FromD].clear();
8259 return make_error<ImportError>(ErrOut);
8271 return make_error<ImportError>(*Err);
8277 if (
auto Error = SharedState->getImportDeclErrorIfAny(ToD)) {
8279 return make_error<ImportError>(*Error);
8283 assert(ImportedDecls.count(FromD) != 0 &&
"Missing call to MapImported?");
8289 SavedImportPaths[FromD].clear();
8299 return ToDCOrErr.takeError();
8300 auto *ToDC = cast<DeclContext>(*ToDCOrErr);
8304 if (
auto *ToRecord = dyn_cast<RecordDecl>(ToDC)) {
8305 auto *FromRecord = cast<RecordDecl>(FromDC);
8306 if (ToRecord->isCompleteDefinition()) {
8308 }
else if (FromRecord->isCompleteDefinition()) {
8311 return std::move(Err);
8315 }
else if (
auto *ToEnum = dyn_cast<EnumDecl>(ToDC)) {
8316 auto *FromEnum = cast<EnumDecl>(FromDC);
8317 if (ToEnum->isCompleteDefinition()) {
8319 }
else if (FromEnum->isCompleteDefinition()) {
8322 return std::move(Err);
8326 }
else if (
auto *ToClass = dyn_cast<ObjCInterfaceDecl>(ToDC)) {
8327 auto *FromClass = cast<ObjCInterfaceDecl>(FromDC);
8328 if (ToClass->getDefinition()) {
8333 return std::move(Err);
8337 }
else if (
auto *ToProto = dyn_cast<ObjCProtocolDecl>(ToDC)) {
8338 auto *FromProto = cast<ObjCProtocolDecl>(FromDC);
8339 if (ToProto->getDefinition()) {
8344 return std::move(Err);
8355 return cast_or_null<Expr>(*ToSOrErr);
8357 return ToSOrErr.takeError();
8365 llvm::DenseMap<Stmt *, Stmt *>::iterator Pos = ImportedStmts.find(FromS);
8366 if (Pos != ImportedStmts.end())
8375 if (
auto *ToE = dyn_cast<Expr>(*ToSOrErr)) {
8376 auto *FromE = cast<Expr>(FromS);
8379 ToE->setValueKind(FromE->getValueKind());
8380 ToE->setObjectKind(FromE->getObjectKind());
8381 ToE->setTypeDependent(FromE->isTypeDependent());
8382 ToE->setValueDependent(FromE->isValueDependent());
8383 ToE->setInstantiationDependent(FromE->isInstantiationDependent());
8384 ToE->setContainsUnexpandedParameterPack(
8385 FromE->containsUnexpandedParameterPack());
8389 ImportedStmts[FromS] = *ToSOrErr;
8400 return std::move(Err);
8404 assert(FromNNS->
getAsIdentifier() &&
"NNS should contain identifier.");
8411 cast<NamespaceDecl>(*NSOrErr));
8413 return NSOrErr.takeError();
8418 cast<NamespaceAliasDecl>(*NSADOrErr));
8420 return NSADOrErr.takeError();
8428 cast<CXXRecordDecl>(*RDOrErr));
8430 return RDOrErr.takeError();
8439 TyOrErr->getTypePtr());
8441 return TyOrErr.takeError();
8445 llvm_unreachable(
"Invalid nested name specifier kind");
8457 NestedNames.push_back(NNS);
8463 while (!NestedNames.empty()) {
8464 NNS = NestedNames.pop_back_val();
8467 return std::move(Err);
8474 return std::move(Err);
8478 return std::move(Err);
8494 ToLocalBeginLoc, ToLocalEndLoc);
8501 return std::move(Err);
8521 if (!ToSourceRangeOrErr)
8522 return ToSourceRangeOrErr.takeError();
8525 ToSourceRangeOrErr->getBegin(),
8526 ToSourceRangeOrErr->getEnd());
8538 return TemplateName(cast<TemplateDecl>(*ToTemplateOrErr));
8540 return ToTemplateOrErr.takeError();
8545 for (
auto *I : *FromStorage) {
8546 if (
auto ToOrErr =
Import(I))
8547 ToTemplates.
addDecl(cast<NamedDecl>(*ToOrErr));
8549 return ToOrErr.takeError();
8559 return DeclNameOrErr.takeError();
8566 if (!QualifierOrErr)
8567 return QualifierOrErr.takeError();
8572 cast<TemplateDecl>(*ToTemplateOrErr));
8574 return ToTemplateOrErr.takeError();
8580 if (!QualifierOrErr)
8581 return QualifierOrErr.takeError();
8597 return ParamOrErr.takeError();
8600 if (!ReplacementOrErr)
8601 return ReplacementOrErr.takeError();
8604 cast<TemplateTemplateParmDecl>(*ParamOrErr), *ReplacementOrErr);
8612 return ParamOrErr.takeError();
8618 return ArgPackOrErr.takeError();
8621 cast<TemplateTemplateParmDecl>(*ParamOrErr), *ArgPackOrErr);
8625 llvm_unreachable(
"Invalid template name kind");
8638 return ToFileIDOrErr.takeError();
8646 return std::move(Err);
8648 return std::move(Err);
8654 llvm::DenseMap<FileID, FileID>::iterator Pos = ImportedFileIDs.find(FromID);
8655 if (Pos != ImportedFileIDs.end())
8668 return ToSpLoc.takeError();
8671 return ToExLocS.takeError();
8672 unsigned TokenLen = FromSM.getFileIDSize(FromID);
8681 return ToExLocE.takeError();
8691 return ToIncludeLoc.takeError();
8711 bool Invalid =
true;
8712 const llvm::MemoryBuffer *FromBuf =
8715 if (!FromBuf || Invalid)
8719 std::unique_ptr<llvm::MemoryBuffer> ToBuf =
8720 llvm::MemoryBuffer::getMemBufferCopy(FromBuf->getBuffer(),
8721 FromBuf->getBufferIdentifier());
8727 assert(ToID.
isValid() &&
"Unexpected invalid fileID was created.");
8729 ImportedFileIDs[FromID] = ToID;
8731 if (FileIDImportHandler)
8732 FileIDImportHandler(ToID, FromID);
8740 return ToExprOrErr.takeError();
8743 if (!LParenLocOrErr)
8744 return LParenLocOrErr.takeError();
8747 if (!RParenLocOrErr)
8748 return RParenLocOrErr.takeError();
8753 return ToTInfoOrErr.takeError();
8758 return std::move(Err);
8761 ToContext, *ToTInfoOrErr, From->
isBaseVirtual(), *LParenLocOrErr,
8762 *ToExprOrErr, *RParenLocOrErr, EllipsisLoc);
8766 return ToFieldOrErr.takeError();
8769 if (!MemberLocOrErr)
8770 return MemberLocOrErr.takeError();
8773 ToContext, cast_or_null<FieldDecl>(*ToFieldOrErr), *MemberLocOrErr,
8774 *LParenLocOrErr, *ToExprOrErr, *RParenLocOrErr);
8778 return ToIFieldOrErr.takeError();
8781 if (!MemberLocOrErr)
8782 return MemberLocOrErr.takeError();
8785 ToContext, cast_or_null<IndirectFieldDecl>(*ToIFieldOrErr),
8786 *MemberLocOrErr, *LParenLocOrErr, *ToExprOrErr, *RParenLocOrErr);
8790 return ToTInfoOrErr.takeError();
8792 return new (ToContext)
8794 *ToExprOrErr, *RParenLocOrErr);
8797 return make_error<ImportError>();
8803 auto Pos = ImportedCXXBaseSpecifiers.find(BaseSpec);
8804 if (Pos != ImportedCXXBaseSpecifiers.end())
8809 return ToSourceRange.takeError();
8812 return ToTSI.takeError();
8815 return ToEllipsisLoc.takeError();
8819 ImportedCXXBaseSpecifiers[BaseSpec] =
Imported;
8826 return ToOrErr.takeError();
8827 Decl *To = *ToOrErr;
8829 auto *FromDC = cast<DeclContext>(From);
8832 if (
auto *ToRecord = dyn_cast<RecordDecl>(To)) {
8833 if (!ToRecord->getDefinition()) {
8834 return Importer.ImportDefinition(
8835 cast<RecordDecl>(FromDC), ToRecord,
8840 if (
auto *ToEnum = dyn_cast<EnumDecl>(To)) {
8841 if (!ToEnum->getDefinition()) {
8842 return Importer.ImportDefinition(
8847 if (
auto *ToIFace = dyn_cast<ObjCInterfaceDecl>(To)) {
8848 if (!ToIFace->getDefinition()) {
8849 return Importer.ImportDefinition(
8850 cast<ObjCInterfaceDecl>(FromDC), ToIFace,
8855 if (
auto *ToProto = dyn_cast<ObjCProtocolDecl>(To)) {
8856 if (!ToProto->getDefinition()) {
8857 return Importer.ImportDefinition(
8858 cast<ObjCProtocolDecl>(FromDC), ToProto,
8863 return Importer.ImportDeclContext(FromDC,
true);
8880 return ToSelOrErr.takeError();
8887 return ToTyOrErr.takeError();
8895 return ToTyOrErr.takeError();
8901 cast<TemplateDecl>(*ToTemplateOrErr));
8903 return ToTemplateOrErr.takeError();
8911 return ToTyOrErr.takeError();
8927 llvm_unreachable(
"Invalid DeclarationName Kind!");
8948 for (
unsigned I = 1, N = FromSel.
getNumArgs(); I < N; ++I)
8957 unsigned NumDecls) {
8967 if (LastDiagFromFrom)
8970 LastDiagFromFrom =
false;
8975 if (!LastDiagFromFrom)
8978 LastDiagFromFrom =
true;
8983 if (
auto *
ID = dyn_cast<ObjCInterfaceDecl>(D)) {
8984 if (!
ID->getDefinition())
8985 ID->startDefinition();
8987 else if (
auto *PD = dyn_cast<ObjCProtocolDecl>(D)) {
8988 if (!PD->getDefinition())
8989 PD->startDefinition();
8991 else if (
auto *TD = dyn_cast<TagDecl>(D)) {
8992 if (!TD->getDefinition() && !TD->isBeingDefined()) {
8993 TD->startDefinition();
8994 TD->setCompleteDefinition(
true);
8998 assert(0 &&
"CompleteDecl called on a Decl that can't be completed");
9003 llvm::DenseMap<Decl *, Decl *>::iterator Pos = ImportedDecls.find(From);
9004 assert((Pos == ImportedDecls.end() || Pos->second == To) &&
9005 "Try to import an already imported Decl");
9006 if (Pos != ImportedDecls.end())
9008 ImportedDecls[From] = To;
9011 ImportedFromDecls[To] = From;
9012 AddToLookupTable(To);
9018 auto Pos = ImportDeclErrors.find(FromD);
9019 if (Pos != ImportDeclErrors.end())
9026 auto InsertRes = ImportDeclErrors.insert({From, Error});
9030 assert(InsertRes.second || InsertRes.first->second.Error == Error.
Error);
9035 llvm::DenseMap<const Type *, const Type *>::iterator Pos =
9037 if (Pos != ImportedTypes.end()) {
9042 llvm::consumeError(ToFromOrErr.takeError());
9049 return Ctx.IsEquivalent(From, To);
SourceLocation getRParenLoc() const
ExpectedStmt VisitNullStmt(NullStmt *S)
const Expr * getSubExpr() const
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
virtual Expected< Decl * > ImportImpl(Decl *From)
Can be overwritten by subclasses to implement their own import logic.
TemplateTemplateParmDecl * getParameterPack() const
Retrieve the template template parameter pack being substituted.
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
Represents a type that was referred to using an elaborated type keyword, e.g., struct S...
void setScopeInfo(unsigned scopeDepth, unsigned parameterIndex)
ObjCPropertyQueryKind getQueryKind() const
const FileEntry * OrigEntry
Reference to the file entry representing this ContentCache.
SourceLocation getRParenLoc() const
VarDecl * getCapturedVar() const
Retrieve the declaration of the local variable being captured.
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...
This represents a GCC inline-assembly statement extension.
void setImplicit(bool I=true)
Represents a function declaration or definition.
SourceLocation getForLoc() const
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
ExpectedDecl VisitLinkageSpecDecl(LinkageSpecDecl *D)
bool isImplicit() const
Determine whether this was an implicit capture (not written between the square brackets introducing t...
void localUncachedLookup(DeclarationName Name, SmallVectorImpl< NamedDecl *> &Results)
A simplistic name lookup mechanism that performs name lookup into this declaration context without co...
ExpectedStmt VisitOpaqueValueExpr(OpaqueValueExpr *E)
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.
unsigned getNumInputs() const
ExpectedStmt VisitExpr(Expr *E)
SourceLocation getRParenLoc() const
void setArrayFiller(Expr *filler)
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
SourceLocation getBeginLoc() const
Expected< ObjCTypeParamList * > ImportObjCTypeParamList(ObjCTypeParamList *list)
ExpectedDecl VisitObjCIvarDecl(ObjCIvarDecl *D)
ArrayRef< TemplateArgumentLoc > template_arguments() const
const char * getDeclKindName() const
StringKind getKind() const
ExpectedType VisitElaboratedType(const ElaboratedType *T)
ExpectedDecl VisitUsingDecl(UsingDecl *D)
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.
void setCompleteDefinition(bool V=true)
True if this decl has its body fully specified.
unsigned param_size() const
Error ImportArrayChecked(IIter Ibegin, IIter Iend, OIter Obegin)
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)...
ObjCInterfaceDecl * getClassInterface()
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
Get the location of the ... in a case statement of the form LHS ... RHS.
SourceLocation getLParen() const
Get the location of the left parentheses '('.
const Expr * getSubExpr() const
SourceLocation getEllipsisLoc() const
Get the location of the ellipsis if this is a pack expansion.
SourceLocation getLParenLoc() const
ExpectedDecl VisitVarTemplateDecl(VarTemplateDecl *D)
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
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.
SourceRange getBraceRange() const
CompoundStmt * getSubStmt()
InClassInitStyle getInClassInitStyle() const
Get the kind of (C++11) default member initializer that this field has.
ArrayRef< TemplateArgument > getTypeConstraintArguments() const
Expr * getUnderlyingExpr() const
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.
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
ExpectedDecl VisitTypeAliasDecl(TypeAliasDecl *D)
IfStmt - This represents an if/then/else.
ClassTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
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
ExpectedDecl VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D)
ExpectedStmt VisitObjCAtTryStmt(ObjCAtTryStmt *S)
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.
StorageClass getStorageClass() const
Returns the storage class as written in the source.
static UnresolvedMemberExpr * Create(const ASTContext &Context, bool HasUnresolvedUsing, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
void setTypedefNameForAnonDecl(TypedefNameDecl *TDD)
Represents the declaration of a typedef-name via the 'typedef' type specifier.
llvm::Expected< T > Expected
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...
ExpectedDecl VisitParmVarDecl(ParmVarDecl *D)
ExpectedStmt VisitUnresolvedMemberExpr(UnresolvedMemberExpr *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...
ArrayRef< CleanupObject > getObjects() const
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
bool isInitICE() const
Determines whether the initializer is an integral constant expression, or in C++11, whether the initializer is a constant expression.
ExpectedStmt VisitDoStmt(DoStmt *S)
ExpectedStmt VisitExpressionTraitExpr(ExpressionTraitExpr *E)
QualType getQualifiedType(SplitQualType split) const
Un-split a SplitQualType.
Decl - This represents one declaration (or definition), e.g.
void setRangeEnd(SourceLocation E)
bool hasLeadingEmptyMacro() const
Stmt * getHandlerBlock() const
ExpectedStmt VisitBinaryConditionalOperator(BinaryConditionalOperator *E)
ExpectedDecl VisitRecordDecl(RecordDecl *D)
llvm::APFloat getValue() const
SourceLocation getBeginLoc() const LLVM_READONLY
ExpectedStmt VisitBreakStmt(BreakStmt *S)
static const ASTTemplateArgumentListInfo * Create(const ASTContext &C, const TemplateArgumentListInfo &List)
Represents the index of the current element of an array being initialized by an ArrayInitLoopExpr.
FunctionDecl * getOperatorNew() const
ExpectedStmt VisitObjCAtSynchronizedStmt(ObjCAtSynchronizedStmt *S)
ExpectedStmt VisitVAArgExpr(VAArgExpr *E)
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
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.
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
ExpectedStmt VisitCXXNullPtrLiteralExpr(CXXNullPtrLiteralExpr *E)
Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained by a type-constraint.
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)
ExpectedStmt VisitLabelStmt(LabelStmt *S)
Represents an attribute applied to a statement.
bool hasWrittenPrototype() const
Whether this function has a written prototype.
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
ExpectedStmt VisitParenListExpr(ParenListExpr *E)
Error ImportTemplateInformation(FunctionDecl *FromFD, FunctionDecl *ToFD)
SourceLocation getColonLoc() const
The location of the colon following the access specifier.
The base class of the type hierarchy.
Represents an empty-declaration.
ExpectedStmt VisitStmt(Stmt *S)
Represents Objective-C's @throw statement.
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called...
ExpectedStmt VisitDefaultStmt(DefaultStmt *S)
Each ExpansionInfo encodes the expansion location - where the token was ultimately expanded...
DiagnosticsEngine & getDiagnostics() const
ExpectedType VisitUnresolvedUsingType(const UnresolvedUsingType *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.
ExpectedStmt VisitAttributedStmt(AttributedStmt *S)
Represents a call to a C++ constructor.
SourceLocation getBeginLoc() const LLVM_READONLY
DeclarationName getDeclName() const
Get the name of the template.
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.
SourceLocation getEndLoc() const LLVM_READONLY
VecTy copyCycleAtBack() const
Returns the copy of the cycle.
ExpectedDecl VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D)
A container of type source information.
RefQualifierKind RefQualifier
ExpectedStmt VisitExprWithCleanups(ExprWithCleanups *E)
Store information needed for an explicit specifier.
QualType getValueType() const
Gets the type contained by this atomic type, i.e.
bool isEmpty() const
Evaluates true when this declaration name is empty.
ExpectedStmt VisitFloatingLiteral(FloatingLiteral *E)
static AttributedStmt * Create(const ASTContext &C, SourceLocation Loc, ArrayRef< const Attr *> Attrs, Stmt *SubStmt)
bool hasAutoReturnTypeDeclaredInside(FunctionDecl *D)
IdentKind getIdentKind() const
ExpectedType VisitDependentTemplateSpecializationType(const DependentTemplateSpecializationType *T)
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getGotoLoc() const
void setTemplateArgsInfo(const TemplateArgumentListInfo &ArgsInfo)
ExpectedDecl VisitFieldDecl(FieldDecl *D)
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 getRParenLoc() const
const Expr * getAnyInitializer() const
Get the initializer for this variable, no matter which declaration it is attached to...
SourceLocation getColonLoc() const
Retrieve the location of the ':' separating the type parameter name from the explicitly-specified bou...
bool isPackExpansion() const
Determine whether this capture is a pack expansion, which captures a function parameter pack...
Not supported node or case.
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.
ExpectedType VisitComplexType(const ComplexType *T)
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
ExpectedDecl VisitNamespaceAliasDecl(NamespaceAliasDecl *D)
SourceLocation getLocalBeginLoc() const
Retrieve the location of the beginning of this component of the nested-name-specifier.
void createImplicitParams(ASTContext &Context, const ObjCInterfaceDecl *ID)
createImplicitParams - Used to lazily create the self and cmd implict parameters. ...
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.
const Expr * getSubExpr() const
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
static CXXOperatorCallExpr * Create(const ASTContext &Ctx, OverloadedOperatorKind OpKind, Expr *Fn, ArrayRef< Expr *> Args, QualType Ty, ExprValueKind VK, SourceLocation OperatorLoc, FPOptions FPFeatures, ADLCallKind UsesADL=NotADL)
ExpectedStmt VisitImplicitCastExpr(ImplicitCastExpr *E)
const IdentifierInfo * getIdentifier() const
Returns the identifier to which this template name refers.
SourceLocation getCoawaitLoc() const
std::tuple< FunctionTemplateDecl *, TemplateArgsTy > FunctionTemplateAndArgsTy
Expr * getIndexExpr(unsigned Idx)
bool isIndirectMemberInitializer() const
An identifier, stored as an IdentifierInfo*.
SourceLocation getBeginLoc() 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.
Expected< CXXCastPath > ImportCastPath(CastExpr *E)
static CXXConstructExpr * Create(const ASTContext &Ctx, QualType Ty, SourceLocation Loc, CXXConstructorDecl *Ctor, bool Elidable, ArrayRef< Expr *> Args, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization, ConstructionKind ConstructKind, SourceRange ParenOrBraceRange)
Create a C++ construction expression.
Represents a variable declaration or definition.
ExpectedType VisitIncompleteArrayType(const IncompleteArrayType *T)
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.
ExpectedType VisitTypeOfType(const TypeOfType *T)
ExpectedDecl VisitLabelDecl(LabelDecl *D)
CompoundLiteralExpr - [C99 6.5.2.5].
ExpectedDecl VisitImplicitParamDecl(ImplicitParamDecl *D)
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.
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
ExpectedType VisitAtomicType(const AtomicType *T)
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.
SourceRange getSourceRange() const
bool hasInheritedDefaultArg() const
decl_range decls() const
decls_begin/decls_end - Iterate over the declarations stored in this context.
ExpectedType VisitRValueReferenceType(const RValueReferenceType *T)
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...
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
ExpectedType VisitObjCObjectType(const ObjCObjectType *T)
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.
TranslationUnitDecl * GetFromTU(Decl *ToD)
Return the translation unit from where the declaration was imported.
Implicit construction of a std::initializer_list<T> object from an array temporary within list-initia...
llvm::PointerUnion< NamedDecl *, TypeSourceInfo * > FriendUnion
SourceLocation getIfLoc() const
Stores a list of template parameters for a TemplateDecl and its derived classes.
unsigned getNumPlacementArgs() const
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.
static CXXDefaultInitExpr * Create(const ASTContext &Ctx, SourceLocation Loc, FieldDecl *Field, DeclContext *UsedContext)
Field is the non-static data member whose default initializer is used by this expression.
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.
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will call.
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.
Represents the result of substituting a type for a template type parameter.
static CXXTemporaryObjectExpr * Create(const ASTContext &Ctx, CXXConstructorDecl *Cons, QualType Ty, TypeSourceInfo *TSI, ArrayRef< Expr *> Args, SourceRange ParenOrBraceRange, bool HadMultipleCandidates, bool ListInitialization, bool StdInitListInitialization, bool ZeroInitialization)
DeclarationNameInfo getNameInfo() const
Defines the clang::Expr interface and subclasses for C++ expressions.
SourceLocation getRParenLoc() const
QualType getIntegralType() const
Retrieve the type of the integral value.
void removeDecl(Decl *D)
Removes a declaration from this context.
Represents the builtin template declaration which is used to implement __make_integer_seq and other b...
CXXRecordDecl * getLambdaClass() const
Retrieve the class that corresponds to the lambda.
SourceLocation getBuiltinLoc() const
const ObjCInterfaceDecl * getSuperClass() const
ExpectedDecl VisitFunctionTemplateDecl(FunctionTemplateDecl *D)
SubstTemplateTemplateParmStorage * getAsSubstTemplateTemplateParm() const
Retrieve the substituted template template parameter, if known.
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.
ExpectedStmt VisitForStmt(ForStmt *S)
static CXXUnresolvedConstructExpr * Create(const ASTContext &Context, TypeSourceInfo *Type, SourceLocation LParenLoc, ArrayRef< Expr *> Args, SourceLocation RParenLoc)
ExpectedStmt VisitCompoundStmt(CompoundStmt *S)
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.
ExpectedDecl VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D)
SourceLocation getVarianceLoc() const
Retrieve the location of the variance keyword.
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the class template specialization.
Description of a constructor that was inherited from a base class.
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
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.
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 '~'.
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
ExpectedDecl VisitDecl(Decl *D)
ValueDecl * getExtendingDecl()
StringLiteral * getMessage()
bool cleanupsHaveSideEffects() const
QualType getComputationResultType() const
bool isInAnonymousNamespace() const
bool isArrayRangeDesignator() const
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)
CXXRecordDecl * getPreviousDecl()
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.
The results of name lookup within a DeclContext.
bool CheckedICE
Whether we already checked whether this statement was an integral constant expression.
NamespaceDecl * getNamespace()
Retrieve the namespace declaration aliased by this directive.
ConstexprSpecKind getConstexprKind() const
The template argument is an integral value stored in an llvm::APSInt that was provided for an integra...
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.
SourceLocation getBeginLoc() const LLVM_READONLY
field_range fields() const
SourceLocation getAmpAmpLoc() const
SourceLocation getBeginLoc() const LLVM_READONLY
ExpectedStmt VisitCXXThisExpr(CXXThisExpr *E)
NameKind getNameKind() const
Determine what kind of name this is.
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.
ExpectedStmt VisitChooseExpr(ChooseExpr *E)
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.
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. ...
ExpectedStmt VisitCXXTypeidExpr(CXXTypeidExpr *E)
SourceLocation getBeginLoc() const LLVM_READONLY
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.
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.
ExpectedDecl VisitObjCMethodDecl(ObjCMethodDecl *D)
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)
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
SourceLocation getRBraceLoc() const
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.
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 there is...
bool isInIdentifierNamespace(unsigned NS) const
unsigned getPosition() const
Get the position of the template parameter within its parameter list.
ExpectedStmt VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E)
TemplateName getOverloadedTemplateName(UnresolvedSetIterator Begin, UnresolvedSetIterator End) const
Retrieve the template name that corresponds to a non-empty lookup.
void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const
Copies the template arguments into the given structure.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
ExpectedStmt VisitArrayTypeTraitExpr(ArrayTypeTraitExpr *E)
Represents a C++ member access expression for which lookup produced a set of overloaded functions...
protocol_iterator protocol_end() const
ExpectedStmt VisitWhileStmt(WhileStmt *S)
ExpectedStmt VisitCXXThrowExpr(CXXThrowExpr *E)
ExpectedType VisitDecayedType(const DecayedType *T)
const DeclGroupRef getDeclGroup() const
Represents an access specifier followed by colon ':'.
SourceLocation getBeginLoc() const LLVM_READONLY
void startDefinition()
Starts the definition of this Objective-C protocol.
ExpectedDecl VisitVarTemplateSpecializationDecl(VarTemplateSpecializationDecl *D)
SourceLocation getQuestionLoc() const
void addShadowDecl(UsingShadowDecl *S)
static CXXRecordDecl * CreateLambda(const ASTContext &C, DeclContext *DC, TypeSourceInfo *Info, SourceLocation Loc, bool DependentLambda, bool IsGeneric, LambdaCaptureDefault CaptureDefault)
SourceLocation getTemplateLoc() const
ExpectedStmt VisitCXXNewExpr(CXXNewExpr *E)
TemplateName getReplacement() const
ExpectedStmt VisitUnaryOperator(UnaryOperator *E)
LambdaCaptureDefault getCaptureDefault() const
Determine the default capture kind for this lambda.
unsigned getIndex() const
Retrieve the index into its type parameter list.
LLVM_NODISCARD llvm::Error ImportDefinition(Decl *From)
Import the definition of the given declaration, including all of the declarations it contains...
ArrayRef< TemplateArgumentLoc > template_arguments() const
QualType getParamTypeForDecl() const
bool hasExplicitTemplateArgs() const
Determines whether this lookup had explicit template arguments.
Qualifiers getLocalQualifiers() const
Retrieve the set of qualifiers local to this particular QualType instance, not including any qualifie...
bool hadArrayRangeDesignator() const
SourceLocation getCatchLoc() const
ExpectedStmt VisitCXXStdInitializerListExpr(CXXStdInitializerListExpr *E)
ArrayRef< ParmVarDecl * > parameters() const
ExpectedStmt VisitArrayInitLoopExpr(ArrayInitLoopExpr *E)
Represents Objective-C's @catch statement.
SourceLocation getComposedLoc(FileID FID, unsigned Offset) const
Form a SourceLocation from a FileID and Offset pair.
ExpectedStmt VisitCXXScalarValueInitExpr(CXXScalarValueInitExpr *E)
SourceLocation getBeginLoc() const
TypeAliasDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
IndirectGotoStmt - This represents an indirect goto.
SourceLocation getMemberLoc() const
ExpectedDecl VisitVarDecl(VarDecl *D)
static ParenListExpr * Create(const ASTContext &Ctx, SourceLocation LParenLoc, ArrayRef< Expr *> Exprs, SourceLocation RParenLoc)
Create a paren list.
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.
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
Optional< Expr * > getArraySize()
IdentifierInfo * getAsIdentifier() const
Retrieve the identifier stored in this nested name specifier.
SourceLocation getEndLoc() const
ExpectedDecl VisitTypedefDecl(TypedefDecl *D)
ForStmt - This represents a 'for (init;cond;inc)' stmt.
Represents the results of name lookup.
A qualified template name, where the qualification is kept to describe the source code as written...
unsigned getFirstExprIndex() const
static IfStmt * Create(const ASTContext &Ctx, SourceLocation IL, bool IsConstexpr, Stmt *Init, VarDecl *Var, Expr *Cond, Stmt *Then, SourceLocation EL=SourceLocation(), Stmt *Else=nullptr)
Create an IfStmt.
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
Error ImportDefinition(RecordDecl *From, RecordDecl *To, ImportDefinitionKind Kind=IDK_Default)
bool isBaseVirtual() const
Returns whether the base is virtual or not.
ExpectedStmt VisitInitListExpr(InitListExpr *E)
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.
bool isKNRPromoted() const
True if the value passed to this parameter must undergo K&R-style default argument promotion: ...
ExpectedType VisitPointerType(const PointerType *T)
const FileInfo & getFile() const
const TemplateArgumentList & getTemplateArgs() const
Retrieve the template arguments of the variable template specialization.
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...
An unqualified-id that has been assumed to name a function template that will be found by ADL...
SourceLocation getLBracLoc() const
const TypeConstraint * getTypeConstraint() const
Returns the type constraint associated with this template parameter (if any).
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
bool hasSameVisibilityContext(T *Found, T *From)
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()
static CaseStmt * Create(const ASTContext &Ctx, Expr *lhs, Expr *rhs, SourceLocation caseLoc, SourceLocation ellipsisLoc, SourceLocation colonLoc)
Build a case statement.
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
ExpectedDecl VisitEnumDecl(EnumDecl *D)
PropertyAttributeKind getPropertyAttributes() const
NamespaceAliasDecl * getAsNamespaceAlias() const
Retrieve the namespace alias stored in this nested name specifier.
ExpectedDecl VisitAccessSpecDecl(AccessSpecDecl *D)
ExpectedStmt VisitSubstNonTypeTemplateParmExpr(SubstNonTypeTemplateParmExpr *E)
SourceLocation getBeginLoc() const LLVM_READONLY
Error ImportDeclContext(DeclContext *FromDC, bool ForceImport=false)
Represents a typeof (or typeof) expression (a GCC extension).
LifetimeExtendedTemporaryDecl * getLifetimeExtendedTemporaryDecl()
A builtin binary operation expression such as "x + y" or "x <= y".
Expected< FunctionDecl * > FindFunctionTemplateSpecialization(FunctionDecl *FromFD)
ExpectedStmt VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *S)
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...
ExpectedType VisitUnaryTransformType(const UnaryTransformType *T)
tokloc_iterator tokloc_end() const
ExpectedStmt VisitSwitchStmt(SwitchStmt *S)
ArrayRef< TemplateArgumentLoc > template_arguments() const
static CompoundStmt * Create(const ASTContext &C, ArrayRef< Stmt *> Stmts, SourceLocation LB, SourceLocation RB)
ExpectedStmt VisitExplicitCastExpr(ExplicitCastExpr *E)
ExpectedStmt VisitArraySubscriptExpr(ArraySubscriptExpr *E)
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...
ExpectedType VisitFunctionProtoType(const FunctionProtoType *T)
Error ImportInitializer(VarDecl *From, VarDecl *To)
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...
void setSpecializationKind(TemplateSpecializationKind TSK)
Expr * getSizeExpr() const
static bool isAncestorDeclContextOf(const DeclContext *DC, const Decl *D)
const Type * getTypePtr() const
Retrieves a pointer to the underlying (unqualified) type.
ExpectedStmt VisitOffsetOfExpr(OffsetOfExpr *OE)
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.
ExpectedStmt VisitGNUNullExpr(GNUNullExpr *E)
bool declaresSameEntity(const Decl *D1, const Decl *D2)
Determine whether two declarations declare the same entity.
CaseStmt - Represent a case statement.
bool hasUnparsedDefaultArg() const
Determines whether this parameter has a default argument that has not yet been parsed.
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.
ExpectedStmt VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E)
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...
Expr * getTemporaryExpr()
Retrieve the expression to which the temporary materialization conversion was applied.
CXXRecordDecl * getNamingClass()
Gets the 'naming class' (in the sense of C++0x [class.access.base]p5) of the lookup.
ExpectedStmt VisitCXXCatchStmt(CXXCatchStmt *S)
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.
bool isTypeDependent() const
isTypeDependent - Determines whether this expression is type-dependent (C++ [temp.dep.expr]), which means that its type could change from one template instantiation to the next.
void setProtocolList(ObjCProtocolDecl *const *List, unsigned Num, const SourceLocation *Locs, ASTContext &C)
setProtocolList - Set the list of protocols that this interface implements.
ExpectedStmt VisitDependentScopeDeclRefExpr(DependentScopeDeclRefExpr *E)
PropertyControl getPropertyImplementation() const
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.
void log(raw_ostream &OS) const override
ExpectedDecl VisitStaticAssertDecl(StaticAssertDecl *D)
Represents a C++ member access expression where the actual member referenced could not be resolved be...
ExpectedStmt VisitReturnStmt(ReturnStmt *S)
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...
ExpectedStmt VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E)
Represents a linkage specification.
SourceLocation getOperatorLoc() const
getOperatorLoc - Return the location of the operator.
QualType getReturnType() const
SourceLocation getIncludeLoc() const
CXXRecordDecl * getTemplatedDecl() const
Get the underlying class declarations of the template.
bool isParameterPack() const
Whether this template template parameter is a template parameter pack.
static UnresolvedLookupExpr * Create(const ASTContext &Context, CXXRecordDecl *NamingClass, NestedNameSpecifierLoc QualifierLoc, const DeclarationNameInfo &NameInfo, bool RequiresADL, bool Overloaded, UnresolvedSetIterator Begin, UnresolvedSetIterator End)
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
ExpectedStmt VisitLambdaExpr(LambdaExpr *LE)
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
ExpectedType VisitDependentSizedArrayType(const DependentSizedArrayType *T)
Expr * getSizeExpr() const
A default argument (C++ [dcl.fct.default]).
bool isMacroArgExpansion() const
void setMethodParams(ASTContext &C, ArrayRef< ParmVarDecl *> Params, ArrayRef< SourceLocation > SelLocs=llvm::None)
Sets the method's parameters and selector source locations.
QualType getPointeeTypeAsWritten() const
SourceLocation getAtStartLoc() const
ExpectedStmt VisitParenExpr(ParenExpr *E)
Import the default subset of the definition, which might be nothing (if minimal import is set) or mig...
void addDeclInternal(Decl *D)
Add the declaration D into this context, but suppress searches for external declarations with the sam...
ExpectedDecl VisitClassTemplateDecl(ClassTemplateDecl *D)
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...
static MemberExpr * Create(const ASTContext &C, Expr *Base, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, ValueDecl *MemberDecl, DeclAccessPair FoundDecl, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs, QualType T, ExprValueKind VK, ExprObjectKind OK, NonOdrUseReason NOUR)
Represents the this expression in C++.
ExpectedStmt VisitIfStmt(IfStmt *S)
ExpectedDecl VisitObjCImplementationDecl(ObjCImplementationDecl *D)
SourceLocation getRParenLoc() const
Retrieve the location of the right parentheses (')') that follows the argument list.
TypeSourceInfo * getAllocatedTypeSourceInfo() const
lookup_result lookup(DeclarationName Name) const
lookup - Find the declarations (if any) with the given Name in this context.
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
SourceLocation getTemplateEllipsisLoc() 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 getEllipsisLoc() const
Decl * MapImported(Decl *From, Decl *To)
Store and assign the imported declaration to its counterpart.
bool hasBraces() const
Determines whether this linkage specification had braces in its syntactic form.
ExpectedStmt VisitCXXDeleteExpr(CXXDeleteExpr *E)
void completeDefinition(QualType NewType, QualType PromotionType, unsigned NumPositiveBits, unsigned NumNegativeBits)
When created, the EnumDecl corresponds to a forward-declared enum.
static auto getTemplateDefinition(T *D) -> T *
ConditionalOperator - The ?: ternary operator.
QualType getBaseType() const
Gets the base type of this object type.
TypeSourceInfo * getTypeSourceInfo() const
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
RecordDecl * getMostRecentDecl()
CXXRecordDecl * getMostRecentDecl()
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 }.
ExpectedStmt VisitDesignatedInitExpr(DesignatedInitExpr *E)
void AddSpecialization(VarTemplateSpecializationDecl *D, void *InsertPos)
Insert the specified specialization knowing that it is not already in.
Represents a prototype with parameter type info, e.g.
bool isFileVarDecl() const
Returns true for file scoped variable declaration.
Error ImportDefaultArgOfParmVarDecl(const ParmVarDecl *FromParam, ParmVarDecl *ToParam)
bool isMicrosoftABI() const
Returns whether this is really a Win64 ABI va_arg expression.
ExpectedDecl VisitImportDecl(ImportDecl *D)
ExpectedType VisitTypeOfExprType(const TypeOfExprType *T)
friend class ASTNodeImporter
This declaration is a C++ operator declared in a non-class context.
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...
Represents a ValueDecl that came out of a declarator.
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)
ExpectedStmt VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *E)
DeclarationNameTable DeclarationNames
A dependent template name that has not been resolved to a template (or set of templates).
SourceLocation getBeginLoc() const LLVM_READONLY
ExpectedStmt VisitUnresolvedLookupExpr(UnresolvedLookupExpr *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
SourceLocation getLocation() const
SourceLocation getLocation() const
void setTypeParamList(ObjCTypeParamList *TPL)
Set the type parameters of this category.
SourceLocation getEndLoc() const LLVM_READONLY
ArrayRef< TypeSourceInfo * > getArgs() const
Retrieve the argument types.
ConstantExpr - An expression that occurs in a constant context and optionally the result of evaluatin...
ImportDefinitionKind
What we should import from the definition.
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
ExpectedStmt VisitGCCAsmStmt(GCCAsmStmt *S)
SourceLocation getLabelLoc() const
void setInClassInitializer(Expr *Init)
Set the C++11 in-class initializer for this member.
This declaration is a friend class.
bool isImplicitAccess() const
True if this is an implicit access, i.e.
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.
ExpectedStmt VisitCompoundLiteralExpr(CompoundLiteralExpr *E)
Represents an array type in C++ whose size is a value-dependent expression.
SourceLocation getDestroyedTypeLoc() const
Retrieve the starting location of the type being destroyed.
SourceLocation getBeginLoc() const
Get the begin source location.
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
static StringLiteral * Create(const ASTContext &Ctx, StringRef Str, StringKind Kind, bool Pascal, QualType Ty, const SourceLocation *Loc, unsigned NumConcatenated)
This is the "fully general" constructor that allows representation of strings formed from multiple co...
An expression "T()" which creates a value-initialized rvalue of type T, which is a non-class type...
ADLCallKind getADLCallKind() const
SourceLocation getOperatorLoc() const
Retrieve the location of the '->' or '.' operator.
QualType getInjectedSpecializationType() const
Retrieves the injected specialization type for this partial specialization.
QualType getElementType() const
static CallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr *> Args, QualType Ty, ExprValueKind VK, SourceLocation RParenLoc, unsigned MinNumArgs=0, ADLCallKind UsesADL=NotADL)
Create a call expression.
Error ImportTemplateArgumentListInfo(const InContainerTy &Container, TemplateArgumentListInfo &ToTAInfo)
void setGetterMethodDecl(ObjCMethodDecl *gDecl)
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
QualType getCXXNameType() const
If this name is one of the C++ names (of a constructor, destructor, or conversion function)...
ExpectedType VisitInjectedClassNameType(const InjectedClassNameType *T)
unsigned getNumArgs() const
Retrieve the number of template arguments.
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 ...
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.
SourceLocation getElseLoc() const
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
bool isDefaulted() const
Whether this function is defaulted per C++0x.
SourceLocation getCaptureDefaultLoc() const
Retrieve the location of this lambda's capture-default, if any.
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.
virtual Expected< 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.
TypeSourceInfo * getSuperClassTInfo() const
bool containsDecl(Decl *D) const
Checks whether a declaration is in this context.
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
unsigned getPackLength() const
Retrieve the length of the parameter pack.
void setSyntacticForm(InitListExpr *Init)
ExpectedDecl VisitNamespaceDecl(NamespaceDecl *D)
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why? This is only meaningful if the named memb...
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...
void setRBraceLoc(SourceLocation L)
ExpectedType VisitObjCInterfaceType(const ObjCInterfaceType *T)
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...
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 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.
SourceLocation getBeginLoc() const
void setRBraceLoc(SourceLocation L)
const char * getTypeClassName() const
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)
ExpectedDecl VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *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.
overridden_method_range overridden_methods() const
static ConstantExpr * Create(const ASTContext &Context, Expr *E, const APValue &Result)
ExpectedStmt VisitGotoStmt(GotoStmt *S)
TemplateParameterList * getTemplateParameterList(unsigned index) const
const CompoundStmt * getSynchBody() const
DeclContext * getDeclContext()
SourceLocation getLParenLoc() const
A structure for storing the information associated with a substituted template template parameter...
CXXRecordDecl * getDefinition() const
ExpectedType VisitTypedefType(const TypedefType *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
static CXXDependentScopeMemberExpr * Create(const ASTContext &Ctx, Expr *Base, QualType BaseType, bool IsArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, NamedDecl *FirstQualifierFoundInScope, DeclarationNameInfo MemberNameInfo, const TemplateArgumentListInfo *TemplateArgs)
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.
ExpectedStmt VisitCXXDefaultArgExpr(CXXDefaultArgExpr *E)
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.
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.
Represents the type decltype(expr) (C++11).
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()
ExpectedStmt VisitArrayInitIndexExpr(ArrayInitIndexExpr *E)
AutoType * getContainedAutoType() const
Get the AutoType whose type will be deduced for a variable with an initializer of this type...
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
void setImplementation(ObjCImplementationDecl *ImplD)
void setConstexpr(bool IC)
SourceRange getAngleBrackets() const LLVM_READONLY
ExpectedStmt VisitIntegerLiteral(IntegerLiteral *E)
ExpectedDecl VisitCXXConversionDecl(CXXConversionDecl *D)
Kind getKind() const
Determine what kind of offsetof node this is.
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
bool hasBody(const FunctionDecl *&Definition) const
Returns true if the function has a body.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
bool isFunctionOrMethod() const
std::error_code convertToErrorCode() const override
ExpectedDecl VisitObjCProtocolDecl(ObjCProtocolDecl *D)
ExpectedStmt VisitTypeTraitExpr(TypeTraitExpr *E)
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.
LabelDecl * getLabel() const
DeclContext * getParent()
getParent - Returns the containing DeclContext.
const Stmt * getTryBody() const
Retrieve the @try body.
static PredefinedExpr * Create(const ASTContext &Ctx, SourceLocation L, QualType FNTy, IdentKind IK, StringLiteral *SL)
Create a PredefinedExpr.
ReturnStmt - This represents a return, optionally of an expression: return; return 4;...
void setTypeConstraint(NestedNameSpecifierLoc NNS, DeclarationNameInfo NameInfo, NamedDecl *FoundDecl, ConceptDecl *CD, const ASTTemplateArgumentListInfo *ArgsAsWritten, Expr *ImmediatelyDeclaredConstraint)
void setPointOfInstantiation(SourceLocation Loc)
SourceLocation getDoLoc() const
SwitchCase * getSwitchCaseList()
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...
SourceLocation getEndLoc() const LLVM_READONLY
ExpectedStmt VisitObjCAtCatchStmt(ObjCAtCatchStmt *S)
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.
static WhileStmt * Create(const ASTContext &Ctx, VarDecl *Var, Expr *Cond, Stmt *Body, SourceLocation WL)
Create a while statement.
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 setOperatorDelete(FunctionDecl *OD, Expr *ThisArg)
BuiltinTemplateKind getBuiltinTemplateKind() const
ExpectedStmt VisitCXXTemporaryObjectExpr(CXXTemporaryObjectExpr *E)
void setDescribedClassTemplate(ClassTemplateDecl *Template)
SourceLocation getRParenLoc() const
Represents a C++ conversion function within a class.
ExpectedStmt VisitCXXDefaultInitExpr(CXXDefaultInitExpr *E)
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
SourceLocation getBeginLoc() const LLVM_READONLY
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.
ExpectedStmt VisitStringLiteral(StringLiteral *E)
bool isNull() const
Return true if this QualType doesn't point to a type yet.
ImplicitParamDecl * getSelfDecl() const
A type, stored as a Type*.
const DeclContext * getUsedContext() const
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 ...
SourceLocation getEndLoc() const LLVM_READONLY
ExpectedStmt VisitCXXNamedCastExpr(CXXNamedCastExpr *E)
const ExpansionInfo & getExpansion() const
ImaginaryLiteral - We support imaginary integer and floating point literals, like "1...
static TemplateParameterList * Create(const ASTContext &C, SourceLocation TemplateLoc, SourceLocation LAngleLoc, ArrayRef< NamedDecl *> Params, SourceLocation RAngleLoc, Expr *RequiresClause)
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so...
Expr * getUnderlyingExpr() const
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
ExpectedStmt VisitIndirectGotoStmt(IndirectGotoStmt *S)
ExpectedStmt VisitCXXConstructExpr(CXXConstructExpr *E)
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.
TypeSourceInfo * getAsTypeSourceInfo() const
ExpectedStmt VisitCharacterLiteral(CharacterLiteral *E)
APValue getAPValueResult() const
SourceLocation getLParenLoc() const
Retrieve the location of the left parentheses ('(') that precedes the argument list.
TypeSourceInfo * getReturnTypeSourceInfo() const
RecordDecl * getDecl() const
const DirectoryEntry * getDir() const
Return the directory the file lives in.
bool capturesVariable() const
Determine whether this capture handles a variable.
void RegisterImportedDecl(Decl *FromD, Decl *ToD)
SpecifierKind
The kind of specifier that completes this nested name specifier.
const DeclarationNameInfo & getNameInfo() const
Retrieve the name that this expression refers to.
bool isSynthesizedAccessorStub() const
ExpectedStmt VisitPredefinedExpr(PredefinedExpr *E)
NestedNameSpecifierLoc getTemplateQualifierLoc() const
ExpectedStmt VisitCompoundAssignOperator(CompoundAssignOperator *E)
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 * getTrailingRequiresClause()
Get the constraint-expression introduced by the trailing requires-clause in the function/member decla...
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.
Error ImportContainerChecked(const InContainerTy &InContainer, OutContainerTy &OutContainer)
static SwitchStmt * Create(const ASTContext &Ctx, Stmt *Init, VarDecl *Var, Expr *Cond)
Create a switch statement.
OpaqueValueExpr - An expression referring to an opaque object of a fixed type and value class...
OverloadedTemplateStorage * getAsOverloadedTemplate() const
Retrieve the underlying, overloaded function template declarations that this template name refers to...
void makeDeclVisibleInContext(NamedDecl *D)
Makes a declaration visible within this context.
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
ExpectedDecl VisitCXXConstructorDecl(CXXConstructorDecl *D)
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.
ExpectedStmt VisitPackExpansionExpr(PackExpansionExpr *E)
QualType getCanonicalType() const
Represents a call to an inherited base class constructor from an inheriting constructor.
ExpectedDecl VisitEmptyDecl(EmptyDecl *D)
ExpressionTrait getTrait() const
ExceptionSpecificationType Type
The kind of exception specification this is.
TypeLoc IgnoreParens() const
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
param_type_range param_types() const
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
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)
SourceLocation getEllipsisLoc() const
Retrieve the location of the ellipsis for a capture that is a pack expansion.
SourceLocation getEndLoc() const LLVM_READONLY
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...
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
StringLiteral * getFunctionName()
unsigned getNumExprs() const
Return the number of expressions in this paren list.
ExpectedStmt VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr *E)
Error ImportTemplateParameterLists(const DeclaratorDecl *FromD, DeclaratorDecl *ToD)
ExpectedType VisitRecordType(const RecordType *T)
void MakeSuper(ASTContext &Context, CXXRecordDecl *RD, SourceLocation SuperLoc, SourceLocation ColonColonLoc)
Turns this (empty) nested-name-specifier into '__super' nested-name-specifier.
bool hasTypeConstraint() const
Determine whether this template parameter has a type-constraint.
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.
SourceLocation getEndLoc() const LLVM_READONLY
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
StringRef getName() const
ObjCProtocolList::iterator protocol_iterator
const Stmt * getCatchBody() const
static DependentScopeDeclRefExpr * Create(const ASTContext &Context, NestedNameSpecifierLoc QualifierLoc, SourceLocation TemplateKWLoc, const DeclarationNameInfo &NameInfo, const TemplateArgumentListInfo *TemplateArgs)
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.
void setBraceRange(SourceRange R)
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
SourceLocation getLAngleLoc() const
Retrieve the location of the left angle bracket starting the explicit template argument list followin...
Attr * clone(ASTContext &C) const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieves the nested-name-specifier that qualifies the type name, with source-location information...
SourceLocation getNamespaceKeyLocation() const
Returns the location of the namespace keyword.
This names the __make_integer_seq BuiltinTemplateDecl.
ExpectedDecl VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D)
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.
Expr * getSubExpr(unsigned Idx) const
A structure for storing an already-substituted template template parameter pack.
ExpectedStmt VisitObjCAutoreleasePoolStmt(ObjCAutoreleasePoolStmt *S)
SourceLocation getOperatorLoc() const
Retrieve the location of the cast operator keyword, e.g., static_cast.
ExpectedStmt VisitDeclStmt(DeclStmt *S)
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.
ExpectedType VisitSubstTemplateTypeParmType(const SubstTemplateTypeParmType *T)
bool wasDeclaredWithTypename() const
Whether this template type parameter was declared with the 'typename' keyword.
DeclarationName getName() const
getName - Returns the embedded declaration name.
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.
static Error setTypedefNameForAnonDecl(TagDecl *From, TagDecl *To, ASTImporter &Importer)
ObjCCategoryDecl * getCategoryDecl() const
QualType getElementType() const
DeclStmt - Adaptor class for mixing declarations with statements and expressions. ...
ExpectedType VisitAutoType(const AutoType *T)
void setTemplateParameterListsInfo(ASTContext &Context, ArrayRef< TemplateParameterList *> TPLists)
Represents the declaration of a label.
void setPropertyAttributesAsWritten(PropertyAttributeKind PRVal)
SourceLocation getEndLoc() const LLVM_READONLY
Represents a dependent using declaration which was not marked with typename.
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...
ExprObjectKind
A further classification of the kind of object referenced by an l-value or x-value.
ExpectedDecl VisitIndirectFieldDecl(IndirectFieldDecl *D)
void setLambdaMangling(unsigned ManglingNumber, Decl *ContextDecl, bool HasKnownInternalLinkage=false)
Set the mangling number and context declaration for a lambda class.
bool isWrittenInBuiltinFile(SourceLocation Loc) const
Returns whether Loc is located in a <built-in> file.
static OffsetOfExpr * Create(const ASTContext &C, QualType type, SourceLocation OperatorLoc, TypeSourceInfo *tsi, ArrayRef< OffsetOfNode > comps, ArrayRef< Expr *> exprs, SourceLocation RParenLoc)
Represents a static or instance method of a struct/union/class.
void setDefaulted(bool D=true)
bool isLambda() const
Determine whether this record is a class describing a lambda function object.
static ExprWithCleanups * Create(const ASTContext &C, EmptyShell empty, unsigned numObjects)
SourceLocation getFriendLoc() const
Retrieves the location of the 'friend' keyword.
bool shouldForceImportDeclContext(ImportDefinitionKind IDK)
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.
virtual void Imported(Decl *From, Decl *To)
Subclasses can override this function to observe all of the From -> To declaration mappings as they a...
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 '::'.
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...
ExpectedType VisitTemplateSpecializationType(const TemplateSpecializationType *T)
ExpectedDecl VisitCXXMethodDecl(CXXMethodDecl *D)
ObjCCategoryDecl - Represents a category declaration.
unsigned pack_size() const
The number of template arguments in the given template argument pack.
llvm::Expected< QualType > Import(QualType FromT)
Import the given type from the "from" context into the "to" context.
QualType getInjectedClassNameSpecialization()
Retrieve the template specialization type of the injected-class-name for this class template...
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)
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
ExpectedStmt VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E)
void setPointOfInstantiation(SourceLocation Loc)
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...
SourceRange getRange() const
ClassTemplateDecl * getMostRecentDecl()
const StringLiteral * getOutputConstraintLiteral(unsigned i) const
ExpectedStmt VisitContinueStmt(ContinueStmt *S)
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.
ASTNodeImporter(ASTImporter &Importer)
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
ExpectedDecl VisitObjCPropertyDecl(ObjCPropertyDecl *D)
ExpectedDecl VisitEnumConstantDecl(EnumConstantDecl *D)
NestedNameSpecifier * getQualifier() const
Retrieve the qualification on this type.
SourceLocation getAtCatchLoc() const
ExpectedType VisitParenType(const ParenType *T)
A simple visitor class that helps create declaration visitors.
CharacterKind getKind() const
bool hasUninstantiatedDefaultArg() const
ExpectedDecl VisitClassTemplateSpecializationDecl(ClassTemplateSpecializationDecl *D)
AutoTypeKeyword getKeyword() const
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required...
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.
SourceLocation getRAngleLoc() const
SourceLocation getMemberLocation() const
bool isImplicitInterfaceDecl() const
isImplicitInterfaceDecl - check that this is an implicitly declared ObjCInterfaceDecl node...
EnumDecl * getDecl() const
ArrayRef< Expr * > exprs()
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted per C++0x.
DeclarationNameInfo getNameInfo() const
ExpectedType VisitExtVectorType(const ExtVectorType *T)
Represents a C++11 static_assert declaration.
VarDecl * getConditionVariable()
Retrieve the variable declared in this "switch" statement, if any.
Naming ambiguity (likely ODR violation).
SourceLocation getExpansionLocStart() const
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 * getArrayFiller()
If this initializer list initializes an array with more elements than there are initializers in the l...
TypeSourceInfo * getTypeSourceInfo() const
Retrieves the type and source location of the base class.
SourceLocation getStarLoc() const
void setExplicitlyDefaulted(bool ED=true)
State that this function is explicitly defaulted per C++0x.
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)
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)
FunctionDecl * getOperatorDelete() const
SourceLocation getBeginLoc() const LLVM_READONLY
SourceLocation getTemplateKeywordLoc() const
Retrieve the location of the template keyword preceding this name, if any.
SourceLocation getIvarLBraceLoc() const
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Represents a pointer type decayed from an array or function type.
SourceLocation getExprLoc() const LLVM_READONLY
getExprLoc - Return the preferred location for the arrow when diagnosing a problem with a generic exp...
NonOdrUseReason isNonOdrUse() const
Is this expression a non-odr-use reference, and if so, why?
The injected class name of a C++ class template or class template partial specialization.
ExpectedType VisitBuiltinType(const BuiltinType *T)
A qualified reference to a name whose declaration cannot yet be resolved.
void setVirtualAsWritten(bool V)
State that this function is marked as virtual explicitly.
ExpectedType VisitEnumType(const EnumType *T)
const Expr * getInitializer() const
ExpectedStmt VisitDeclRefExpr(DeclRefExpr *E)
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
ExpectedStmt VisitImaginaryLiteral(ImaginaryLiteral *E)
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...
ExpectedStmt VisitImplicitValueInitExpr(ImplicitValueInitExpr *E)
ArrayRef< TemplateArgument > getPartialArguments() const
Get.
Error ImportArrayChecked(const InContainerTy &InContainer, OIter Obegin)
void updateFlags(const Decl *From, Decl *To)
ExpectedStmt VisitCXXForRangeStmt(CXXForRangeStmt *S)
Error ImportTemplateArguments(const TemplateArgument *FromArgs, unsigned NumFromArgs, SmallVectorImpl< TemplateArgument > &ToArgs)
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.
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
TypeSourceInfo * getDestroyedTypeInfo() const
Retrieve the source location information for the type being destroyed.
Expected< FunctionTemplateAndArgsTy > ImportFunctionTemplateWithTemplateArgsFromSpecialization(FunctionDecl *FromFD)
llvm::Expected< DeclContext * > ImportContext(DeclContext *FromDC)
Import the given declaration context from the "from" AST context into the "to" AST context...
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.
virtual void CompleteDecl(Decl *D)
Called for ObjCInterfaceDecl, ObjCProtocolDecl, and TagDecl.
SourceLocation getLocation() const
Dataflow Directional Tag Classes.
void setDescribedAliasTemplate(TypeAliasTemplateDecl *TAT)
unsigned getManglingNumber() const
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.
ExpectedType VisitVectorType(const VectorType *T)
tokloc_iterator tokloc_begin() const
ExpectedStmt VisitCallExpr(CallExpr *E)
ExtInfo getExtInfo() const
VarDecl * getConditionVariable()
Retrieve the variable declared in this "while" statement, if any.
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...
ExpectedStmt VisitAtomicExpr(AtomicExpr *E)
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
SourceLocation getTemplateNameLoc() const
IdentifierInfo * getOutputIdentifier(unsigned i) const
PropertyAttributeKind getPropertyAttributesAsWritten() const
Kind getPropertyImplementation() const
ExpectedDecl VisitTranslationUnitDecl(TranslationUnitDecl *D)
bool isInitKnownICE() const
Determines whether it is already known whether the initializer is an integral constant expression or ...
const Stmt * getFinallyBody() const
The template argument is a pack expansion of a template name that was provided for a template templat...
bool hasCycleAtBack() const
Returns true if the last element can be found earlier in the path.
SourceLocation getAtLoc() const
ExpectedStmt VisitAddrLabelExpr(AddrLabelExpr *E)
const TemplateArgument * getArgs() const
Retrieve the template arguments.
TemplateSpecializationKind getTemplateSpecializationKind() const
Determine what kind of template instantiation this function represents.
ArrayRef< const Attr * > getAttrs() const
static ReturnStmt * Create(const ASTContext &Ctx, SourceLocation RL, Expr *E, const VarDecl *NRVOCandidate)
Create a return statement.
Represents a field injected from an anonymous union/struct into the parent scope. ...
Decl * GetAlreadyImportedOrNull(const Decl *FromD) const
Return the copy of the given declaration in the "to" context if it has already been imported from the...
QualType getUnderlyingType() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name of the namespace, with source-location inf...
ExpectedStmt VisitBinaryOperator(BinaryOperator *E)
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
const Expr * getInit() 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.
ExpectedType VisitType(const Type *T)
unsigned getIndex() const
Retrieve the index of the template parameter.
LLVM_NODISCARD llvm::Error importInto(ImportT &To, const ImportT &From)
Import the given object, returns the result.
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
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...
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the name, with source-location information.
ASTImporter(ASTContext &ToContext, FileManager &ToFileManager, ASTContext &FromContext, FileManager &FromFileManager, bool MinimalImport, std::shared_ptr< ASTImporterSharedState > SharedState=nullptr)
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...
ExpectedType VisitConstantArrayType(const ConstantArrayType *T)
unsigned getNumTemplateParameterLists() const
Error ImportImplicitMethods(const CXXRecordDecl *From, CXXRecordDecl *To)
const Expr * getSynchExpr() const
A pointer to member type per C++ 8.3.3 - Pointers to members.
ExpectedDecl VisitObjCCategoryDecl(ObjCCategoryDecl *D)
This names the __type_pack_element BuiltinTemplateDecl.
TemplateSpecializationKind
Describes the kind of template specialization that a particular template specialization declaration r...
ExpectedStmt VisitCXXNoexceptExpr(CXXNoexceptExpr *E)
ExpectedStmt VisitConstantExpr(ConstantExpr *E)
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)
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
ExpectedDecl VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D)
VarTemplateSpecializationDecl * findSpecialization(ArrayRef< TemplateArgument > Args, void *&InsertPos)
Return the specialization with the provided arguments if it exists, otherwise return the insertion po...
ExpectedStmt VisitCXXInheritedCtorInitExpr(CXXInheritedCtorInitExpr *E)
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.
llvm::APInt getValue() const
QualType getModifiedType() const
LabelDecl * getLabel() const
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
llvm::ErrorOr< const FileEntry * > getFile(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Lookup, cache, and verify the specified file (real or virtual).
SourceLocation getBeginLoc() const
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)
ExpectedDecl VisitLifetimeExtendedTemporaryDecl(LifetimeExtendedTemporaryDecl *D)
Imports selected nodes from one AST context into another context, merging AST nodes where appropriate...
TemplateName getAssumedTemplateName(DeclarationName Name) const
Retrieve a template name representing an unqualified-id that has been assumed to name a template for ...
ArraySubscriptExpr - [C99 6.5.2.1] Array Subscripting.
QualType getCanonicalTypeInternal() const
Represents Objective-C's collection statement.
Represents a C++ base or member initializer.
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)
ExpectedType VisitAttributedType(const AttributedType *T)
An implicit indirection through a C++ base class, when the field found is in a base class...
const llvm::APInt & getSize() const
void setImportDeclError(Decl *From, ImportError Error)
Mark (newly) imported declaration with error.
Expr * getCond() const
getCond - Return the condition expression; this is defined in terms of the opaque value...
protocol_iterator protocol_begin() const
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, NonOdrUseReason NOUR=NOUR_None)
SourceLocation getRParenLoc() 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.
ExpectedDecl VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D)
SourceRange getDirectInitRange() const
NestedNameSpecifierLoc getQualifierLoc() const
Retrieve the nested-name-specifier that qualifies the member name, with source location information...
void setRange(SourceRange R)
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.
const Expr * getSizeExpr() const
ClassTemplatePartialSpecializationDecl * findPartialSpecialization(ArrayRef< TemplateArgument > Args, TemplateParameterList *TPL, void *&InsertPos)
Return the partial specialization with the provided arguments if it exists, otherwise return the inse...
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
AssumedTemplateStorage * getAsAssumedTemplateName() const
Retrieve information on a name that has been assumed to be a template-name in order to permit a call ...
ExpectedDecl VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D)
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())
The template argument is actually a parameter pack.
bool isArrow() const
Determine whether this member expression used the '->' operator; otherwise, it used the '...
SourceLocation getColonLoc() const
Represents a base class of a C++ class.
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
SourceLocation getRParenLoc() const
static llvm::Optional< unsigned > getFieldIndex(Decl *F)
Determine the index of a field in its parent record.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
SourceManager & getSourceManager()
void setObjCMethodScopeInfo(unsigned parameterIndex)
bool isIncompleteType(NamedDecl **Def=nullptr) const
Types are partitioned into 3 broad categories (C99 6.2.5p1): object types, function types...
bool isPartiallySubstituted() const
Determine whether this represents a partially-substituted sizeof...
ExpectedStmt VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *E)
DeclStmt * getRangeStmt()
unsigned arg_size() const
Retrieve the number of arguments.
ImplementationControl getImplementationControl() const
Error ImportDefinitionIfNeeded(Decl *FromD, Decl *ToD=nullptr)
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.
ExpectedDecl VisitObjCInterfaceDecl(ObjCInterfaceDecl *D)
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.
ExpectedType VisitLValueReferenceType(const LValueReferenceType *T)
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
ExpectedStmt VisitConditionalOperator(ConditionalOperator *E)
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...
TypedefNameDecl * getDecl() const
const SwitchCase * getNextSwitchCase() const
ExpectedDecl VisitCXXDestructorDecl(CXXDestructorDecl *D)
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.
ArrayRef< TemplateArgumentLoc > template_arguments() const
ExpectedType VisitObjCObjectPointerType(const ObjCObjectPointerType *T)
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.
static CXXMemberCallExpr * Create(const ASTContext &Ctx, Expr *Fn, ArrayRef< Expr *> Args, QualType Ty, ExprValueKind VK, SourceLocation RP, unsigned MinNumArgs=0)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
ExpectedStmt VisitObjCForCollectionStmt(ObjCForCollectionStmt *S)
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name...
VarDecl * getConditionVariable()
Retrieve the variable declared in this "if" statement, if any.
TranslationUnitDecl * getTranslationUnitDecl() const
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
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).
bool isThisDeclarationADefinition() const
Return true if this declaration is a completion definition of the type.
Represents a C++ struct/union/class.
Represents a template specialization type whose template cannot be resolved, e.g. ...
ContinueStmt - This represents a continue.
ExpectedType VisitFunctionNoProtoType(const FunctionNoProtoType *T)
Represents a loop initializing the elements of an array.
The template argument is a template name that was provided for a template template parameter...
void setDescribedVarTemplate(VarTemplateDecl *Template)
ExpectedType VisitVariableArrayType(const VariableArrayType *T)
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.
ChooseExpr - GNU builtin-in function __builtin_choose_expr.
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.
bool LE(InterpState &S, CodePtr OpPC)
SourceLocation getRParenLoc() const
ExpectedStmt VisitCXXMemberCallExpr(CXXMemberCallExpr *E)
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
A structure for storing the information associated with a name that has been assumed to be a template...
ExpectedType VisitPackExpansionType(const PackExpansionType *T)
ExpectedStmt VisitSizeOfPackExpr(SizeOfPackExpr *E)
unsigned getNumConcatenated() const
getNumConcatenated - Get the number of string literal tokens that were concatenated in translation ph...
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...
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...
const DeclContext * getUsedContext() const
ExpectedDecl VisitBuiltinTemplateDecl(BuiltinTemplateDecl *D)
CompoundStmt * getTryBlock()
SourceLocation getBreakLoc() const
ExpectedDecl VisitFunctionDecl(FunctionDecl *D)
TypeLoc getTypeLoc() const
For a nested-name-specifier that refers to a type, retrieve the type with source-location information...
SourceLocation getCaseLoc() const
capture_range captures() const
Retrieve this lambda's captures.
void setPropertyAttributes(PropertyAttributeKind PRVal)
static CXXDefaultArgExpr * Create(const ASTContext &C, SourceLocation Loc, ParmVarDecl *Param, DeclContext *UsedContext)
Represents Objective-C's @try ... @catch ... @finally statement.
protocol_iterator protocol_end() const
bool isGlobalDelete() const
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]).
Implicit declaration of a temporary that was materialized by a MaterializeTemporaryExpr and lifetime-...
Expected< TemplateArgument > ImportTemplateArgument(const TemplateArgument &From)
ExpectedStmt VisitStmtExpr(StmtExpr *E)
ExpectedDecl VisitFriendDecl(FriendDecl *D)
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.
void setDescribedFunctionTemplate(FunctionTemplateDecl *Template)
ExpectedDecl VisitObjCTypeParamDecl(ObjCTypeParamDecl *D)
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
SourceLocation getRAngleLoc() const
Retrieve the location of the right angle bracket ending the explicit template argument list following...
ExpectedDecl VisitUsingDirectiveDecl(UsingDirectiveDecl *D)
void setNextSwitchCase(SwitchCase *SC)
decl_type * getMostRecentDecl()
Returns the most recent (re)declaration of this declaration.
The top declaration context.
unsigned getNumComponents() const
const ParmVarDecl * getParam() const
llvm::Optional< ImportError > getImportDeclErrorIfAny(Decl *FromD) const
Return if import of the given declaration has failed and if yes the kind of the problem.
QualType getAsType() const
Retrieve the type for a type template argument.
A reference to a declared variable, function, enum, etc.
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.
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...
std::string toString() const
ExpectedStmt VisitCaseStmt(CaseStmt *S)
SourceLocation getUsingLoc() const
Returns the source location of the 'using' keyword.
const VarDecl * getCatchParamDecl() const
ExpectedType VisitMemberPointerType(const MemberPointerType *T)
unsigned getNumLabels() const
ExpectedType VisitTemplateTypeParmType(const TemplateTypeParmType *T)
SourceLocation getLocation() const
void setObjCDeclQualifier(ObjCDeclQualifier QTVal)
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.
DefinitionKind isThisDeclarationADefinition(ASTContext &) const
Check whether this declaration is a definition.
bool isConditionDependent() const
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.
static DeclarationName getUsingDirectiveName()
Returns the name for all C++ using-directives.
DeclStmt * getLoopVarStmt()
IdentifierInfo * getCXXLiteralIdentifier() const
If this name is the name of a literal operator, retrieve the identifier associated with it...
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
Return the number of arguments to the constructor call.
protocol_loc_iterator protocol_loc_begin() const
Error ImportDeclParts(NamedDecl *D, DeclContext *&DC, DeclContext *&LexicalDC, DeclarationName &Name, NamedDecl *&ToD, SourceLocation &Loc)
A set of overloaded template declarations.
Error ImportDeclarationNameLoc(const DeclarationNameInfo &From, DeclarationNameInfo &To)
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).
ExpectedStmt VisitObjCAtThrowStmt(ObjCAtThrowStmt *S)
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)
Represents a C array with a specified size that is not an integer-constant-expression.
Expr * getQueriedExpression() const
Represents a C++ namespace alias.
SourceLocation getBuiltinLoc() const
APValue::ValueKind getResultAPValueKind() const
TemplateDecl * getDescribedTemplate() const
If this is a declaration that describes some template, this method returns that template declaration...
SourceRange getSourceRange() const LLVM_READONLY
Retrieves the source range that contains the entire base specifier.
Error ImportFunctionDeclBody(FunctionDecl *FromFD, FunctionDecl *ToFD)
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.
ExpectedType VisitDependentNameType(const DependentNameType *T)
void setTypeAsWritten(TypeSourceInfo *T)
Sets the type of this specialization as it was written by the user.
ConceptDecl * getTypeConstraintConcept() const
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.
ExpectedStmt VisitCXXTryStmt(CXXTryStmt *S)
void setType(QualType newType)
SourceLocation getBegin() const
TranslationUnitDecl * getTranslationUnitDecl()
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue...
Error ImportOverriddenMethods(CXXMethodDecl *ToMethod, CXXMethodDecl *FromMethod)
const ASTTemplateArgumentListInfo * getTemplateArgsAsWritten() const
Get the template arguments as written.
SourceLocation getRParenLoc() const
Return the location of the right parentheses.
ExpectedStmt VisitMemberExpr(MemberExpr *E)
SourceLocation getInnerLocStart() const
Return start of source range ignoring outer template declarations.
NamedDecl * getPack() const
Retrieve the parameter pack.
void setDeletedAsWritten(bool D=true)
Represents Objective-C's @autoreleasepool Statement.
bool isConditionTrue() const
isConditionTrue - Return whether the condition is true (i.e.
ExpectedDecl VisitTypedefNameDecl(TypedefNameDecl *D, bool IsAlias)
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
InitListExpr * getSyntacticForm() const
Defines enum values for all the target-independent builtin functions.
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.
Attr - This represents one attribute.
bool isDeletedAsWritten() const
SourceLocation getLocation() const
QualType getPointeeType() const
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
ExpectedType VisitDecltypeType(const DecltypeType *T)
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.
SourceLocation getRBraceLoc() const
SourceLocation getOperatorLoc() const
ExpectedDecl VisitUsingShadowDecl(UsingShadowDecl *D)
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
static CXXNewExpr * Create(const ASTContext &Ctx, bool IsGlobalNew, FunctionDecl *OperatorNew, FunctionDecl *OperatorDelete, bool ShouldPassAlignment, bool UsualArrayDeleteWantsSize, ArrayRef< Expr *> PlacementArgs, SourceRange TypeIdParens, Optional< Expr *> ArraySize, InitializationStyle InitializationStyle, Expr *Initializer, QualType Ty, TypeSourceInfo *AllocatedTypeInfo, SourceRange Range, SourceRange DirectInitRange)
Create a c++ new expression.
bool isThisDeclarationADefinition() const
Returns whether this template declaration defines the primary pattern.
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.
const llvm::MemoryBuffer * getBuffer(DiagnosticsEngine &Diag, FileManager &FM, SourceLocation Loc=SourceLocation(), bool *Invalid=nullptr) const
Returns the memory buffer for the associated content.
ConstructionKind getConstructionKind() const
Determine whether this constructor is actually constructing a base class (rather than a complete obje...
ObjCCategoryDecl * FindCategoryDeclaration(IdentifierInfo *CategoryId) const
FindCategoryDeclaration - Finds category declaration in the list of categories for this class and ret...
ExpectedType VisitBlockPointerType(const BlockPointerType *T)
Structure used to store a statement, the constant value to which it was evaluated (if any)...
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.
FunctionTemplateDecl * getMostRecentDecl()
void notePriorDiagnosticFrom(const DiagnosticsEngine &Other)
Note that the prior diagnostic was emitted by some other DiagnosticsEngine, and we may be attaching a...