From: Axel Naumann Date: Tue, 8 Nov 2011 18:21:06 +0000 (+0000) Subject: From Vassil Vassilev: add checks for removing Decls for more use cases. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d9d137e6bc54bad6a7aa64b667aea22230e8264b;p=clang From Vassil Vassilev: add checks for removing Decls for more use cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144094 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 95d52cb0fa..c766577ab0 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -1622,7 +1622,7 @@ FunctionDecl::setPreviousDeclaration(FunctionDecl *PrevDecl) { FunTmpl->setPreviousDeclaration(PrevFunTmpl); } - if (PrevDecl->IsInline) + if (PrevDecl && PrevDecl->IsInline) IsInline = true; } diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index 4c31bbd3d7..d892c56f71 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -987,7 +987,8 @@ void DeclContext::removeDecl(Decl *D) { StoredDeclsMap::iterator Pos = Map->find(ND->getDeclName()); assert(Pos != Map->end() && "no lookup entry for decl"); - Pos->second.remove(ND); + if (Pos->second.getAsVector() || Pos->second.getAsDecl() == ND) + Pos->second.remove(ND); } }