Skip to content

Commit b208862

Browse files
committed
+ update comments (checkedc#256)
1 parent 295d298 commit b208862

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

include/clang/AST/Expr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2799,7 +2799,7 @@ class BoundsExpr : public Expr {
27992799
class CastExpr : public Expr {
28002800
private:
28012801
// BOUNDS - declared bounds of the result of the cast expression
2802-
// CASTBOUNDS - inferred bounds of cast expression
2802+
// CASTBOUNDS - normalized version of BOUNDS
28032803
// SUBEXPRBOUNDS - inferred bounds of subexpression
28042804
enum { OP, BOUNDS, CASTBOUNDS, SUBEXPRBOUNDS, END_EXPR = 4 };
28052805
Stmt* SubExprs[END_EXPR];

lib/CodeGen/CGExpr.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4315,11 +4315,13 @@ llvm::Value *CodeGenFunction::EmitBoundsCast(CastExpr *CE) {
43154315
Expr *E = CE->getSubExpr();
43164316
QualType DestTy = CE->getType();
43174317
CastKind Kind = CE->getCastKind();
4318-
// Bounds casting has two functionalities
4318+
// Bounds casting has two functionalities.
43194319
// - code generation for explicit type casting
4320-
// - code generation for dynamic check, dynamic_bounds_cast only
4321-
// - dynamic_check(e1 != NULL)
4322-
// - dynamic_check(lb <= e2 && e3 <= ub)
4320+
// - code generation for dynamic check for only dynamic_bounds_cast
4321+
// : bounds_cast<T>(e1, e2, e3) with e1 : bounds(lb, ub)
4322+
// - dynamic_check(e1 == NULL || (lb <= e2 && e3 <= ub))
4323+
// if e1 is NULL, it skips checking range bounds.
4324+
// otherwise, it checks range bounds.
43234325
Address Addr = Address::invalid();
43244326
// For count bounds, source can be a pointer/array type (ArrayToPointerDecay)
43254327
// For range bounds, source can be a pointer/array/integer

0 commit comments

Comments
 (0)