summaryrefslogtreecommitdiff
path: root/test/FixIt
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2017-08-17 14:22:27 +0000
committerAlex Lorenz <arphaman@gmail.com>2017-08-17 14:22:27 +0000
commitd4d128789d475f17fa1d04de15e491a4920f0e74 (patch)
tree1e48017a54ff319b3493f9c99e515b953fbc370c /test/FixIt
parent05fae15d08c7298a9a14bde5b50d1eafa298dee9 (diff)
Unguarded availability diagnoser should use TraverseStmt instead of
Base::TraverseStmt when visiting the then/else branches of if statements This ensures that the statement stack is correctly tracked and correct multi-statement fixit is generated inside of an if (@available) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311088 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/FixIt')
-rw-r--r--test/FixIt/fixit-availability.mm8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/FixIt/fixit-availability.mm b/test/FixIt/fixit-availability.mm
index f6a1855694..a566082532 100644
--- a/test/FixIt/fixit-availability.mm
+++ b/test/FixIt/fixit-availability.mm
@@ -108,6 +108,14 @@ void wrapDeclStmtUses() {
// CHECK-NEXT: fix-it:{{.*}}:{[[@LINE-2]]:24-[[@LINE-2]]:24}:"\n } else {\n // Fallback on earlier versions\n }"
anotherFunction(y);
anotherFunction(x);
+
+ if (@available(macOS 10.1, *)) {
+ int z = function();
+ (void)z;
+// CHECK: fix-it:{{.*}}:{[[@LINE-2]]:5-[[@LINE-2]]:5}:"if (@available(macOS 10.12, *)) {\n "
+// CHECK-NEXT: fix-it:{{.*}}:{[[@LINE-2]]:13-[[@LINE-2]]:13}:"\n } else {\n // Fallback on earlier versions\n }"
+ anotherFunction(x);
+ }
}
#define API_AVAILABLE(X) __attribute__((availability(macos, introduced=10.12))) // dummy macro