[PATCH] D50879: [analyzer] [NFC] Minor refactoring of ISL-specific code in RetainCountChecker
George Karpenkov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 17 14:44:19 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rC340098: [analyzer] [NFC] Minor refactoring of ISL-specific code in RetainCountChecker (authored by george.karpenkov, committed by ).
Herald added a subscriber: cfe-commits.
Changed prior to commit:
https://reviews.llvm.org/D50879?vs=161151&id=161339#toc
Repository:
rC Clang
https://reviews.llvm.org/D50879
Files:
lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountSummaries.cpp
Index: lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountSummaries.cpp
===================================================================
--- lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountSummaries.cpp
+++ lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountSummaries.cpp
@@ -482,10 +482,10 @@
return isRetain(FD, FName) || isAutorelease(FD, FName) ||
isMakeCollectable(FName);
- if (FD->getDefinition()) {
- bool out = isTrustedReferenceCountImplementation(FD->getDefinition());
- hasTrustedImplementationAnnotation = out;
- return out;
+ const FunctionDecl* FDD = FD->getDefinition();
+ if (FDD && isTrustedReferenceCountImplementation(FDD)) {
+ hasTrustedImplementationAnnotation = true;
+ return true;
}
}
Index: lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
===================================================================
--- lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
+++ lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
@@ -765,9 +765,7 @@
bool hasTrustedImplementationAnnotation = false;
// See if it's one of the specific functions we know how to eval.
- bool canEval = SmrMgr.canEval(CE, FD, hasTrustedImplementationAnnotation);
-
- if (!canEval)
+ if (!SmrMgr.canEval(CE, FD, hasTrustedImplementationAnnotation))
return false;
// Bind the return value.
@@ -1235,11 +1233,8 @@
return N;
}
-static bool isGeneralizedObjectRef(QualType Ty) {
- if (Ty.getAsString().substr(0, 4) == "isl_")
- return true;
- else
- return false;
+static bool isISLObjectRef(QualType Ty) {
+ return StringRef(Ty.getAsString()).startswith("isl_");
}
void RetainCountChecker::checkBeginFunction(CheckerContext &Ctx) const {
@@ -1263,9 +1258,9 @@
QualType Ty = Param->getType();
const ArgEffect *AE = CalleeSideArgEffects.lookup(idx);
- if (AE && *AE == DecRef && isGeneralizedObjectRef(Ty)) {
+ if (AE && *AE == DecRef && isISLObjectRef(Ty)) {
state = setRefBinding(state, Sym, RefVal::makeOwned(RetEffect::ObjKind::Generalized, Ty));
- } else if (isGeneralizedObjectRef(Ty)) {
+ } else if (isISLObjectRef(Ty)) {
state = setRefBinding(
state, Sym,
RefVal::makeNotOwned(RetEffect::ObjKind::Generalized, Ty));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50879.161339.patch
Type: text/x-patch
Size: 2364 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180817/c5833033/attachment.bin>
More information about the cfe-commits
mailing list