[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 18 02:56:54 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: None (martinboehme)
<details>
<summary>Changes</summary>
This didn't have any documentation, so I had to do some experimenting in
godbolt when I used this in https://github.com/llvm/llvm-project/pull/84138,
and my reviewer later also had some
[questions](https://github.com/llvm/llvm-project/pull/84138#discussion_r1524855434)
about this, so I figured it would be worth adding documentation.
---
Full diff: https://github.com/llvm/llvm-project/pull/85623.diff
1 Files Affected:
- (modified) clang/include/clang/AST/Expr.h (+9)
``````````diff
diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h
index 446bec4081e869..8c4db4828477d0 100644
--- a/clang/include/clang/AST/Expr.h
+++ b/clang/include/clang/AST/Expr.h
@@ -3552,6 +3552,15 @@ class CastExpr : public Expr {
/// function that it invokes.
NamedDecl *getConversionFunction() const;
+ /// Path through the class hierarchy taken by a `DerivedToBase` or
+ /// `UncheckedDerivedToBase` cast. 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.
typedef CXXBaseSpecifier **path_iterator;
typedef const CXXBaseSpecifier *const *path_const_iterator;
bool path_empty() const { return path_size() == 0; }
``````````
</details>
https://github.com/llvm/llvm-project/pull/85623
More information about the cfe-commits
mailing list