|
| 1 | +//===- Checker.h - C++ Lifetime Safety Analysis -*----------- 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-exception |
| 6 | +// |
| 7 | +//===----------------------------------------------------------------------===// |
| 8 | +// |
| 9 | +// This file defines and enforces the lifetime safety policy. It detects |
| 10 | +// use-after-free errors by examining loan expiration points and checking if |
| 11 | +// any live origins hold the expired loans. |
| 12 | +// |
| 13 | +//===----------------------------------------------------------------------===// |
| 14 | + |
| 15 | +#ifndef LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMESAFETY_CHECKER_H |
| 16 | +#define LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMESAFETY_CHECKER_H |
| 17 | + |
| 18 | +#include "clang/Analysis/Analyses/LifetimeSafety/Facts.h" |
| 19 | +#include "clang/Analysis/Analyses/LifetimeSafety/LifetimeSafety.h" |
| 20 | +#include "clang/Analysis/Analyses/LifetimeSafety/LiveOrigins.h" |
| 21 | +#include "clang/Analysis/Analyses/LifetimeSafety/LoanPropagation.h" |
| 22 | + |
| 23 | +namespace clang::lifetimes::internal { |
| 24 | + |
| 25 | +/// Runs the lifetime checker, which detects use-after-free errors by |
| 26 | +/// examining loan expiration points and checking if any live origins hold |
| 27 | +/// the expired loan. |
| 28 | +void runLifetimeChecker(const LoanPropagationAnalysis &LoanPropagation, |
| 29 | + const LiveOriginsAnalysis &LiveOrigins, |
| 30 | + const FactManager &FactMgr, AnalysisDeclContext &ADC, |
| 31 | + LifetimeSafetyReporter *Reporter); |
| 32 | + |
| 33 | +} // namespace clang::lifetimes::internal |
| 34 | + |
| 35 | +#endif // LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMESAFETY_CHECKER_H |
0 commit comments