summaryrefslogtreecommitdiffstats
path: root/clang/Basic/SourceManager.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2007-05-04 21:54:46 +0000
committerSteve Naroff <snaroff@apple.com>2007-05-04 21:54:46 +0000
commit218bc2b32db6aed0fd36a3a706edadb843e87069 (patch)
treeb79aa1ebb4b4a6a667da829d24503374b8fda161 /clang/Basic/SourceManager.cpp
parent17f76e04d244c80e70f1c81c94d4524b53d9772d (diff)
downloadbcm5719-llvm-218bc2b32db6aed0fd36a3a706edadb843e87069.tar.gz
bcm5719-llvm-218bc2b32db6aed0fd36a3a706edadb843e87069.zip
Bug #:
Submitted by: Reviewed by: Implemented type checking for compound assignments (*=, /=, etc.). This encouraged me to do a fairly dramatic refactoring of the Check* functions. (since I wanted to reuse the existing work, rather than duplicate the logic). For example, I changed all the Check* functions to return a QualType (instead of returning an Expr). This had a very nice side benefit...there is now only one instantiation point for BinaryOperator()! (A property I've always wanted...separating type checking from AST building is *much* nicer). Another change is to remove "code" from all the Check* functions (this allowed me to remove the weird comment about enums/unsigned:-). Removing the code forced me to add a few functions, however. For example, < ExprResult CheckAdditiveOperands( // C99 6.5.6 < Expr *lex, Expr *rex, SourceLocation OpLoc, unsigned OpCode); > inline QualType CheckAdditionOperands( // C99 6.5.6 > Expr *lex, Expr *rex, SourceLocation OpLoc); > inline QualType CheckSubtractionOperands( // C99 6.5.6 > Expr *lex, Expr *rex, SourceLocation OpLoc); While this isn't as terse, it more closely reflects the differences in the typechecking logic. For example, I disliked having to check the code again in CheckMultiplicativeOperands/CheckAdditiveOperands. Created the following helper functions: - Expr::isNullPointerConstant(). - SemaExpr.cpp: static inline BinaryOperator::Opcode ConvertTokenKindToBinaryOpcode(). This was purely asethetic, since ParseBinOp() is now larger. I didn't feel like looking at 2 huge switch statements. ParseBinOp() now avoids using any of the BinaryOperator predicates (since I switched to a switch statement:-) Only one regret (minor). I couldn't figure out how to avoid having two assign functions, CheckCompoundAssignmentOperands, CheckSimpleAssignmentOperands. Conceptually, the two functions make sense. Unfortunately, their implementation contains a lot of duplication (thought they aren't that be in the first place). llvm-svn: 39433
Diffstat (limited to 'clang/Basic/SourceManager.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud