[PATCH] D10022: Refactor: Simplify boolean conditional return statements in lib/StaticAnalyzer/Core
Richard via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 24 12:23:50 PDT 2015
LegalizeAdulthood updated this revision to Diff 38319.
LegalizeAdulthood added a comment.
Update from latest
http://reviews.llvm.org/D10022
Files:
lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
lib/StaticAnalyzer/Core/SValBuilder.cpp
lib/StaticAnalyzer/Core/SymbolManager.cpp
Index: lib/StaticAnalyzer/Core/SymbolManager.cpp
===================================================================
--- lib/StaticAnalyzer/Core/SymbolManager.cpp
+++ lib/StaticAnalyzer/Core/SymbolManager.cpp
@@ -493,9 +493,7 @@
if (LCtx != ELCtx) {
// If the reaper's location context is a parent of the expression's
// location context, then the expression value is now "out of scope".
- if (LCtx->isParentOf(ELCtx))
- return false;
- return true;
+ return !LCtx->isParentOf(ELCtx);
}
// If no statement is provided, everything is this and parent contexts is live.
Index: lib/StaticAnalyzer/Core/SValBuilder.cpp
===================================================================
--- lib/StaticAnalyzer/Core/SValBuilder.cpp
+++ lib/StaticAnalyzer/Core/SValBuilder.cpp
@@ -394,10 +394,7 @@
if (ToTy->isVoidType())
return true;
- if (ToTy != FromTy)
- return false;
-
- return true;
+ return ToTy == FromTy;
}
// FIXME: should rewrite according to the cast kind.
Index: lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
===================================================================
--- lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
+++ lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
@@ -690,14 +690,11 @@
return true;
CXXBasePaths Paths(false, false, false);
- if (RD->lookupInBases(
- [DeclName](const CXXBaseSpecifier *Specifier, CXXBasePath &Path) {
- return CXXRecordDecl::FindOrdinaryMember(Specifier, Path, DeclName);
- },
- Paths))
- return true;
-
- return false;
+ return RD->lookupInBases(
+ [DeclName](const CXXBaseSpecifier *Specifier, CXXBasePath &Path) {
+ return CXXRecordDecl::FindOrdinaryMember(Specifier, Path, DeclName);
+ },
+ Paths);
}
/// Returns true if the given C++ class is a container or iterator.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10022.38319.patch
Type: text/x-patch
Size: 1879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151024/ee32bea9/attachment.bin>
More information about the cfe-commits
mailing list