forked from OSchip/llvm-project
AST import of parenthesized expressions, unary operators, binary
operators, and compound assignment operators. llvm-svn: 96643
This commit is contained in:
parent
445a603c78
commit
c74247eddd
|
@ -109,6 +109,10 @@ namespace {
|
|||
Expr *VisitExpr(Expr *E);
|
||||
Expr *VisitIntegerLiteral(IntegerLiteral *E);
|
||||
Expr *VisitCharacterLiteral(CharacterLiteral *E);
|
||||
Expr *VisitParenExpr(ParenExpr *E);
|
||||
Expr *VisitUnaryOperator(UnaryOperator *E);
|
||||
Expr *VisitBinaryOperator(BinaryOperator *E);
|
||||
Expr *VisitCompoundAssignOperator(CompoundAssignOperator *E);
|
||||
Expr *VisitImplicitCastExpr(ImplicitCastExpr *E);
|
||||
};
|
||||
}
|
||||
|
@ -2609,6 +2613,76 @@ Expr *ASTNodeImporter::VisitCharacterLiteral(CharacterLiteral *E) {
|
|||
Importer.Import(E->getLocation()));
|
||||
}
|
||||
|
||||
Expr *ASTNodeImporter::VisitParenExpr(ParenExpr *E) {
|
||||
Expr *SubExpr = Importer.Import(E->getSubExpr());
|
||||
if (!SubExpr)
|
||||
return 0;
|
||||
|
||||
return new (Importer.getToContext())
|
||||
ParenExpr(Importer.Import(E->getLParen()),
|
||||
Importer.Import(E->getRParen()),
|
||||
SubExpr);
|
||||
}
|
||||
|
||||
Expr *ASTNodeImporter::VisitUnaryOperator(UnaryOperator *E) {
|
||||
QualType T = Importer.Import(E->getType());
|
||||
if (T.isNull())
|
||||
return 0;
|
||||
|
||||
Expr *SubExpr = Importer.Import(E->getSubExpr());
|
||||
if (!SubExpr)
|
||||
return 0;
|
||||
|
||||
return new (Importer.getToContext()) UnaryOperator(SubExpr, E->getOpcode(),
|
||||
T,
|
||||
Importer.Import(E->getOperatorLoc()));
|
||||
}
|
||||
|
||||
Expr *ASTNodeImporter::VisitBinaryOperator(BinaryOperator *E) {
|
||||
QualType T = Importer.Import(E->getType());
|
||||
if (T.isNull())
|
||||
return 0;
|
||||
|
||||
Expr *LHS = Importer.Import(E->getLHS());
|
||||
if (!LHS)
|
||||
return 0;
|
||||
|
||||
Expr *RHS = Importer.Import(E->getRHS());
|
||||
if (!RHS)
|
||||
return 0;
|
||||
|
||||
return new (Importer.getToContext()) BinaryOperator(LHS, RHS, E->getOpcode(),
|
||||
T,
|
||||
Importer.Import(E->getOperatorLoc()));
|
||||
}
|
||||
|
||||
Expr *ASTNodeImporter::VisitCompoundAssignOperator(CompoundAssignOperator *E) {
|
||||
QualType T = Importer.Import(E->getType());
|
||||
if (T.isNull())
|
||||
return 0;
|
||||
|
||||
QualType CompLHSType = Importer.Import(E->getComputationLHSType());
|
||||
if (CompLHSType.isNull())
|
||||
return 0;
|
||||
|
||||
QualType CompResultType = Importer.Import(E->getComputationResultType());
|
||||
if (CompResultType.isNull())
|
||||
return 0;
|
||||
|
||||
Expr *LHS = Importer.Import(E->getLHS());
|
||||
if (!LHS)
|
||||
return 0;
|
||||
|
||||
Expr *RHS = Importer.Import(E->getRHS());
|
||||
if (!RHS)
|
||||
return 0;
|
||||
|
||||
return new (Importer.getToContext())
|
||||
CompoundAssignOperator(LHS, RHS, E->getOpcode(),
|
||||
T, CompLHSType, CompResultType,
|
||||
Importer.Import(E->getOperatorLoc()));
|
||||
}
|
||||
|
||||
Expr *ASTNodeImporter::VisitImplicitCastExpr(ImplicitCastExpr *E) {
|
||||
QualType T = Importer.Import(E->getType());
|
||||
if (T.isNull())
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Matching
|
||||
enum E0 {
|
||||
E0_Val0 = 'a'
|
||||
E0_Val0 = 'a',
|
||||
E0_Val1 = (17),
|
||||
E0_Val2 = (1 << 2)
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// Matching
|
||||
enum E0 {
|
||||
E0_Val0 = 'a'
|
||||
E0_Val0 = 'a',
|
||||
E0_Val1 = (17),
|
||||
E0_Val2 = (1 << 2)
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue