Skip to content

Commit

Permalink
[clang][NFC] Add documentation for CastExpr::path(). (#85623)
Browse files Browse the repository at this point in the history
This didn't have any documentation, so I had to do some experimenting in
godbolt when I used this in
#84138, and my reviewer later
also had some
[questions](#84138 (comment))
about this, so I figured it would be worth adding documentation.
  • Loading branch information
martinboehme authored Mar 20, 2024
1 parent 5fb2797 commit 972f65a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions clang/include/clang/AST/Expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -3562,6 +3562,18 @@ class CastExpr : public Expr {
path_const_iterator path_begin() const { return path_buffer(); }
path_const_iterator path_end() const { return path_buffer() + path_size(); }

/// Path through the class hierarchy taken by casts between base and derived
/// classes (see implementation of `CastConsistency()` for a full list of
/// cast kinds that have a path).
///
/// For each derived-to-base edge in the path, the path contains a
/// `CXXBaseSpecifier` for the base class of that edge; the entries are
/// ordered from derived class to base class.
///
/// For example, given classes `Base`, `Intermediate : public Base` and
/// `Derived : public Intermediate`, the path for a cast from `Derived *` to
/// `Base *` contains two entries: One for `Intermediate`, and one for `Base`,
/// in that order.
llvm::iterator_range<path_iterator> path() {
return llvm::make_range(path_begin(), path_end());
}
Expand Down

0 comments on commit 972f65a

Please sign in to comment.