clang  14.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 Expr;
19 class FunctionDecl;
20 class Type;
21 
22 // Ref-countability of a type is implicitly defined by Ref<T> and RefPtr<T>
23 // implementation. It can be modeled as: type T having public methods ref() and
24 // deref()
25 
26 // In WebKit there are two ref-counted templated smart pointers: RefPtr<T> and
27 // Ref<T>.
28 
29 /// \returns CXXRecordDecl of the base if the type is ref-countable, nullptr if
30 /// not, None if inconclusive.
33 
34 /// \returns true if \p Class is ref-countable, false if not, None if
35 /// inconclusive.
37 
38 /// \returns true if \p Class is ref-counted, false if not.
39 bool isRefCounted(const clang::CXXRecordDecl *Class);
40 
41 /// \returns true if \p Class is ref-countable AND not ref-counted, false if
42 /// not, None if inconclusive.
44 
45 /// \returns true if \p T is either a raw pointer or reference to an uncounted
46 /// class, false if not, None if inconclusive.
48 
49 /// \returns true if \p F creates ref-countable object from uncounted parameter,
50 /// false if not.
52 
53 /// \returns true if \p M is getter of a ref-counted class, false if not.
55 
56 /// \returns true if \p F is a conversion between ref-countable or ref-counted
57 /// pointer types.
58 bool isPtrConversion(const FunctionDecl *F);
59 
60 } // namespace clang
61 
62 #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:1490
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:255
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:147
clang::FunctionDecl
Represents a function declaration or definition.
Definition: Decl.h:1856
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:1948
Type
MatchType Type
Definition: ASTMatchFinder.cpp:70