Skip to content

Commit d2ae766

Browse files
committed
Delete unused code in WebKit checkers (llvm#171768)
(cherry picked from commit 1307b77)
1 parent 7e3c647 commit d2ae766

File tree

2 files changed

+0
-58
lines changed

2 files changed

+0
-58
lines changed

clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.cpp

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -300,37 +300,6 @@ bool RetainTypeChecker::isUnretained(const QualType QT, bool ignoreARC) {
300300
return RT && CFPointees.contains(RT);
301301
}
302302

303-
std::optional<bool> isUnretained(const QualType T, bool IsARCEnabled) {
304-
if (auto *Subst = dyn_cast<SubstTemplateTypeParmType>(T)) {
305-
if (auto *Decl = Subst->getAssociatedDecl()) {
306-
if (isRetainPtrOrOSPtr(safeGetName(Decl)))
307-
return false;
308-
}
309-
}
310-
if ((ento::cocoa::isCocoaObjectRef(T) && !IsARCEnabled) ||
311-
ento::coreFoundation::isCFObjectRef(T))
312-
return true;
313-
314-
// RetainPtr strips typedef for CF*Ref. Manually check for struct __CF* types.
315-
auto CanonicalType = T.getCanonicalType();
316-
auto *Type = CanonicalType.getTypePtrOrNull();
317-
if (!Type)
318-
return false;
319-
auto Pointee = Type->getPointeeType();
320-
auto *PointeeType = Pointee.getTypePtrOrNull();
321-
if (!PointeeType)
322-
return false;
323-
auto *Record = PointeeType->getAsStructureType();
324-
if (!Record)
325-
return false;
326-
auto *Decl = Record->getDecl();
327-
if (!Decl)
328-
return false;
329-
auto TypeName = Decl->getName();
330-
return TypeName.starts_with("__CF") || TypeName.starts_with("__CG") ||
331-
TypeName.starts_with("__CM");
332-
}
333-
334303
std::optional<bool> isUncounted(const CXXRecordDecl* Class)
335304
{
336305
// Keep isRefCounted first as it's cheaper.
@@ -366,25 +335,6 @@ std::optional<bool> isUncheckedPtr(const QualType T) {
366335
return false;
367336
}
368337

369-
std::optional<bool> isUnsafePtr(const QualType T, bool IsArcEnabled) {
370-
if (T->isPointerType() || T->isReferenceType()) {
371-
if (auto *CXXRD = T->getPointeeCXXRecordDecl()) {
372-
auto isUncountedPtr = isUncounted(CXXRD);
373-
auto isUncheckedPtr = isUnchecked(CXXRD);
374-
auto isUnretainedPtr = isUnretained(T, IsArcEnabled);
375-
std::optional<bool> result;
376-
if (isUncountedPtr)
377-
result = *isUncountedPtr;
378-
if (isUncheckedPtr)
379-
result = result ? *result || *isUncheckedPtr : *isUncheckedPtr;
380-
if (isUnretainedPtr)
381-
result = result ? *result || *isUnretainedPtr : *isUnretainedPtr;
382-
return result;
383-
}
384-
}
385-
return false;
386-
}
387-
388338
std::optional<bool> isGetterOfSafePtr(const CXXMethodDecl *M) {
389339
assert(M);
390340

clang/lib/StaticAnalyzer/Checkers/WebKit/PtrTypesSemantics.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ class RetainTypeChecker {
8787
bool defaultSynthProperties() const { return DefaultSynthProperties; }
8888
};
8989

90-
/// \returns true if \p Class is NS or CF objects AND not retained, false if
91-
/// not, std::nullopt if inconclusive.
92-
std::optional<bool> isUnretained(const clang::QualType T, bool IsARCEnabled);
93-
9490
/// \returns true if \p Class is ref-countable AND not ref-counted, false if
9591
/// not, std::nullopt if inconclusive.
9692
std::optional<bool> isUncounted(const clang::CXXRecordDecl* Class);
@@ -107,10 +103,6 @@ std::optional<bool> isUncountedPtr(const clang::QualType T);
107103
/// class, false if not, std::nullopt if inconclusive.
108104
std::optional<bool> isUncheckedPtr(const clang::QualType T);
109105

110-
/// \returns true if \p T is either a raw pointer or reference to an uncounted
111-
/// or unchecked class, false if not, std::nullopt if inconclusive.
112-
std::optional<bool> isUnsafePtr(const QualType T, bool IsArcEnabled);
113-
114106
/// \returns true if \p T is a RefPtr, Ref, CheckedPtr, CheckedRef, or its
115107
/// variant, false if not.
116108
bool isRefOrCheckedPtrType(const clang::QualType T);

0 commit comments

Comments
 (0)