[cfe-commits] [PATCH] C++ 11 statement attributes + switch labels fall-through detection

Alexander Kornienko alexfh at google.com
Wed Apr 4 14:01:48 PDT 2012


Hi all,

I've implemented more or less generic handling of C++ 11 attributes on
statements. This includes AttributedStmt class, which represents statements
with attributes in AST, relevant changes in Parser class and in all related
places: serialization code, visitors, pretty-printing etc.

The AttributedStmt class acts as a wrapper for a statement, which has c++
11 style attributes. It works similar to LabelStmt.

I've also implemented one specific statement attribute as an example (and
quite valuable on its own, I believe): [[fallthrough]] attribute for switch
cases, which allows to mark intended fall-through from one switch case to
another, and diagnose missing break/return statements in switch cases
(controlled via -Wimplicit-fallthrough command-line flag). The patch also
includes tests for the diagnostics
(test/SemaCXX/switch-implicit-fallthrough.cpp,
 test/SemaCXX/switch-implicit-fallthrough-fail.cpp).

Please, review this patch.

Thanks!

-- 
Best regards,
Alexander Kornienko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120404/8dc4e50a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: stmt-attributes.diff
Type: application/octet-stream
Size: 116458 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120404/8dc4e50a/attachment.obj>


More information about the cfe-commits mailing list