This is an archive of the discontinued LLVM Phabricator instance.

PR15730/PR16986 Allow dependently typed vector_size types.
ClosedPublic

Authored by erichkeane on Jul 6 2018, 2:56 PM.

Details

Summary

As listed in the above PRs, vector_size doesn't allow
dependent types/values. This patch introduces a new
DependentVectorType to handle a VectorType that has a dependent
size or type.

In the future, ALL the vector-types should be able to create one
of these to handle dependent types/sizes as well. For example,
DependentSizedExtVectorType could likely be switched to just use
this instead, though that is left as an exercise for the future.

Diff Detail

Event Timeline

erichkeane created this revision.Jul 6 2018, 2:56 PM
aaron.ballman added inline comments.Jul 13 2018, 6:05 AM
include/clang/AST/ASTContext.h
1327–1329

The formatting looks off here. Did clang-format do this?

include/clang/AST/Type.h
3083

sizeis -> size is

3105

Can this return const Expr * and have a non-const overload to return the non-const Expr *?

lib/AST/ASTContext.cpp
3316

Insert a newline above, and reformat.

lib/AST/ItaniumMangle.cpp
3007–3008

This seems reachable.

3083

As does this.

lib/AST/Type.cpp
192

Formatting? Also, does this need to take the VecKind?

lib/Sema/SemaTemplateDeduction.cpp
1874

Can use const auto * here.

1877

Here too.

1897

Can the size ever be negative? Perhaps an unsigned type would be better than a signed type?

1901

const auto *

5317

const auto *

erichkeane marked 12 inline comments as done.
erichkeane added inline comments.
include/clang/AST/ASTContext.h
1327–1329

It DID, then I renamed it and forgot to rerun :/

include/clang/AST/Type.h
3105

Done, but unfortunately, TypeLoc visitation (RecursiveASTVisitor) lacks const correctness in a bunch of places so a cast was required there :/ Additionally, TreeTransform has similar issues, so a const-cast was required as well. Both end up being a bit of a cleanup, perhaps more than I can tackle at the moment.

lib/AST/ItaniumMangle.cpp
3007–3008

I don't think it IS actually (since we never create one of these), but point made :)

aaron.ballman accepted this revision.Jul 13 2018, 12:13 PM

LGTM, though it's your call on the const_cast stuff whether you want to revert or keep it.

include/clang/AST/Type.h
3105

Oye, now that I see how many const_cast's get added, I'm starting to regret asking for this. :-P Your call as to whether you want to leave it in this state or revert back the const-correctness attempt.

This revision is now accepted and ready to land.Jul 13 2018, 12:13 PM
This revision was automatically updated to reflect the committed changes.