[CodeComplete] Fix crash when completing params function declarations.
authorSam McCall <sam.mccall@gmail.com>
Wed, 10 Oct 2018 10:51:48 +0000 (10:51 +0000)
committerSam McCall <sam.mccall@gmail.com>
Wed, 10 Oct 2018 10:51:48 +0000 (10:51 +0000)
commitaeb4b3e6324bfcce4b997204e54b8a0bf63efd5d
treebb79c5938723a1c61dd31ff221a32629bb4343ff
parent5cb3a82892ed66655849b49cd693c69f2139ec5c
[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
clang/lib/Sema/SemaCodeComplete.cpp
clang/test/CodeCompletion/crash-func-decl.cpp [new file with mode: 0644]