This is an archive of the discontinued LLVM Phabricator instance.

Add a C2x mode and allow attributes in it
ClosedPublic

Authored by aaron.ballman on May 1 2019, 3:06 AM.

Details

Reviewers
rsmith
dblaikie
Summary

WG14 has a working draft for C2x (WG14 N2346) and we've begun voting new features into it, so I think it's time for use to expose a C2x flag and use it. The new features we adopted this week that Clang already has support for are: the new attribute syntax (WG14 N2335), the [[nodiscard]] attribute (WG14 N2267), the [[maybe_unused]] attribute (WG14 N2270), and the [[deprecated]] attribute (WG14 N2334).

This patch adds the new C2x language mode and flips a switch to allow double-square bracket attributes in that new mode.

Diff Detail

Event Timeline

aaron.ballman created this revision.May 1 2019, 3:06 AM
rsmith accepted this revision.May 13 2019, 3:00 PM
rsmith added inline comments.
lib/Frontend/CompilerInvocation.cpp
2593–2596

(We get this wrong in a bunch of other places, but...)

The default from the language mode should be set by setLangDefault, and here we should override it if suitable flags are set.

This revision is now accepted and ready to land.May 13 2019, 3:00 PM
aaron.ballman closed this revision.May 14 2019, 5:07 AM
aaron.ballman marked an inline comment as done.

I've commit in r360667, thanks!

lib/Frontend/CompilerInvocation.cpp
2593–2596

Ah, good to know. I went ahead and fixed this for the commit.