summaryrefslogtreecommitdiff
path: root/test/FixIt
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2016-12-19 22:35:24 +0000
committerJordan Rose <jordan_rose@apple.com>2016-12-19 22:35:24 +0000
commit64caf82375f4a7988a0b23fa54fc527944356d3c (patch)
treed153d94bafbac08ad95de95efb388b512930a062 /test/FixIt
parent3efe802b4e854017f1e120006168bcd5056254dc (diff)
Don't try to emit nullability fix-its within/around macros.
The newly-added notes from r290132 are too noisy even when the fix-it is valid. For the existing warning from r286521, it's probably the right decision 95% of the time to put the change outside the macro if the array is outside the macro and inside otherwise, but I don't want to overthink it right now. Caught by the ASan bot! More rdar://problem/29524992 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@290141 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/FixIt')
-rw-r--r--test/FixIt/Inputs/nullability.h8
-rw-r--r--test/FixIt/nullability.mm6
2 files changed, 14 insertions, 0 deletions
diff --git a/test/FixIt/Inputs/nullability.h b/test/FixIt/Inputs/nullability.h
index 5dd5dfab3b..bdfa01e499 100644
--- a/test/FixIt/Inputs/nullability.h
+++ b/test/FixIt/Inputs/nullability.h
@@ -17,3 +17,11 @@ void arrayParameterWithStar(int x[*]); // expected-warning {{array parameter is
// expected-note@-2 {{insert '_Nonnull'}}
// CHECK: fix-it:"{{.*}}nullability.h":{[[@LINE-3]]:35-[[@LINE-3]]:35}:"_Nullable "
// CHECK: fix-it:"{{.*}}nullability.h":{[[@LINE-4]]:35-[[@LINE-4]]:35}:"_Nonnull "
+
+
+// No fix-its on either the macro definition or instantiation.
+// CHECK-NOT: fix-it:"{{.*}}nullability.h":{[[@LINE+2]]
+// CHECK-NOT: fix-it:"{{.*}}nullability.h":{[[@LINE+2]]
+#define PTR(X) X *
+PTR(int) a; // expected-warning{{pointer is missing a nullability type specifier}}
+#undef PTR
diff --git a/test/FixIt/nullability.mm b/test/FixIt/nullability.mm
index eb900bb446..815c844192 100644
--- a/test/FixIt/nullability.mm
+++ b/test/FixIt/nullability.mm
@@ -16,6 +16,12 @@ extern void* array2[2]; // expected-warning {{inferring '_Nonnull' for pointer t
extern void *nestedArray[2][3]; // expected-warning {{inferring '_Nonnull' for pointer type within array is deprecated}}
// CHECK: fix-it:"{{.*}}nullability.mm":{[[@LINE-1]]:14-[[@LINE-1]]:14}:" _Nonnull "
+// No fix-its on either the macro definition or instantiation.
+// CHECK-NOT: fix-it:"{{.*}}nullability.mm":{[[@LINE+2]]
+// CHECK-NOT: fix-it:"{{.*}}nullability.mm":{[[@LINE+2]]
+#define PTR(X) X *
+extern PTR(void) array[2]; // expected-warning {{inferring '_Nonnull' for pointer type within array is deprecated}}
+
typedef const void *CFTypeRef;