|
37 | 37 | #include "swift/AST/PlatformKind.h"
|
38 | 38 | #include "swift/AST/Requirement.h"
|
39 | 39 | #include "swift/AST/StorageImpl.h"
|
40 |
| -#include "swift/AST/TrailingCallArguments.h" |
41 | 40 | #include "llvm/ADT/iterator_range.h"
|
42 | 41 | #include "llvm/ADT/SmallVector.h"
|
43 | 42 | #include "llvm/ADT/StringRef.h"
|
|
46 | 45 | #include "llvm/Support/VersionTuple.h"
|
47 | 46 |
|
48 | 47 | namespace swift {
|
| 48 | +class ArgumentList; |
49 | 49 | class ASTPrinter;
|
50 | 50 | class ASTContext;
|
51 | 51 | struct PrintOptions;
|
@@ -1530,48 +1530,40 @@ class ClangImporterSynthesizedTypeAttr : public DeclAttribute {
|
1530 | 1530 | };
|
1531 | 1531 |
|
1532 | 1532 | /// Defines a custom attribute.
|
1533 |
| -class CustomAttr final : public DeclAttribute, |
1534 |
| - public TrailingCallArguments<CustomAttr> { |
| 1533 | +class CustomAttr final : public DeclAttribute { |
1535 | 1534 | TypeExpr *typeExpr;
|
1536 |
| - Expr *arg; |
| 1535 | + ArgumentList *argList; |
1537 | 1536 | PatternBindingInitializer *initContext;
|
1538 | 1537 | Expr *semanticInit = nullptr;
|
1539 | 1538 |
|
1540 |
| - unsigned hasArgLabelLocs : 1; |
1541 |
| - unsigned numArgLabels : 16; |
1542 | 1539 | mutable unsigned isArgUnsafeBit : 1;
|
1543 | 1540 |
|
1544 | 1541 | CustomAttr(SourceLoc atLoc, SourceRange range, TypeExpr *type,
|
1545 |
| - PatternBindingInitializer *initContext, Expr *arg, |
1546 |
| - ArrayRef<Identifier> argLabels, ArrayRef<SourceLoc> argLabelLocs, |
| 1542 | + PatternBindingInitializer *initContext, ArgumentList *argList, |
1547 | 1543 | bool implicit);
|
1548 | 1544 |
|
1549 | 1545 | public:
|
1550 | 1546 | static CustomAttr *create(ASTContext &ctx, SourceLoc atLoc, TypeExpr *type,
|
1551 | 1547 | bool implicit = false) {
|
1552 |
| - return create(ctx, atLoc, type, false, nullptr, SourceLoc(), { }, { }, { }, |
1553 |
| - SourceLoc(), implicit); |
| 1548 | + return create(ctx, atLoc, type, /*initContext*/ nullptr, |
| 1549 | + /*argList*/ nullptr, implicit); |
1554 | 1550 | }
|
1555 | 1551 |
|
1556 | 1552 | static CustomAttr *create(ASTContext &ctx, SourceLoc atLoc, TypeExpr *type,
|
1557 |
| - bool hasInitializer, |
1558 | 1553 | PatternBindingInitializer *initContext,
|
1559 |
| - SourceLoc lParenLoc, |
1560 |
| - ArrayRef<Expr *> args, |
1561 |
| - ArrayRef<Identifier> argLabels, |
1562 |
| - ArrayRef<SourceLoc> argLabelLocs, |
1563 |
| - SourceLoc rParenLoc, |
1564 |
| - bool implicit = false); |
1565 |
| - |
1566 |
| - unsigned getNumArguments() const { return numArgLabels; } |
1567 |
| - bool hasArgumentLabelLocs() const { return hasArgLabelLocs; } |
| 1554 | + ArgumentList *argList, bool implicit = false); |
1568 | 1555 |
|
1569 | 1556 | TypeExpr *getTypeExpr() const { return typeExpr; }
|
1570 | 1557 | TypeRepr *getTypeRepr() const;
|
1571 | 1558 | Type getType() const;
|
1572 | 1559 |
|
1573 |
| - Expr *getArg() const { return arg; } |
1574 |
| - void setArg(Expr *newArg) { arg = newArg; } |
| 1560 | + /// Whether the attribute has any arguments. |
| 1561 | + bool hasArgs() const { return argList != nullptr; } |
| 1562 | + |
| 1563 | + /// The argument list of the attribute if it has any arguments, \c nullptr |
| 1564 | + /// otherwise. |
| 1565 | + ArgumentList *getArgs() const { return argList; } |
| 1566 | + void setArgs(ArgumentList *newArgs) { argList = newArgs; } |
1575 | 1567 |
|
1576 | 1568 | /// Determine whether the argument is '(unsafe)', a special subexpression
|
1577 | 1569 | /// used by global actors.
|
|
0 commit comments