This is an archive of the discontinued LLVM Phabricator instance.

[Sema/Attribute] Make types declared with address_space an AttributedType
ClosedPublic

Authored by leonardchan on Aug 24 2018, 12:07 PM.

Details

Summary

Currently an address_space is stored in a qualifier. This makes any type declared with an address_space attribute in the form __attribute__((address_space(1))) int 1; be wrapped in an AttributedType.

This is for a later patch where if address_space is declared in a macro, any diagnostics that would normally print the address space will instead dump the macro name. This will require saving any macro information in the AttributedType.

Diff Detail

Repository
rC Clang

Event Timeline

leonardchan created this revision.Aug 24 2018, 12:07 PM
rsmith added inline comments.Aug 24 2018, 3:02 PM
lib/AST/TypePrinter.cpp
1430–1431

Please justify why this is appropriate with a comment.

1505–1506

Just add this to the list starting on line 1450.

lib/Sema/SemaType.cpp
7295–7302

This should be done in HandleAddressSpaceTypeAttribute, not here.

leonardchan marked 3 inline comments as done.
rsmith added inline comments.Aug 24 2018, 4:00 PM
lib/Sema/SemaType.cpp
5815

We should also create the AttributedType to track the source syntax in the dependent case. If we don't, the AttributedType will be missing after template instantiation.

leonardchan marked an inline comment as done.
rsmith accepted this revision.Aug 24 2018, 6:54 PM
rsmith added inline comments.
lib/Sema/SemaType.cpp
5599–5600

Can you delete this, or otherwise reorder the filling of dependent address spaces, atomic types, attributed types, and adjusted types so that we don't have duplicates?

This revision is now accepted and ready to land.Aug 24 2018, 6:54 PM
leonardchan marked an inline comment as done.
This revision was automatically updated to reflect the committed changes.