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

Skip to content

Commit 6e5207c

Browse files
committed
CPP: Allow declarations of library printf functions in source (repairs most of the tests).
1 parent fe8f7e9 commit 6e5207c

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

  • cpp/ql/src/semmle/code/cpp/models/implementations

cpp/ql/src/semmle/code/cpp/models/implementations/Printf.qll

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class Printf extends FormattingFunction {
1313
hasGlobalName("wprintf_s") or
1414
hasGlobalName("g_printf")
1515
) and
16-
not exists(getADeclarationEntry().getFile().getRelativePath())
16+
not exists(getDefinition().getFile().getRelativePath())
1717
}
1818

1919
override int getFormatParameterIndex() { result=0 }
@@ -34,7 +34,7 @@ class Fprintf extends FormattingFunction {
3434
hasGlobalName("fwprintf") or
3535
hasGlobalName("g_fprintf")
3636
) and
37-
not exists(getADeclarationEntry().getFile().getRelativePath())
37+
not exists(getDefinition().getFile().getRelativePath())
3838
}
3939

4040
override int getFormatParameterIndex() { result=1 }
@@ -57,7 +57,7 @@ class Sprintf extends FormattingFunction {
5757
hasGlobalName("g_sprintf") or
5858
hasGlobalName("__builtin___sprintf_chk")
5959
) and
60-
not exists(getADeclarationEntry().getFile().getRelativePath())
60+
not exists(getDefinition().getFile().getRelativePath())
6161
}
6262

6363
override predicate isWideCharDefault() {
@@ -111,7 +111,7 @@ class Snprintf extends FormattingFunction {
111111
or hasGlobalName("wnsprintf")
112112
or hasGlobalName("__builtin___snprintf_chk")
113113
) and
114-
not exists(getADeclarationEntry().getFile().getRelativePath())
114+
not exists(getDefinition().getFile().getRelativePath())
115115
}
116116

117117
override int getFormatParameterIndex() {
@@ -150,7 +150,7 @@ class Snprintf extends FormattingFunction {
150150
hasGlobalName("__builtin___snprintf_chk") or
151151
hasGlobalName("snprintf_s")
152152
) and
153-
not exists(getADeclarationEntry().getFile().getRelativePath())
153+
not exists(getDefinition().getFile().getRelativePath())
154154
}
155155

156156
override int getSizeParameterIndex() {
@@ -173,7 +173,7 @@ class StringCchPrintf extends FormattingFunction {
173173
or hasGlobalName("StringCbPrintf_l")
174174
or hasGlobalName("StringCbPrintf_lEx")
175175
) and
176-
not exists(getADeclarationEntry().getFile().getRelativePath())
176+
not exists(getDefinition().getFile().getRelativePath())
177177
}
178178

179179
override int getFormatParameterIndex() {

0 commit comments

Comments
 (0)