blob: 02c70b651119ab0d6fe6b8ce7d211c7792182a10 [file] [log] [blame]
Anton Korobeynikov3d364fd2010-01-10 14:38:13 +00001//===--- 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"
17using 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
27DEF_SIMPLE_ATTR_CLONE(Packed)
28DEF_SIMPLE_ATTR_CLONE(AlwaysInline)
29DEF_SIMPLE_ATTR_CLONE(Malloc)
30DEF_SIMPLE_ATTR_CLONE(NoReturn)
31DEF_SIMPLE_ATTR_CLONE(AnalyzerNoReturn)
32DEF_SIMPLE_ATTR_CLONE(Deprecated)
33DEF_SIMPLE_ATTR_CLONE(Final)
34DEF_SIMPLE_ATTR_CLONE(Unavailable)
35DEF_SIMPLE_ATTR_CLONE(Unused)
36DEF_SIMPLE_ATTR_CLONE(Used)
37DEF_SIMPLE_ATTR_CLONE(Weak)
38DEF_SIMPLE_ATTR_CLONE(WeakImport)
39DEF_SIMPLE_ATTR_CLONE(NoThrow)
40DEF_SIMPLE_ATTR_CLONE(Const)
41DEF_SIMPLE_ATTR_CLONE(Pure)
42DEF_SIMPLE_ATTR_CLONE(FastCall)
43DEF_SIMPLE_ATTR_CLONE(StdCall)
44DEF_SIMPLE_ATTR_CLONE(CDecl)
45DEF_SIMPLE_ATTR_CLONE(TransparentUnion)
46DEF_SIMPLE_ATTR_CLONE(ObjCNSObject)
47DEF_SIMPLE_ATTR_CLONE(ObjCException)
48DEF_SIMPLE_ATTR_CLONE(NoDebug)
49DEF_SIMPLE_ATTR_CLONE(WarnUnusedResult)
50DEF_SIMPLE_ATTR_CLONE(NoInline)
51DEF_SIMPLE_ATTR_CLONE(CFReturnsRetained)
52DEF_SIMPLE_ATTR_CLONE(NSReturnsRetained)
53DEF_SIMPLE_ATTR_CLONE(BaseCheck)
54DEF_SIMPLE_ATTR_CLONE(Hiding)
55DEF_SIMPLE_ATTR_CLONE(Override)
56DEF_SIMPLE_ATTR_CLONE(DLLImport)
57DEF_SIMPLE_ATTR_CLONE(DLLExport)
58
59Attr* PragmaPackAttr::clone(ASTContext &C) const {
60 return ::new (C) PragmaPackAttr(Alignment);
61}
62
63Attr* AlignedAttr::clone(ASTContext &C) const {
64 return ::new (C) AlignedAttr(Alignment);
65}
66
67Attr* AnnotateAttr::clone(ASTContext &C) const {
68 return ::new (C) AnnotateAttr(Annotation);
69}
70
71Attr *AsmLabelAttr::clone(ASTContext &C) const {
72 return ::new (C) AsmLabelAttr(Label);
73}
74
75Attr *AliasAttr::clone(ASTContext &C) const {
76 return ::new (C) AliasAttr(Aliasee);
77}
78
79Attr *ConstructorAttr::clone(ASTContext &C) const {
80 return ::new (C) ConstructorAttr(priority);
81}
82
83Attr *DestructorAttr::clone(ASTContext &C) const {
84 return ::new (C) DestructorAttr(priority);
85}
86
87Attr *IBOutletAttr::clone(ASTContext &C) const {
88 return ::new (C) IBOutletAttr;
89}
90
91Attr *GNUInlineAttr::clone(ASTContext &C) const {
92 return ::new (C) GNUInlineAttr;
93}
94
95Attr *SectionAttr::clone(ASTContext &C) const {
96 return ::new (C) SectionAttr(Name);
97}
98
99Attr *NonNullAttr::clone(ASTContext &C) const {
100 return ::new (C) NonNullAttr(ArgNums, Size);
101}
102
103Attr *FormatAttr::clone(ASTContext &C) const {
104 return ::new (C) FormatAttr(Type, formatIdx, firstArg);
105}
106
107Attr *FormatArgAttr::clone(ASTContext &C) const {
108 return ::new (C) FormatArgAttr(formatIdx);
109}
110
111Attr *SentinelAttr::clone(ASTContext &C) const {
112 return ::new (C) SentinelAttr(sentinel, NullPos);
113}
114
115Attr *VisibilityAttr::clone(ASTContext &C) const {
116 return ::new (C) VisibilityAttr(VisibilityType);
117}
118
119Attr *OverloadableAttr::clone(ASTContext &C) const {
120 return ::new (C) OverloadableAttr;
121}
122
123Attr *BlocksAttr::clone(ASTContext &C) const {
124 return ::new (C) BlocksAttr(BlocksAttrType);
125}
126
127Attr *CleanupAttr::clone(ASTContext &C) const {
128 return ::new (C) CleanupAttr(FD);
129}
130
131Attr *RegparmAttr::clone(ASTContext &C) const {
132 return ::new (C) RegparmAttr(NumParams);
133}
134
135Attr *ReqdWorkGroupSizeAttr::clone(ASTContext &C) const {
136 return ::new (C) ReqdWorkGroupSizeAttr(X, Y, Z);
137}
138
139Attr *MSP430InterruptAttr::clone(ASTContext &C) const {
140 return ::new (C) MSP430InterruptAttr(Number);
141}
142
143