From 618f97ca21d5319f499a2fe130e957aea2475051 Mon Sep 17 00:00:00 2001 From: Kaelyn Uhrain Date: Wed, 15 Feb 2012 22:59:03 +0000 Subject: Silence a valgrind warning, and remove an unused var. llvm-svn: 150629 --- clang/lib/Sema/SemaLookup.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'clang/lib/Sema/SemaLookup.cpp') diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index ceb3dcaaed3..81710d2043f 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -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(NamespaceDeclChain.back())) { + NamespaceDeclChain.empty() ? NULL : + dyn_cast_or_null(NamespaceDeclChain.back())) { IdentifierInfo *Name = ND->getIdentifier(); if (std::find(CurContextIdentifiers.begin(), CurContextIdentifiers.end(), Name) != CurContextIdentifiers.end() || -- cgit v1.2.3