Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8f9849b

Browse files
committed
C++: Add BuiltInIntAddr class for __INTADDR__
1 parent 6b27dca commit 8f9849b

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

cpp/ql/src/semmle/code/cpp/exprs/BuiltInOperations.qll

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,19 @@ class BuiltInNoOp extends BuiltInOperation, @noopexpr {
4242
}
4343

4444
/**
45-
* A C++ `__offsetof` expression (used by some implementations of offsetof in the presence of user-defined `operator&`).
45+
* A C++ `__offsetof` expression (used by some implementations of offsetof in the presence of user-defined `operator&`).
4646
*/
4747
class BuiltInOperationOffsetOf extends BuiltInOperation, @offsetofexpr {
4848
override string toString() { result = "__offsetof" }
4949
}
5050

51+
/**
52+
* A C/C++ `__INTADDR__` expression, used by EDG to implement `offsetof` in the presence of user-defined `operator&`.
53+
*/
54+
class BuiltInIntAddr extends BuiltInOperation, @intaddrexpr {
55+
override string toString() { result = "__INTADDR__" }
56+
}
57+
5158
/**
5259
* A C++ `__has_assign` expression (used by some implementations of the type_traits header).
5360
*/

cpp/ql/test/library-tests/builtins/edg/expr.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
| edg.c:13:14:13:45 | (...) | 0 | 0 |
99
| edg.c:13:14:13:45 | (mystruct *)... | 0 | 0 |
1010
| edg.c:13:14:13:45 | (size_t)... | 0 | 0 |
11+
| edg.c:13:14:13:45 | __INTADDR__ | 1 | 1 |
1112
| edg.c:13:43:13:44 | f2 | 0 | 0 |
1213
| file://:0:0:0:0 | 0 | 0 | 0 |
1314
| file://:0:0:0:0 | * ... | 0 | 0 |

0 commit comments

Comments
 (0)