Skip to content

Commit 039ba89

Browse files
committed
documentation updates
1 parent c6e7bf0 commit 039ba89

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
//
77
//===----------------------------------------------------------------------===//
88
//
9-
// This file provides the entry point for lifetime checking, which detects
10-
// use-after-free errors by checking if live origins hold loans that have
11-
// expired.
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.
1212
//
1313
//===----------------------------------------------------------------------===//
14+
1415
#ifndef LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMESAFETY_CHECKER_H
1516
#define LLVM_CLANG_ANALYSIS_ANALYSES_LIFETIMESAFETY_CHECKER_H
1617

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
//
77
//===----------------------------------------------------------------------===//
88
//
9-
// This file defines the entry point for a dataflow-based static analysis
10-
// that checks for C++ lifetime violations.
9+
// This file defines the main entry point and orchestrator for the C++ Lifetime
10+
// Safety Analysis. It coordinates the entire analysis pipeline: fact
11+
// generation, loan propagation, live origins analysis, and enforcement of
12+
// lifetime safety policy.
1113
//
1214
// The analysis is based on the concepts of "origins" and "loans" to track
1315
// pointer lifetimes and detect issues like use-after-free and dangling

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
//
99
// This file defines the LiveOriginAnalysis, a backward dataflow analysis that
1010
// determines which origins are "live" at each program point. An origin is
11-
// "live" at a program point if there's a potential future use of the pointer it
12-
// represents. Liveness is "generated" by a read of origin's loan set (e.g., a
13-
// `UseFact`) and is "killed" (i.e., it stops being live) when its loan set is
14-
// overwritten (e.g. a OriginFlow killing the destination origin).
11+
// "live" at a program point if there's a potential future use of a pointer it
12+
// is associated with. Liveness is "generated" by a use of an origin (e.g., a
13+
// `UseFact` from a read of a pointer) and is "killed" (i.e., it stops being
14+
// live) when the origin is replaced by flowing a different origin into it
15+
// (e.g., an OriginFlow from an assignment that kills the destination).
1516
//
1617
// This information is used for detecting use-after-free errors, as it allows us
1718
// to check if a live origin holds a loan to an object that has already expired.
@@ -42,8 +43,8 @@ struct LivenessInfo {
4243
/// multiple uses along different paths, this will point to the use appearing
4344
/// earlier in the translation unit.
4445
/// This is 'null' when the origin is not live.
45-
4646
const UseFact *CausingUseFact;
47+
4748
/// The kind of liveness of the origin.
4849
/// `Must`: The origin is live on all control-flow paths from the current
4950
/// point to the function's exit (i.e. the current point is dominated by a set
@@ -79,7 +80,7 @@ class LiveOriginsAnalysis {
7980
~LiveOriginsAnalysis();
8081

8182
/// Returns the set of origins that are live at a specific program point,
82-
/// along with the confidence level of their liveness.
83+
/// along with the the details of the liveness.
8384
LivenessMap getLiveOriginsAt(ProgramPoint P) const;
8485

8586
// Dump liveness values on all test points in the program.

0 commit comments

Comments
 (0)