Deleted Added
full compact
Attr.h (204643) Attr.h (208600)
1//===--- Attr.h - Classes for representing expressions ----------*- 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 unchanged lines hidden (view full) ---

18#include "llvm/ADT/StringRef.h"
19#include <cassert>
20#include <cstring>
21#include <algorithm>
22using llvm::dyn_cast;
23
24namespace clang {
25 class ASTContext;
1//===--- Attr.h - Classes for representing expressions ----------*- 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 unchanged lines hidden (view full) ---

18#include "llvm/ADT/StringRef.h"
19#include <cassert>
20#include <cstring>
21#include <algorithm>
22using llvm::dyn_cast;
23
24namespace clang {
25 class ASTContext;
26 class IdentifierInfo;
27 class ObjCInterfaceDecl;
26}
27
28}
29
28
29// Defined in ASTContext.h
30void *operator new(size_t Bytes, clang::ASTContext &C,
31 size_t Alignment = 16) throw ();
32
33// It is good practice to pair new/delete operators. Also, MSVC gives many
34// warnings if a matching delete overload is not declared, even though the
35// throw() spec guarantees it will not be implicitly called.
36void operator delete(void *Ptr, clang::ASTContext &C, size_t)
37 throw ();
38
39namespace clang {
40
41/// Attr - This represents one attribute.
42class Attr {
43public:
44 enum Kind {
45 Alias,
46 Aligned,
30// Defined in ASTContext.h
31void *operator new(size_t Bytes, clang::ASTContext &C,
32 size_t Alignment = 16) throw ();
33
34// It is good practice to pair new/delete operators. Also, MSVC gives many
35// warnings if a matching delete overload is not declared, even though the
36// throw() spec guarantees it will not be implicitly called.
37void operator delete(void *Ptr, clang::ASTContext &C, size_t)
38 throw ();
39
40namespace clang {
41
42/// Attr - This represents one attribute.
43class Attr {
44public:
45 enum Kind {
46 Alias,
47 Aligned,
48 AlignMac68k,
47 AlwaysInline,
48 AnalyzerNoReturn, // Clang-specific.
49 Annotate,
50 AsmLabel, // Represent GCC asm label extension.
51 BaseCheck,
52 Blocks,
53 CDecl,
54 Cleanup,
55 Const,
56 Constructor,
57 Deprecated,
58 Destructor,
59 FastCall,
60 Final,
61 Format,
62 FormatArg,
63 GNUInline,
64 Hiding,
65 IBOutletKind, // Clang-specific. Use "Kind" suffix to not conflict w/ macro.
49 AlwaysInline,
50 AnalyzerNoReturn, // Clang-specific.
51 Annotate,
52 AsmLabel, // Represent GCC asm label extension.
53 BaseCheck,
54 Blocks,
55 CDecl,
56 Cleanup,
57 Const,
58 Constructor,
59 Deprecated,
60 Destructor,
61 FastCall,
62 Final,
63 Format,
64 FormatArg,
65 GNUInline,
66 Hiding,
67 IBOutletKind, // Clang-specific. Use "Kind" suffix to not conflict w/ macro.
68 IBOutletCollectionKind, // Clang-specific.
66 IBActionKind, // Clang-specific. Use "Kind" suffix to not conflict w/ macro.
67 Malloc,
69 IBActionKind, // Clang-specific. Use "Kind" suffix to not conflict w/ macro.
70 Malloc,
71 MaxFieldAlignment,
68 NoDebug,
69 NoInline,
70 NonNull,
71 NoReturn,
72 NoThrow,
73 ObjCException,
74 ObjCNSObject,
75 Override,
76 CFReturnsRetained, // Clang/Checker-specific.
77 CFReturnsNotRetained, // Clang/Checker-specific.
78 NSReturnsRetained, // Clang/Checker-specific.
79 NSReturnsNotRetained, // Clang/Checker-specific.
80 Overloadable, // Clang-specific
81 Packed,
72 NoDebug,
73 NoInline,
74 NonNull,
75 NoReturn,
76 NoThrow,
77 ObjCException,
78 ObjCNSObject,
79 Override,
80 CFReturnsRetained, // Clang/Checker-specific.
81 CFReturnsNotRetained, // Clang/Checker-specific.
82 NSReturnsRetained, // Clang/Checker-specific.
83 NSReturnsNotRetained, // Clang/Checker-specific.
84 Overloadable, // Clang-specific
85 Packed,
82 PragmaPack,
83 Pure,
84 Regparm,
85 ReqdWorkGroupSize, // OpenCL-specific
86 Section,
87 Sentinel,
88 StdCall,
86 Pure,
87 Regparm,
88 ReqdWorkGroupSize, // OpenCL-specific
89 Section,
90 Sentinel,
91 StdCall,
92 ThisCall,
89 TransparentUnion,
90 Unavailable,
91 Unused,
92 Used,
93 Visibility,
94 WarnUnusedResult,
95 Weak,
96 WeakImport,

--- 81 unchanged lines hidden (view full) ---

178 ATTR##Attr() : Attr(ATTR) {} \
179 virtual Attr *clone(ASTContext &C) const; \
180 static bool classof(const Attr *A) { return A->getKind() == ATTR; } \
181 static bool classof(const ATTR##Attr *A) { return true; } \
182}
183
184DEF_SIMPLE_ATTR(Packed);
185
93 TransparentUnion,
94 Unavailable,
95 Unused,
96 Used,
97 Visibility,
98 WarnUnusedResult,
99 Weak,
100 WeakImport,

--- 81 unchanged lines hidden (view full) ---

182 ATTR##Attr() : Attr(ATTR) {} \
183 virtual Attr *clone(ASTContext &C) const; \
184 static bool classof(const Attr *A) { return A->getKind() == ATTR; } \
185 static bool classof(const ATTR##Attr *A) { return true; } \
186}
187
188DEF_SIMPLE_ATTR(Packed);
189
186class PragmaPackAttr : public Attr {
190/// \brief Attribute for specifying a maximum field alignment; this is only
191/// valid on record decls.
192class MaxFieldAlignmentAttr : public Attr {
187 unsigned Alignment;
188
189public:
193 unsigned Alignment;
194
195public:
190 PragmaPackAttr(unsigned alignment) : Attr(PragmaPack), Alignment(alignment) {}
196 MaxFieldAlignmentAttr(unsigned alignment)
197 : Attr(MaxFieldAlignment), Alignment(alignment) {}
191
192 /// getAlignment - The specified alignment in bits.
193 unsigned getAlignment() const { return Alignment; }
194
195 virtual Attr* clone(ASTContext &C) const;
196
197 // Implement isa/cast/dyncast/etc.
198 static bool classof(const Attr *A) {
198
199 /// getAlignment - The specified alignment in bits.
200 unsigned getAlignment() const { return Alignment; }
201
202 virtual Attr* clone(ASTContext &C) const;
203
204 // Implement isa/cast/dyncast/etc.
205 static bool classof(const Attr *A) {
199 return A->getKind() == PragmaPack;
206 return A->getKind() == MaxFieldAlignment;
200 }
207 }
201 static bool classof(const PragmaPackAttr *A) { return true; }
208 static bool classof(const MaxFieldAlignmentAttr *A) { return true; }
202};
203
209};
210
211DEF_SIMPLE_ATTR(AlignMac68k);
212
204class AlignedAttr : public Attr {
205 unsigned Alignment;
206public:
207 AlignedAttr(unsigned alignment)
208 : Attr(Aligned), Alignment(alignment) {}
209
210 /// getAlignment - The specified alignment in bits.
211 unsigned getAlignment() const { return Alignment; }

--- 100 unchanged lines hidden (view full) ---

312
313 // Implement isa/cast/dyncast/etc.
314 static bool classof(const Attr *A) {
315 return A->getKind() == IBOutletKind;
316 }
317 static bool classof(const IBOutletAttr *A) { return true; }
318};
319
213class AlignedAttr : public Attr {
214 unsigned Alignment;
215public:
216 AlignedAttr(unsigned alignment)
217 : Attr(Aligned), Alignment(alignment) {}
218
219 /// getAlignment - The specified alignment in bits.
220 unsigned getAlignment() const { return Alignment; }

--- 100 unchanged lines hidden (view full) ---

321
322 // Implement isa/cast/dyncast/etc.
323 static bool classof(const Attr *A) {
324 return A->getKind() == IBOutletKind;
325 }
326 static bool classof(const IBOutletAttr *A) { return true; }
327};
328
329class IBOutletCollectionAttr : public Attr {
330 const ObjCInterfaceDecl *D;
331public:
332 IBOutletCollectionAttr(const ObjCInterfaceDecl *d = 0)
333 : Attr(IBOutletCollectionKind), D(d) {}
334
335 const ObjCInterfaceDecl *getClass() const { return D; }
336
337 virtual Attr *clone(ASTContext &C) const;
338
339 // Implement isa/cast/dyncast/etc.
340 static bool classof(const Attr *A) {
341 return A->getKind() == IBOutletCollectionKind;
342 }
343 static bool classof(const IBOutletCollectionAttr *A) { return true; }
344};
345
320class IBActionAttr : public Attr {
321public:
322 IBActionAttr() : Attr(IBActionKind) {}
323
324 virtual Attr *clone(ASTContext &C) const;
325
326 // Implement isa/cast/dyncast/etc.
327 static bool classof(const Attr *A) {

--- 124 unchanged lines hidden (view full) ---

452
453 // Implement isa/cast/dyncast/etc.
454 static bool classof(const Attr *A) { return A->getKind() == Visibility; }
455 static bool classof(const VisibilityAttr *A) { return true; }
456};
457
458DEF_SIMPLE_ATTR(FastCall);
459DEF_SIMPLE_ATTR(StdCall);
346class IBActionAttr : public Attr {
347public:
348 IBActionAttr() : Attr(IBActionKind) {}
349
350 virtual Attr *clone(ASTContext &C) const;
351
352 // Implement isa/cast/dyncast/etc.
353 static bool classof(const Attr *A) {

--- 124 unchanged lines hidden (view full) ---

478
479 // Implement isa/cast/dyncast/etc.
480 static bool classof(const Attr *A) { return A->getKind() == Visibility; }
481 static bool classof(const VisibilityAttr *A) { return true; }
482};
483
484DEF_SIMPLE_ATTR(FastCall);
485DEF_SIMPLE_ATTR(StdCall);
486DEF_SIMPLE_ATTR(ThisCall);
460DEF_SIMPLE_ATTR(CDecl);
461DEF_SIMPLE_ATTR(TransparentUnion);
462DEF_SIMPLE_ATTR(ObjCNSObject);
463DEF_SIMPLE_ATTR(ObjCException);
464
465class OverloadableAttr : public Attr {
466public:
467 OverloadableAttr() : Attr(Overloadable) { }

--- 120 unchanged lines hidden ---
487DEF_SIMPLE_ATTR(CDecl);
488DEF_SIMPLE_ATTR(TransparentUnion);
489DEF_SIMPLE_ATTR(ObjCNSObject);
490DEF_SIMPLE_ATTR(ObjCException);
491
492class OverloadableAttr : public Attr {
493public:
494 OverloadableAttr() : Attr(Overloadable) { }

--- 120 unchanged lines hidden ---