search for: isa_or_null

Displaying 14 results from an estimated 14 matches for "isa_or_null".

2019 Apr 04
4
[RFC] Should we add isa_or_null<>?
I'd like to propose adding `isa_or_null<>` to replace the following usage pattern that's relatively common in conditionals: var && isa<T>(var) =>> isa_or_null<T>(var) And in particular when `var` is a method call which might be expensive, e.g.: X->foo() && isa<T>(X->foo())...
2019 Apr 04
2
[RFC] Should we add isa_or_null<>?
On Thu, Apr 4, 2019 at 10:30 AM David Greene <dag at cray.com> wrote: > I don't think that's a correct replacement. > > if (var && isa<T>(var)) { > ... > } > > is not the same as: > > if (isa_or_null<T>(var)) { > ... > } > > at least according to what "isa_or_null" conveys to me. > This is the same convention used by the existing "_or_null" varieties, i.e., "cast_or_null" and "dyn_cast_or_null". They accept a null and propagate i...
2019 Apr 04
4
[RFC] Should we add isa_or_null<>?
On Thu, Apr 4, 2019 at 12:58 PM Chris Lattner <clattner at nondot.org> wrote: > > > > > On Apr 4, 2019, at 5:37 AM, Don Hinton via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > > > I'd like to propose adding `isa_or_null<>` to replace the following usage pattern that's relatively common in conditionals: > > > > var && isa<T>(var) =>> isa_or_null<T>(var) > > > > And in particular when `var` is a method call which might be expensive, e.g.: > > >...
2019 Apr 04
2
[RFC] Should we add isa_or_null<>?
...ing like if > (dyn_cast_or_null<UndefValue>(P->hasConstantValue())) > Yes, I've seen those, but while working on a new checker, I was advised that replacing `X && isa<Y>(X)` with `dyn_cast_or_null<Y>(X)` was suboptimal, and it was suggested something like a `isa_or_null` style operator would better express what was actually going on, i.e., we are expecting a bool, not a pointer. > > ~Craig > > > On Thu, Apr 4, 2019 at 4:16 PM Don Hinton via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> I've added a patch, temporarily u...
2019 Apr 05
2
[RFC] Should we add isa_or_null<>?
On Thu, Apr 4, 2019 at 7:10 PM Craig Topper <craig.topper at gmail.com> wrote: > Agreed that the new isa_or_null style is better. Just wanted mention the > other style so we know we should migrate those to the new one. > I have a checker under review that could be enhanced to do that -- though it currently replaces `X->foo() && isa<Y>(X->foo())` with `dyn_cast_or_null<Y>(X-&gt...
2019 Apr 04
2
[RFC] Should we add isa_or_null<>?
...added a patch, temporarily using the name Chris suggested. Please let me know what you think. https://reviews.llvm.org/D60291 thanks... don On Thu, Apr 4, 2019 at 2:55 PM David Greene <dag at cray.com> wrote: > Don Hinton <hintonda at gmail.com> writes: > > > > if (isa_or_null<T>(var)) { > > > ... > > > } > > > > > > at least according to what "isa_or_null" conveys to me. > > > > This is the same convention used by the existing "_or_null" varieties, > > i.e., "cast_or_null" and...
2019 Apr 06
4
[RFC] Should we add isa_or_null<>?
...PM Chris Lattner <clattner at nondot.org> >> wrote: >> > >> > >> > >> > > On Apr 4, 2019, at 5:37 AM, Don Hinton via llvm-dev < >> llvm-dev at lists.llvm.org> wrote: >> > > >> > > I'd like to propose adding `isa_or_null<>` to replace the following >> usage pattern that's relatively common in conditionals: >> > > >> > > var && isa<T>(var) =>> isa_or_null<T>(var) >> > > >> > > And in particular when `var` is a method call w...
2019 Apr 10
2
[RFC] Should we add isa_or_null<>?
...t; > On Thu, Apr 4, 2019 at 12:58 PM Chris Lattner <clattner at nondot.org> wrote: > > > > > > > > > On Apr 4, 2019, at 5:37 AM, Don Hinton via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > > > > > I'd like to propose adding `isa_or_null<>` to replace the following usage pattern that's relatively common in conditionals: > > > > > > var && isa<T>(var) =>> isa_or_null<T>(var) > > > > > > And in particular when `var` is a method call which might be expensi...
2019 Apr 07
2
[RFC] Should we add isa_or_null<>?
...; wrote: >>>> > >>>> > >>>> > >>>> > > On Apr 4, 2019, at 5:37 AM, Don Hinton via llvm-dev < >>>> llvm-dev at lists.llvm.org> wrote: >>>> > > >>>> > > I'd like to propose adding `isa_or_null<>` to replace the following >>>> usage pattern that's relatively common in conditionals: >>>> > > >>>> > > var && isa<T>(var) =>> isa_or_null<T>(var) >>>> > > >>>> > > And in...
2019 Apr 07
2
[RFC] Should we add isa_or_null<>?
...? Still looks awkward but maybe less naively misleading. From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Zachary Turner via llvm-dev Sent: Saturday, April 06, 2019 10:15 PM To: Mehdi AMINI Cc: LLVM Development List; Aaron Ballman Subject: Re: [llvm-dev] [RFC] Should we add isa_or_null<>? In that case my original suggestion of isa<T>(not_null(v)) matches the semantics right? On Sat, Apr 6, 2019 at 5:03 PM Mehdi AMINI <joker.eph at gmail.com<mailto:joker.eph at gmail.com>> wrote: I read `isa<T>(or_null(v))` as "v is a T or nullptr", which...
2019 Apr 05
2
[RFC] Should we add isa_or_null<>?
+1 for "isa_nonnull" --paulr From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Hubert Tong via llvm-dev Sent: Friday, April 05, 2019 12:10 AM To: Aaron Ballman Cc: LLVM Development List Subject: Re: [llvm-dev] [RFC] Should we add isa_or_null<>? On Thu, Apr 4, 2019 at 11:15 PM Aaron Ballman via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote: On Thu, Apr 4, 2019 at 12:58 PM Chris Lattner <clattner at nondot.org<mailto:clattner at nondot.org>> wrote: > > > > > O...
2019 Apr 22
3
[RFC] Should we add isa_or_null<>?
...ndot.org> >> wrote: >> > > >> > > >> > > >> > > > On Apr 4, 2019, at 5:37 AM, Don Hinton via llvm-dev < >> llvm-dev at lists.llvm.org> wrote: >> > > > >> > > > I'd like to propose adding `isa_or_null<>` to replace the >> following usage pattern that's relatively common in conditionals: >> > > > >> > > > var && isa<T>(var) =>> isa_or_null<T>(var) >> > > > >> > > > And in particular when...
2019 May 04
2
[RFC] Should we add isa_or_null<>?
On Mon, Apr 29, 2019, 02:37 David Chisnall via llvm-dev < llvm-dev at lists.llvm.org> wrote: > On 22/04/2019 15:15, Don Hinton via llvm-dev wrote: > > Although there were a few no votes, it looks like there's a consensus > > for adding a `isa_and_nonnull` type operator. While there were some who > > preferred `isa_nonnull`, it wasn't overwhelming, and since
2019 May 05
3
[RFC] Should we add isa_or_null<>?
+1 on not adding the new API On Sat, May 4, 2019, 11:51 AM David Blaikie via llvm-dev < llvm-dev at lists.llvm.org> wrote: > +1, if we're voting. I don't think it adds to the readability of code > for me personally. > > On Sat, May 4, 2019 at 11:47 AM Chandler Carruth via llvm-dev > <llvm-dev at lists.llvm.org> wrote: > > > > On Mon, Apr 29, 2019,