Skip to content

Commit 3bed353

Browse files
author
Christian Ehrhardt
committed
clang-tidy: cheri: Allow modulus expressions in checkCastExpr
If the expression that is subject to a capability cast is a modulus expression with a positive constant the capability cast is ok because that expression cannot be a pointer.
1 parent 5c1c188 commit 3bed353

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang-tools-extra/clang-tidy/cheri/CheriUtil.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,8 +617,9 @@ class Util {
617617

618618
switch (Binop->getOpcode()) {
619619
case BO_And: {
620+
case BO_Rem:
620621
/*
621-
* If either side of the binary expression
622+
* If either side of and "and" or "remainder" expression
622623
* is a positive constant this is ok.
623624
*/
624625
if (Clhs && Clhs->sge(0))

0 commit comments

Comments
 (0)