Merge pull request #24 from nickrolfe/declspec_guard

C++: test for __declspec(guard(...))
This commit is contained in:
ian-semmle
2018-08-28 16:15:08 +01:00
committed by GitHub
3 changed files with 20 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
// semmle-extractor-options: --edg --microsoft
void f(__declspec(guard(overflow)) size_t length) {
}
__declspec(guard(ignore))
void g(void) {
}

View File

@@ -0,0 +1,2 @@
| test.cpp:3:6:3:6 | f | 0 | length |
| test.cpp:7:6:7:6 | g | -1 | <none> |

View File

@@ -0,0 +1,10 @@
import cpp
// What we select here isn't too important; we're just testing the
// __declspec(guard(...)) attributes don't cause extractor errors.
from Function f, string p, int n
where if f.getNumberOfParameters() = 0
then (p = "<none>" and n = -1)
else p = f.getParameter(n).toString()
select f, n, p