xref: /freebsd/contrib/llvm-project/clang/lib/StaticAnalyzer/Checkers/AllocationState.h (revision 0b57cec536236d46e3dba9bd041533462f33dbb7)
1*0b57cec5SDimitry Andric //===--- AllocationState.h ------------------------------------- *- C++ -*-===//
2*0b57cec5SDimitry Andric //
3*0b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*0b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5*0b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*0b57cec5SDimitry Andric //
7*0b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
8*0b57cec5SDimitry Andric 
9*0b57cec5SDimitry Andric #ifndef LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_ALLOCATIONSTATE_H
10*0b57cec5SDimitry Andric #define LLVM_CLANG_LIB_STATICANALYZER_CHECKERS_ALLOCATIONSTATE_H
11*0b57cec5SDimitry Andric 
12*0b57cec5SDimitry Andric #include "clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h"
13*0b57cec5SDimitry Andric #include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
14*0b57cec5SDimitry Andric 
15*0b57cec5SDimitry Andric namespace clang {
16*0b57cec5SDimitry Andric namespace ento {
17*0b57cec5SDimitry Andric 
18*0b57cec5SDimitry Andric namespace allocation_state {
19*0b57cec5SDimitry Andric 
20*0b57cec5SDimitry Andric ProgramStateRef markReleased(ProgramStateRef State, SymbolRef Sym,
21*0b57cec5SDimitry Andric                              const Expr *Origin);
22*0b57cec5SDimitry Andric 
23*0b57cec5SDimitry Andric /// This function provides an additional visitor that augments the bug report
24*0b57cec5SDimitry Andric /// with information relevant to memory errors caused by the misuse of
25*0b57cec5SDimitry Andric /// AF_InnerBuffer symbols.
26*0b57cec5SDimitry Andric std::unique_ptr<BugReporterVisitor> getInnerPointerBRVisitor(SymbolRef Sym);
27*0b57cec5SDimitry Andric 
28*0b57cec5SDimitry Andric /// 'Sym' represents a pointer to the inner buffer of a container object.
29*0b57cec5SDimitry Andric /// This function looks up the memory region of that object in
30*0b57cec5SDimitry Andric /// DanglingInternalBufferChecker's program state map.
31*0b57cec5SDimitry Andric const MemRegion *getContainerObjRegion(ProgramStateRef State, SymbolRef Sym);
32*0b57cec5SDimitry Andric 
33*0b57cec5SDimitry Andric } // end namespace allocation_state
34*0b57cec5SDimitry Andric 
35*0b57cec5SDimitry Andric } // end namespace ento
36*0b57cec5SDimitry Andric } // end namespace clang
37*0b57cec5SDimitry Andric 
38*0b57cec5SDimitry Andric #endif
39