1 ; Verify that incompatible declarations of known library functions are
2 ; not annotated with argument attributes. This negative test complements
5 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
6 ; RUN: opt < %s -passes=inferattrs -S | FileCheck %s --match-full-lines
9 ; Exercise <math.h> function declarations.
11 ; Expect double fabs(double).
12 declare float @fabs(float)
13 ; CHECK: declare float @fabs(float)
16 ; Exercise <stdio.h> function declarations.
18 ; Expect int fgetc(FILE*).
19 declare i32 @fgetc(ptr, i32)
20 ; CHECK: declare i32 @fgetc(ptr, i32)
22 ; Expect char* fgets(char*, int, FILE*).
23 declare i32 @fgets(ptr, i32, ptr)
24 ; CHECK: declare i32 @fgets(ptr, i32, ptr)
26 ; Expect int sprintf(char*, const char*, ...).
27 declare i32 @sprintf(ptr, i64, ptr, ...)
28 ; CHECK: declare i32 @sprintf(ptr, i64, ptr, ...)
30 ; Expect int snprintf(char*, size_t, const char*, ...).
31 declare i32 @snprintf(ptr, i64, ptr)
32 ; CHECK: declare i32 @snprintf(ptr, i64, ptr)
34 ; Expect int sscanf(const char*, const char*, ...).
35 declare i32 @sscanf(ptr, ...)
36 ; CHECK: declare i32 @sscanf(ptr, ...)
39 ; Exercise <stdlib.h> function declarations.
41 ; Expect int atoi(const char*).
43 ; CHECK: declare i8 @atoi(ptr)
45 ; Expect long long atoll(const char*).
46 declare i1 @atoll(ptr)
47 ; CHECK: declare i1 @atoll(ptr)
49 ; Expect double atof(const char*).
50 declare float @atof(ptr)
51 ; CHECK: declare float @atof(ptr)
53 ; Expect double strtod(const char*, char**).
54 declare double @strtod(ptr, ptr, i32)
55 ; CHECK: declare double @strtod(ptr, ptr, i32)
57 ; Expect float strtof(const char*, char**).
58 declare double @strtof(ptr, ptr)
59 ; CHECK: declare double @strtof(ptr, ptr)
62 ; Exercise <string.h> function declarations.
64 ; Expect void* memccpy(void*, const void*, int, size_t).
65 declare ptr @memccpy(ptr, ptr, i64, i64)
66 ; CHECK: declare ptr @memccpy(ptr, ptr, i64, i64)
68 ; Expect int strcasecmp(const char*, const char*).
69 declare i1 @strcasecmp(ptr, ptr)
70 ; CHECK: declare i1 @strcasecmp(ptr, ptr)
72 ; Expect int strcoll(const char*, const char*).
73 declare ptr @strcoll(ptr, ptr)
74 ; CHECK: declare ptr @strcoll(ptr, ptr)
76 ; Expect int strncasecmp(const char*, const char*, size_t).
77 declare i32 @strncasecmp(ptr, ptr, i64, i64)
78 ; CHECK: declare i32 @strncasecmp(ptr, ptr, i64, i64)
80 ; Expect int strxfrm(const char*, const char*).
81 declare i16 @strxfrm(ptr, ptr)
82 ; CHECK: declare i16 @strxfrm(ptr, ptr)
84 ; Expect char* strtok(const char*, const char*).
85 declare ptr @strtok(ptr, i8)
86 ; CHECK: declare ptr @strtok(ptr, i8)
88 ; Expect char* strtok_r(const char*, const char*, char**).
89 declare ptr @strtok_r(ptr, ptr, i64)
90 ; CHECK: declare ptr @strtok_r(ptr, ptr, i64)
92 ; Expect char* strdup(const char*).
93 declare ptr @strdup(ptr, i64)
94 ; CHECK: declare ptr @strdup(ptr, i64)
96 ; Expect char* strndup(const char*, size_t).
97 declare ptr @strndup(ptr, i64, i64)
98 ; CHECK: declare ptr @strndup(ptr, i64, i64)
101 ; Exercise <sys/stat.h> and <sys/statvfs.h> function declarations.
103 ; Expect int stat(const char*, struct stat*).
104 declare i32 @stat(ptr, ptr, i64)
105 ; CHECK: declare i32 @stat(ptr, ptr, i64)
107 ; Expect int statvfs(const char*, struct statvfs*).
108 declare i32 @statvfs(ptr, ptr, i64)
109 ; CHECK: declare i32 @statvfs(ptr, ptr, i64)