]> granicus.if.org Git - clang/commitdiff
Add a C++ indexing test case, where we show the references of overloaded '+' plus...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 14 Jul 2009 03:19:46 +0000 (03:19 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 14 Jul 2009 03:19:46 +0000 (03:19 +0000)
Ok, this is a bit out of place since C++ support is way way off, but it was just too cool to not show it off :-)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75601 91177308-0d34-0410-b5e6-96231b3b80d8

test/Index/cxx-operator-overload-input.cpp [new file with mode: 0644]
test/Index/cxx-operator-overload.cpp [new file with mode: 0644]

diff --git a/test/Index/cxx-operator-overload-input.cpp b/test/Index/cxx-operator-overload-input.cpp
new file mode 100644 (file)
index 0000000..f0503ae
--- /dev/null
@@ -0,0 +1,12 @@
+class Cls {
+public:
+    Cls operator +(const Cls &RHS);
+};
+
+static void bar() {
+    Cls x1, x2, x3;
+    Cls x4 = x1 + x2 + x3;
+}
+
+Cls Cls::operator +(const Cls &RHS) {
+}
diff --git a/test/Index/cxx-operator-overload.cpp b/test/Index/cxx-operator-overload.cpp
new file mode 100644 (file)
index 0000000..54d6896
--- /dev/null
@@ -0,0 +1,9 @@
+// RUN: clang-cc -emit-pch %S/cxx-operator-overload-input.cpp -o %t.ast &&
+// RUN: index-test %t.ast -point-at %S/cxx-operator-overload-input.cpp:8:17 -print-decls | count 2 &&
+// RUN: index-test %t.ast -point-at %S/cxx-operator-overload-input.cpp:8:17 -print-decls | grep ':3:9,' &&
+// RUN: index-test %t.ast -point-at %S/cxx-operator-overload-input.cpp:8:17 -print-decls | grep ':11:10,' &&
+
+// Yep, we can show references of '+' plus signs that are overloaded, w00t!
+// RUN: index-test %t.ast -point-at %S/cxx-operator-overload-input.cpp:3:15 -print-refs | count 2 &&
+// RUN: index-test %t.ast -point-at %S/cxx-operator-overload-input.cpp:3:15 -print-refs | grep ':8:17,' &&
+// RUN: index-test %t.ast -point-at %S/cxx-operator-overload-input.cpp:3:15 -print-refs | grep ':8:22,'