[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-19 Thread via cfe-commits
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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-19 Thread via 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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-19 Thread via 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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-19 Thread via 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/3] [clang][dataflow] Make optional checker work for types

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-18 Thread Yitzhak Mandelbaum via cfe-commits
@@ -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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-18 Thread Yitzhak Mandelbaum via cfe-commits
@@ -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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-18 Thread Yitzhak Mandelbaum via cfe-commits
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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-18 Thread Yitzhak Mandelbaum via 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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-18 Thread Yitzhak Mandelbaum via cfe-commits
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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-18 Thread via 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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-18 Thread via 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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-18 Thread via cfe-commits
@@ -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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-18 Thread via cfe-commits
@@ -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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-18 Thread via cfe-commits
@@ -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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-18 Thread via cfe-commits
@@ -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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-18 Thread via cfe-commits
@@ -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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-15 Thread via cfe-commits
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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-14 Thread Yitzhak Mandelbaum via cfe-commits
@@ -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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-14 Thread Yitzhak Mandelbaum via cfe-commits
@@ -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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-14 Thread Yitzhak Mandelbaum via cfe-commits
@@ -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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-14 Thread Yitzhak Mandelbaum via cfe-commits
@@ -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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-14 Thread Yitzhak Mandelbaum via cfe-commits
@@ -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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-14 Thread Yitzhak Mandelbaum via cfe-commits
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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-14 Thread Yitzhak Mandelbaum via cfe-commits
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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-12 Thread via 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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-12 Thread via cfe-commits
@@ -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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-12 Thread via 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] [clang][dataflow] Make optional checker work for types

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-06 Thread Yitzhak Mandelbaum via cfe-commits
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).

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-06 Thread Gábor Horváth via cfe-commits
@@ -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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-06 Thread via cfe-commits
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

[clang] [clang][dataflow] Make optional checker work for types derived from optional. (PR #84138)

2024-03-06 Thread via cfe-commits
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