On Thu, Dec 6, 2018 at 3:20 PM Adrian Prantl via lldb-dev
<[email protected]> wrote:
>
> I was puzzled by the behavior of ArchSpec::IsExactMatch() and
> IsCompatibleMatch() yesterday, so I created a couple of unit tests to
> document the current behavior. Most of the tests make perfect sense, but a
> few edge cases really don't behave like I would have expected them to.
>
> > {
> > ArchSpec A("arm64-*-*");
> > ArchSpec B("arm64-apple-ios");
> > ASSERT_FALSE(A.IsExactMatch(B));
> > // FIXME: This looks unintuitive and we should investigate whether
> > // this is the desired behavior.
> > ASSERT_FALSE(A.IsCompatibleMatch(B));
> > }
> > {
> > ArchSpec A("x86_64-*-*");
> > ArchSpec B("x86_64-apple-ios-simulator");
> > ASSERT_FALSE(A.IsExactMatch(B));
> > // FIXME: See above, though the extra environment complicates things.
> > ASSERT_FALSE(A.IsCompatibleMatch(B));
> > }
> > {
> > ArchSpec A("x86_64");
> > ArchSpec B("x86_64-apple-macosx10.14");
> > // FIXME: The exact match also looks unintuitive.
> > ASSERT_TRUE(A.IsExactMatch(B));
> > ASSERT_TRUE(A.IsCompatibleMatch(B));
> > }
> >
>
> Particularly, I believe that:
> - ArchSpec("x86_64-*-*") and ArchSpec("x86_64") should behave the same.
Yes.
> - ArchSpec("x86_64").IsExactMatch("x86_64-apple-macosx10.14") should be false.
I'm at a loss trying to understand how this could not be false.
It would mean that when we instantiate a Triple and we don't have an
arch we believe it's a Mach-O binary.
This sounds really wrong, and if there's code in lldb living under the
assumption this is true, we might consider getting rid of it (or
fixing it).
> - ArchSpec("x86_64-*-*").IsCompatibleMath("x86_64-apple-macosx") should be
> true.
>
Yes.
--
Davide
_______________________________________________
lldb-dev mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev