]> granicus.if.org Git - clang/commitdiff
Cleanup confused code that redundantly called "getDeclContext()" twice.
authorTed Kremenek <kremenek@apple.com>
Fri, 14 Jan 2011 22:31:41 +0000 (22:31 +0000)
committerTed Kremenek <kremenek@apple.com>
Fri, 14 Jan 2011 22:31:41 +0000 (22:31 +0000)
Found by clang static analyzer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123485 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp

index eefad95f215f88480b36d2b4ce463c8c2cfa139a..a4a582968fe9db4b7691f0076227c1dd88dfa907 100644 (file)
@@ -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<NamespaceDecl>(D->getDeclContext());
   if (!ND)
     return false;
   const IdentifierInfo *II = ND->getIdentifier();
   if (!II || !II->getName().equals(NS))
     return false;
-  DC = ND->getDeclContext();
-  return isa<TranslationUnitDecl>(DC);
+  return isa<TranslationUnitDecl>(ND->getDeclContext());
 }
 
 static bool IsStdString(QualType T) {