Skip to content

Commit

Permalink
[cxx-interop] Look through template decl to find constructor when imp…
Browse files Browse the repository at this point in the history
…orting the function name.

Sometimes, on windows, we get a function template wrapping the
constructor decl. In this case, look through the function template to
find the constructor decl.
  • Loading branch information
zoecarver committed Oct 16, 2020
1 parent d9acaf3 commit 545b44e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/ClangImporter/ImportName.cpp
Expand Up @@ -1608,14 +1608,18 @@ ImportedName NameImporter::importNameImpl(const clang::NamedDecl *D,
SmallString<16> selectorSplitScratch;
ArrayRef<const clang::ParmVarDecl *> params;
switch (D->getDeclName().getNameKind()) {
case clang::DeclarationName::CXXConstructorName:
case clang::DeclarationName::CXXConstructorName: {
isInitializer = true;
isFunction = true;
result.info.initKind = CtorInitializerKind::Designated;
baseName = "init";
addEmptyArgNamesForClangFunction(cast<clang::CXXConstructorDecl>(D),
argumentNames);
auto ctor = dyn_cast<clang::CXXConstructorDecl>(D);
if (auto templateCtor = dyn_cast<clang::FunctionTemplateDecl>(D))
ctor = cast<clang::CXXConstructorDecl>(templateCtor->getAsFunction());
assert(ctor && "Unkown decl with CXXConstructorName.");
addEmptyArgNamesForClangFunction(ctor, argumentNames);
break;
}

case clang::DeclarationName::CXXConversionFunctionName:
case clang::DeclarationName::CXXDestructorName:
Expand Down

0 comments on commit 545b44e

Please sign in to comment.