Skip to content

Commit 178dac0

Browse files
committed
[cxx-interop] Add static "createImported" member to "ConstructorDecl".
1 parent 8474332 commit 178dac0

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

include/swift/AST/Decl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6509,6 +6509,10 @@ class ConstructorDecl : public AbstractFunctionDecl {
65096509
GenericParamList *GenericParams,
65106510
DeclContext *Parent);
65116511

6512+
template<class ...Args>
6513+
static ConstructorDecl *createImported(ASTContext &ctx, ClangNode clangNode,
6514+
Args&&... args);
6515+
65126516
SourceLoc getConstructorLoc() const { return getNameLoc(); }
65136517
SourceLoc getStartLoc() const { return getConstructorLoc(); }
65146518
SourceRange getSourceRange() const;

lib/AST/Decl.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7524,6 +7524,15 @@ ConstructorDecl::ConstructorDecl(DeclName Name, SourceLoc ConstructorLoc,
75247524
assert(Name.getBaseName() == DeclBaseName::createConstructor());
75257525
}
75267526

7527+
template<class ...Args>
7528+
ConstructorDecl *ConstructorDecl::createImported(ASTContext &ctx,
7529+
ClangNode clangNode,
7530+
Args&&... args) {
7531+
auto ctor = new (ctx) ConstructorDecl(std::forward<Args>(args)...);
7532+
ctor->setClangNode(clangNode);
7533+
return ctor;
7534+
}
7535+
75277536
bool ConstructorDecl::isObjCZeroParameterWithLongSelector() const {
75287537
// The initializer must have a single, non-empty argument name.
75297538
if (getName().getArgumentNames().size() != 1 ||

0 commit comments

Comments
 (0)