summaryrefslogtreecommitdiff
path: root/lib/AST/StmtProfile.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-08-02 17:33:11 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-08-02 17:33:11 +0000
commitc7e70c433efc6953dc3888b9fbf9f3512d7da2b0 (patch)
tree27425930fc0c91650a7f3527fcac8e0f92907b90 /lib/AST/StmtProfile.cpp
parent486754660bb926339aefcf012a3f848592babb8b (diff)
Notes
Diffstat (limited to 'lib/AST/StmtProfile.cpp')
-rw-r--r--lib/AST/StmtProfile.cpp55
1 files changed, 29 insertions, 26 deletions
diff --git a/lib/AST/StmtProfile.cpp b/lib/AST/StmtProfile.cpp
index 791ec569cc419..15653c4fd838c 100644
--- a/lib/AST/StmtProfile.cpp
+++ b/lib/AST/StmtProfile.cpp
@@ -1277,25 +1277,24 @@ static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
case OO_Arrow:
case OO_Call:
case OO_Conditional:
- case OO_Coawait:
case NUM_OVERLOADED_OPERATORS:
llvm_unreachable("Invalid operator call kind");
-
+
case OO_Plus:
if (S->getNumArgs() == 1) {
UnaryOp = UO_Plus;
return Stmt::UnaryOperatorClass;
}
-
+
BinaryOp = BO_Add;
return Stmt::BinaryOperatorClass;
-
+
case OO_Minus:
if (S->getNumArgs() == 1) {
UnaryOp = UO_Minus;
return Stmt::UnaryOperatorClass;
}
-
+
BinaryOp = BO_Sub;
return Stmt::BinaryOperatorClass;
@@ -1304,14 +1303,14 @@ static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
UnaryOp = UO_Deref;
return Stmt::UnaryOperatorClass;
}
-
+
BinaryOp = BO_Mul;
return Stmt::BinaryOperatorClass;
case OO_Slash:
BinaryOp = BO_Div;
return Stmt::BinaryOperatorClass;
-
+
case OO_Percent:
BinaryOp = BO_Rem;
return Stmt::BinaryOperatorClass;
@@ -1325,10 +1324,10 @@ static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
UnaryOp = UO_AddrOf;
return Stmt::UnaryOperatorClass;
}
-
+
BinaryOp = BO_And;
return Stmt::BinaryOperatorClass;
-
+
case OO_Pipe:
BinaryOp = BO_Or;
return Stmt::BinaryOperatorClass;
@@ -1352,7 +1351,7 @@ static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
case OO_Greater:
BinaryOp = BO_GT;
return Stmt::BinaryOperatorClass;
-
+
case OO_PlusEqual:
BinaryOp = BO_AddAssign;
return Stmt::CompoundAssignOperatorClass;
@@ -1376,19 +1375,19 @@ static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
case OO_CaretEqual:
BinaryOp = BO_XorAssign;
return Stmt::CompoundAssignOperatorClass;
-
+
case OO_AmpEqual:
BinaryOp = BO_AndAssign;
return Stmt::CompoundAssignOperatorClass;
-
+
case OO_PipeEqual:
BinaryOp = BO_OrAssign;
return Stmt::CompoundAssignOperatorClass;
-
+
case OO_LessLess:
BinaryOp = BO_Shl;
return Stmt::BinaryOperatorClass;
-
+
case OO_GreaterGreater:
BinaryOp = BO_Shr;
return Stmt::BinaryOperatorClass;
@@ -1396,7 +1395,7 @@ static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
case OO_LessLessEqual:
BinaryOp = BO_ShlAssign;
return Stmt::CompoundAssignOperatorClass;
-
+
case OO_GreaterGreaterEqual:
BinaryOp = BO_ShrAssign;
return Stmt::CompoundAssignOperatorClass;
@@ -1404,15 +1403,15 @@ static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
case OO_EqualEqual:
BinaryOp = BO_EQ;
return Stmt::BinaryOperatorClass;
-
+
case OO_ExclaimEqual:
BinaryOp = BO_NE;
return Stmt::BinaryOperatorClass;
-
+
case OO_LessEqual:
BinaryOp = BO_LE;
return Stmt::BinaryOperatorClass;
-
+
case OO_GreaterEqual:
BinaryOp = BO_GE;
return Stmt::BinaryOperatorClass;
@@ -1420,17 +1419,17 @@ static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
case OO_Spaceship:
// FIXME: Update this once we support <=> expressions.
llvm_unreachable("<=> expressions not supported yet");
-
+
case OO_AmpAmp:
BinaryOp = BO_LAnd;
return Stmt::BinaryOperatorClass;
-
+
case OO_PipePipe:
BinaryOp = BO_LOr;
return Stmt::BinaryOperatorClass;
case OO_PlusPlus:
- UnaryOp = S->getNumArgs() == 1? UO_PreInc
+ UnaryOp = S->getNumArgs() == 1? UO_PreInc
: UO_PostInc;
return Stmt::UnaryOperatorClass;
@@ -1446,11 +1445,15 @@ static Stmt::StmtClass DecodeOperatorCall(const CXXOperatorCallExpr *S,
case OO_ArrowStar:
BinaryOp = BO_PtrMemI;
return Stmt::BinaryOperatorClass;
-
+
case OO_Subscript:
return Stmt::ArraySubscriptExprClass;
+
+ case OO_Coawait:
+ UnaryOp = UO_Coawait;
+ return Stmt::UnaryOperatorClass;
}
-
+
llvm_unreachable("Invalid overloaded operator expression");
}
@@ -1482,7 +1485,7 @@ void StmtProfiler::VisitCXXOperatorCallExpr(const CXXOperatorCallExpr *S) {
Visit(S->getArg(I));
if (SC == Stmt::UnaryOperatorClass)
ID.AddInteger(UnaryOp);
- else if (SC == Stmt::BinaryOperatorClass ||
+ else if (SC == Stmt::BinaryOperatorClass ||
SC == Stmt::CompoundAssignOperatorClass)
ID.AddInteger(BinaryOp);
else
@@ -1843,7 +1846,7 @@ void StmtProfiler::VisitCoyieldExpr(const CoyieldExpr *S) {
}
void StmtProfiler::VisitOpaqueValueExpr(const OpaqueValueExpr *E) {
- VisitExpr(E);
+ VisitExpr(E);
}
void StmtProfiler::VisitTypoExpr(const TypoExpr *E) {
@@ -1962,7 +1965,7 @@ void StmtProfiler::VisitTemplateArgument(const TemplateArgument &Arg) {
case TemplateArgument::TemplateExpansion:
VisitTemplateName(Arg.getAsTemplateOrTemplatePattern());
break;
-
+
case TemplateArgument::Declaration:
VisitDecl(Arg.getAsDecl());
break;