Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle the CXXDependentScopeMemberExpr here. #7

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions dmd2/cpp/cppexpression.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,56 @@ Expression* ExprMapper::fromExpression(const clang::Expr* E, Type *destType,
else
return fromExpression(SNTTP->getReplacement());
}
else if (auto CDSME = dyn_cast<clang::CXXDependentScopeMemberExpr>(E))
{
Expression *e1 = nullptr;
Identifier *ident;
::TemplateInstance *tempinst = nullptr;
TypeQualified *tqual = nullptr;

if (auto NNS = CDSME->getQualifier())
{
tqual = TypeMapper::FromType(tymap).fromNestedNameSpecifier(NNS);
e1 = new TypeExp(loc, tqual);
}

if (CDSME->getMember().isIdentifier())
{
ident = fromIdentifier(CDSME->getMember().getAsIdentifierInfo());
if (tqual)
{
tqual->addIdent(ident);
auto base = CDSME->getBase();
e1 = new DotTypeExp(loc, fromExpression(base, tymap.fromType(base->getType())), new Dsymbol(ident));
}
}
else
assert(false && "Unhandled Member Expr");

if (CDSME->hasExplicitTemplateArgs())
{
auto tiargs = fromASTTemplateArgumentListInfo(
CDSME->getExplicitTemplateArgs(), tymap);

tempinst = new ::TemplateInstance(loc, ident);
tempinst->tiargs = tiargs;
}

if (e1)
{
if (tempinst)
return new DotTemplateInstanceExp(loc, e1, tempinst);
else
return new DotIdExp(loc, e1, ident);
}
else
{
if (tempinst)
return new TypeExp(loc, new TypeInstance(loc, tempinst));
else
return new IdentifierExp(loc, ident);
}
}
else if (auto DSDR = dyn_cast<clang::DependentScopeDeclRefExpr>(E))
{
Expression *e1 = nullptr;
Expand Down