summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/pragma-arc-cf-code-audited.c
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-09-30 05:12:12 +0000
committerJohn McCall <rjmccall@apple.com>2011-09-30 05:12:12 +0000
commit32f5fe1467c4f6cb9c3efe174cb6c8a374e6e149 (patch)
tree0045d1a99fc26a8c59d42184c0f322b6e97d7712 /clang/test/Sema/pragma-arc-cf-code-audited.c
parent3360b411a5cddd9b7067147b3621d90b56dd90a8 (diff)
downloadbcm5719-llvm-32f5fe1467c4f6cb9c3efe174cb6c8a374e6e149.tar.gz
bcm5719-llvm-32f5fe1467c4f6cb9c3efe174cb6c8a374e6e149.zip
Add explicit attributes to mark functions as having had their
CoreFoundation object-transfer properties audited, and add a #pragma to cause them to be automatically applied to functions in a particular span of code. This has to be implemented largely in the preprocessor because of the requirement that the region be entirely contained in a single file; that's hard to impose from the parser without registering for a ton of callbacks. llvm-svn: 140846
Diffstat (limited to 'clang/test/Sema/pragma-arc-cf-code-audited.c')
-rw-r--r--clang/test/Sema/pragma-arc-cf-code-audited.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/Sema/pragma-arc-cf-code-audited.c b/clang/test/Sema/pragma-arc-cf-code-audited.c
new file mode 100644
index 00000000000..b646e8966c6
--- /dev/null
+++ b/clang/test/Sema/pragma-arc-cf-code-audited.c
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+#pragma clang arc_cf_code_audited foo // expected-error {{expected 'begin' or 'end'}}
+
+#pragma clang arc_cf_code_audited begin foo // expected-warning {{extra tokens at end of #pragma directive}}
+
+#pragma clang arc_cf_code_audited end
+#pragma clang arc_cf_code_audited end // expected-error {{not currently inside '#pragma clang arc_cf_code_audited'}}
+
+#pragma clang arc_cf_code_audited begin // expected-note {{#pragma entered here}}
+#pragma clang arc_cf_code_audited begin // expected-error {{already inside '#pragma clang arc_cf_code_audited'}} expected-note {{#pragma entered here}}
+
+#include "Inputs/pragma-arc-cf-code-audited.h" // expected-error {{cannot #include files inside '#pragma clang arc_cf_code_audited'}}
+
+// This is actually on the #pragma line in the header.
+// expected-error {{'#pragma clang arc_cf_code_audited' was not ended within this file}}
+
+#pragma clang arc_cf_code_audited begin // expected-error {{'#pragma clang arc_cf_code_audited' was not ended within this file}}
OpenPOWER on IntegriCloud