brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · b4352b4 Raw
38 lines · c
1//=== SmartPtr.h - Tracking smart pointer state. -------------------*- 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-exception6//7//===----------------------------------------------------------------------===//8//9// Defines inter-checker API for the smart pointer modeling. It allows10// dependent checkers to figure out if an smart pointer is null or not.11//12//===----------------------------------------------------------------------===//13 14#ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SMARTPTR_H15#define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SMARTPTR_H16 17#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"18 19namespace clang {20namespace ento {21namespace smartptr {22 23/// Returns true if the event call is on smart pointer.24bool isStdSmartPtrCall(const CallEvent &Call);25bool isStdSmartPtr(const CXXRecordDecl *RD);26bool isStdSmartPtr(const Expr *E);27 28/// Returns whether the smart pointer is null or not.29bool isNullSmartPtr(const ProgramStateRef State, const MemRegion *ThisRegion);30 31const BugType *getNullDereferenceBugType();32 33} // namespace smartptr34} // namespace ento35} // namespace clang36 37#endif // LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_SMARTPTR_H38