This is an archive of the discontinued LLVM Phabricator instance.

[TableGen] Only normalize the spelling of GNU-style attributes.
ClosedPublic

Authored by jlebar on Jan 4 2017, 1:53 PM.

Details

Summary

When Sema looks up an attribute name, it strips off leading and trailing
"" if the attribute is GNU-style. That is, attribute((foo)) and
attribute((foo__)) are equivalent.

This is only true for GNU-style attributes. In particular,
declspec(foo) is not equivalent to declspec(foo), and Sema
respects this difference.

This patch fixes TableGen to match Sema's behavior. The spelling
'GNU<"foo">' should be normalized to 'GNU<"foo">', but
'Declspec<"foo">' should not be changed.

This is necessary to make CUDA compilation work on Windows, because e.g.
the device attribute is spelled declspec(device__).

Attr.td does not contain any Declspec spellings that start or end with
"__", so this change should not affect any other attributes.

Event Timeline

jlebar updated this revision to Diff 83125.Jan 4 2017, 1:53 PM
jlebar retitled this revision from to [TableGen] Only normalize the spelling of GNU-style attributes..
jlebar updated this object.
jlebar added a reviewer: rnk.
jlebar added subscribers: tra, cfe-commits.
rnk accepted this revision.Jan 4 2017, 4:24 PM
rnk edited edge metadata.

lgtm

This revision is now accepted and ready to land.Jan 4 2017, 4:24 PM
This revision was automatically updated to reflect the committed changes.