Skip to content

Commit 972f65a

Browse files
authored
[clang][NFC] Add documentation for CastExpr::path(). (#85623)
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.
1 parent 5fb2797 commit 972f65a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

clang/include/clang/AST/Expr.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3562,6 +3562,18 @@ class CastExpr : public Expr {
35623562
path_const_iterator path_begin() const { return path_buffer(); }
35633563
path_const_iterator path_end() const { return path_buffer() + path_size(); }
35643564

3565+
/// Path through the class hierarchy taken by casts between base and derived
3566+
/// classes (see implementation of `CastConsistency()` for a full list of
3567+
/// cast kinds that have a path).
3568+
///
3569+
/// For each derived-to-base edge in the path, the path contains a
3570+
/// `CXXBaseSpecifier` for the base class of that edge; the entries are
3571+
/// ordered from derived class to base class.
3572+
///
3573+
/// For example, given classes `Base`, `Intermediate : public Base` and
3574+
/// `Derived : public Intermediate`, the path for a cast from `Derived *` to
3575+
/// `Base *` contains two entries: One for `Intermediate`, and one for `Base`,
3576+
/// in that order.
35653577
llvm::iterator_range<path_iterator> path() {
35663578
return llvm::make_range(path_begin(), path_end());
35673579
}

0 commit comments

Comments
 (0)