summaryrefslogtreecommitdiffstats
path: root/clang/test/Format/cursor.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-05-21 12:21:39 +0000
committerDaniel Jasper <djasper@google.com>2013-05-21 12:21:39 +0000
commit2a250b8b49e70f53b185749a94956d54d941ef2d (patch)
treedf02c858d099e0982459b90d2f0d9715ee1b05b1 /clang/test/Format/cursor.cpp
parentc787d42f40a6e4a8ee5c2d1a910b393b7191fdfa (diff)
downloadbcm5719-llvm-2a250b8b49e70f53b185749a94956d54d941ef2d.tar.gz
bcm5719-llvm-2a250b8b49e70f53b185749a94956d54d941ef2d.zip
Let clang-format move the cursor appropriately.
With this patch, clang-format will try to keep the cursor at the original code position in editor integrations (implemented for emacs and vim). This means, after formatting, clang-format will try to keep the cursor on the same character of the same token. llvm-svn: 182373
Diffstat (limited to 'clang/test/Format/cursor.cpp')
-rw-r--r--clang/test/Format/cursor.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/Format/cursor.cpp b/clang/test/Format/cursor.cpp
new file mode 100644
index 00000000000..d9aab5acb63
--- /dev/null
+++ b/clang/test/Format/cursor.cpp
@@ -0,0 +1,6 @@
+// RUN: grep -Ev "// *[A-Z-]+:" %s > %t2.cpp
+// RUN: clang-format -style=LLVM %t2.cpp -cursor=6 > %t.cpp
+// RUN: FileCheck -strict-whitespace -input-file=%t.cpp %s
+// CHECK: {{^\{ "Cursor": 4 \}$}}
+// CHECK: {{^int\ \i;$}}
+ int i;
OpenPOWER on IntegriCloud