]> granicus.if.org Git - clang/commitdiff
From Vassil Vassilev: add checks for removing Decls for more use cases.
authorAxel Naumann <Axel.Naumann@cern.ch>
Tue, 8 Nov 2011 18:21:06 +0000 (18:21 +0000)
committerAxel Naumann <Axel.Naumann@cern.ch>
Tue, 8 Nov 2011 18:21:06 +0000 (18:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144094 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Decl.cpp
lib/AST/DeclBase.cpp

index 95d52cb0fa1b7a0c752ceaf29565441999384c2c..c766577ab0e3494e44edd205c64403384c7fbbfd 100644 (file)
@@ -1622,7 +1622,7 @@ FunctionDecl::setPreviousDeclaration(FunctionDecl *PrevDecl) {
     FunTmpl->setPreviousDeclaration(PrevFunTmpl);
   }
   
-  if (PrevDecl->IsInline)
+  if (PrevDecl && PrevDecl->IsInline)
     IsInline = true;
 }
 
index 4c31bbd3d7620b40a2ef5323baf02b4d4fa69455..d892c56f71212563636c5bdaf3e028c754ac1172 100644 (file)
@@ -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);
   }
 }