summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeCompletion/ctor-initializer.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2016-06-16 21:40:06 +0000
committerOlivier Goffart <ogoffart@woboq.com>2016-06-16 21:40:06 +0000
commitf9e890cbf964ec2222693034d159c49a28f6f117 (patch)
treed9b8baadf77a24c92e1ccce8b7905d0a48367ab6 /clang/test/CodeCompletion/ctor-initializer.cpp
parent119dad63bc5bd5ed46d2be2556af148264f9f62f (diff)
downloadbcm5719-llvm-f9e890cbf964ec2222693034d159c49a28f6f117.tar.gz
bcm5719-llvm-f9e890cbf964ec2222693034d159c49a28f6f117.zip
Fix a few issues while skipping function bodies
- In functions with try { } catch { }, only the try block would be skipped, not the catch blocks - The template functions would still be parsed. - The initializers within a constructor would still be parsed. - The inline functions within class would still be stored, only to be discared later. - Invalid code with try would assert (as in "int foo() try assert_here") This attempt to do even less while skipping function bodies. Differential Revision: http://reviews.llvm.org/D20821 llvm-svn: 272963
Diffstat (limited to 'clang/test/CodeCompletion/ctor-initializer.cpp')
-rw-r--r--clang/test/CodeCompletion/ctor-initializer.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/clang/test/CodeCompletion/ctor-initializer.cpp b/clang/test/CodeCompletion/ctor-initializer.cpp
new file mode 100644
index 00000000000..00af64dd4fa
--- /dev/null
+++ b/clang/test/CodeCompletion/ctor-initializer.cpp
@@ -0,0 +1,41 @@
+struct Base1 {
+ Base1() : {}
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:2:12 %s -o - | FileCheck -check-prefix=CHECK-CC1 %s
+ // CHECK-CC1: COMPLETION: Pattern : member1(<#args#>)
+ // CHECK-CC1: COMPLETION: Pattern : member2(<#args#>
+
+ Base1(int) : member1(123), {}
+ // RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:7:30 %s -o - | FileCheck -check-prefix=CHECK-CC2 %s
+ // CHECK-CC2-NOT: COMPLETION: Pattern : member1(<#args#>)
+ // CHECK-CC2: COMPLETION: Pattern : member2(<#args#>
+
+ int member1;
+ float member2;
+};
+
+struct Derived : public Base1 {
+ Derived();
+ Derived(int);
+ Derived(float);
+ int deriv1;
+};
+
+Derived::Derived() : {}
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:23:22 %s -o - | FileCheck -check-prefix=CHECK-CC3 %s
+// CHECK-CC3: COMPLETION: Pattern : Base1(<#args#>)
+// CHECK-CC3: COMPLETION: Pattern : deriv1(<#args#>)
+
+Derived::Derived(int) try : {
+} catch (...) {
+}
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:28:29 %s -o - | FileCheck -check-prefix=CHECK-CC4 %s
+// CHECK-CC4: COMPLETION: Pattern : Base1(<#args#>)
+// CHECK-CC4: COMPLETION: Pattern : deriv1(<#args#>)
+
+Derived::Derived(float) try : Base1(),
+{
+} catch (...) {
+}
+// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:35:39 %s -o - | FileCheck -check-prefix=CHECK-CC5 %s
+// CHECK-CC5-NOT: COMPLETION: Pattern : Base1(<#args#>)
+// CHECK-CC5: COMPLETION: Pattern : deriv1(<#args#>)
OpenPOWER on IntegriCloud