[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)
https://github.com/martinboehme closed https://github.com/llvm/llvm-project/pull/85623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)
https://github.com/rjmccall approved this pull request. https://github.com/llvm/llvm-project/pull/85623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)
tbaederr wrote: > I've moved the documentation down, right above the declaration of `path()`. > WDYT? I think that should work. https://github.com/llvm/llvm-project/pull/85623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)
martinboehme wrote: > Does this actually show up at the right place? Or is it now the documentation > for `path_empty()`? Or even `path_iterator`? Hm, good question. This seemed the most logical place to put the documentation in the source code, but of course, once it gets processed by Doxygen, it will probably get attached to something we don't want. I've moved the documentation down, right above the declaration of `path()`. WDYT? https://github.com/llvm/llvm-project/pull/85623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)
https://github.com/martinboehme updated https://github.com/llvm/llvm-project/pull/85623 >From 369410916bd61671f81702c4654bd48bfc3c6c53 Mon Sep 17 00:00:00 2001 From: Martin Braenne Date: Mon, 18 Mar 2024 09:51:23 + Subject: [PATCH 1/3] [clang][NFC] Add documentation for `CastExpr::path()`. 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. --- clang/include/clang/AST/Expr.h | 9 + 1 file changed, 9 insertions(+) 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; } >From 571d5f4b180b2e55b03a4a43a7c0fadbee2ed25a Mon Sep 17 00:00:00 2001 From: Martin Braenne Date: Tue, 19 Mar 2024 07:30:39 + Subject: [PATCH 2/3] fixup! [clang][NFC] Add documentation for `CastExpr::path()`. --- clang/include/clang/AST/Expr.h | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h index 8c4db4828477d0..292cda39dc56bf 100644 --- a/clang/include/clang/AST/Expr.h +++ b/clang/include/clang/AST/Expr.h @@ -3552,10 +3552,13 @@ 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. + /// 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 >From 806ee8eab73a61867cb7cf305762aa4755bd20f4 Mon Sep 17 00:00:00 2001 From: Martin Braenne Date: Tue, 19 Mar 2024 10:36:11 + Subject: [PATCH 3/3] fixup! fixup! [clang][NFC] Add documentation for `CastExpr::path()`. --- clang/include/clang/AST/Expr.h | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h index 292cda39dc56bf..a76404b3138dda 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; + typedef CXXBaseSpecifier **path_iterator; + typedef const CXXBaseSpecifier *const *path_const_iterator; + bool path_empty() const { return path_size() == 0; } + unsigned path_size() const { return CastExprBits.BasePathSize; } + path_iterator path_begin() { return path_buffer(); } + path_iterator path_end() { return path_buffer() + path_size(); } + 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). @@ -3564,15 +3573,6 @@ class CastExpr : public Expr { /// `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
[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)
tbaederr wrote: Does this actually show up at the right place? Or is it now the documentation for `path_empty()`? Or even `path_iterator`? https://github.com/llvm/llvm-project/pull/85623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)
@@ -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. martinboehme wrote: Thanks for pointing this out! I've fixed this -- WDYT? https://github.com/llvm/llvm-project/pull/85623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)
https://github.com/martinboehme updated https://github.com/llvm/llvm-project/pull/85623 >From 369410916bd61671f81702c4654bd48bfc3c6c53 Mon Sep 17 00:00:00 2001 From: Martin Braenne Date: Mon, 18 Mar 2024 09:51:23 + Subject: [PATCH 1/2] [clang][NFC] Add documentation for `CastExpr::path()`. 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. --- clang/include/clang/AST/Expr.h | 9 + 1 file changed, 9 insertions(+) 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; } >From 571d5f4b180b2e55b03a4a43a7c0fadbee2ed25a Mon Sep 17 00:00:00 2001 From: Martin Braenne Date: Tue, 19 Mar 2024 07:30:39 + Subject: [PATCH 2/2] fixup! [clang][NFC] Add documentation for `CastExpr::path()`. --- clang/include/clang/AST/Expr.h | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h index 8c4db4828477d0..292cda39dc56bf 100644 --- a/clang/include/clang/AST/Expr.h +++ b/clang/include/clang/AST/Expr.h @@ -3552,10 +3552,13 @@ 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. + /// 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 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)
@@ -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. rjmccall wrote: You can see in `CastConsistency` the set of cast kinds that require a base path; it's more than just these two. https://github.com/llvm/llvm-project/pull/85623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)
https://github.com/ymand approved this pull request. thanks! https://github.com/llvm/llvm-project/pull/85623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)
https://github.com/martinboehme edited https://github.com/llvm/llvm-project/pull/85623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)
llvmbot wrote: @llvm/pr-subscribers-clang Author: None (martinboehme) Changes 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; } `` https://github.com/llvm/llvm-project/pull/85623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [clang][NFC] Add documentation for `CastExpr::path()`. (PR #85623)
https://github.com/martinboehme created https://github.com/llvm/llvm-project/pull/85623 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. >From 369410916bd61671f81702c4654bd48bfc3c6c53 Mon Sep 17 00:00:00 2001 From: Martin Braenne Date: Mon, 18 Mar 2024 09:51:23 + Subject: [PATCH] [clang][NFC] Add documentation for `CastExpr::path()`. 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. --- clang/include/clang/AST/Expr.h | 9 + 1 file changed, 9 insertions(+) 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; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits