https://github.com/martinboehme closed
https://github.com/llvm/llvm-project/pull/84138
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -129,19 +215,19 @@ auto inPlaceClass() {
auto isOptionalNulloptConstructor() {
return cxxConstructExpr(
- hasOptionalType(),
+ hasOptionalOrDerivedType(),
martinboehme wrote:
Done.
https://github.com/llvm/llvm-project/pull/84138
@@ -119,20 +119,28 @@ QualType getPublicType(const Expr *E) {
return Ty;
}
- QualType Ty = getPublicType(Cast->getSubExpr());
-
- // Is `Ty` the type of `*this`? In this special case, we can upcast to the
- // base class even if the base is non-public.
- bool
https://github.com/martinboehme updated
https://github.com/llvm/llvm-project/pull/84138
>From 209aac483514f6d041486f36e6dabec78598fcec Mon Sep 17 00:00:00 2001
From: Martin Braenne
Date: Tue, 12 Mar 2024 15:56:41 +
Subject: [PATCH 1/3] [clang][dataflow] Make optional checker work for types
@@ -129,19 +215,19 @@ auto inPlaceClass() {
auto isOptionalNulloptConstructor() {
return cxxConstructExpr(
- hasOptionalType(),
+ hasOptionalOrDerivedType(),
ymand wrote:
Here and below -- now that this matcher is more expensive, please move
@@ -64,39 +64,117 @@ static bool hasOptionalClassName(const CXXRecordDecl ) {
return false;
}
+static const CXXRecordDecl *getOptionalBaseClass(const CXXRecordDecl *RD) {
+ if (RD == nullptr)
+return nullptr;
+ if (hasOptionalClassName(*RD))
+return RD;
+
+ if
https://github.com/ymand approved this pull request.
https://github.com/llvm/llvm-project/pull/84138
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -119,20 +119,28 @@ QualType getPublicType(const Expr *E) {
return Ty;
}
- QualType Ty = getPublicType(Cast->getSubExpr());
-
- // Is `Ty` the type of `*this`? In this special case, we can upcast to the
- // base class even if the base is non-public.
- bool
https://github.com/ymand edited https://github.com/llvm/llvm-project/pull/84138
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
martinboehme wrote:
Forgot to push a fixup commit -- now added.
https://github.com/llvm/llvm-project/pull/84138
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/martinboehme updated
https://github.com/llvm/llvm-project/pull/84138
>From 209aac483514f6d041486f36e6dabec78598fcec Mon Sep 17 00:00:00 2001
From: Martin Braenne
Date: Tue, 12 Mar 2024 15:56:41 +
Subject: [PATCH 1/2] [clang][dataflow] Make optional checker work for types
@@ -129,19 +207,19 @@ auto inPlaceClass() {
auto isOptionalNulloptConstructor() {
return cxxConstructExpr(
- hasOptionalType(),
+ hasOptionalOrDerivedType(),
martinboehme wrote:
> I would think that we don't know (and therefore can't model) the
@@ -64,39 +64,117 @@ static bool hasOptionalClassName(const CXXRecordDecl ) {
return false;
}
+static const CXXRecordDecl *getOptionalBaseClass(const CXXRecordDecl *RD) {
+ if (RD == nullptr)
+return nullptr;
+ if (hasOptionalClassName(*RD))
+return RD;
+
+ if
@@ -64,39 +64,117 @@ static bool hasOptionalClassName(const CXXRecordDecl ) {
return false;
}
+static const CXXRecordDecl *getOptionalBaseClass(const CXXRecordDecl *RD) {
+ if (RD == nullptr)
+return nullptr;
+ if (hasOptionalClassName(*RD))
+return RD;
+
+ if
@@ -64,39 +64,117 @@ static bool hasOptionalClassName(const CXXRecordDecl ) {
return false;
}
+static const CXXRecordDecl *getOptionalBaseClass(const CXXRecordDecl *RD) {
+ if (RD == nullptr)
+return nullptr;
+ if (hasOptionalClassName(*RD))
+return RD;
+
+ if
@@ -64,39 +64,117 @@ static bool hasOptionalClassName(const CXXRecordDecl ) {
return false;
}
+static const CXXRecordDecl *getOptionalBaseClass(const CXXRecordDecl *RD) {
+ if (RD == nullptr)
+return nullptr;
+ if (hasOptionalClassName(*RD))
+return RD;
+
+ if
martinboehme wrote:
> One high level question: is there a simpler path by which we avoid crashing
> on derived types but also don't support them? It seems like there is a lot of
> complexity required in getting this just right. Is it worth it (both in the
> code itself and in terms of runtime
@@ -64,39 +64,117 @@ static bool hasOptionalClassName(const CXXRecordDecl ) {
return false;
}
+static const CXXRecordDecl *getOptionalBaseClass(const CXXRecordDecl *RD) {
+ if (RD == nullptr)
+return nullptr;
+ if (hasOptionalClassName(*RD))
+return RD;
+
+ if
@@ -129,19 +207,19 @@ auto inPlaceClass() {
auto isOptionalNulloptConstructor() {
return cxxConstructExpr(
- hasOptionalType(),
+ hasOptionalOrDerivedType(),
ymand wrote:
Here and below: Why admit a derived class here? I would think that we don't
@@ -64,39 +64,117 @@ static bool hasOptionalClassName(const CXXRecordDecl ) {
return false;
}
+static const CXXRecordDecl *getOptionalBaseClass(const CXXRecordDecl *RD) {
+ if (RD == nullptr)
+return nullptr;
+ if (hasOptionalClassName(*RD))
+return RD;
+
+ if
@@ -64,39 +64,117 @@ static bool hasOptionalClassName(const CXXRecordDecl ) {
return false;
}
+static const CXXRecordDecl *getOptionalBaseClass(const CXXRecordDecl *RD) {
+ if (RD == nullptr)
+return nullptr;
+ if (hasOptionalClassName(*RD))
+return RD;
+
+ if
@@ -64,39 +64,117 @@ static bool hasOptionalClassName(const CXXRecordDecl ) {
return false;
}
+static const CXXRecordDecl *getOptionalBaseClass(const CXXRecordDecl *RD) {
+ if (RD == nullptr)
+return nullptr;
+ if (hasOptionalClassName(*RD))
+return RD;
+
+ if
https://github.com/ymand commented:
One high level question: is there a simpler path by which we avoid crashing on
derived types but also don't support them? It seems like there is a lot of
complexity required in getting this just right. Is it worth it (both in the
code itself and in terms of
https://github.com/ymand edited https://github.com/llvm/llvm-project/pull/84138
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
martinboehme wrote:
> Per offline discussion, please see if we can be more targeted in our use of
> the generalized matching, given the potentially high cost incurred (for every
> relevant operation, like comparison, we'll be searching the entire type
> hierchy of the arguments).
Done!
I'm
@@ -64,38 +64,53 @@ static bool hasOptionalClassName(const CXXRecordDecl ) {
return false;
}
+static const CXXRecordDecl *getOptionalBaseClass(const CXXRecordDecl *RD) {
+ if (RD == nullptr)
+return nullptr;
+ if (hasOptionalClassName(*RD))
+return RD;
+
+ if
https://github.com/martinboehme updated
https://github.com/llvm/llvm-project/pull/84138
>From 209aac483514f6d041486f36e6dabec78598fcec Mon Sep 17 00:00:00 2001
From: Martin Braenne
Date: Tue, 12 Mar 2024 15:56:41 +
Subject: [PATCH] [clang][dataflow] Make optional checker work for types
ymand wrote:
Per offline discussion, please see if we can be more targeted in our use of the
generalized matching, given the potentially high cost incurred (for every
relevant operation, like comparison, we'll be searching the entire type hierchy
of the arguments).
@@ -64,38 +64,53 @@ static bool hasOptionalClassName(const CXXRecordDecl ) {
return false;
}
+static const CXXRecordDecl *getOptionalBaseClass(const CXXRecordDecl *RD) {
+ if (RD == nullptr)
+return nullptr;
+ if (hasOptionalClassName(*RD))
+return RD;
+
+ if
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: None (martinboehme)
Changes
`llvm::MaybeAlign` does this, for example.
It's not an option to simply ignore these derived classes because they get cast
back to the optional classes (for example, simply when calling the optional
member
https://github.com/martinboehme created
https://github.com/llvm/llvm-project/pull/84138
`llvm::MaybeAlign` does this, for example.
It's not an option to simply ignore these derived classes because they get cast
back to the optional classes (for example, simply when calling the optional
member
31 matches
Mail list logo