Skip to content

Commit 7220c9a

Browse files
committed
AST: Fix attribute printing for @c
1 parent 9ec824c commit 7220c9a

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lib/AST/Attr.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,9 +1246,17 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
12461246
break;
12471247
}
12481248

1249-
case DeclAttrKind::CDecl:
1250-
Printer << "@_cdecl(\"" << cast<CDeclAttr>(this)->Name << "\")";
1249+
case DeclAttrKind::CDecl: {
1250+
auto Attr = cast<CDeclAttr>(this);
1251+
if (Attr->Underscored)
1252+
Printer << "@_cdecl(\"" << cast<CDeclAttr>(this)->Name << "\")";
1253+
else {
1254+
Printer << "@c";
1255+
if (!Attr->Name.empty())
1256+
Printer << "(" << cast<CDeclAttr>(this)->Name << ")";
1257+
}
12511258
break;
1259+
}
12521260

12531261
case DeclAttrKind::Expose: {
12541262
Printer.printAttrName("@_expose");

0 commit comments

Comments
 (0)