r173749 - Actually remove the hack which was blocking the Borland-style attributes from

Richard Smith richard-llvm at metafoo.co.uk
Mon Jan 28 17:38:41 PST 2013


Author: rsmith
Date: Mon Jan 28 19:38:41 2013
New Revision: 173749

URL: http://llvm.org/viewvc/llvm-project?rev=173749&view=rev
Log:
Actually remove the hack which was blocking the Borland-style attributes from
working, and add the missing attribute spellings. This brings _pascal,
_fastcall, _stdcall and _cdecl to life in -fborland-extensions mode.

Modified:
    cfe/trunk/include/clang/Basic/Attr.td
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp
    cfe/trunk/test/SemaCXX/borland-extensions.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=173749&r1=173748&r2=173749&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Mon Jan 28 19:38:41 2013
@@ -220,7 +220,8 @@ def CarriesDependency : InheritableParam
 }
 
 def CDecl : InheritableAttr {
-  let Spellings = [GNU<"cdecl">, CXX11<"gnu", "cdecl">, Keyword<"__cdecl">];
+  let Spellings = [GNU<"cdecl">, CXX11<"gnu", "cdecl">, Keyword<"__cdecl">,
+                   Keyword<"_cdecl">];
 }
 
 // cf_audited_transfer indicates that the given function has been
@@ -340,7 +341,7 @@ def FallThrough : Attr {
 
 def FastCall : InheritableAttr {
   let Spellings = [GNU<"fastcall">, CXX11<"gnu", "fastcall">,
-                   Keyword<"__fastcall">];
+                   Keyword<"__fastcall">, Keyword<"_fastcall">];
 }
 
 def Final : InheritableAttr {
@@ -638,16 +639,16 @@ def Sentinel : InheritableAttr {
 
 def StdCall : InheritableAttr {
   let Spellings = [GNU<"stdcall">, CXX11<"gnu", "stdcall">,
-                   Keyword<"__stdcall">];
+                   Keyword<"__stdcall">, Keyword<"_stdcall">];
 }
 
 def ThisCall : InheritableAttr {
   let Spellings = [GNU<"thiscall">, CXX11<"gnu", "thiscall">,
-                   Keyword<"__thiscall">];
+                   Keyword<"__thiscall">, Keyword<"_thiscall">];
 }
 
 def Pascal : InheritableAttr {
-  let Spellings = [GNU<"pascal">, Keyword<"__pascal">];
+  let Spellings = [GNU<"pascal">, Keyword<"__pascal">, Keyword<"_pascal">];
 }
 
 def TransparentUnion : InheritableAttr {

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=173749&r1=173748&r2=173749&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Mon Jan 28 19:38:41 2013
@@ -4759,13 +4759,6 @@ static void ProcessDeclAttribute(Sema &S
   if (Attr.isInvalid())
     return;
 
-  // 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
   // instead.
   if (Attr.isCXX11Attribute() && !IncludeCXX11Attributes)

Modified: cfe/trunk/test/SemaCXX/borland-extensions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/borland-extensions.cpp?rev=173749&r1=173748&r2=173749&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/borland-extensions.cpp (original)
+++ cfe/trunk/test/SemaCXX/borland-extensions.cpp Mon Jan 28 19:38:41 2013
@@ -7,6 +7,7 @@
 int dummy_function() { return 0; }
 
 // 2. test __pascal
+// expected-warning at +1 {{calling convention '_pascal' ignored for this target}}
 int _pascal f2();
 
 // expected-warning at +1 {{calling convention '__pascal' ignored for this target}}
@@ -33,7 +34,9 @@ void m2() {
 
 // 3. test other calling conventions
 int _cdecl fa3();
+// expected-warning at +1 {{calling convention '_fastcall' ignored for this target}}
 int _fastcall fc3();
+// expected-warning at +1 {{calling convention '_stdcall' ignored for this target}}
 int _stdcall fd3();
 
 // 4. test __uuidof()





More information about the cfe-commits mailing list