Skip to content

Commit 1307b77

Browse files
authored
Delete unused code in WebKit checkers (#171768)
1 parent a6c211d commit 1307b77

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
@@ -287,37 +287,6 @@ bool RetainTypeChecker::isUnretained(const QualType QT, bool ignoreARC) {
287287
return RecordlessTypes.contains(QT.getTypePtr());
288288
}
289289

290-
std::optional<bool> isUnretained(const QualType T, bool IsARCEnabled) {
291-
if (auto *Subst = dyn_cast<SubstTemplateTypeParmType>(T)) {
292-
if (auto *Decl = Subst->getAssociatedDecl()) {
293-
if (isRetainPtrOrOSPtr(safeGetName(Decl)))
294-
return false;
295-
}
296-
}
297-
if ((ento::cocoa::isCocoaObjectRef(T) && !IsARCEnabled) ||
298-
ento::coreFoundation::isCFObjectRef(T))
299-
return true;
300-
301-
// RetainPtr strips typedef for CF*Ref. Manually check for struct __CF* types.
302-
auto CanonicalType = T.getCanonicalType();
303-
auto *Type = CanonicalType.getTypePtrOrNull();
304-
if (!Type)
305-
return false;
306-
auto Pointee = Type->getPointeeType();
307-
auto *PointeeType = Pointee.getTypePtrOrNull();
308-
if (!PointeeType)
309-
return false;
310-
auto *Record = PointeeType->getAsStructureType();
311-
if (!Record)
312-
return false;
313-
auto *Decl = Record->getDecl();
314-
if (!Decl)
315-
return false;
316-
auto TypeName = Decl->getName();
317-
return TypeName.starts_with("__CF") || TypeName.starts_with("__CG") ||
318-
TypeName.starts_with("__CM");
319-
}
320-
321290
std::optional<bool> isUncounted(const CXXRecordDecl* Class)
322291
{
323292
// Keep isRefCounted first as it's cheaper.
@@ -353,25 +322,6 @@ std::optional<bool> isUncheckedPtr(const QualType T) {
353322
return false;
354323
}
355324

356-
std::optional<bool> isUnsafePtr(const QualType T, bool IsArcEnabled) {
357-
if (T->isPointerType() || T->isReferenceType()) {
358-
if (auto *CXXRD = T->getPointeeCXXRecordDecl()) {
359-
auto isUncountedPtr = isUncounted(CXXRD);
360-
auto isUncheckedPtr = isUnchecked(CXXRD);
361-
auto isUnretainedPtr = isUnretained(T, IsArcEnabled);
362-
std::optional<bool> result;
363-
if (isUncountedPtr)
364-
result = *isUncountedPtr;
365-
if (isUncheckedPtr)
366-
result = result ? *result || *isUncheckedPtr : *isUncheckedPtr;
367-
if (isUnretainedPtr)
368-
result = result ? *result || *isUnretainedPtr : *isUnretainedPtr;
369-
return result;
370-
}
371-
}
372-
return false;
373-
}
374-
375325
std::optional<bool> isGetterOfSafePtr(const CXXMethodDecl *M) {
376326
assert(M);
377327

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)