This is an archive of the discontinued LLVM Phabricator instance.

GCC Compatibility: Support for __final specifier
ClosedPublic

Authored by erichkeane on Jul 28 2016, 8:43 AM.

Details

Summary

As reported in bug 28473, GCC supports ‘final’ functionality in pre-C++11 code using the __final keyword. Clang currently supports the ‘final’ keyword in accordance with the C++11 specification, however it ALSO supports it in pre-C++11 mode, with a warning.

This patch adds the ‘__final’ keyword for compatibility with GCC in GCC Keywords mode (so it is enabled with existing flags), and issues a warning on its usage (suggesting switching to the C++11 keyword). This patch also adds a regression test for the functionality described. I believe this patch has minimal impact, as it simply adds a new keyword for existing behavior.

This has been validated with check-clang to avoid regressions. Patch is created in reference to revisions 276665

Diff Detail

Repository
rL LLVM

Event Timeline

erichkeane updated this revision to Diff 65939.Jul 28 2016, 8:43 AM
erichkeane retitled this revision from to GCC Compatibility: Support for __final specifier.
erichkeane updated this object.
erichkeane set the repository for this revision to rL LLVM.
erichkeane added a project: Restricted Project.
majnemer accepted this revision.Jul 28 2016, 9:25 AM
majnemer edited edge metadata.

LGTM as-is, clang's behavior would be congruent with GCC's.

lib/Parse/ParseDeclCXX.cpp
3024–3026 ↗(On Diff #65939)

Please remove these braces.

This revision is now accepted and ready to land.Jul 28 2016, 9:25 AM
erichkeane updated this revision to Diff 65951.Jul 28 2016, 9:34 AM
erichkeane edited edge metadata.
erichkeane removed rL LLVM as the repository for this revision.
erichkeane marked an inline comment as done.

Fixed the braces mentioned.

This revision was automatically updated to reflect the committed changes.