//=== RetainSummaryManager.h - Summaries for reference counting ---*- C++ -*--// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file defines summaries implementation for retain counting, which // implements a reference count checker for Core Foundation and Cocoa // on (Mac OS X). // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_ANALYSIS_RETAINSUMMARYMANAGER_H #define LLVM_CLANG_ANALYSIS_RETAINSUMMARYMANAGER_H #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/FoldingSet.h" #include "llvm/ADT/ImmutableMap.h" #include "clang/AST/Attr.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclObjC.h" #include "clang/AST/ParentMap.h" #include "clang/Analysis/AnyCall.h" #include "clang/Analysis/SelectorExtras.h" #include "llvm/ADT/STLExtras.h" #include <optional> usingnamespaceclang; namespace clang { namespace ento { /// Determines the object kind of a tracked object. enum class ObjKind { … }; enum ArgEffectKind { … }; /// An ArgEffect summarizes the retain count behavior on an argument or receiver /// to a function or method. class ArgEffect { … }; /// RetEffect summarizes a call's retain/release behavior with respect /// to its return value. class RetEffect { … }; /// A key identifying a summary. class ObjCSummaryKey { … }; } // end namespace ento } // end namespace clang usingnamespaceento; namespace llvm { //===----------------------------------------------------------------------===// // Adapters for FoldingSet. //===----------------------------------------------------------------------===// template <> struct FoldingSetTrait<ArgEffect> { … }; template <> struct FoldingSetTrait<RetEffect> { … }; template <> struct DenseMapInfo<ObjCSummaryKey> { … }; } // end llvm namespace namespace clang { namespace ento { /// ArgEffects summarizes the effects of a function/method call on all of /// its arguments. ArgEffects; /// Summary for a function with respect to ownership changes. class RetainSummary { … }; class ObjCSummaryCache { … }; class RetainSummaryTemplate; class RetainSummaryManager { … }; // Used to avoid allocating long-term (BPAlloc'd) memory for default retain // summaries. If a function or method looks like it has a default summary, but // it has annotations, the annotations are added to the stack-based template // and then copied into managed memory. class RetainSummaryTemplate { … }; } // end namespace ento } // end namespace clang #endif