|
clang 23.0.0git
|
Namespaces | |
| namespace | internal |
Classes | |
| class | LifetimeSafetySemaHelper |
| Abstract interface for operations requiring Sema access. More... | |
| struct | LifetimeSafetyStats |
| A structure to hold the statistics related to LifetimeAnalysis. More... | |
Enumerations | |
| enum class | Confidence : uint8_t { None , Maybe , Definite } |
| Enum to track the confidence level of a potential error. More... | |
| enum class | SuggestionScope { CrossTU , IntraTU } |
| Enum to track functions visible across or within TU. More... | |
|
strong |
Enum to track the confidence level of a potential error.
| Enumerator | |
|---|---|
| None | |
| Maybe | |
| Definite | |
Definition at line 33 of file LifetimeSafety.h.
|
strong |
Enum to track functions visible across or within TU.
| Enumerator | |
|---|---|
| CrossTU | |
| IntraTU | |
Definition at line 40 of file LifetimeSafety.h.
| const CXXMethodDecl * clang::lifetimes::getDeclWithMergedLifetimeBoundAttrs | ( | const CXXMethodDecl * | CMD | ) |
Definition at line 25 of file LifetimeAnnotations.cpp.
References getDeclWithMergedLifetimeBoundAttrs().
| const FunctionDecl * clang::lifetimes::getDeclWithMergedLifetimeBoundAttrs | ( | const FunctionDecl * | FD | ) |
Definition at line 20 of file LifetimeAnnotations.cpp.
References clang::FunctionDecl::getMostRecentDecl().
Referenced by getDeclWithMergedLifetimeBoundAttrs(), implicitObjectParamIsLifetimeBound(), isAssignmentOperatorLifetimeBound(), and clang::sema::visitFunctionCallArguments().
|
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 59 of file LifetimeAnnotations.cpp.
References clang::TypeLoc::getAsAdjusted(), and clang::TypeSourceInfo::getTypeLoc().
| bool clang::lifetimes::implicitObjectParamIsLifetimeBound | ( | const FunctionDecl * | FD | ) |
Definition at line 73 of file LifetimeAnnotations.cpp.
References getDeclWithMergedLifetimeBoundAttrs(), clang::FunctionDecl::getTemplateInstantiationPattern(), and isNormalAssignmentOperator().
Referenced by clang::Sema::addLifetimeBoundToImplicitThis(), ProcessAPINotes(), and clang::sema::visitFunctionCallArguments().
| bool clang::lifetimes::isAssignmentOperatorLifetimeBound | ( | const CXXMethodDecl * | CMD | ) |
Definition at line 49 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().
Definition at line 215 of file LifetimeAnnotations.cpp.
References isRecordWithAttr().
Referenced by shouldTrackImplicitObjectArg(), and clang::lifetimes::internal::FactsGenerator::VisitCXXMemberCallExpr().
Definition at line 214 of file LifetimeAnnotations.cpp.
References isRecordWithAttr().
Referenced by clang::lifetimes::internal::hasOrigins(), clang::Sema::inferLifetimeCaptureByAttribute(), isPointerLikeType(), shouldTrackFirstArgument(), shouldTrackImplicitObjectArg(), clang::lifetimes::internal::FactsGenerator::VisitCXXConstructExpr(), clang::lifetimes::internal::FactsGenerator::VisitCXXFunctionalCastExpr(), and clang::lifetimes::internal::FactsGenerator::VisitCXXMemberCallExpr().
Definition at line 92 of file LifetimeAnnotations.cpp.
References clang::Decl::getDeclContext(), clang::DeclContext::isStdNamespace(), and clang::isUppercase().
Referenced by clang::sema::isStdInitializerListOfPointer(), and shouldTrackImplicitObjectArg().
| bool clang::lifetimes::isNormalAssignmentOperator | ( | const FunctionDecl * | FD | ) |
Definition at line 31 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 106 of file LifetimeAnnotations.cpp.
References isGslPointerType(), clang::Type::isNullPtrType(), and clang::Type::isPointerType().
Referenced by clang::sema::checkExprLifetimeImpl(), clang::sema::isContainerOfPointer(), clang::sema::isStdInitializerListOfPointer(), and shouldTrackImplicitObjectArg().
Definition at line 187 of file LifetimeAnnotations.cpp.
References clang::Type::getAsCXXRecordDecl(), clang::Result, and clang::T.
Referenced by isGslOwnerType(), and isGslPointerType().
| 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 105 of file LifetimeSafety.cpp.
References clang::lifetimes::internal::LifetimeSafetyAnalysis::getFactManager(), clang::lifetimes::internal::FactManager::getOriginMgr(), and clang::lifetimes::internal::LifetimeSafetyAnalysis::run().
Referenced by clang::sema::AnalysisBasedWarnings::IssueWarnings().
| bool clang::lifetimes::shouldTrackFirstArgument | ( | const FunctionDecl * | FD | ) |
Definition at line 163 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 CXXMethodDecl * | Callee, |
| bool | RunningUnderLifetimeSafety ) |
Definition at line 110 of file LifetimeAnnotations.cpp.
References clang::Default, isGslOwnerType(), isGslPointerType(), isInStlNamespace(), and isPointerLikeType().
Referenced by clang::sema::visitFunctionCallArguments().