forked from OSchip/llvm-project
[ASTImporter] Support importing CXXPseudoDestructorExpr
Patch by Peter Szecsi! Differential Revision: https://reviews.llvm.org/D38843 llvm-svn: 319015
This commit is contained in:
parent
bd2c7eb923
commit
60ccb7daf1
|
@ -283,6 +283,7 @@ namespace clang {
|
|||
Expr *VisitExprWithCleanups(ExprWithCleanups *EWC);
|
||||
Expr *VisitCXXThisExpr(CXXThisExpr *E);
|
||||
Expr *VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E);
|
||||
Expr *VisitCXXPseudoDestructorExpr(CXXPseudoDestructorExpr *E);
|
||||
Expr *VisitMemberExpr(MemberExpr *E);
|
||||
Expr *VisitCallExpr(CallExpr *E);
|
||||
Expr *VisitInitListExpr(InitListExpr *E);
|
||||
|
@ -5725,6 +5726,39 @@ Expr *ASTNodeImporter::VisitMemberExpr(MemberExpr *E) {
|
|||
E->getObjectKind());
|
||||
}
|
||||
|
||||
Expr *ASTNodeImporter::VisitCXXPseudoDestructorExpr(
|
||||
CXXPseudoDestructorExpr *E) {
|
||||
|
||||
Expr *BaseE = Importer.Import(E->getBase());
|
||||
if (!BaseE)
|
||||
return nullptr;
|
||||
|
||||
TypeSourceInfo *ScopeInfo = Importer.Import(E->getScopeTypeInfo());
|
||||
if (!ScopeInfo && E->getScopeTypeInfo())
|
||||
return nullptr;
|
||||
|
||||
PseudoDestructorTypeStorage Storage;
|
||||
if (IdentifierInfo *FromII = E->getDestroyedTypeIdentifier()) {
|
||||
IdentifierInfo *ToII = Importer.Import(FromII);
|
||||
if (!ToII)
|
||||
return nullptr;
|
||||
Storage = PseudoDestructorTypeStorage(
|
||||
ToII, Importer.Import(E->getDestroyedTypeLoc()));
|
||||
} else {
|
||||
TypeSourceInfo *TI = Importer.Import(E->getDestroyedTypeInfo());
|
||||
if (!TI)
|
||||
return nullptr;
|
||||
Storage = PseudoDestructorTypeStorage(TI);
|
||||
}
|
||||
|
||||
return new (Importer.getToContext()) CXXPseudoDestructorExpr(
|
||||
Importer.getToContext(), BaseE, E->isArrow(),
|
||||
Importer.Import(E->getOperatorLoc()),
|
||||
Importer.Import(E->getQualifierLoc()),
|
||||
ScopeInfo, Importer.Import(E->getColonColonLoc()),
|
||||
Importer.Import(E->getTildeLoc()), Storage);
|
||||
}
|
||||
|
||||
Expr *ASTNodeImporter::VisitCallExpr(CallExpr *E) {
|
||||
QualType T = Importer.Import(E->getType());
|
||||
if (T.isNull())
|
||||
|
|
|
@ -567,5 +567,21 @@ TEST(ImportExpr, ImportTypeTraitExprValDep) {
|
|||
)))))))))));
|
||||
}
|
||||
|
||||
const internal::VariadicDynCastAllOfMatcher<Expr, CXXPseudoDestructorExpr>
|
||||
cxxPseudoDestructorExpr;
|
||||
|
||||
TEST(ImportExpr, ImportCXXPseudoDestructorExpr) {
|
||||
MatchVerifier<Decl> Verifier;
|
||||
EXPECT_TRUE(
|
||||
testImport("typedef int T;"
|
||||
"void declToImport(int *p) {"
|
||||
" T t;"
|
||||
" p->T::~T();"
|
||||
"}",
|
||||
Lang_CXX, "", Lang_CXX, Verifier,
|
||||
functionDecl(has(compoundStmt(has(
|
||||
callExpr(has(cxxPseudoDestructorExpr()))))))));
|
||||
}
|
||||
|
||||
} // end namespace ast_matchers
|
||||
} // end namespace clang
|
||||
|
|
Loading…
Reference in New Issue