]> granicus.if.org Git - clang/commitdiff
Silence a valgrind warning, and remove an unused var.
authorKaelyn Uhrain <rikka@google.com>
Wed, 15 Feb 2012 22:59:03 +0000 (22:59 +0000)
committerKaelyn Uhrain <rikka@google.com>
Wed, 15 Feb 2012 22:59:03 +0000 (22:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150629 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaLookup.cpp

index ceb3dcaaed373775ac6a52a71a6c043172662ea7..81710d2043f23ef7aca490e4f261f7704471d59a 100644 (file)
@@ -3335,8 +3335,6 @@ void NamespaceSpecifierSet::AddNamespace(NamespaceDecl *ND) {
   unsigned NumSpecifiers = 0;
   DeclContextList NamespaceDeclChain(BuildContextChain(Ctx));
   DeclContextList FullNamespaceDeclChain(NamespaceDeclChain);
-  // The full size of NamespaceDeclChain before any common elements are removed
-  DeclContextList::size_type FullSize = NamespaceDeclChain.size();
 
   // Eliminate common elements from the two DeclContext chains.
   for (DeclContextList::reverse_iterator C = CurContextChain.rbegin(),
@@ -3348,7 +3346,8 @@ void NamespaceSpecifierSet::AddNamespace(NamespaceDecl *ND) {
 
   // Add an explicit leading '::' specifier if needed.
   if (NamespaceDecl *ND =
-      dyn_cast<NamespaceDecl>(NamespaceDeclChain.back())) {
+        NamespaceDeclChain.empty() ? NULL :
+          dyn_cast_or_null<NamespaceDecl>(NamespaceDeclChain.back())) {
     IdentifierInfo *Name = ND->getIdentifier();
     if (std::find(CurContextIdentifiers.begin(), CurContextIdentifiers.end(),
                   Name) != CurContextIdentifiers.end() ||