[PATCH] Flag Enumerator Attribute

Aaron Ballman aaron.ballman at gmail.com
Mon Nov 24 07:12:47 PST 2014


On Fri, Nov 21, 2014 at 12:12 AM, Sean Hunt <scshunt at csclub.uwaterloo.ca> wrote:
> A few more comments from Aaron.
>
> On the C++ side, I realized that forward declarations and redeclarations possibly break everything. I don't want to think about that now. It could be made an error in C++ for the time being if that's a large concern, or I could simply work on FIXMEs or a later patch to make it work in C++.

Since this can do the wrong thing in C++, I would make it unavailable
there for now. You can do this by adding a new LangOpt subclass:

def CPlusPlus : LangOpt("CPlusPlus");

and in your attribute, add:

let LangOpts = [CPlusPlus];

Then just add a test to ensure it gives the expected error.

Otherwise, patch LGTM!

~Aaron

>
> http://reviews.llvm.org/D5853
>
> Files:
>   include/clang/Basic/Attr.td
>   include/clang/Basic/AttrDocs.td
>   include/clang/Basic/DiagnosticGroups.td
>   include/clang/Basic/DiagnosticSemaKinds.td
>   include/clang/Sema/AttributeList.h
>   include/clang/Sema/Sema.h
>   lib/Sema/SemaDecl.cpp
>   lib/Sema/SemaDeclAttr.cpp
>   lib/Sema/SemaStmt.cpp
>   test/Sema/attr-flag-enum.c
>   utils/TableGen/ClangAttrEmitter.cpp




More information about the cfe-commits mailing list