r173746 - Replace AS_MSTypespec with AS_Keyword, for representing any attribute spelled
Timur Iskhodzhanov
timurrrr at google.com
Tue Jan 29 02:16:02 PST 2013
My Windows bot is green again, thank you very much for a quick fix!
2013/1/29 Richard Smith <richard at metafoo.co.uk>:
> I've re-enabled most of that test, should be better in r173788.
>
> On Tue, Jan 29, 2013 at 12:32 AM, Richard Smith <richard at metafoo.co.uk> wrote:
>> Oh, awesome, the test for this has 'REQUIRES: disabled'. ;-(
>>
>> On Mon, Jan 28, 2013 at 11:31 PM, Timur Iskhodzhanov
>> <timurrrr at google.com> wrote:
>>> Hi Richard,
>>>
>>> I believe your change has broken compilation of <windows.h> on Windows:
>>> --------------
>>> In file included from windows_h_test.cpp:1:
>>> In file included from c:\Program Files (x86)\Microsoft
>>> SDKs\Windows\v7.0A\include\windows.h:155:
>>> In file included from c:\Program Files (x86)\Microsoft
>>> SDKs\Windows\v7.0A\include\windef.h:177:
>>> In file included from c:\Program Files (x86)\Microsoft
>>> SDKs\Windows\v7.0A\include\winnt.h:159:
>>> c:\Program Files (x86)\Microsoft
>>> SDKs\Windows\v7.0A\include\basetsd.h:361:20: error: '__ptr64'
>>> attribute ignored when parsing type
>>> return((void * POINTER_64) (unsigned __int64) (ULONG_PTR)p );
>>> ^~~~~~~~~~
>>> c:\Program Files (x86)\Microsoft
>>> SDKs\Windows\v7.0A\include\basetsd.h:36:23: note: expanded from macro
>>> 'POINTER_64'
>>> #define POINTER_64 __ptr64
>>> ^~~~~~~
>>> c:\Program Files (x86)\Microsoft
>>> SDKs\Windows\v7.0A\include\basetsd.h:379:20: error: '__ptr64'
>>> attribute ignored when parsing type
>>> return((void * POINTER_64)(__int64)(LONG_PTR)h );
>>> ^~~~~~~~~~
>>> c:\Program Files (x86)\Microsoft
>>> SDKs\Windows\v7.0A\include\basetsd.h:36:23: note: expanded from macro
>>> 'POINTER_64'
>>> #define POINTER_64 __ptr64
>>> --------------
>>>
>>> Can you please check?
>>>
>>> Thanks
>>> --
>>> Timur
>>>
>>> 2013/1/29 Richard Smith <richard-llvm at metafoo.co.uk>:
>>>> Author: rsmith
>>>> Date: Mon Jan 28 19:24:26 2013
>>>> New Revision: 173746
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=173746&view=rev
>>>> Log:
>>>> Replace AS_MSTypespec with AS_Keyword, for representing any attribute spelled
>>>> as a keyword. Rationalize existing attributes to use it as appropriate, and to
>>>> not lie about some __declspec attributes being GNU attributes. In passing,
>>>> remove a gross hack which was discarding attributes which we could handle. This
>>>> results in us actually respecting the __pascal keyword again.
>>>>
>>>> Modified:
>>>> cfe/trunk/include/clang/Basic/Attr.td
>>>> cfe/trunk/include/clang/Sema/AttributeList.h
>>>> cfe/trunk/lib/Parse/ParseDecl.cpp
>>>> cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>>>> cfe/trunk/lib/Sema/SemaType.cpp
>>>> cfe/trunk/test/Sema/attr-print.c
>>>> cfe/trunk/test/SemaCXX/attr-print.cpp
>>>> cfe/trunk/test/SemaCXX/borland-extensions.cpp
>>>> cfe/trunk/test/SemaCXX/cxx11-attr-print.cpp
>>>> cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
>>>>
>>>> Modified: cfe/trunk/include/clang/Basic/Attr.td
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=173746&r1=173745&r2=173746&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/include/clang/Basic/Attr.td (original)
>>>> +++ cfe/trunk/include/clang/Basic/Attr.td Mon Jan 28 19:24:26 2013
>>>> @@ -29,8 +29,8 @@ class SubsetSubject<AttrSubject base, st
>>>> code CheckCode = check;
>>>> }
>>>>
>>>> -// This is the type of a variable which C++11 defines [[aligned()]] as being
>>>> -// a possible subject.
>>>> +// This is the type of a variable which C++11 allows alignas(...) to appertain
>>>> +// to.
>>>> def NormalVar : SubsetSubject<Var, "non-register, non-parameter variable",
>>>> [{S->getStorageClass() != VarDecl::Register &&
>>>> S->getKind() != Decl::ImplicitParam &&
>>>> @@ -91,6 +91,7 @@ class Declspec<string name> : Spelling<n
>>>> class CXX11<string namespace, string name> : Spelling<name, "CXX11"> {
>>>> string Namespace = namespace;
>>>> }
>>>> +class Keyword<string name> : Spelling<name, "Keyword">;
>>>>
>>>> class Attr {
>>>> // The various ways in which an attribute can be spelled in source
>>>> @@ -125,6 +126,13 @@ class InheritableAttr : Attr;
>>>> /// redeclarations, even when it's written on a parameter.
>>>> class InheritableParamAttr : InheritableAttr;
>>>>
>>>> +/// An ignored attribute, which we parse but discard with no checking.
>>>> +class IgnoredAttr : Attr {
>>>> + let Ignored = 1;
>>>> + let ASTNode = 0;
>>>> + let SemaHandler = 0;
>>>> +}
>>>> +
>>>> //
>>>> // Attributes begin here
>>>> //
>>>> @@ -141,7 +149,8 @@ def Alias : InheritableAttr {
>>>> }
>>>>
>>>> def Aligned : InheritableAttr {
>>>> - let Spellings = [GNU<"aligned">, GNU<"align">, CXX11<"gnu", "aligned">];
>>>> + let Spellings = [GNU<"aligned">, Declspec<"align">, CXX11<"gnu", "aligned">,
>>>> + Keyword<"alignas">];
>>>> let Subjects = [NonBitField, NormalVar, Tag];
>>>> let Args = [AlignedArgument<"Alignment">, BoolArgument<"IsMSDeclSpec">];
>>>> }
>>>> @@ -200,11 +209,8 @@ def Blocks : InheritableAttr {
>>>> let Args = [EnumArgument<"Type", "BlockType", ["byref"], ["ByRef"]>];
>>>> }
>>>>
>>>> -def Bounded : Attr {
>>>> +def Bounded : IgnoredAttr {
>>>> let Spellings = [GNU<"bounded">];
>>>> - let ASTNode = 0;
>>>> - let SemaHandler = 0;
>>>> - let Ignored = 1;
>>>> }
>>>>
>>>> def CarriesDependency : InheritableParamAttr {
>>>> @@ -214,7 +220,7 @@ def CarriesDependency : InheritableParam
>>>> }
>>>>
>>>> def CDecl : InheritableAttr {
>>>> - let Spellings = [GNU<"cdecl">, GNU<"__cdecl">, CXX11<"gnu", "cdecl">];
>>>> + let Spellings = [GNU<"cdecl">, CXX11<"gnu", "cdecl">, Keyword<"__cdecl">];
>>>> }
>>>>
>>>> // cf_audited_transfer indicates that the given function has been
>>>> @@ -302,7 +308,7 @@ def CXX11NoReturn : InheritableAttr {
>>>> }
>>>>
>>>> def OpenCLKernel : Attr {
>>>> - let Spellings = [GNU<"opencl_kernel_function">];
>>>> + let Spellings = [Keyword<"__kernel">, Keyword<"kernel">];
>>>> }
>>>>
>>>> def OpenCLImageAccess : Attr {
>>>> @@ -333,8 +339,8 @@ def FallThrough : Attr {
>>>> }
>>>>
>>>> def FastCall : InheritableAttr {
>>>> - let Spellings = [GNU<"fastcall">, GNU<"__fastcall">,
>>>> - CXX11<"gnu", "fastcall">];
>>>> + let Spellings = [GNU<"fastcall">, CXX11<"gnu", "fastcall">,
>>>> + Keyword<"__fastcall">];
>>>> }
>>>>
>>>> def Final : InheritableAttr {
>>>> @@ -631,16 +637,17 @@ def Sentinel : InheritableAttr {
>>>> }
>>>>
>>>> def StdCall : InheritableAttr {
>>>> - let Spellings = [GNU<"stdcall">, GNU<"__stdcall">, CXX11<"gnu", "stdcall">];
>>>> + let Spellings = [GNU<"stdcall">, CXX11<"gnu", "stdcall">,
>>>> + Keyword<"__stdcall">];
>>>> }
>>>>
>>>> def ThisCall : InheritableAttr {
>>>> - let Spellings = [GNU<"thiscall">, GNU<"__thiscall">,
>>>> - CXX11<"gnu", "thiscall">];
>>>> + let Spellings = [GNU<"thiscall">, CXX11<"gnu", "thiscall">,
>>>> + Keyword<"__thiscall">];
>>>> }
>>>>
>>>> def Pascal : InheritableAttr {
>>>> - let Spellings = [GNU<"pascal">];
>>>> + let Spellings = [GNU<"pascal">, Keyword<"__pascal">];
>>>> }
>>>>
>>>> def TransparentUnion : InheritableAttr {
>>>> @@ -694,11 +701,8 @@ def VectorSize : Attr {
>>>> let ASTNode = 0;
>>>> }
>>>>
>>>> -def VecTypeHint : Attr {
>>>> +def VecTypeHint : IgnoredAttr {
>>>> let Spellings = [GNU<"vec_type_hint">];
>>>> - let ASTNode = 0;
>>>> - let SemaHandler = 0;
>>>> - let Ignored = 1;
>>>> }
>>>>
>>>> def Visibility : InheritableAttr {
>>>> @@ -894,29 +898,33 @@ def DLLImport : InheritableAttr {
>>>> }
>>>>
>>>> def ForceInline : InheritableAttr {
>>>> - let Spellings = [Declspec<"__forceinline">];
>>>> + let Spellings = [Keyword<"__forceinline">];
>>>> }
>>>>
>>>> def Win64 : InheritableAttr {
>>>> - let Spellings = [Declspec<"w64">];
>>>> + let Spellings = [Keyword<"__w64">];
>>>> }
>>>>
>>>> def Ptr32 : InheritableAttr {
>>>> - let Spellings = [Declspec<"__ptr32">];
>>>> + let Spellings = [Keyword<"__ptr32">];
>>>> }
>>>>
>>>> def Ptr64 : InheritableAttr {
>>>> - let Spellings = [Declspec<"__ptr64">];
>>>> + let Spellings = [Keyword<"__ptr64">];
>>>> }
>>>>
>>>> def SingleInheritance : InheritableAttr {
>>>> - let Spellings = [Declspec<"__single_inheritance">];
>>>> + let Spellings = [Keyword<"__single_inheritance">];
>>>> }
>>>>
>>>> def MultipleInheritance : InheritableAttr {
>>>> - let Spellings = [Declspec<"__multiple_inheritance">];
>>>> + let Spellings = [Keyword<"__multiple_inheritance">];
>>>> }
>>>>
>>>> def VirtualInheritance : InheritableAttr {
>>>> - let Spellings = [Declspec<"__virtual_inheritance">];
>>>> + let Spellings = [Keyword<"__virtual_inheritance">];
>>>> +}
>>>> +
>>>> +def Unaligned : IgnoredAttr {
>>>> + let Spellings = [Keyword<"__unaligned">];
>>>> }
>>>>
>>>> Modified: cfe/trunk/include/clang/Sema/AttributeList.h
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/AttributeList.h?rev=173746&r1=173745&r2=173746&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/include/clang/Sema/AttributeList.h (original)
>>>> +++ cfe/trunk/include/clang/Sema/AttributeList.h Mon Jan 28 19:24:26 2013
>>>> @@ -56,12 +56,14 @@ class AttributeList { // TODO: This shou
>>>> public:
>>>> /// The style used to specify an attribute.
>>>> enum Syntax {
>>>> + /// __attribute__((...))
>>>> AS_GNU,
>>>> + /// [[...]]
>>>> AS_CXX11,
>>>> + /// __declspec(...)
>>>> AS_Declspec,
>>>> - // eg) __w64, __ptr32, etc. It is implied that an MSTypespec is also
>>>> - // a declspec.
>>>> - AS_MSTypespec
>>>> + /// __ptr16, alignas(...), etc.
>>>> + AS_Keyword
>>>> };
>>>> private:
>>>> IdentifierInfo *AttrName;
>>>> @@ -227,12 +229,9 @@ public:
>>>> IdentifierInfo *getParameterName() const { return ParmName; }
>>>> SourceLocation getParameterLoc() const { return ParmLoc; }
>>>>
>>>> - /// Returns true if the attribute is a pure __declspec or a synthesized
>>>> - /// declspec representing a type specification (like __w64 or __ptr32).
>>>> - bool isDeclspecAttribute() const { return SyntaxUsed == AS_Declspec ||
>>>> - SyntaxUsed == AS_MSTypespec; }
>>>> + bool isDeclspecAttribute() const { return SyntaxUsed == AS_Declspec; }
>>>> bool isCXX11Attribute() const { return SyntaxUsed == AS_CXX11; }
>>>> - bool isMSTypespecAttribute() const { return SyntaxUsed == AS_MSTypespec; }
>>>> + bool isKeywordAttribute() const { return SyntaxUsed == AS_Keyword; }
>>>>
>>>> bool isInvalid() const { return Invalid; }
>>>> void setInvalid(bool b = true) const { Invalid = b; }
>>>>
>>>> Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=173746&r1=173745&r2=173746&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
>>>> +++ cfe/trunk/lib/Parse/ParseDecl.cpp Mon Jan 28 19:24:26 2013
>>>> @@ -462,7 +462,7 @@ void Parser::ParseMicrosoftTypeAttribute
>>>> IdentifierInfo *AttrName = Tok.getIdentifierInfo();
>>>> SourceLocation AttrNameLoc = ConsumeToken();
>>>> attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0,
>>>> - SourceLocation(), 0, 0, AttributeList::AS_MSTypespec);
>>>> + SourceLocation(), 0, 0, AttributeList::AS_Keyword);
>>>> }
>>>> }
>>>>
>>>> @@ -472,21 +472,23 @@ void Parser::ParseBorlandTypeAttributes(
>>>> IdentifierInfo *AttrName = Tok.getIdentifierInfo();
>>>> SourceLocation AttrNameLoc = ConsumeToken();
>>>> attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0,
>>>> - SourceLocation(), 0, 0, AttributeList::AS_MSTypespec);
>>>> + SourceLocation(), 0, 0, AttributeList::AS_Keyword);
>>>> }
>>>> }
>>>>
>>>> void Parser::ParseOpenCLAttributes(ParsedAttributes &attrs) {
>>>> // Treat these like attributes
>>>> while (Tok.is(tok::kw___kernel)) {
>>>> + IdentifierInfo *AttrName = Tok.getIdentifierInfo();
>>>> SourceLocation AttrNameLoc = ConsumeToken();
>>>> - attrs.addNew(PP.getIdentifierInfo("opencl_kernel_function"),
>>>> - AttrNameLoc, 0, AttrNameLoc, 0,
>>>> - SourceLocation(), 0, 0, AttributeList::AS_GNU);
>>>> + attrs.addNew(AttrName, AttrNameLoc, 0, AttrNameLoc, 0,
>>>> + SourceLocation(), 0, 0, AttributeList::AS_Keyword);
>>>> }
>>>> }
>>>>
>>>> void Parser::ParseOpenCLQualifiers(DeclSpec &DS) {
>>>> + // FIXME: The mapping from attribute spelling to semantics should be
>>>> + // performed in Sema, not here.
>>>> SourceLocation Loc = Tok.getLocation();
>>>> switch(Tok.getKind()) {
>>>> // OpenCL qualifiers:
>>>>
>>>> Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=173746&r1=173745&r2=173746&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
>>>> +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon Jan 28 19:24:26 2013
>>>> @@ -4759,11 +4759,11 @@ static void ProcessDeclAttribute(Sema &S
>>>> if (Attr.isInvalid())
>>>> return;
>>>>
>>>> - // Type attributes are still treated as declaration attributes by
>>>> - // ParseMicrosoftTypeAttributes and ParseBorlandTypeAttributes. We don't
>>>> - // want to process them, however, because we will simply warn about ignoring
>>>> - // them. So instead, we will bail out early.
>>>> - if (Attr.isMSTypespecAttribute())
>>>> + // FIXME: Ignore unknown keyword attributes for now. We see this in the case
>>>> + // of some Borland attributes, like __pascal.
>>>> + // FIXME: Add these attributes to Attr.td and mark as ignored!
>>>> + if (Attr.isKeywordAttribute() &&
>>>> + Attr.getKind() == AttributeList::UnknownAttribute)
>>>> return;
>>>>
>>>> // Ignore C++11 attributes on declarator chunks: they appertain to the type
>>>>
>>>> Modified: cfe/trunk/lib/Sema/SemaType.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=173746&r1=173745&r2=173746&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/lib/Sema/SemaType.cpp (original)
>>>> +++ cfe/trunk/lib/Sema/SemaType.cpp Mon Jan 28 19:24:26 2013
>>>> @@ -4336,13 +4336,6 @@ static void processTypeAttrs(TypeProcess
>>>> attr.setUsedAsTypeAttr();
>>>> break;
>>>>
>>>> - case AttributeList::AT_Win64:
>>>> - case AttributeList::AT_Ptr32:
>>>> - case AttributeList::AT_Ptr64:
>>>> - // FIXME: don't ignore these
>>>> - attr.setUsedAsTypeAttr();
>>>> - break;
>>>> -
>>>> case AttributeList::AT_NSReturnsRetained:
>>>> if (!state.getSema().getLangOpts().ObjCAutoRefCount)
>>>> break;
>>>>
>>>> Modified: cfe/trunk/test/Sema/attr-print.c
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/attr-print.c?rev=173746&r1=173745&r2=173746&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/test/Sema/attr-print.c (original)
>>>> +++ cfe/trunk/test/Sema/attr-print.c Mon Jan 28 19:24:26 2013
>>>> @@ -1,4 +1,4 @@
>>>> -// RUN: %clang_cc1 %s -ast-print | FileCheck %s
>>>> +// RUN: %clang_cc1 %s -ast-print -fms-extensions | FileCheck %s
>>>>
>>>> // FIXME: we need to fix the "BoolArgument<"IsMSDeclSpec">"
>>>> // hack in Attr.td for attribute "Aligned".
>>>> @@ -6,8 +6,9 @@
>>>> // CHECK: int x __attribute__((aligned(4, 0)));
>>>> int x __attribute__((aligned(4)));
>>>>
>>>> -// CHECK: int y __attribute__((align(4, 0)));
>>>> -int y __attribute__((align(4)));
>>>> +// FIXME: Print this at a valid location for a __declspec attr.
>>>> +// CHECK: int y __declspec(align(4, 1));
>>>> +__declspec(align(4)) int y;
>>>>
>>>> // CHECK: void foo() __attribute__((const));
>>>> void foo() __attribute__((const));
>>>>
>>>> Modified: cfe/trunk/test/SemaCXX/attr-print.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/attr-print.cpp?rev=173746&r1=173745&r2=173746&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/test/SemaCXX/attr-print.cpp (original)
>>>> +++ cfe/trunk/test/SemaCXX/attr-print.cpp Mon Jan 28 19:24:26 2013
>>>> @@ -1,12 +1,13 @@
>>>> -// RUN: %clang_cc1 %s -ast-print | FileCheck %s
>>>> +// RUN: %clang_cc1 %s -ast-print -fms-extensions | FileCheck %s
>>>>
>>>> // FIXME: align attribute print
>>>>
>>>> // CHECK: int x __attribute__((aligned(4, 0)));
>>>> int x __attribute__((aligned(4)));
>>>>
>>>> -// CHECK: int y __attribute__((align(4, 0)));
>>>> -int y __attribute__((align(4)));
>>>> +// FIXME: Print this at a valid location for a __declspec attr.
>>>> +// CHECK: int y __declspec(align(4, 1));
>>>> +__declspec(align(4)) int y;
>>>>
>>>> // CHECK: void foo() __attribute__((const));
>>>> void foo() __attribute__((const));
>>>>
>>>> Modified: cfe/trunk/test/SemaCXX/borland-extensions.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/borland-extensions.cpp?rev=173746&r1=173745&r2=173746&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/test/SemaCXX/borland-extensions.cpp (original)
>>>> +++ cfe/trunk/test/SemaCXX/borland-extensions.cpp Mon Jan 28 19:24:26 2013
>>>> @@ -1,5 +1,5 @@
>>>> -// RUN: %clang_cc1 %s -fsyntax-only -verify -fborland-extensions
>>>> -// expected-no-diagnostics
>>>> +// RUN: %clang_cc1 %s -fsyntax-only -fborland-extensions -triple x86_64-linux-gnu -verify
>>>> +// RUN: %clang_cc1 %s -fsyntax-only -fborland-extensions -triple i686-linux-gnu -Werror
>>>>
>>>> // Borland extensions
>>>>
>>>> @@ -9,13 +9,18 @@ int dummy_function() { return 0; }
>>>> // 2. test __pascal
>>>> int _pascal f2();
>>>>
>>>> +// expected-warning at +1 {{calling convention '__pascal' ignored for this target}}
>>>> float __pascal gi2(int, int);
>>>> +// expected-warning at +1 {{calling convention '__pascal' ignored for this target}}
>>>> template<typename T> T g2(T (__pascal * const )(int, int)) { return 0; }
>>>>
>>>> struct M {
>>>> + // expected-warning at +1 {{calling convention '__pascal' ignored for this target}}
>>>> int __pascal addP();
>>>> + // expected-warning at +1 {{calling convention '__pascal' ignored for this target}}
>>>> float __pascal subtractP();
>>>> };
>>>> +// expected-warning at +1 {{calling convention '__pascal' ignored for this target}}
>>>> template<typename T> int h2(T (__pascal M::* const )()) { return 0; }
>>>> void m2() {
>>>> int i; float f;
>>>>
>>>> Modified: cfe/trunk/test/SemaCXX/cxx11-attr-print.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx11-attr-print.cpp?rev=173746&r1=173745&r2=173746&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/test/SemaCXX/cxx11-attr-print.cpp (original)
>>>> +++ cfe/trunk/test/SemaCXX/cxx11-attr-print.cpp Mon Jan 28 19:24:26 2013
>>>> @@ -1,11 +1,12 @@
>>>> -// RUN: %clang_cc1 -std=c++11 -ast-print %s | FileCheck %s
>>>> +// RUN: %clang_cc1 -std=c++11 -ast-print -fms-extensions %s | FileCheck %s
>>>> // FIXME: align attribute print
>>>>
>>>> // CHECK: int x __attribute__((aligned(4, 0)));
>>>> int x __attribute__((aligned(4)));
>>>>
>>>> -// CHECK: int y __attribute__((align(4, 0)));
>>>> -int y __attribute__((align(4)));
>>>> +// FIXME: Print this at a valid location for a __declspec attr.
>>>> +// CHECK: int y __declspec(align(4, 1));
>>>> +__declspec(align(4)) int y;
>>>>
>>>> // CHECK: gnu::aligned(4, 0)]];
>>>> int z [[gnu::aligned(4)]];
>>>>
>>>> Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=173746&r1=173745&r2=173746&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
>>>> +++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Mon Jan 28 19:24:26 2013
>>>> @@ -776,8 +776,11 @@ static void writePrettyPrintFunction(Rec
>>>> } else if (Variety == "Declspec") {
>>>> Prefix = " __declspec(";
>>>> Suffix = ")";
>>>> + } else if (Variety == "Keyword") {
>>>> + Prefix = " ";
>>>> + Suffix = "";
>>>> } else {
>>>> - llvm_unreachable("Unkown attribute syntax variety!");
>>>> + llvm_unreachable("Unknown attribute syntax variety!");
>>>> }
>>>>
>>>> Spelling += Name;
>>>> @@ -1149,6 +1152,7 @@ void EmitClangAttrSpellingListIndex(Reco
>>>> .Case("GNU", 0)
>>>> .Case("CXX11", 1)
>>>> .Case("Declspec", 2)
>>>> + .Case("Keyword", 3)
>>>> .Default(0)
>>>> << " && Scope == \"" << Namespace << "\")\n"
>>>> << " return " << I << ";\n";
>>>>
>>>>
>>>> _______________________________________________
>>>> cfe-commits mailing list
>>>> cfe-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>
>>>
>>>
>>> --
>>> Timur Iskhodzhanov,
>>> Google Russia
--
Timur Iskhodzhanov,
Google Russia
More information about the cfe-commits
mailing list