On Wed, Feb 4, 2015 at 2:23 AM, David Majnemer <[email protected]> wrote: > Author: majnemer > Date: Wed Feb 4 01:23:21 2015 > New Revision: 228120 > > URL: http://llvm.org/viewvc/llvm-project?rev=228120&view=rev > Log: > Sema: Add support for __declspec(restrict) > > __declspec(restrict) and __attribute(malloc) are both handled > identically by clang: they are allowed to the noalias LLVM attribute. > > Seeing as how noalias models the C99 notion of 'restrict', rename the > internal clang attribute to Restrict from Malloc. > > Modified: > cfe/trunk/include/clang/Basic/Attr.td > cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > cfe/trunk/include/clang/Sema/Sema.h > cfe/trunk/lib/CodeGen/CGCall.cpp > cfe/trunk/lib/Sema/SemaDeclAttr.cpp > cfe/trunk/lib/Sema/SemaExprCXX.cpp > cfe/trunk/test/Parser/MicrosoftExtensions.c > cfe/trunk/test/Sema/attr-malloc.c > cfe/trunk/test/SemaObjC/attr-malloc.m > > Modified: cfe/trunk/include/clang/Basic/Attr.td > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=228120&r1=228119&r2=228120&view=diff > ============================================================================== > --- cfe/trunk/include/clang/Basic/Attr.td (original) > +++ cfe/trunk/include/clang/Basic/Attr.td Wed Feb 4 01:23:21 2015 > @@ -790,9 +790,9 @@ def IBOutletCollection : InheritableAttr > let Documentation = [Undocumented]; > } > > -def Malloc : InheritableAttr { > - let Spellings = [GCC<"malloc">]; > -// let Subjects = [Function]; > +def Restrict : InheritableAttr { > + let Spellings = [Declspec<"restrict">, GCC<"malloc">]; > + let Subjects = SubjectList<[Function]>;
>From memory, isn't __declspec(restrict) basically the function return type version of the MS extension __restrict? I'm wondering about adding a Keyword spelling, and how much work it would be to support that? (If I'm way off-base, that's fine too.) > let Documentation = [Undocumented]; While I know this is not a new attribute per-se, it would still be good to have it documented just the same. Thank you for working on this! ~Aaron _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
