summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeCompletion/crash-func-decl.cpp
diff options
context:
space:
mode:
authorSam McCall <sam.mccall@gmail.com>2018-10-10 10:51:48 +0000
committerSam McCall <sam.mccall@gmail.com>2018-10-10 10:51:48 +0000
commitaeb4b3e6324bfcce4b997204e54b8a0bf63efd5d (patch)
treebb79c5938723a1c61dd31ff221a32629bb4343ff /clang/test/CodeCompletion/crash-func-decl.cpp
parent5cb3a82892ed66655849b49cd693c69f2139ec5c (diff)
downloadbcm5719-llvm-aeb4b3e6324bfcce4b997204e54b8a0bf63efd5d.tar.gz
bcm5719-llvm-aeb4b3e6324bfcce4b997204e54b8a0bf63efd5d.zip
[CodeComplete] Fix crash when completing params function declarations.
Summary: In a decl like `int AA(BB cc)` where BB isn't defined, we end up trying to parse `BB cc` as an expression (vexing parse) and end up triggering the parser's "recovery-in-function" completion with no actual function scope. This patch avoids the assumption that such a scope exists in this context. Reviewers: kadircet Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D53070 llvm-svn: 344133
Diffstat (limited to 'clang/test/CodeCompletion/crash-func-decl.cpp')
-rw-r--r--clang/test/CodeCompletion/crash-func-decl.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/test/CodeCompletion/crash-func-decl.cpp b/clang/test/CodeCompletion/crash-func-decl.cpp
new file mode 100644
index 00000000000..7abcdcdb271
--- /dev/null
+++ b/clang/test/CodeCompletion/crash-func-decl.cpp
@@ -0,0 +1,5 @@
+// Important that BB is unknown.
+// This triggers completion in PCC_RecoveryInFunction context, with no function.
+int AA(BB cc);
+// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:3:12 %s | FileCheck %s
+// CHECK: COMPLETION: char
OpenPOWER on IntegriCloud