mirror of
https://github.com/github/codeql.git
synced 2026-04-27 17:55:19 +02:00
C++ IR: Support __builtin_addressof
This commit is contained in:
@@ -174,6 +174,17 @@ bad_asts.cpp:
|
||||
# 27| Type = const Point &
|
||||
# 27| ValueCategory = prvalue(load)
|
||||
# 28| 1: return ...
|
||||
clang.cpp:
|
||||
# 5| int* globalIntAddress()
|
||||
# 5| params:
|
||||
# 5| body: { ... }
|
||||
# 6| 0: return ...
|
||||
# 6| 0: __builtin_addressof ...
|
||||
# 6| Type = int *
|
||||
# 6| ValueCategory = prvalue
|
||||
# 6| 0: globalInt
|
||||
# 6| Type = int
|
||||
# 6| ValueCategory = lvalue
|
||||
ir.cpp:
|
||||
# 1| void Constants()
|
||||
# 1| params:
|
||||
|
||||
7
cpp/ql/test/library-tests/ir/ir/clang.cpp
Normal file
7
cpp/ql/test/library-tests/ir/ir/clang.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
// semmle-extractor-options: --clang
|
||||
|
||||
int globalInt;
|
||||
|
||||
int *globalIntAddress() {
|
||||
return __builtin_addressof(globalInt);
|
||||
}
|
||||
@@ -48,6 +48,20 @@ bad_asts.cpp:
|
||||
# 26| v0_13(void) = UnmodeledUse : mu*
|
||||
# 26| v0_14(void) = ExitFunction :
|
||||
|
||||
clang.cpp:
|
||||
# 5| int* globalIntAddress()
|
||||
# 5| Block 0
|
||||
# 5| v0_0(void) = EnterFunction :
|
||||
# 5| mu0_1(unknown) = AliasedDefinition :
|
||||
# 5| mu0_2(unknown) = UnmodeledDefinition :
|
||||
# 6| r0_3(glval<int *>) = VariableAddress[#return] :
|
||||
# 6| r0_4(glval<int>) = VariableAddress[globalInt] :
|
||||
# 6| mu0_5(int *) = Store : &:r0_3, r0_4
|
||||
# 5| r0_6(glval<int *>) = VariableAddress[#return] :
|
||||
# 5| v0_7(void) = ReturnValue : &:r0_6, ~mu0_2
|
||||
# 5| v0_8(void) = UnmodeledUse : mu*
|
||||
# 5| v0_9(void) = ExitFunction :
|
||||
|
||||
ir.cpp:
|
||||
# 1| void Constants()
|
||||
# 1| Block 0
|
||||
|
||||
Reference in New Issue
Block a user