[clang] [Webkit Checkers] Treat const member variables as a safe origin (PR #115594)
Rashmi Mudduluru via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 14 16:29:36 PST 2024
================
@@ -145,25 +145,36 @@ bool isCtorOfSafePtr(const clang::FunctionDecl *F) {
return isCtorOfRefCounted(F) || isCtorOfCheckedPtr(F);
}
-bool isSafePtrType(const clang::QualType T) {
+template <typename Predicate>
+static bool isPtrOfType(const clang::QualType T, Predicate Pred) {
QualType type = T;
while (!type.isNull()) {
if (auto *elaboratedT = type->getAs<ElaboratedType>()) {
type = elaboratedT->desugar();
continue;
}
if (auto *specialT = type->getAs<TemplateSpecializationType>()) {
- if (auto *decl = specialT->getTemplateName().getAsTemplateDecl()) {
- auto name = decl->getNameAsString();
- return isRefType(name) || isCheckedPtr(name);
- }
+ if (auto *decl = specialT->getTemplateName().getAsTemplateDecl())
----------------
t-rasmud wrote:
Can we do an early return here instead of nested `if`s?
https://github.com/llvm/llvm-project/pull/115594
More information about the cfe-commits
mailing list