Skip to content

Commit c8bf0d0

Browse files
committed
C++: Add formatAttribute test.
1 parent 1376385 commit c8bf0d0

File tree

5 files changed

+29
-0
lines changed

5 files changed

+29
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
typedef void *va_list;
3+
4+
int myPrintf(const char *format, ...) __attribute__((format(printf, 1, 2)));
5+
int mySprintf(char *buffer, const char *format, ...) __attribute__((format(__printf__, 2, 3)));
6+
int myVprintf(const char *format, va_list arg) __attribute__((format(printf, 1, 0)));
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| AttributeFormattingFunction.cpp:4:5:4:12 | myPrintf | 0 | char | wchar_t | wchar_t |
2+
| AttributeFormattingFunction.cpp:5:5:5:13 | mySprintf | 1 | char | wchar_t | wchar_t |
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import cpp
2+
3+
from AttributeFormattingFunction f
4+
select
5+
f,
6+
f.getFormatParameterIndex(),
7+
concat(f.getDefaultCharType().toString(), ", "),
8+
concat(f.getWideCharType().toString(), ", "),
9+
concat(f.getNonDefaultCharType().toString(), ", ")
10+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
| AttributeFormattingFunction.cpp:4:54:4:59 | format | printf | 0 | 1 |
2+
| AttributeFormattingFunction.cpp:5:69:5:74 | format | __printf__ | 1 | 2 |
3+
| AttributeFormattingFunction.cpp:6:63:6:68 | format | printf | 0 | |
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import cpp
2+
3+
from FormatAttribute fa
4+
select
5+
fa,
6+
fa.getArchetype(),
7+
concat(fa.getFormatIndex().toString(), ", "),
8+
concat(fa.getFirstFormatArgIndex().toString(), ", ")

0 commit comments

Comments
 (0)