clang  15.0.0git
PtrTypesSemantics.h
Go to the documentation of this file.
1 //=======- PtrTypesSemantics.cpp ---------------------------------*- C++ -*-==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_ANALYZER_WEBKIT_PTRTYPESEMANTICS_H
10 #define LLVM_CLANG_ANALYZER_WEBKIT_PTRTYPESEMANTICS_H
11 
12 #include "llvm/ADT/APInt.h"
13 
14 namespace clang {
15 class CXXBaseSpecifier;
16 class CXXMethodDecl;
17 class CXXRecordDecl;
18 class FunctionDecl;
19 class Type;
20 
21 // Ref-countability of a type is implicitly defined by Ref<T> and RefPtr<T>
22 // implementation. It can be modeled as: type T having public methods ref() and
23 // deref()
24 
25 // In WebKit there are two ref-counted templated smart pointers: RefPtr<T> and
26 // Ref<T>.
27 
28 /// \returns CXXRecordDecl of the base if the type is ref-countable, nullptr if
29 /// not, None if inconclusive.
32 
33 /// \returns true if \p Class is ref-countable, false if not, None if
34 /// inconclusive.
36 
37 /// \returns true if \p Class is ref-counted, false if not.
38 bool isRefCounted(const clang::CXXRecordDecl *Class);
39 
40 /// \returns true if \p Class is ref-countable AND not ref-counted, false if
41 /// not, None if inconclusive.
43 
44 /// \returns true if \p T is either a raw pointer or reference to an uncounted
45 /// class, false if not, None if inconclusive.
47 
48 /// \returns true if \p F creates ref-countable object from uncounted parameter,
49 /// false if not.
51 
52 /// \returns true if \p M is getter of a ref-counted class, false if not.
54 
55 /// \returns true if \p F is a conversion between ref-countable or ref-counted
56 /// pointer types.
57 bool isPtrConversion(const FunctionDecl *F);
58 
59 } // namespace clang
60 
61 #endif
clang::isUncounted
llvm::Optional< bool > isUncounted(const CXXRecordDecl *Class)
Definition: PtrTypesSemantics.cpp:115
clang::isUncountedPtr
llvm::Optional< bool > isUncountedPtr(const Type *T)
Definition: PtrTypesSemantics.cpp:127
llvm::Optional
Definition: LLVM.h:40
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1500
clang::isCtorOfRefCounted
bool isCtorOfRefCounted(const clang::FunctionDecl *F)
Definition: PtrTypesSemantics.cpp:98
clang::isRefCounted
bool isRefCounted(const CXXRecordDecl *R)
Definition: PtrTypesSemantics.cpp:168
Base
clang::isRefCountable
llvm::Optional< const clang::CXXRecordDecl * > isRefCountable(const CXXBaseSpecifier *Base)
Definition: PtrTypesSemantics.cpp:49
clang::CXXRecordDecl
Represents a C++ struct/union/class.
Definition: DeclCXX.h:254
clang::isPtrConversion
bool isPtrConversion(const FunctionDecl *F)
Definition: PtrTypesSemantics.cpp:178
clang
Definition: CalledOnceCheck.h:17
clang::CXXBaseSpecifier
Represents a base class of a C++ class.
Definition: DeclCXX.h:146
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1872
clang::isGetterOfRefCounted
Optional< bool > isGetterOfRefCounted(const CXXMethodDecl *M)
Definition: PtrTypesSemantics.cpp:138
clang::CXXMethodDecl
Represents a static or instance method of a struct/union/class.
Definition: DeclCXX.h:1968
Type
MatchType Type
Definition: ASTMatchFinder.cpp:71