xref: /netbsd-src/external/apache2/llvm/dist/clang/lib/StaticAnalyzer/Checkers/SmartPtr.h (revision e038c9c4676b0f19b1b7dd08a940c6ed64a6d5ae)
1*e038c9c4Sjoerg //=== SmartPtr.h - Tracking smart pointer state. -------------------*- C++ -*-//
2*e038c9c4Sjoerg //
3*e038c9c4Sjoerg // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*e038c9c4Sjoerg // See https://llvm.org/LICENSE.txt for license information.
5*e038c9c4Sjoerg // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*e038c9c4Sjoerg //
7*e038c9c4Sjoerg //===----------------------------------------------------------------------===//
8*e038c9c4Sjoerg //
9*e038c9c4Sjoerg // Defines inter-checker API for the smart pointer modeling. It allows
10*e038c9c4Sjoerg // dependent checkers to figure out if an smart pointer is null or not.
11*e038c9c4Sjoerg //
12*e038c9c4Sjoerg //===----------------------------------------------------------------------===//
13*e038c9c4Sjoerg 
14*e038c9c4Sjoerg #ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SMARTPTR_H
15*e038c9c4Sjoerg #define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SMARTPTR_H
16*e038c9c4Sjoerg 
17*e038c9c4Sjoerg #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
18*e038c9c4Sjoerg 
19*e038c9c4Sjoerg namespace clang {
20*e038c9c4Sjoerg namespace ento {
21*e038c9c4Sjoerg namespace smartptr {
22*e038c9c4Sjoerg 
23*e038c9c4Sjoerg /// Returns true if the event call is on smart pointer.
24*e038c9c4Sjoerg bool isStdSmartPtrCall(const CallEvent &Call);
25*e038c9c4Sjoerg 
26*e038c9c4Sjoerg /// Returns whether the smart pointer is null or not.
27*e038c9c4Sjoerg bool isNullSmartPtr(const ProgramStateRef State, const MemRegion *ThisRegion);
28*e038c9c4Sjoerg 
29*e038c9c4Sjoerg const BugType *getNullDereferenceBugType();
30*e038c9c4Sjoerg 
31*e038c9c4Sjoerg } // namespace smartptr
32*e038c9c4Sjoerg } // namespace ento
33*e038c9c4Sjoerg } // namespace clang
34*e038c9c4Sjoerg 
35*e038c9c4Sjoerg #endif // LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SMARTPTR_H
36