1 //=== SmartPtr.h - Tracking smart pointer state. -------------------*- C++ -*-//
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
7 //===----------------------------------------------------------------------===//
9 // Defines inter-checker API for the smart pointer modeling. It allows
10 // dependent checkers to figure out if an smart pointer is null or not.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SMARTPTR_H
15 #define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SMARTPTR_H
17 #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
23 /// Returns true if the event call is on smart pointer.
24 bool isStdSmartPtrCall(const CallEvent
&Call
);
25 bool isStdSmartPtr(const CXXRecordDecl
*RD
);
26 bool isStdSmartPtr(const Expr
*E
);
28 /// Returns whether the smart pointer is null or not.
29 bool isNullSmartPtr(const ProgramStateRef State
, const MemRegion
*ThisRegion
);
31 const BugType
*getNullDereferenceBugType();
33 } // namespace smartptr
37 #endif // LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SMARTPTR_H