summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clangd/ExpectedTypes.cpp
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2019-11-20 14:38:35 -0500
committerNico Weber <thakis@chromium.org>2019-11-20 14:38:35 -0500
commit6de45772e0910bf7fa626e5493a2798b071eb26c (patch)
treecd0f3a344c4c19536f0d09b90faa3555dfe5ae5c /clang-tools-extra/clangd/ExpectedTypes.cpp
parentf751a79173958526b8e8793d4e4c84b2d33dc662 (diff)
downloadbcm5719-llvm-6de45772e0910bf7fa626e5493a2798b071eb26c.tar.gz
bcm5719-llvm-6de45772e0910bf7fa626e5493a2798b071eb26c.zip
Revert "[clangd] Fix a crash in expected types"
This reverts commit b5135a86e04761577494c70e7c0057136cc90b5b. Test fails on Windows.
Diffstat (limited to 'clang-tools-extra/clangd/ExpectedTypes.cpp')
-rw-r--r--clang-tools-extra/clangd/ExpectedTypes.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang-tools-extra/clangd/ExpectedTypes.cpp b/clang-tools-extra/clangd/ExpectedTypes.cpp
index a82a64cf14e..3b0779ea66b 100644
--- a/clang-tools-extra/clangd/ExpectedTypes.cpp
+++ b/clang-tools-extra/clangd/ExpectedTypes.cpp
@@ -44,10 +44,12 @@ static const Type *toEquivClass(ASTContext &Ctx, QualType T) {
static llvm::Optional<QualType>
typeOfCompletion(const CodeCompletionResult &R) {
const NamedDecl *D = R.Declaration;
+ if (!D)
+ return llvm::None;
// Templates do not have a type on their own, look at the templated decl.
- if (auto *Template = dyn_cast_or_null<TemplateDecl>(D))
+ if (auto *Template = dyn_cast<TemplateDecl>(D))
D = Template->getTemplatedDecl();
- auto *VD = dyn_cast_or_null<ValueDecl>(D);
+ auto *VD = dyn_cast<ValueDecl>(D);
if (!VD)
return llvm::None; // We handle only variables and functions below.
auto T = VD->getType();
OpenPOWER on IntegriCloud