summaryrefslogtreecommitdiffstats
path: root/clang/AST/SemaExpr.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-03-21 21:08:52 +0000
committerSteve Naroff <snaroff@apple.com>2007-03-21 21:08:52 +0000
commit26c8ea5fab8beb4cc5cdc2b81ea0f6d43b17e51a (patch)
tree73ae265a07d1ea963af1d336d971d24b730d2939 /clang/AST/SemaExpr.cpp
parentbb73acd56003ffb6087fbd166b3511d52777264e (diff)
downloadbcm5719-llvm-26c8ea5fab8beb4cc5cdc2b81ea0f6d43b17e51a.tar.gz
bcm5719-llvm-26c8ea5fab8beb4cc5cdc2b81ea0f6d43b17e51a.zip
Bug #:
Submitted by: Reviewed by: Implement type checking. First round of changes are: - Added predicates to Type. - Added predicates to BinExpr. - Added Check hooks that model the categories for Binary ops. - Added TypeRef to Expr. Will lazily eval subclasses... - Misc bug fixes/cleanups. llvm-svn: 39360
Diffstat (limited to 'clang/AST/SemaExpr.cpp')
-rw-r--r--clang/AST/SemaExpr.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/clang/AST/SemaExpr.cpp b/clang/AST/SemaExpr.cpp
index 715cb414b26..7bc54550f16 100644
--- a/clang/AST/SemaExpr.cpp
+++ b/clang/AST/SemaExpr.cpp
@@ -188,7 +188,7 @@ ParseSizeOfAlignOfTypeExpr(SourceLocation OpLoc, bool isSizeof,
if (isa<FunctionType>(ArgTy) && isSizeof) {
// alignof(function) is allowed.
Diag(OpLoc, diag::ext_sizeof_function_type);
- return new IntegerLiteral(/*1*/);
+ return new IntegerLiteral(1, Context.IntTy);
} else if (ArgTy->isVoidType()) {
Diag(OpLoc, diag::ext_sizeof_void_type, isSizeof ? "sizeof" : "__alignof");
} else if (ArgTy->isIncompleteType()) {
@@ -196,7 +196,7 @@ ParseSizeOfAlignOfTypeExpr(SourceLocation OpLoc, bool isSizeof,
ArgTy->getAsString(TypeName);
Diag(OpLoc, isSizeof ? diag::err_sizeof_incomplete_type :
diag::err_alignof_incomplete_type, TypeName);
- return new IntegerLiteral(/*0*/);
+ return new IntegerLiteral(0, Context.IntTy);
}
return new SizeOfAlignOfTypeExpr(isSizeof, ArgTy);
@@ -289,6 +289,21 @@ Action::ExprResult Sema::ParseBinOp(SourceLocation TokLoc, tok::TokenKind Kind,
case tok::comma: Opc = BinaryOperator::Comma; break;
}
+ if (BinaryOperator::isMultiplicativeOp(Opc))
+ CheckMultiplicativeOperands((Expr*)LHS, (Expr*)RHS);
+ else if (BinaryOperator::isAdditiveOp(Opc))
+ CheckAdditiveOperands((Expr*)LHS, (Expr*)RHS);
+ else if (BinaryOperator::isShiftOp(Opc))
+ CheckShiftOperands((Expr*)LHS, (Expr*)RHS);
+ else if (BinaryOperator::isRelationalOp(Opc))
+ CheckRelationalOperands((Expr*)LHS, (Expr*)RHS);
+ else if (BinaryOperator::isEqualityOp(Opc))
+ CheckEqualityOperands((Expr*)LHS, (Expr*)RHS);
+ else if (BinaryOperator::isBitwiseOp(Opc))
+ CheckBitwiseOperands((Expr*)LHS, (Expr*)RHS);
+ else if (BinaryOperator::isLogicalOp(Opc))
+ CheckLogicalOperands((Expr*)LHS, (Expr*)RHS);
+
return new BinaryOperator((Expr*)LHS, (Expr*)RHS, Opc);
}
@@ -301,3 +316,24 @@ Action::ExprResult Sema::ParseConditionalOp(SourceLocation QuestionLoc,
return new ConditionalOperator((Expr*)Cond, (Expr*)LHS, (Expr*)RHS);
}
+void Sema::CheckMultiplicativeOperands(Expr *op1, Expr *op2) {
+}
+
+void Sema::CheckAdditiveOperands(Expr *op1, Expr *op2) {
+}
+
+void Sema::CheckShiftOperands(Expr *op1, Expr *op2) {
+}
+
+void Sema::CheckRelationalOperands(Expr *op1, Expr *op2) {
+}
+
+void Sema::CheckEqualityOperands(Expr *op1, Expr *op2) {
+}
+
+void Sema::CheckBitwiseOperands(Expr *op1, Expr *op2) {
+}
+
+void Sema::CheckLogicalOperands(Expr *op1, Expr *op2) {
+}
+
OpenPOWER on IntegriCloud