diff options
| author | Alexander Kornienko <alexfh@google.com> | 2017-05-09 14:56:28 +0000 |
|---|---|---|
| committer | Alexander Kornienko <alexfh@google.com> | 2017-05-09 14:56:28 +0000 |
| commit | d0488d427c74564a1f95849c5faa9b1f3b9ee45b (patch) | |
| tree | 51097882a9c431d1f0a88d9d969a53b1f93b6823 /clang-tools-extra/test/clang-tidy/misc-non-copyable-objects.c | |
| parent | 66fb0d9768edf37c65c20e9d4dafc5d7f96669de (diff) | |
| download | bcm5719-llvm-d0488d427c74564a1f95849c5faa9b1f3b9ee45b.tar.gz bcm5719-llvm-d0488d427c74564a1f95849c5faa9b1f3b9ee45b.zip | |
Change EOL style to LF. NFC
llvm-svn: 302534
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/misc-non-copyable-objects.c')
| -rw-r--r-- | clang-tools-extra/test/clang-tidy/misc-non-copyable-objects.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/clang-tools-extra/test/clang-tidy/misc-non-copyable-objects.c b/clang-tools-extra/test/clang-tidy/misc-non-copyable-objects.c index 98e52b95f69..ac6198e8b37 100644 --- a/clang-tools-extra/test/clang-tidy/misc-non-copyable-objects.c +++ b/clang-tools-extra/test/clang-tidy/misc-non-copyable-objects.c @@ -1,43 +1,43 @@ -// RUN: %check_clang_tidy %s misc-non-copyable-objects %t
-
-typedef struct FILE {} FILE;
-typedef struct pthread_cond_t {} pthread_cond_t;
-typedef int pthread_mutex_t;
-
-// CHECK-MESSAGES: :[[@LINE+1]]:13: warning: 'f' declared as type 'FILE', which is unsafe to copy; did you mean 'FILE *'? [misc-non-copyable-objects]
-void g(FILE f);
-// CHECK-MESSAGES: :[[@LINE+1]]:24: warning: 'm' declared as type 'pthread_mutex_t', which is unsafe to copy; did you mean 'pthread_mutex_t *'?
-void h(pthread_mutex_t m);
-// CHECK-MESSAGES: :[[@LINE+1]]:23: warning: 'c' declared as type 'pthread_cond_t', which is unsafe to copy; did you mean 'pthread_cond_t *'?
-void i(pthread_cond_t c);
-
-struct S {
- pthread_cond_t c; // ok
- // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: 'f' declared as type 'FILE', which is unsafe to copy; did you mean 'FILE *'?
- FILE f;
-};
-
-void func(FILE *f) {
- // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: 'f1' declared as type 'FILE', which is unsafe to copy; did you mean 'FILE *'?
- FILE f1; // match
- // CHECK-MESSAGES: :[[@LINE+2]]:8: warning: 'f2' declared as type 'FILE', which is unsafe to copy; did you mean 'FILE *'?
- // CHECK-MESSAGES: :[[@LINE+1]]:13: warning: expression has opaque data structure type 'FILE'; type should only be used as a pointer and not dereferenced
- FILE f2 = *f;
- // CHECK-MESSAGES: :[[@LINE+1]]:15: warning: 'f3' declared as type 'FILE', which is unsafe to copy; did you mean 'FILE *'?
- struct FILE f3;
- // CHECK-MESSAGES: :[[@LINE+1]]:16: warning: expression has opaque data structure type 'FILE'; type should only be used as a pointer and not dereferenced
- (void)sizeof(*f);
- (void)sizeof(FILE);
- // CHECK-MESSAGES: :[[@LINE+1]]:5: warning: expression has opaque data structure type 'FILE'; type should only be used as a pointer and not dereferenced
- g(*f);
-
- pthread_mutex_t m; // ok
- h(m); // ok
-
- pthread_cond_t c; // ok
- i(c); // ok
-
- pthread_mutex_t *m1 = &m; // ok
- // CHECK-MESSAGES: :[[@LINE+1]]:5: warning: expression has opaque data structure type 'pthread_mutex_t'; type should only be used as a pointer and not dereferenced
- h(*m1);
-}
\ No newline at end of file +// RUN: %check_clang_tidy %s misc-non-copyable-objects %t + +typedef struct FILE {} FILE; +typedef struct pthread_cond_t {} pthread_cond_t; +typedef int pthread_mutex_t; + +// CHECK-MESSAGES: :[[@LINE+1]]:13: warning: 'f' declared as type 'FILE', which is unsafe to copy; did you mean 'FILE *'? [misc-non-copyable-objects] +void g(FILE f); +// CHECK-MESSAGES: :[[@LINE+1]]:24: warning: 'm' declared as type 'pthread_mutex_t', which is unsafe to copy; did you mean 'pthread_mutex_t *'? +void h(pthread_mutex_t m); +// CHECK-MESSAGES: :[[@LINE+1]]:23: warning: 'c' declared as type 'pthread_cond_t', which is unsafe to copy; did you mean 'pthread_cond_t *'? +void i(pthread_cond_t c); + +struct S { + pthread_cond_t c; // ok + // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: 'f' declared as type 'FILE', which is unsafe to copy; did you mean 'FILE *'? + FILE f; +}; + +void func(FILE *f) { + // CHECK-MESSAGES: :[[@LINE+1]]:8: warning: 'f1' declared as type 'FILE', which is unsafe to copy; did you mean 'FILE *'? + FILE f1; // match + // CHECK-MESSAGES: :[[@LINE+2]]:8: warning: 'f2' declared as type 'FILE', which is unsafe to copy; did you mean 'FILE *'? + // CHECK-MESSAGES: :[[@LINE+1]]:13: warning: expression has opaque data structure type 'FILE'; type should only be used as a pointer and not dereferenced + FILE f2 = *f; + // CHECK-MESSAGES: :[[@LINE+1]]:15: warning: 'f3' declared as type 'FILE', which is unsafe to copy; did you mean 'FILE *'? + struct FILE f3; + // CHECK-MESSAGES: :[[@LINE+1]]:16: warning: expression has opaque data structure type 'FILE'; type should only be used as a pointer and not dereferenced + (void)sizeof(*f); + (void)sizeof(FILE); + // CHECK-MESSAGES: :[[@LINE+1]]:5: warning: expression has opaque data structure type 'FILE'; type should only be used as a pointer and not dereferenced + g(*f); + + pthread_mutex_t m; // ok + h(m); // ok + + pthread_cond_t c; // ok + i(c); // ok + + pthread_mutex_t *m1 = &m; // ok + // CHECK-MESSAGES: :[[@LINE+1]]:5: warning: expression has opaque data structure type 'pthread_mutex_t'; type should only be used as a pointer and not dereferenced + h(*m1); +} |

