Fix crash caused by this:
void f() {
int +; // crash here
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58846 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 3e4e2c5..fd94c80 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1639,6 +1639,10 @@
void Sema::ActOnUninitializedDecl(DeclTy *dcl) {
Decl *RealDecl = static_cast<Decl *>(dcl);
+ // If there is no declaration, there was an error parsing it. Just ignore it.
+ if (RealDecl == 0)
+ return;
+
if (VarDecl *Var = dyn_cast<VarDecl>(RealDecl)) {
QualType Type = Var->getType();
// C++ [dcl.init.ref]p3: