Error ImportDefaultArgOfParmVarDecl(const ParmVarDecl *FromParam,
ParmVarDecl *ToParam);
+ Expected<InheritedConstructor>
+ ImportInheritedConstructor(const InheritedConstructor &From);
+
template <typename T>
bool hasSameVisibilityContextAndLinkage(T *Found, T *From);
importExplicitSpecifier(Err, FromConstructor->getExplicitSpecifier());
if (Err)
return std::move(Err);
+ auto ToInheritedConstructor = InheritedConstructor();
+ if (FromConstructor->isInheritingConstructor()) {
+ Expected<InheritedConstructor> ImportedInheritedCtor =
+ import(FromConstructor->getInheritedConstructor());
+ if (!ImportedInheritedCtor)
+ return ImportedInheritedCtor.takeError();
+ ToInheritedConstructor = *ImportedInheritedCtor;
+ }
if (GetImportedOrCreateDecl<CXXConstructorDecl>(
ToFunction, D, Importer.getToContext(), cast<CXXRecordDecl>(DC),
ToInnerLocStart, NameInfo, T, TInfo, ESpec, D->UsesFPIntrin(),
D->isInlineSpecified(), D->isImplicit(), D->getConstexprKind(),
- InheritedConstructor(), // FIXME: Properly import inherited
- // constructor info
- TrailingRequiresClause))
+ ToInheritedConstructor, TrailingRequiresClause))
return ToFunction;
} else if (CXXDestructorDecl *FromDtor = dyn_cast<CXXDestructorDecl>(D)) {
return Error::success();
}
+Expected<InheritedConstructor>
+ASTNodeImporter::ImportInheritedConstructor(const InheritedConstructor &From) {
+ Error Err = Error::success();
+ CXXConstructorDecl *ToBaseCtor = importChecked(Err, From.getConstructor());
+ ConstructorUsingShadowDecl *ToShadow =
+ importChecked(Err, From.getShadowDecl());
+ if (Err)
+ return std::move(Err);
+ return InheritedConstructor(ToShadow, ToBaseCtor);
+}
+
ExpectedDecl ASTNodeImporter::VisitParmVarDecl(ParmVarDecl *D) {
// Parameters are created in the translation unit's context, then moved
// into the function declaration's context afterward.
return ToTargetOrErr.takeError();
UsingShadowDecl *ToShadow;
- if (GetImportedOrCreateDecl(ToShadow, D, Importer.getToContext(), DC, Loc,
- Name, *ToIntroducerOrErr, *ToTargetOrErr))
- return ToShadow;
+ if (auto *FromConstructorUsingShadow =
+ dyn_cast<ConstructorUsingShadowDecl>(D)) {
+ if (GetImportedOrCreateDecl<ConstructorUsingShadowDecl>(
+ ToShadow, D, Importer.getToContext(), DC, Loc,
+ cast<UsingDecl>(*ToIntroducerOrErr), *ToTargetOrErr,
+ FromConstructorUsingShadow->constructsVirtualBase()))
+ return ToShadow;
+ // FIXME import the below members!
+ // FromConstructorUsingShadow->getNominatedBaseClassShadowDecl();
+ // FromConstructorUsingShadow->getConstructedBaseClassShadowDecl();
+ // FromConstructorUsingShadow->getNominatedBaseClass();
+ // FromConstructorUsingShadow->getConstructedBaseClass();
+ } else {
+ if (GetImportedOrCreateDecl(ToShadow, D, Importer.getToContext(), DC, Loc,
+ Name, *ToIntroducerOrErr, *ToTargetOrErr))
+ return ToShadow;
+ }
ToShadow->setLexicalDeclContext(LexicalDC);
ToShadow->setAccess(D->getAccess());
return ToDOrErr;
}
+llvm::Expected<InheritedConstructor>
+ASTImporter::Import(const InheritedConstructor &From) {
+ return ASTNodeImporter(*this).ImportInheritedConstructor(From);
+}
+
Expected<DeclContext *> ASTImporter::ImportContext(DeclContext *FromDC) {
if (!FromDC)
return FromDC;