xref: /freebsd/contrib/llvm-project/clang/lib/StaticAnalyzer/Checkers/SmartPtr.h (revision e8d8bef961a50d4dc22501cde4fb9fb0be1b2532)
15ffd83dbSDimitry Andric //=== SmartPtr.h - Tracking smart pointer state. -------------------*- C++ -*-//
25ffd83dbSDimitry Andric //
35ffd83dbSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45ffd83dbSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
55ffd83dbSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65ffd83dbSDimitry Andric //
75ffd83dbSDimitry Andric //===----------------------------------------------------------------------===//
85ffd83dbSDimitry Andric //
95ffd83dbSDimitry Andric // Defines inter-checker API for the smart pointer modeling. It allows
105ffd83dbSDimitry Andric // dependent checkers to figure out if an smart pointer is null or not.
115ffd83dbSDimitry Andric //
125ffd83dbSDimitry Andric //===----------------------------------------------------------------------===//
135ffd83dbSDimitry Andric 
145ffd83dbSDimitry Andric #ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SMARTPTR_H
155ffd83dbSDimitry Andric #define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SMARTPTR_H
165ffd83dbSDimitry Andric 
175ffd83dbSDimitry Andric #include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
185ffd83dbSDimitry Andric 
195ffd83dbSDimitry Andric namespace clang {
205ffd83dbSDimitry Andric namespace ento {
215ffd83dbSDimitry Andric namespace smartptr {
225ffd83dbSDimitry Andric 
235ffd83dbSDimitry Andric /// Returns true if the event call is on smart pointer.
245ffd83dbSDimitry Andric bool isStdSmartPtrCall(const CallEvent &Call);
255ffd83dbSDimitry Andric 
265ffd83dbSDimitry Andric /// Returns whether the smart pointer is null or not.
275ffd83dbSDimitry Andric bool isNullSmartPtr(const ProgramStateRef State, const MemRegion *ThisRegion);
285ffd83dbSDimitry Andric 
29*e8d8bef9SDimitry Andric const BugType *getNullDereferenceBugType();
30*e8d8bef9SDimitry Andric 
315ffd83dbSDimitry Andric } // namespace smartptr
325ffd83dbSDimitry Andric } // namespace ento
335ffd83dbSDimitry Andric } // namespace clang
345ffd83dbSDimitry Andric 
355ffd83dbSDimitry Andric #endif // LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SMARTPTR_H
36