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