From: Ted Kremenek Date: Fri, 14 Jan 2011 22:31:41 +0000 (+0000) Subject: Cleanup confused code that redundantly called "getDeclContext()" twice. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c39b5e867df74904ac7e50d225b3cca0db43571f;p=clang Cleanup confused code that redundantly called "getDeclContext()" twice. Found by clang static analyzer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123485 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp b/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp index eefad95f21..a4a582968f 100644 --- a/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp @@ -38,15 +38,13 @@ static bool IsLLVMStringRef(QualType T) { /// Check whether the declaration is semantically inside the top-level /// namespace named by ns. static bool InNamespace(const Decl *D, llvm::StringRef NS) { - const DeclContext *DC = D->getDeclContext(); const NamespaceDecl *ND = dyn_cast(D->getDeclContext()); if (!ND) return false; const IdentifierInfo *II = ND->getIdentifier(); if (!II || !II->getName().equals(NS)) return false; - DC = ND->getDeclContext(); - return isa(DC); + return isa(ND->getDeclContext()); } static bool IsStdString(QualType T) {