diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2017-03-24 09:11:57 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2017-03-24 09:11:57 +0000 |
commit | 45bbe0117bee932c967de6d44984ea7dab8f36b5 (patch) | |
tree | f138defe1ddbfab8edbad2265af359e6339f6289 /clang/test/CodeGen/nonnull.c | |
parent | 0387364c4c00277be875e1544d99492b0ea7820b (diff) | |
download | bcm5719-llvm-45bbe0117bee932c967de6d44984ea7dab8f36b5.tar.gz bcm5719-llvm-45bbe0117bee932c967de6d44984ea7dab8f36b5.zip |
Revert r298491 and r298494 which changed Clang's handling of 'nonnull'
attributes.
These patches don't work because we can't currently access the parameter
information in a reliable way when building attributes. I thought this
would be relatively straightforward to fix, but it seems not to be the
case. Fixing this will requrie a substantial re-plumbing of machinery to
allow attributes to be handled in this location, and several other fixes
to the attribute machinery should probably be made at the same time. All
of this will make the patch .... substantially more complicated.
Reverting for now as there are active miscompiles caused by the current
version.
llvm-svn: 298695
Diffstat (limited to 'clang/test/CodeGen/nonnull.c')
-rw-r--r-- | clang/test/CodeGen/nonnull.c | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/clang/test/CodeGen/nonnull.c b/clang/test/CodeGen/nonnull.c index 63d8b90b349..7c33e6329fd 100644 --- a/clang/test/CodeGen/nonnull.c +++ b/clang/test/CodeGen/nonnull.c @@ -49,87 +49,3 @@ __attribute__((nonnull(2))) {} // CHECK: define void @bar8(i32* nonnull %a, i32* nonnull %b) void bar8(int *a, int *b) __attribute__((nonnull)) __attribute__((nonnull(1))) {} - -// CHECK: declare void @foo_decl(i32* nonnull) -void foo_decl(int *__attribute__((nonnull))); - -// CHECK: declare void @bar_decl(i32* nonnull) -void bar_decl(int *) __attribute__((nonnull(1))); - -// CHECK: declare void @bar2_decl(i32*, i32* nonnull) -void bar2_decl(int *, int *) __attribute__((nonnull(2))); - -// CHECK: declare nonnull i32* @bar3_decl() -int *bar3_decl(void) __attribute__((returns_nonnull)); - -// CHECK: declare i32 @bar4_decl(i32, i32* nonnull) -int bar4_decl(int, int *) __attribute__((nonnull)); - -// CHECK: declare i32 @bar5_decl(i32, i32* nonnull) -int bar5_decl(int, int *) __attribute__((nonnull(1, 2))); - -// CHECK: declare i32 @bar6_decl(i64) -int bar6_decl(TransparentUnion) __attribute__((nonnull(1))); - -// CHECK: declare void @bar7_decl(i32* nonnull, i32* nonnull) -void bar7_decl(int *, int *) - __attribute__((nonnull(1))) __attribute__((nonnull(2))); - -// CHECK: declare void @bar8_decl(i32* nonnull, i32* nonnull) -void bar8_decl(int *, int *) - __attribute__((nonnull)) __attribute__((nonnull(1))); - -// Clang specially disables nonnull attributes on some library builtin -// functions to work around the fact that the standard and some vendors mark -// them as nonnull even though they are frequently called in practice with null -// arguments if a corresponding size argument is zero. - -// CHECK: declare i8* @memcpy(i8*, i8*, i64) -void *memcpy(void *, const void *, unsigned long) - __attribute__((nonnull(1, 2))) __attribute__((returns_nonnull)); - -// CHECK: declare i32 @memcmp(i8*, i8*, i64) -int memcmp(const void *, const void *, unsigned long) __attribute__((nonnull(1, 2))); - -// CHECK: declare i8* @memmove(i8*, i8*, i64) -void *memmove(void *, const void *, unsigned long) - __attribute__((nonnull(1, 2))) __attribute__((returns_nonnull)); - -// CHECK: declare i8* @strncpy(i8*, i8*, i64) -char *strncpy(char *, const char *, unsigned long) - __attribute__((nonnull(1, 2))) __attribute__((returns_nonnull)); - -// CHECK: declare i32 @strncmp(i8*, i8*, i64) -int strncmp(const char *, const char *, unsigned long) __attribute__((nonnull(1, 2))); - -// CHECK: declare nonnull i8* @strncat(i8* nonnull, i8*, i64) -char *strncat(char *, const char *, unsigned long) - __attribute__((nonnull(1, 2))) __attribute__((returns_nonnull)); - -// CHECK: declare i8* @memchr(i8*, i32, i64) -void *memchr(const void *__attribute__((nonnull)), int, unsigned long) - __attribute__((returns_nonnull)); - -// CHECK: declare i8* @memset(i8*, i32, i64) -void *memset(void *__attribute__((nonnull)), int, unsigned long) - __attribute__((returns_nonnull)); - -void use_declarations(int *p, void *volatile *sink) { - foo_decl(p); - bar_decl(p); - bar2_decl(p, p); - (void)bar3_decl(); - bar4_decl(42, p); - bar5_decl(42, p); - bar6_decl(p); - bar7_decl(p, p); - bar8_decl(p, p); - *sink = (void *)&memcpy; - *sink = (void *)&memcmp; - *sink = (void *)&memmove; - *sink = (void *)&strncpy; - *sink = (void *)&strncmp; - *sink = (void *)&strncat; - *sink = (void *)&memchr; - *sink = (void *)&memset; -} |