xref: /freebsd/contrib/llvm-project/clang/lib/StaticAnalyzer/Checkers/SmartPtr.h (revision fe6060f10f634930ff71b7c50291ddc610da2475)
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);
25*fe6060f1SDimitry Andric bool isStdSmartPtr(const CXXRecordDecl *RD);
26*fe6060f1SDimitry Andric bool isStdSmartPtr(const Expr *E);
27*fe6060f1SDimitry Andric 
28*fe6060f1SDimitry Andric bool isStdSmartPtr(const CXXRecordDecl *RD);
295ffd83dbSDimitry Andric 
305ffd83dbSDimitry Andric /// Returns whether the smart pointer is null or not.
315ffd83dbSDimitry Andric bool isNullSmartPtr(const ProgramStateRef State, const MemRegion *ThisRegion);
325ffd83dbSDimitry Andric 
33e8d8bef9SDimitry Andric const BugType *getNullDereferenceBugType();
34e8d8bef9SDimitry Andric 
355ffd83dbSDimitry Andric } // namespace smartptr
365ffd83dbSDimitry Andric } // namespace ento
375ffd83dbSDimitry Andric } // namespace clang
385ffd83dbSDimitry Andric 
395ffd83dbSDimitry Andric #endif // LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SMARTPTR_H
40