FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/cpp/ql/src/Microsoft/InconsistentSAL.ql at codeql-cli/v2.26.3 · github/codeql · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
github
/
codeql
Public
Notifications
You must be signed in to change notification settings
Fork
2.1k
Star
10k
Code
Issues
997
Pull requests
463
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql
/
cpp
/
ql
/
src
/
Microsoft
/
InconsistentSAL.ql
Copy path
More file actions
More file actions
Latest commit
History
History
History
41 lines (37 loc) · 1.25 KB
Breadcrumbs
codeql
/
cpp
/
ql
/
src
/
Microsoft
/
InconsistentSAL.ql
Copy path
File metadata and controls
41 lines (37 loc) · 1.25 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* @name Inconsistent SAL annotation
* @description Annotations are different between declaration and definition.
* @kind problem
* @id cpp/inconsistent-sal
* @problem.severity warning
* @tags reliability
*/
import
SAL
/** Holds if `e` has SAL annotation `name`. */
predicate
hasAnnotation
(
DeclarationEntry
e
,
string
name
)
{
exists
(
SalAnnotation
a
|
a
.
getMacro
(
)
.
getName
(
)
=
name
and
a
.
getDeclarationEntry
(
)
=
e
)
}
/** Holds if `e` is annotated to take its annotation from its declaration. */
predicate
inheritsDeclAnnotations
(
DeclarationEntry
e
)
{
// Is directly annotated
e
.
isDefinition
(
)
and
exists
(
SalAnnotation
a
|
a
.
getMacro
(
)
.
getName
(
)
=
"_Use_decl_annotations_"
|
a
.
getDeclarationEntry
(
)
=
e
)
or
// or is a parameter of a function with such an annotation
inheritsDeclAnnotations
(
e
.
(
ParameterDeclarationEntry
)
.
getFunctionDeclarationEntry
(
)
)
}
from
DeclarationEntry
e1
,
DeclarationEntry
e2
,
string
name
where
e1
.
getDeclaration
(
)
=
e2
.
getDeclaration
(
)
and
hasAnnotation
(
e1
,
name
)
and
not
hasAnnotation
(
e2
,
name
)
and
not
name
=
"_Use_decl_annotations_"
and
not
inheritsDeclAnnotations
(
e2
)
select
e2
,
"Missing SAL annotation "
+
name
+
" in "
+
e2
.
toString
(
)
+
" although it is present on $@."
,
e1
,
e1
.
toString
(
)
Back
|
FazBrowse Home
|
New Git URL