Skip to content

Commit 4f23c35

Browse files
committed
C++: Don't generate WriteSideEffect instructions for const parameter indirections.
1 parent d490bea commit 4f23c35

File tree

2 files changed

+395
-457
lines changed

2 files changed

+395
-457
lines changed

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,14 +658,18 @@ newtype TTranslatedElement =
658658
t instanceof ReferenceType
659659
) and
660660
(
661-
isWrite = true or
661+
isWrite = true and
662+
not call.getTarget().getParameter(n).getType().isDeeplyConstBelow()
663+
or
662664
isWrite = false
663665
)
664666
or
665667
not call.getTarget() instanceof SideEffectFunction and
666668
n = -1 and
667669
(
668-
isWrite = true or
670+
isWrite = true and
671+
not call.getTarget() instanceof ConstMemberFunction
672+
or
669673
isWrite = false
670674
)
671675
) and

0 commit comments

Comments
 (0)