summaryrefslogtreecommitdiff
path: root/test/Tooling
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2017-08-18 21:26:13 +0000
committerJohannes Altmanninger <aclopte@gmail.com>2017-08-18 21:26:13 +0000
commit5ce0ae8c6ac9dc99e4807f2989be4c6c50975c5e (patch)
tree3c247fa946d32f226cc8ccd14709c28a43002c14 /test/Tooling
parent433560bf0604ccb20dcafe9716270ba06debd7c9 (diff)
[clang-diff] Move the JSON export function to clang-diff
Reviewers: arphaman Subscribers: klimek Differential Revision: https://reviews.llvm.org/D36178 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@311199 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Tooling')
-rw-r--r--test/Tooling/clang-diff-json.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Tooling/clang-diff-json.cpp b/test/Tooling/clang-diff-json.cpp
new file mode 100644
index 0000000000..ee67a6d1f3
--- /dev/null
+++ b/test/Tooling/clang-diff-json.cpp
@@ -0,0 +1,27 @@
+// RUN: clang-diff -ast-dump %s -- \
+// RUN: | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
+// RUN: | FileCheck %s
+
+// CHECK: "begin": 294,
+// CHECK: "type": "CXXRecordDecl",
+// CHECK: "type": "FieldDecl",
+// CHECK: "end": 314,
+class A {
+ int x;
+};
+
+// CHECK: "children": [
+// CHECK-NEXT: {
+// CHECK-NEXT: "begin":
+// CHECK-NEXT: "children": []
+// CHECK-NEXT: "end":
+// CHECK-NEXT: "id":
+// CHECK-NEXT: "type": "CharacterLiteral"
+// CHECK-NEXT: }
+// CHECK: ]
+// CHECK: "type": "VarDecl",
+char nl = '\n';
+
+// CHECK: "value": "abc \n\t\u0000\u001f\u0123 \ub370\ubc15"
+char s[] = "abc \n\t\0\x1f\u0123 데박";
+