Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit39ef003

Browse files
Update to use features from codeql-qtil
1 parentb47ec45 commit39ef003

File tree

6 files changed

+25
-155
lines changed

6 files changed

+25
-155
lines changed

‎cpp/common/src/codingstandards/cpp/util/CondensedList.qll‎

Lines changed: 0 additions & 105 deletions
This file was deleted.

‎cpp/common/src/codingstandards/cpp/util/Pair.qll‎

Lines changed: 0 additions & 21 deletions
This file was deleted.

‎cpp/misra/src/codeql-pack.lock.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
lockVersion:1.0.0
33
dependencies:
4+
advanced-security/qtil:
5+
version:0.0.1
46
codeql/cpp-all:
57
version:2.1.1
68
codeql/dataflow:

‎cpp/misra/src/qlpack.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ license: MIT
66
dependencies:
77
codeql/common-cpp-coding-standards:'*'
88
codeql/cpp-all:2.1.1
9+
advanced-security/qtil:0.0.1

‎cpp/misra/src/rules/RULE-19-0-4/UndefOfMacroNotDefinedInFile.ql‎

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,15 @@
1616

1717
import cpp
1818
import codingstandards.cpp.misra
19-
import codingstandards.cpp.util.CondensedList
20-
import codingstandards.cpp.util.Pair
19+
import qtil.Qtil
2120

2221
classDefOrUndefextendsPreprocessorDirective{
23-
stringname;
22+
DefOrUndef(){thisinstanceofPreprocessorUndeforthisinstanceofMacro}
2423

25-
DefOrUndef(){
26-
name=this.(PreprocessorUndef).getName()or
27-
name=this.(Macro).getName()
24+
stringgetName(){
25+
result=this.(PreprocessorUndef).getName()or
26+
result=this.(Macro).getName()
2827
}
29-
30-
stringgetName(){result=name}
3128
}
3229

3330
predicaterelevantNameAndFile(stringname,Filefile){
@@ -37,30 +34,24 @@ predicate relevantNameAndFile(string name, File file) {
3734
)
3835
}
3936

40-
classStringFilePair= Pair<string,File>::Where<relevantNameAndFile/2>::Pair;
41-
42-
module DefUndefListConfigimplementsCondensedListSig{
43-
classDivision=StringFilePair;
37+
classStringFilePair= Qtil::Pair<string,File,relevantNameAndFile/2>::Pair;
4438

45-
classItem=DefOrUndef;
39+
/**
40+
* Defs and undefs ordered by location, grouped by name and file.
41+
*/
42+
classOrderedDefOrUndefextends Qtil::Ordered<DefOrUndef>::GroupBy<StringFilePair>::Type{
43+
overrideintgetOrder(){result=getLocation().getStartLine()}
4644

47-
intgetSparseIndex(StringFilePairdivision,DefOrUndefdirective){
48-
directive.getName()=division.getFirst()and
49-
directive.getFile()=division.getSecond()and
50-
result=directive.getLocation().getStartLine()
45+
overrideStringFilePairgetGroup(){
46+
result.getFirst()=getName()andresult.getSecond()=getFile()
5147
}
5248
}
5349

54-
classListEntry= Condense<DefUndefListConfig>::ListEntry;
55-
56-
fromPreprocessorUndefundef,ListEntrydefUndefListEntry
50+
fromOrderedDefOrUndefdefOrUndef
5751
where
58-
notisExcluded(undef, PreprocessorPackage::undefOfMacroNotDefinedInFileQuery())and
59-
// There exists a def or undef for a given name and file, and it is an #undef
60-
undef=defUndefListEntry.getItem()and
61-
// Exclude cases where the previous def or undef with the same name in the same file is a #define
62-
notexists(ListEntryprev|
63-
prev=defUndefListEntry.getPrev()and
64-
prev.getItem()instanceofMacro
65-
)
66-
selectundef,"Undef of name '"+undef.getName()+"' not defined in the same file."
52+
notisExcluded(defOrUndef, PreprocessorPackage::undefOfMacroNotDefinedInFileQuery())and
53+
// There exists an #undef for a given name and file
54+
defOrUndefinstanceofPreprocessorUndefand
55+
// A previous def or undef of this name must exist in this file, and it must be a #define
56+
notdefOrUndef.getPrevious()instanceofMacro
57+
selectdefOrUndef,"Undef of name '"+defOrUndef.getName()+"' not defined in the same file."

‎cpp/misra/test/codeql-pack.lock.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
lockVersion:1.0.0
33
dependencies:
4+
advanced-security/qtil:
5+
version:0.0.1
46
codeql/cpp-all:
57
version:2.1.1
68
codeql/dataflow:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp