Skip to content

Commit d86b10f

Browse files
usx95DharuniRAcharya
authored andcommitted
Reapply "[LifetimeSafety] Reorganize code into modular components (llvm#162474)"
This reverts commit 24a5d8a. Add link libs to the new clang library
1 parent 799b97c commit d86b10f

31 files changed

+2212
-1754
lines changed

.github/new-prs-labeler.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,8 +1096,8 @@ clang:openmp:
10961096
- llvm/test/Transforms/OpenMP/**
10971097

10981098
clang:temporal-safety:
1099-
- clang/include/clang/Analysis/Analyses/LifetimeSafety*
1100-
- clang/lib/Analysis/LifetimeSafety*
1099+
- clang/include/clang/Analysis/Analyses/LifetimeSafety/**
1100+
- clang/lib/Analysis/LifetimeSafety/**
11011101
- clang/unittests/Analysis/LifetimeSafety*
11021102
- clang/test/Sema/*lifetime-safety*
11031103
- clang/test/Sema/*lifetime-analysis*

clang/include/clang/Analysis/Analyses/LifetimeSafety.h

Lines changed: 0 additions & 183 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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

Comments
 (0)