Anton Korobeynikov | 3d364fd | 2010-01-10 14:38:13 +0000 | [diff] [blame^] | 1 | //===--- AttrImpl.cpp - Classes for representing attributes -----*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file contains out-of-line virtual methods for Attr classes. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | |
| 15 | #include "clang/AST/Attr.h" |
| 16 | #include "clang/AST/ASTContext.h" |
| 17 | using namespace clang; |
| 18 | |
| 19 | #define DEF_SIMPLE_ATTR_CLONE(ATTR) \ |
| 20 | Attr *ATTR##Attr::clone(ASTContext &C) const { \ |
| 21 | return ::new (C) ATTR##Attr; \ |
| 22 | } |
| 23 | |
| 24 | // FIXME: Can we use variadic macro to define DEF_SIMPLE_ATTR_CLONE for |
| 25 | // "non-simple" classes? |
| 26 | |
| 27 | DEF_SIMPLE_ATTR_CLONE(Packed) |
| 28 | DEF_SIMPLE_ATTR_CLONE(AlwaysInline) |
| 29 | DEF_SIMPLE_ATTR_CLONE(Malloc) |
| 30 | DEF_SIMPLE_ATTR_CLONE(NoReturn) |
| 31 | DEF_SIMPLE_ATTR_CLONE(AnalyzerNoReturn) |
| 32 | DEF_SIMPLE_ATTR_CLONE(Deprecated) |
| 33 | DEF_SIMPLE_ATTR_CLONE(Final) |
| 34 | DEF_SIMPLE_ATTR_CLONE(Unavailable) |
| 35 | DEF_SIMPLE_ATTR_CLONE(Unused) |
| 36 | DEF_SIMPLE_ATTR_CLONE(Used) |
| 37 | DEF_SIMPLE_ATTR_CLONE(Weak) |
| 38 | DEF_SIMPLE_ATTR_CLONE(WeakImport) |
| 39 | DEF_SIMPLE_ATTR_CLONE(NoThrow) |
| 40 | DEF_SIMPLE_ATTR_CLONE(Const) |
| 41 | DEF_SIMPLE_ATTR_CLONE(Pure) |
| 42 | DEF_SIMPLE_ATTR_CLONE(FastCall) |
| 43 | DEF_SIMPLE_ATTR_CLONE(StdCall) |
| 44 | DEF_SIMPLE_ATTR_CLONE(CDecl) |
| 45 | DEF_SIMPLE_ATTR_CLONE(TransparentUnion) |
| 46 | DEF_SIMPLE_ATTR_CLONE(ObjCNSObject) |
| 47 | DEF_SIMPLE_ATTR_CLONE(ObjCException) |
| 48 | DEF_SIMPLE_ATTR_CLONE(NoDebug) |
| 49 | DEF_SIMPLE_ATTR_CLONE(WarnUnusedResult) |
| 50 | DEF_SIMPLE_ATTR_CLONE(NoInline) |
| 51 | DEF_SIMPLE_ATTR_CLONE(CFReturnsRetained) |
| 52 | DEF_SIMPLE_ATTR_CLONE(NSReturnsRetained) |
| 53 | DEF_SIMPLE_ATTR_CLONE(BaseCheck) |
| 54 | DEF_SIMPLE_ATTR_CLONE(Hiding) |
| 55 | DEF_SIMPLE_ATTR_CLONE(Override) |
| 56 | DEF_SIMPLE_ATTR_CLONE(DLLImport) |
| 57 | DEF_SIMPLE_ATTR_CLONE(DLLExport) |
| 58 | |
| 59 | Attr* PragmaPackAttr::clone(ASTContext &C) const { |
| 60 | return ::new (C) PragmaPackAttr(Alignment); |
| 61 | } |
| 62 | |
| 63 | Attr* AlignedAttr::clone(ASTContext &C) const { |
| 64 | return ::new (C) AlignedAttr(Alignment); |
| 65 | } |
| 66 | |
| 67 | Attr* AnnotateAttr::clone(ASTContext &C) const { |
| 68 | return ::new (C) AnnotateAttr(Annotation); |
| 69 | } |
| 70 | |
| 71 | Attr *AsmLabelAttr::clone(ASTContext &C) const { |
| 72 | return ::new (C) AsmLabelAttr(Label); |
| 73 | } |
| 74 | |
| 75 | Attr *AliasAttr::clone(ASTContext &C) const { |
| 76 | return ::new (C) AliasAttr(Aliasee); |
| 77 | } |
| 78 | |
| 79 | Attr *ConstructorAttr::clone(ASTContext &C) const { |
| 80 | return ::new (C) ConstructorAttr(priority); |
| 81 | } |
| 82 | |
| 83 | Attr *DestructorAttr::clone(ASTContext &C) const { |
| 84 | return ::new (C) DestructorAttr(priority); |
| 85 | } |
| 86 | |
| 87 | Attr *IBOutletAttr::clone(ASTContext &C) const { |
| 88 | return ::new (C) IBOutletAttr; |
| 89 | } |
| 90 | |
| 91 | Attr *GNUInlineAttr::clone(ASTContext &C) const { |
| 92 | return ::new (C) GNUInlineAttr; |
| 93 | } |
| 94 | |
| 95 | Attr *SectionAttr::clone(ASTContext &C) const { |
| 96 | return ::new (C) SectionAttr(Name); |
| 97 | } |
| 98 | |
| 99 | Attr *NonNullAttr::clone(ASTContext &C) const { |
| 100 | return ::new (C) NonNullAttr(ArgNums, Size); |
| 101 | } |
| 102 | |
| 103 | Attr *FormatAttr::clone(ASTContext &C) const { |
| 104 | return ::new (C) FormatAttr(Type, formatIdx, firstArg); |
| 105 | } |
| 106 | |
| 107 | Attr *FormatArgAttr::clone(ASTContext &C) const { |
| 108 | return ::new (C) FormatArgAttr(formatIdx); |
| 109 | } |
| 110 | |
| 111 | Attr *SentinelAttr::clone(ASTContext &C) const { |
| 112 | return ::new (C) SentinelAttr(sentinel, NullPos); |
| 113 | } |
| 114 | |
| 115 | Attr *VisibilityAttr::clone(ASTContext &C) const { |
| 116 | return ::new (C) VisibilityAttr(VisibilityType); |
| 117 | } |
| 118 | |
| 119 | Attr *OverloadableAttr::clone(ASTContext &C) const { |
| 120 | return ::new (C) OverloadableAttr; |
| 121 | } |
| 122 | |
| 123 | Attr *BlocksAttr::clone(ASTContext &C) const { |
| 124 | return ::new (C) BlocksAttr(BlocksAttrType); |
| 125 | } |
| 126 | |
| 127 | Attr *CleanupAttr::clone(ASTContext &C) const { |
| 128 | return ::new (C) CleanupAttr(FD); |
| 129 | } |
| 130 | |
| 131 | Attr *RegparmAttr::clone(ASTContext &C) const { |
| 132 | return ::new (C) RegparmAttr(NumParams); |
| 133 | } |
| 134 | |
| 135 | Attr *ReqdWorkGroupSizeAttr::clone(ASTContext &C) const { |
| 136 | return ::new (C) ReqdWorkGroupSizeAttr(X, Y, Z); |
| 137 | } |
| 138 | |
| 139 | Attr *MSP430InterruptAttr::clone(ASTContext &C) const { |
| 140 | return ::new (C) MSP430InterruptAttr(Number); |
| 141 | } |
| 142 | |
| 143 | |