[cfe-commits] r123485 - /cfe/trunk/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp
Ted Kremenek
kremenek at apple.com
Fri Jan 14 14:31:41 PST 2011
Author: kremenek
Date: Fri Jan 14 16:31:41 2011
New Revision: 123485
URL: http://llvm.org/viewvc/llvm-project?rev=123485&view=rev
Log:
Cleanup confused code that redundantly called "getDeclContext()" twice.
Found by clang static analyzer.
Modified:
cfe/trunk/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp?rev=123485&r1=123484&r2=123485&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/LLVMConventionsChecker.cpp Fri Jan 14 16:31:41 2011
@@ -38,15 +38,13 @@
/// 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) {
More information about the cfe-commits
mailing list