|
clang 23.0.0git
|
Namespaces | |
| namespace | internal |
Classes | |
| struct | LifetimeSafetyOpts |
| class | LifetimeSafetySemaHelper |
| Abstract interface for operations requiring Sema access. More... | |
| class | LifetimeSafetySemaHelperImpl |
| struct | LifetimeSafetyStats |
| A structure to hold the statistics related to LifetimeAnalysis. More... | |
Enumerations | |
| enum class | WarningScope { CrossTU , IntraTU } |
| Enum to track functions visible across or within TU. More... | |
|
strong |
Enum to track functions visible across or within TU.
| Enumerator | |
|---|---|
| CrossTU | |
| IntraTU | |
Definition at line 44 of file LifetimeSafety.h.
| bool clang::lifetimes::destructsFirstArg | ( | const FunctionDecl & | FD | ) |
Definition at line 450 of file LifetimeAnnotations.cpp.
References getName(), clang::isa(), and isInStlNamespace().
| const CXXMethodDecl * clang::lifetimes::getDeclWithMergedLifetimeBoundAttrs | ( | const CXXMethodDecl * | CMD | ) |
Definition at line 27 of file LifetimeAnnotations.cpp.
References getDeclWithMergedLifetimeBoundAttrs().
| const FunctionDecl * clang::lifetimes::getDeclWithMergedLifetimeBoundAttrs | ( | const FunctionDecl * | FD | ) |
Definition at line 22 of file LifetimeAnnotations.cpp.
References clang::FunctionDecl::getMostRecentDecl().
Referenced by getDeclWithMergedLifetimeBoundAttrs(), getImplicitObjectParamLifetimeBoundAttr(), isAssignmentOperatorLifetimeBound(), and clang::sema::visitFunctionCallArguments().
| const LifetimeBoundAttr * clang::lifetimes::getDirectImplicitObjectLifetimeBoundAttr | ( | const FunctionDecl * | FD | ) |
Definition at line 76 of file LifetimeAnnotations.cpp.
References getLifetimeBoundAttrFromFunctionType(), and clang::DeclaratorDecl::getTypeSourceInfo().
Referenced by getImplicitObjectParamLifetimeBoundAttr(), and clang::lifetimes::LifetimeSafetySemaHelperImpl::reportMisplacedLifetimebound().
| const LifetimeBoundAttr * clang::lifetimes::getImplicitObjectParamLifetimeBoundAttr | ( | const FunctionDecl * | FD | ) |
Definition at line 84 of file LifetimeAnnotations.cpp.
References getDeclWithMergedLifetimeBoundAttrs(), getDirectImplicitObjectLifetimeBoundAttr(), clang::FunctionDecl::getTemplateInstantiationPattern(), and clang::FunctionDecl::redecls().
Referenced by implicitObjectParamIsLifetimeBound(), and clang::lifetimes::LifetimeSafetySemaHelperImpl::reportLifetimeboundViolation().
|
static |
Check if a function has a lifetimebound attribute on its function type (which represents the implicit 'this' parameter for methods).
Returns the attribute if found, nullptr otherwise.
Definition at line 61 of file LifetimeAnnotations.cpp.
References clang::TypeLoc::getAsAdjusted(), and clang::TypeSourceInfo::getTypeLoc().
Referenced by getDirectImplicitObjectLifetimeBoundAttr().
|
static |
Definition at line 317 of file LifetimeAnnotations.cpp.
References clang::NamedDecl::getIdentifier(), and clang::NamedDecl::getName().
Referenced by destructsFirstArg(), isInvalidationMethod(), isStdCallableWrapperType(), and isStdUniquePtr().
|
static |
Definition at line 325 of file LifetimeAnnotations.cpp.
References clang::NamedDecl::getIdentifier(), and clang::NamedDecl::getName().
| bool clang::lifetimes::implicitObjectParamIsLifetimeBound | ( | const FunctionDecl * | FD | ) |
Definition at line 102 of file LifetimeAnnotations.cpp.
References getImplicitObjectParamLifetimeBoundAttr(), and isNormalAssignmentOperator().
Referenced by clang::Sema::addLifetimeBoundToImplicitThis(), ProcessAPINotes(), and clang::sema::visitFunctionCallArguments().
| bool clang::lifetimes::isAssignmentOperatorLifetimeBound | ( | const CXXMethodDecl * | CMD | ) |
Definition at line 51 of file LifetimeAnnotations.cpp.
References getDeclWithMergedLifetimeBoundAttrs(), clang::FunctionDecl::getParamDecl(), clang::Decl::hasAttr(), isNormalAssignmentOperator(), and clang::FunctionDecl::param_size().
Referenced by clang::sema::checkExprLifetimeImpl(), and clang::sema::shouldRunGSLAssignmentAnalysis().
| bool clang::lifetimes::isGslOwnerType | ( | const CXXRecordDecl * | RD | ) |
Definition at line 313 of file LifetimeAnnotations.cpp.
References isRecordWithAttr().
Definition at line 312 of file LifetimeAnnotations.cpp.
References isRecordWithAttr().
Referenced by shouldTrackImplicitObjectArg(), clang::lifetimes::internal::FactsGenerator::VisitCXXMemberCallExpr(), and clang::lifetimes::internal::FactsGenerator::VisitCXXOperatorCallExpr().
Definition at line 311 of file LifetimeAnnotations.cpp.
References isRecordWithAttr().
Referenced by clang::lifetimes::internal::OriginManager::hasOrigins(), clang::Sema::inferLifetimeCaptureByAttribute(), isPointerLikeType(), shouldTrackFirstArgument(), shouldTrackImplicitObjectArg(), clang::lifetimes::internal::FactsGenerator::VisitCXXConstructExpr(), clang::lifetimes::internal::FactsGenerator::VisitCXXMemberCallExpr(), and clang::lifetimes::internal::FactsGenerator::VisitCXXOperatorCallExpr().
Definition at line 108 of file LifetimeAnnotations.cpp.
References clang::Decl::getDeclContext(), clang::DeclContext::getParent(), and clang::isUppercase().
Referenced by destructsFirstArg(), isInvalidationMethod(), isStdCallableWrapperType(), clang::sema::isStdInitializerListOfPointer(), and shouldTrackImplicitObjectArg().
| bool clang::lifetimes::isInvalidationMethod | ( | const CXXMethodDecl & | MD | ) |
Definition at line 340 of file LifetimeAnnotations.cpp.
References clang::NamedDecl::getIdentifier(), getName(), clang::NamedDecl::getName(), clang::FunctionDecl::getOverloadedOperator(), clang::CXXMethodDecl::getParent(), isInStlNamespace(), clang::OO_None, and clang::Vector.
Definition at line 27 of file SemaLifetimeSafety.h.
References clang::Decl::getBeginLoc(), clang::Sema::getDiagnostics(), clang::Sema::getLangOpts(), and clang::DiagnosticsEngine::isIgnored().
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().
| bool clang::lifetimes::isNormalAssignmentOperator | ( | const FunctionDecl * | FD | ) |
Definition at line 33 of file LifetimeAnnotations.cpp.
References clang::Decl::getASTContext(), clang::DeclarationName::getCXXOverloadedOperator(), clang::NamedDecl::getDeclName(), clang::ASTContext::getLValueReferenceType(), clang::FunctionDecl::getParamDecl(), clang::FunctionDecl::getReturnType(), clang::ValueDecl::getType(), clang::ASTContext::hasSameType(), clang::isCompoundAssignmentOperator(), and clang::Type::isLValueReferenceType().
Referenced by implicitObjectParamIsLifetimeBound(), and isAssignmentOperatorLifetimeBound().
Definition at line 123 of file LifetimeAnnotations.cpp.
References isGslPointerType(), clang::Type::isNullPtrType(), and clang::Type::isPointerType().
Referenced by clang::sema::checkExprLifetimeImpl(), clang::sema::isContainerOfPointer(), isReferenceOrPointerLikeType(), clang::sema::isStdInitializerListOfPointer(), and shouldTrackImplicitObjectArg().
|
static |
Definition at line 281 of file LifetimeAnnotations.cpp.
References clang::Decl::hasAttr(), and clang::Result.
Referenced by isGslOwnerType(), isGslOwnerType(), isGslPointerType(), and isRecordWithAttr().
Definition at line 307 of file LifetimeAnnotations.cpp.
References clang::Type::getAsCXXRecordDecl(), and isRecordWithAttr().
Definition at line 127 of file LifetimeAnnotations.cpp.
References isPointerLikeType(), and clang::Type::isReferenceType().
Referenced by shouldTrackImplicitObjectArg().
| bool clang::lifetimes::isStdCallableWrapperType | ( | const CXXRecordDecl * | RD | ) |
Definition at line 456 of file LifetimeAnnotations.cpp.
References getName(), and isInStlNamespace().
Referenced by clang::lifetimes::internal::OriginManager::hasOrigins(), clang::lifetimes::internal::FactsGenerator::VisitCXXConstructExpr(), and clang::lifetimes::internal::FactsGenerator::VisitCXXOperatorCallExpr().
| bool clang::lifetimes::isStdReferenceCast | ( | const FunctionDecl * | FD | ) |
Definition at line 463 of file LifetimeAnnotations.cpp.
References clang::FunctionDecl::getBuiltinID().
|
static |
Definition at line 331 of file LifetimeAnnotations.cpp.
References getName(), and clang::Decl::isInStdNamespace().
Referenced by isUniquePtrRelease().
| bool clang::lifetimes::isUniquePtrRelease | ( | const CXXMethodDecl & | MD | ) |
Definition at line 335 of file LifetimeAnnotations.cpp.
References clang::NamedDecl::getIdentifier(), clang::NamedDecl::getName(), clang::FunctionDecl::getNumParams(), clang::CXXMethodDecl::getParent(), and isStdUniquePtr().
| void clang::lifetimes::printStats | ( | const LifetimeSafetyStats & | Stats | ) |
Utility function to print missing origin stats.
Definition at line 19 of file LifetimeStats.cpp.
References clang::lifetimes::LifetimeSafetyStats::ExprStmtClassToMissingOriginCount, clang::lifetimes::LifetimeSafetyStats::ExprTypeToMissingOriginCount, and clang::QualType::getAsString().
Referenced by clang::sema::AnalysisBasedWarnings::PrintStats().
| void clang::lifetimes::runLifetimeSafetyAnalysis | ( | AnalysisDeclContext & | AC, |
| LifetimeSafetySemaHelper * | SemaHelper, | ||
| LifetimeSafetyStats & | Stats, | ||
| bool | CollectStats ) |
The main entry point for the analysis.
Definition at line 123 of file LifetimeSafety.cpp.
References clang::AnalysisDeclContext::getASTContext(), clang::lifetimes::internal::LifetimeSafetyAnalysis::getFactManager(), clang::ASTContext::getLangOpts(), clang::lifetimes::internal::FactManager::getOriginMgr(), clang::lifetimes::LifetimeSafetyOpts::MaxCFGBlocks, and clang::lifetimes::internal::LifetimeSafetyAnalysis::run().
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().
| bool clang::lifetimes::shouldTrackFirstArgument | ( | const FunctionDecl * | FD | ) |
Definition at line 213 of file LifetimeAnnotations.cpp.
References clang::Default, clang::NamedDecl::getIdentifier(), clang::NamedDecl::getName(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getParamDecl(), clang::Type::getPointeeCXXRecordDecl(), clang::FunctionDecl::getReturnType(), clang::ValueDecl::getType(), isGslPointerType(), clang::Decl::isInStdNamespace(), clang::Type::isPointerType(), and clang::Type::isReferenceType().
Referenced by clang::sema::visitFunctionCallArguments().
| bool clang::lifetimes::shouldTrackImplicitObjectArg | ( | const Expr & | ImplicitObjectArgument, |
| const CXXMethodDecl * | Callee, | ||
| bool | RunningUnderLifetimeSafety ) |
Definition at line 131 of file LifetimeAnnotations.cpp.
References clang::Default, clang::Expr::getBestDynamicClassType(), isGslOwnerType(), isGslPointerType(), isInStlNamespace(), isPointerLikeType(), and isReferenceOrPointerLikeType().
Referenced by clang::sema::visitFunctionCallArguments().
| bool clang::lifetimes::shouldTrackSecondArgument | ( | const FunctionDecl * | FD | ) |
Definition at line 265 of file LifetimeAnnotations.cpp.
References clang::Type::getAsCXXRecordDecl(), clang::FunctionDecl::getNumParams(), clang::FunctionDecl::getOverloadedOperator(), clang::FunctionDecl::getParamDecl(), clang::FunctionDecl::getReturnType(), clang::ValueDecl::getType(), clang::Decl::hasAttr(), clang::ASTContext::hasSameUnqualifiedType(), and clang::isa().