Skip to content

Commit ff7ff6d

Browse files
authored
Merge pull request #14201 from MathiasVP/add-ast-consistency-query
C++: Add AST consistency query
2 parents 55546fe + 0cd4e32 commit ff7ff6d

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @name Count AST inconsistencies
3+
* @description Counts the various AST inconsistencies that may occur.
4+
* This query is for internal use only and may change without notice.
5+
* @kind table
6+
* @id cpp/count-ast-inconsistencies
7+
*/
8+
9+
import cpp
10+
11+
predicate hasDuplicateFunctionEntryPointLocation(Function func) {
12+
count(func.getEntryPoint().getLocation()) > 1
13+
}
14+
15+
predicate hasDuplicateFunctionEntryPoint(Function func) { count(func.getEntryPoint()) > 1 }
16+
17+
select count(Function f | hasDuplicateFunctionEntryPoint(f) | f) as duplicateFunctionEntryPoint,
18+
count(Function f | hasDuplicateFunctionEntryPointLocation(f) | f) as duplicateFunctionEntryPointLocation

0 commit comments

Comments
 (0)