mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
C++: Modernize the files tests.
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
| c.c | library-tests/files/c.c |
|
||||
| files1.cpp | library-tests/files/files1.cpp |
|
||||
| files1.h | library-tests/files/files1.h |
|
||||
| files2.cpp | library-tests/files/files2.cpp |
|
||||
@@ -1,5 +0,0 @@
|
||||
import cpp
|
||||
|
||||
from File f
|
||||
where f.toString() != ""
|
||||
select f.toString(), f.getRelativePath()
|
||||
4
cpp/ql/test/library-tests/files/Files.expected
Normal file
4
cpp/ql/test/library-tests/files/Files.expected
Normal file
@@ -0,0 +1,4 @@
|
||||
| c.c | library-tests/files/c.c | CFile, MetricFile | C | | |
|
||||
| files1.cpp | library-tests/files/files1.cpp | CppFile, MetricFile | C++ | swap | t |
|
||||
| files1.h | library-tests/files/files1.h | HeaderFile, MetricFile | | swap | |
|
||||
| files2.cpp | library-tests/files/files2.cpp | CppFile, MetricFile | C++ | g | x, y |
|
||||
15
cpp/ql/test/library-tests/files/Files.ql
Normal file
15
cpp/ql/test/library-tests/files/Files.ql
Normal file
@@ -0,0 +1,15 @@
|
||||
import cpp
|
||||
|
||||
string describe(File f) {
|
||||
f.compiledAsC() and
|
||||
result = "C"
|
||||
or
|
||||
f.compiledAsCpp() and
|
||||
result = "C++"
|
||||
}
|
||||
|
||||
from File f
|
||||
where f.toString() != ""
|
||||
select f.toString(), f.getRelativePath(), concat(f.getAQlClass().toString(), ", "),
|
||||
concat(describe(f), ", "), concat(f.getATopLevelDeclaration().toString(), ", "),
|
||||
concat(LocalVariable v | f.getADeclaration() = v | v.toString(), ", ")
|
||||
@@ -1 +0,0 @@
|
||||
| files1.h:0:0:0:0 | files1.h | files1.cpp:4:6:4:9 | swap |
|
||||
@@ -1,4 +0,0 @@
|
||||
import cpp
|
||||
|
||||
from HeaderFile f
|
||||
select f, f.getATopLevelDeclaration()
|
||||
@@ -1,8 +0,0 @@
|
||||
| CFile | C | --- | c.c |
|
||||
| CppFile | - | C++ | files1.cpp |
|
||||
| CppFile | - | C++ | files2.cpp |
|
||||
| HeaderFile | - | --- | files1.h |
|
||||
| MetricFile | - | --- | files1.h |
|
||||
| MetricFile | - | C++ | files1.cpp |
|
||||
| MetricFile | - | C++ | files2.cpp |
|
||||
| MetricFile | C | --- | c.c |
|
||||
@@ -1,11 +0,0 @@
|
||||
import cpp
|
||||
|
||||
string isCompiledAsC(File f) { if f.compiledAsC() then result = "C" else result = "-" }
|
||||
|
||||
string isCompiledAsCpp(File f) { if f.compiledAsCpp() then result = "C++" else result = "---" }
|
||||
|
||||
from File f
|
||||
// On 64bit Linux, __va_list_tag is in the unknown file (""). Ignore it.
|
||||
where f.getAbsolutePath() != ""
|
||||
select (f.getAQlClass().toString() + " ").prefix(10), isCompiledAsC(f), isCompiledAsCpp(f),
|
||||
f.toString()
|
||||
@@ -1,3 +0,0 @@
|
||||
| files1.cpp | files1.cpp:4:6:4:9 | swap |
|
||||
| files1.h | files1.cpp:4:6:4:9 | swap |
|
||||
| files2.cpp | files2.cpp:3:6:3:6 | g |
|
||||
@@ -1,7 +0,0 @@
|
||||
import cpp
|
||||
|
||||
from File f, Declaration d
|
||||
where
|
||||
d = f.getATopLevelDeclaration() and
|
||||
d.getName() != "__va_list_tag"
|
||||
select f.toString(), d
|
||||
@@ -1,3 +0,0 @@
|
||||
| files1.cpp | files1.cpp:6:6:6:6 | t |
|
||||
| files2.cpp | files2.cpp:4:6:4:6 | x |
|
||||
| files2.cpp | files2.cpp:5:6:5:6 | y |
|
||||
@@ -1,5 +0,0 @@
|
||||
import cpp
|
||||
|
||||
from File f, LocalVariable v
|
||||
where f.getADeclaration() = v
|
||||
select f.toString(), v
|
||||
Reference in New Issue
Block a user