119510856727e0e14a3696b2a72c35163bff2a71fJohn McCall//===--- AttributeList.h - Parsed attribute sets ----------------*- C++ -*-===//
25f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//
35f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//                     The LLVM Compiler Infrastructure
45f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//
50bc735ffcfb223c0186419547abaa5c84482663eChris Lattner// This file is distributed under the University of Illinois Open Source
60bc735ffcfb223c0186419547abaa5c84482663eChris Lattner// License. See LICENSE.TXT for details.
75f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//
85f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//===----------------------------------------------------------------------===//
95f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//
1019510856727e0e14a3696b2a72c35163bff2a71fJohn McCall// This file defines the AttributeList class, which is used to collect
1119510856727e0e14a3696b2a72c35163bff2a71fJohn McCall// parsed attributes.
125f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//
135f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer//===----------------------------------------------------------------------===//
145f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
1519510856727e0e14a3696b2a72c35163bff2a71fJohn McCall#ifndef LLVM_CLANG_SEMA_ATTRLIST_H
1619510856727e0e14a3696b2a72c35163bff2a71fJohn McCall#define LLVM_CLANG_SEMA_ATTRLIST_H
175f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
188f823d2d3c557326d22699d66e5d367d0f0e44efChris Lattner#include "clang/Basic/SourceLocation.h"
190a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor#include "clang/Basic/VersionTuple.h"
200d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko#include "clang/Sema/Ownership.h"
2130a2e16f6c27f888dd11eba6bbbae1e980078fcbChandler Carruth#include "llvm/ADT/SmallVector.h"
2230a2e16f6c27f888dd11eba6bbbae1e980078fcbChandler Carruth#include "llvm/Support/Allocator.h"
235f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#include <cassert>
245f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
255f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencernamespace clang {
260b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  class ASTContext;
278f823d2d3c557326d22699d66e5d367d0f0e44efChris Lattner  class IdentifierInfo;
28ca0408fb49c1370430672acf2d770b7151cf71deJohn McCall  class Expr;
291eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
300a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor/// \brief Represents information about a change in availability for
310a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor/// an entity, which is part of the encoding of the 'availability'
320a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor/// attribute.
330a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregorstruct AvailabilityChange {
340a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor  /// \brief The location of the keyword indicating the kind of change.
350a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor  SourceLocation KeywordLoc;
360a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor
370a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor  /// \brief The version number at which the change occurred.
380a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor  VersionTuple Version;
390a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor
400a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor  /// \brief The source range covering the version number.
410a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor  SourceRange VersionRange;
420a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor
430a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor  /// \brief Determine whether this availability change is valid.
440a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor  bool isValid() const { return !Version.empty(); }
450a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor};
460a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor
47f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith/// AttributeList - Represents a syntactic attribute.
48f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith///
49f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith/// For a GNU attribute, there are four forms of this construct:
505f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer///
515f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer/// 1: __attribute__(( const )). ParmName/Args/NumArgs will all be unused.
525f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer/// 2: __attribute__(( mode(byte) )). ParmName used, Args/NumArgs unused.
535f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer/// 3: __attribute__(( format(printf, 1, 2) )). ParmName/Args/NumArgs all used.
545f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer/// 4: __attribute__(( aligned(16) )). ParmName is unused, Args/Num used.
555f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer///
560b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCallclass AttributeList { // TODO: This should really be called ParsedAttribute
5793f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Huntpublic:
5893f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt  /// The style used to specify an attribute.
5993f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt  enum Syntax {
605cd532ca0bc1cb8110e24586d064f72332d8b767Richard Smith    /// __attribute__((...))
6193f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt    AS_GNU,
625cd532ca0bc1cb8110e24586d064f72332d8b767Richard Smith    /// [[...]]
6393f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt    AS_CXX11,
645cd532ca0bc1cb8110e24586d064f72332d8b767Richard Smith    /// __declspec(...)
65fc685ace387734599c475426b1a8efdb491054b8Aaron Ballman    AS_Declspec,
665cd532ca0bc1cb8110e24586d064f72332d8b767Richard Smith    /// __ptr16, alignas(...), etc.
675cd532ca0bc1cb8110e24586d064f72332d8b767Richard Smith    AS_Keyword
6893f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt  };
698113ecfa4e41e2c888b1794389dfe3bce6386493Ted Kremenekprivate:
705f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  IdentifierInfo *AttrName;
71bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt  IdentifierInfo *ScopeName;
725f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  IdentifierInfo *ParmName;
73ffcc3105d223899740e79f3f8199f3881df4d1deArgyrios Kyrtzidis  SourceRange AttrRange;
740b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  SourceLocation ScopeLoc;
755f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  SourceLocation ParmLoc;
76f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith  SourceLocation EllipsisLoc;
770b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
780b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  /// The number of expression arguments this attribute has.
790b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  /// The expressions themselves are stored after the object.
80b53e417ba487f4193ef3b0485b420e0fdae643a2Douglas Gregor  unsigned NumArgs : 16;
81711c52bb20d0c69063b52a99826fb7d2835501f1John McCall
8293f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt  /// Corresponds to the Syntax enum.
8393f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt  unsigned SyntaxUsed : 2;
840a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor
85711c52bb20d0c69063b52a99826fb7d2835501f1John McCall  /// True if already diagnosed as invalid.
86b53e417ba487f4193ef3b0485b420e0fdae643a2Douglas Gregor  mutable unsigned Invalid : 1;
87711c52bb20d0c69063b52a99826fb7d2835501f1John McCall
88e82247a71a1a76e78f3b979b64d5f6412ab40266John McCall  /// True if this attribute was used as a type attribute.
89e82247a71a1a76e78f3b979b64d5f6412ab40266John McCall  mutable unsigned UsedAsTypeAttr : 1;
90e82247a71a1a76e78f3b979b64d5f6412ab40266John McCall
910b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  /// True if this has the extra information associated with an
920b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  /// availability attribute.
93b53e417ba487f4193ef3b0485b420e0fdae643a2Douglas Gregor  unsigned IsAvailability : 1;
94b53e417ba487f4193ef3b0485b420e0fdae643a2Douglas Gregor
950d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  /// True if this has extra information associated with a
960d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  /// type_tag_for_datatype attribute.
970d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  unsigned IsTypeTagForDatatype : 1;
980d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko
9976da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  /// True if this has extra information associated with a
10076da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  /// Microsoft __delcspec(property) attribute.
10176da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  unsigned IsProperty : 1;
10276da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall
1030c1c98c2375fe68fee0a6075905772e5290d4a28Eli Friedman  unsigned AttrKind : 8;
1040c1c98c2375fe68fee0a6075905772e5290d4a28Eli Friedman
105b53e417ba487f4193ef3b0485b420e0fdae643a2Douglas Gregor  /// \brief The location of the 'unavailable' keyword in an
106b53e417ba487f4193ef3b0485b420e0fdae643a2Douglas Gregor  /// availability attribute.
107b53e417ba487f4193ef3b0485b420e0fdae643a2Douglas Gregor  SourceLocation UnavailableLoc;
108006e42f0c8b65b783d565ef10b938a9e82fc02e3Fariborz Jahanian
109006e42f0c8b65b783d565ef10b938a9e82fc02e3Fariborz Jahanian  const Expr *MessageExpr;
1100b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
1110b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  /// The next attribute in the current position.
1120b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  AttributeList *NextInPosition;
1130b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
1140b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  /// The next attribute allocated in the current Pool.
1150b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  AttributeList *NextInPool;
1160b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
1170b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  Expr **getArgsBuffer() {
1180b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    return reinterpret_cast<Expr**>(this+1);
1190b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
1200b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  Expr * const *getArgsBuffer() const {
1210b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    return reinterpret_cast<Expr* const *>(this+1);
1220b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
1230b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
1240b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  enum AvailabilitySlot {
1250b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    IntroducedSlot, DeprecatedSlot, ObsoletedSlot
1260b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  };
1270b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
1280b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  AvailabilityChange &getAvailabilitySlot(AvailabilitySlot index) {
1290b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    return reinterpret_cast<AvailabilityChange*>(this+1)[index];
1300b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
1310b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  const AvailabilityChange &getAvailabilitySlot(AvailabilitySlot index) const {
1320b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    return reinterpret_cast<const AvailabilityChange*>(this+1)[index];
1330b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
1340b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
1350d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenkopublic:
1360d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  struct TypeTagForDatatypeData {
1370d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    ParsedType *MatchingCType;
1380d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    unsigned LayoutCompatible : 1;
1390d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    unsigned MustBeNull : 1;
1400d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  };
14176da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  struct PropertyData {
14276da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    IdentifierInfo *GetterId, *SetterId;
14376da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    PropertyData(IdentifierInfo *getterId, IdentifierInfo *setterId)
14476da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    : GetterId(getterId), SetterId(setterId) {}
14576da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  };
1460d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko
1470d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenkoprivate:
1480d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  TypeTagForDatatypeData &getTypeTagForDatatypeDataSlot() {
1490d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    return *reinterpret_cast<TypeTagForDatatypeData *>(this + 1);
1500d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  }
1510d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko
1520d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  const TypeTagForDatatypeData &getTypeTagForDatatypeDataSlot() const {
1530d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    return *reinterpret_cast<const TypeTagForDatatypeData *>(this + 1);
1540d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  }
1550d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko
15637453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly  ParsedType &getTypeBuffer() {
15737453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly    return *reinterpret_cast<ParsedType *>(this + 1);
15837453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly  }
15937453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly
16037453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly  const ParsedType &getTypeBuffer() const {
16137453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly    return *reinterpret_cast<const ParsedType *>(this + 1);
16237453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly  }
16337453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly
16476da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  PropertyData &getPropertyDataBuffer() {
16576da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    assert(IsProperty);
16676da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    return *reinterpret_cast<PropertyData*>(this + 1);
16776da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  }
16876da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall
16976da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  const PropertyData &getPropertyDataBuffer() const {
17076da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    assert(IsProperty);
17176da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    return *reinterpret_cast<const PropertyData*>(this + 1);
17276da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  }
17376da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall
174be2fa7ebf01259b63dc52fe46c8d101c18e72269Craig Topper  AttributeList(const AttributeList &) LLVM_DELETED_FUNCTION;
175be2fa7ebf01259b63dc52fe46c8d101c18e72269Craig Topper  void operator=(const AttributeList &) LLVM_DELETED_FUNCTION;
176be2fa7ebf01259b63dc52fe46c8d101c18e72269Craig Topper  void operator delete(void *) LLVM_DELETED_FUNCTION;
177be2fa7ebf01259b63dc52fe46c8d101c18e72269Craig Topper  ~AttributeList() LLVM_DELETED_FUNCTION;
1780b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
1790b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  size_t allocated_size() const;
1800b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
1810d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  /// Constructor for attributes with expression arguments.
182ffcc3105d223899740e79f3f8199f3881df4d1deArgyrios Kyrtzidis  AttributeList(IdentifierInfo *attrName, SourceRange attrRange,
1830b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                IdentifierInfo *scopeName, SourceLocation scopeLoc,
1840b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                IdentifierInfo *parmName, SourceLocation parmLoc,
1850b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                Expr **args, unsigned numArgs,
186f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith                Syntax syntaxUsed, SourceLocation ellipsisLoc)
1870b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    : AttrName(attrName), ScopeName(scopeName), ParmName(parmName),
188ffcc3105d223899740e79f3f8199f3881df4d1deArgyrios Kyrtzidis      AttrRange(attrRange), ScopeLoc(scopeLoc), ParmLoc(parmLoc),
189f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith      EllipsisLoc(ellipsisLoc), NumArgs(numArgs), SyntaxUsed(syntaxUsed),
190f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith      Invalid(false), UsedAsTypeAttr(false), IsAvailability(false),
19176da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall      IsTypeTagForDatatype(false), IsProperty(false), NextInPosition(0),
19276da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall      NextInPool(0) {
1930b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    if (numArgs) memcpy(getArgsBuffer(), args, numArgs * sizeof(Expr*));
19493f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt    AttrKind = getKind(getName(), getScopeName(), syntaxUsed);
1950b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
1960b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
1970d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  /// Constructor for availability attributes.
198ffcc3105d223899740e79f3f8199f3881df4d1deArgyrios Kyrtzidis  AttributeList(IdentifierInfo *attrName, SourceRange attrRange,
1990b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                IdentifierInfo *scopeName, SourceLocation scopeLoc,
2000b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                IdentifierInfo *parmName, SourceLocation parmLoc,
2010b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                const AvailabilityChange &introduced,
2020b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                const AvailabilityChange &deprecated,
2030b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                const AvailabilityChange &obsoleted,
204006e42f0c8b65b783d565ef10b938a9e82fc02e3Fariborz Jahanian                SourceLocation unavailable,
205006e42f0c8b65b783d565ef10b938a9e82fc02e3Fariborz Jahanian                const Expr *messageExpr,
20693f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt                Syntax syntaxUsed)
2070b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    : AttrName(attrName), ScopeName(scopeName), ParmName(parmName),
208f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith      AttrRange(attrRange), ScopeLoc(scopeLoc), ParmLoc(parmLoc), EllipsisLoc(),
20993f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt      NumArgs(0), SyntaxUsed(syntaxUsed),
210e82247a71a1a76e78f3b979b64d5f6412ab40266John McCall      Invalid(false), UsedAsTypeAttr(false), IsAvailability(true),
21176da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall      IsTypeTagForDatatype(false), IsProperty(false),
212006e42f0c8b65b783d565ef10b938a9e82fc02e3Fariborz Jahanian      UnavailableLoc(unavailable), MessageExpr(messageExpr),
213006e42f0c8b65b783d565ef10b938a9e82fc02e3Fariborz Jahanian      NextInPosition(0), NextInPool(0) {
2140b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    new (&getAvailabilitySlot(IntroducedSlot)) AvailabilityChange(introduced);
2150b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    new (&getAvailabilitySlot(DeprecatedSlot)) AvailabilityChange(deprecated);
2160b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    new (&getAvailabilitySlot(ObsoletedSlot)) AvailabilityChange(obsoleted);
21793f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt    AttrKind = getKind(getName(), getScopeName(), syntaxUsed);
2180b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
2190b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
2200d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  /// Constructor for type_tag_for_datatype attribute.
2210d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  AttributeList(IdentifierInfo *attrName, SourceRange attrRange,
2220d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                IdentifierInfo *scopeName, SourceLocation scopeLoc,
2230d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                IdentifierInfo *argumentKindName,
2240d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                SourceLocation argumentKindLoc,
2250d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                ParsedType matchingCType, bool layoutCompatible,
2260d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                bool mustBeNull, Syntax syntaxUsed)
2270d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    : AttrName(attrName), ScopeName(scopeName), ParmName(argumentKindName),
2280d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko      AttrRange(attrRange), ScopeLoc(scopeLoc), ParmLoc(argumentKindLoc),
229f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith      EllipsisLoc(), NumArgs(0), SyntaxUsed(syntaxUsed),
2300d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko      Invalid(false), UsedAsTypeAttr(false), IsAvailability(false),
23176da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall      IsTypeTagForDatatype(true), IsProperty(false), NextInPosition(NULL),
23276da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall      NextInPool(NULL) {
2330d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    TypeTagForDatatypeData &ExtraData = getTypeTagForDatatypeDataSlot();
2340d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    new (&ExtraData.MatchingCType) ParsedType(matchingCType);
2350d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    ExtraData.LayoutCompatible = layoutCompatible;
2360d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    ExtraData.MustBeNull = mustBeNull;
2370d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    AttrKind = getKind(getName(), getScopeName(), syntaxUsed);
2380d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  }
2390d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko
24037453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly  /// Constructor for attributes with a single type argument.
24137453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly  AttributeList(IdentifierInfo *attrName, SourceRange attrRange,
24237453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly                IdentifierInfo *scopeName, SourceLocation scopeLoc,
24337453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly                IdentifierInfo *parmName, SourceLocation parmLoc,
24437453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly                ParsedType typeArg, Syntax syntaxUsed)
24537453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly      : AttrName(attrName), ScopeName(scopeName), ParmName(parmName),
24637453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly        AttrRange(attrRange), ScopeLoc(scopeLoc), ParmLoc(parmLoc),
24737453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly        EllipsisLoc(), NumArgs(1), SyntaxUsed(syntaxUsed), Invalid(false),
24837453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly        UsedAsTypeAttr(false), IsAvailability(false),
24976da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall        IsTypeTagForDatatype(false), IsProperty(false), NextInPosition(0),
25076da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall        NextInPool(0) {
25137453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly    new (&getTypeBuffer()) ParsedType(typeArg);
25237453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly    AttrKind = getKind(getName(), getScopeName(), syntaxUsed);
25337453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly  }
25437453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly
25576da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  /// Constructor for microsoft __declspec(property) attribute.
25676da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  AttributeList(IdentifierInfo *attrName, SourceRange attrRange,
25776da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                IdentifierInfo *scopeName, SourceLocation scopeLoc,
25876da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                IdentifierInfo *parmName, SourceLocation parmLoc,
25976da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                IdentifierInfo *getterId, IdentifierInfo *setterId,
26076da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                Syntax syntaxUsed)
26176da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    : AttrName(attrName), ScopeName(scopeName), ParmName(parmName),
26276da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall      AttrRange(attrRange), ScopeLoc(scopeLoc), ParmLoc(parmLoc),
26376da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall      SyntaxUsed(syntaxUsed),
26476da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall      Invalid(false), UsedAsTypeAttr(false), IsAvailability(false),
26576da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall      IsTypeTagForDatatype(false), IsProperty(true), NextInPosition(0),
26676da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall      NextInPool(0) {
26776da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    new (&getPropertyDataBuffer()) PropertyData(getterId, setterId);
26876da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    AttrKind = getKind(getName(), getScopeName(), syntaxUsed);
26976da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  }
27076da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall
2710b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  friend class AttributePool;
2720b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  friend class AttributeFactory;
2730b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
2748113ecfa4e41e2c888b1794389dfe3bce6386493Ted Kremenekpublic:
275e53ac8aea2d9e8bbb11191398ea3cc2edb2d171aMichael Han  enum Kind {
276e53ac8aea2d9e8bbb11191398ea3cc2edb2d171aMichael Han    #define PARSED_ATTR(NAME) AT_##NAME,
277e53ac8aea2d9e8bbb11191398ea3cc2edb2d171aMichael Han    #include "clang/Sema/AttrParsedAttrList.inc"
278e53ac8aea2d9e8bbb11191398ea3cc2edb2d171aMichael Han    #undef PARSED_ATTR
27905f8e471aae971c9867dbac148eba1275a570814Anders Carlsson    IgnoredAttribute,
28055c28b7c66d39ab6b670aff5f95cad9d15dc7adfTed Kremenek    UnknownAttribute
2812335191341a58fa3f8abea3c9b391c5bb03d67b3Chris Lattner  };
2821eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
2832070d809d208ae17fe81dfe6fad445e7bd8e3283Chris Lattner  IdentifierInfo *getName() const { return AttrName; }
284ffcc3105d223899740e79f3f8199f3881df4d1deArgyrios Kyrtzidis  SourceLocation getLoc() const { return AttrRange.getBegin(); }
285ffcc3105d223899740e79f3f8199f3881df4d1deArgyrios Kyrtzidis  SourceRange getRange() const { return AttrRange; }
286bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt
287bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt  bool hasScope() const { return ScopeName; }
288bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt  IdentifierInfo *getScopeName() const { return ScopeName; }
289bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt  SourceLocation getScopeLoc() const { return ScopeLoc; }
290bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt
2915f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  IdentifierInfo *getParameterName() const { return ParmName; }
292f0b0ccce127857e7e4fb829e017dbcb7487884c4Argyrios Kyrtzidis  SourceLocation getParameterLoc() const { return ParmLoc; }
293bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt
29476da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  /// Is this the Microsoft __declspec(property) attribute?
29576da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  bool isDeclspecPropertyAttribute() const  {
29676da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    return IsProperty;
29776da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  }
29876da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall
299d03de6aaa312d57dcd6e2bc76bed1e89f5c5019dRichard Smith  bool isAlignasAttribute() const {
300d03de6aaa312d57dcd6e2bc76bed1e89f5c5019dRichard Smith    // FIXME: Use a better mechanism to determine this.
301d03de6aaa312d57dcd6e2bc76bed1e89f5c5019dRichard Smith    return getKind() == AT_Aligned && SyntaxUsed == AS_Keyword;
302d03de6aaa312d57dcd6e2bc76bed1e89f5c5019dRichard Smith  }
303d03de6aaa312d57dcd6e2bc76bed1e89f5c5019dRichard Smith
3045cd532ca0bc1cb8110e24586d064f72332d8b767Richard Smith  bool isDeclspecAttribute() const { return SyntaxUsed == AS_Declspec; }
305d03de6aaa312d57dcd6e2bc76bed1e89f5c5019dRichard Smith  bool isCXX11Attribute() const {
306d03de6aaa312d57dcd6e2bc76bed1e89f5c5019dRichard Smith    return SyntaxUsed == AS_CXX11 || isAlignasAttribute();
307d03de6aaa312d57dcd6e2bc76bed1e89f5c5019dRichard Smith  }
3085cd532ca0bc1cb8110e24586d064f72332d8b767Richard Smith  bool isKeywordAttribute() const { return SyntaxUsed == AS_Keyword; }
3091eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
310e215f7232dd4aa65ebf2a1ecd07cd95fe1ce3481Abramo Bagnara  bool isInvalid() const { return Invalid; }
311e215f7232dd4aa65ebf2a1ecd07cd95fe1ce3481Abramo Bagnara  void setInvalid(bool b = true) const { Invalid = b; }
312e215f7232dd4aa65ebf2a1ecd07cd95fe1ce3481Abramo Bagnara
313e82247a71a1a76e78f3b979b64d5f6412ab40266John McCall  bool isUsedAsTypeAttr() const { return UsedAsTypeAttr; }
314e82247a71a1a76e78f3b979b64d5f6412ab40266John McCall  void setUsedAsTypeAttr() { UsedAsTypeAttr = true; }
315e82247a71a1a76e78f3b979b64d5f6412ab40266John McCall
316f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith  bool isPackExpansion() const { return EllipsisLoc.isValid(); }
317f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith  SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
318f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith
3190c1c98c2375fe68fee0a6075905772e5290d4a28Eli Friedman  Kind getKind() const { return Kind(AttrKind); }
32093f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt  static Kind getKind(const IdentifierInfo *Name, const IdentifierInfo *Scope,
32193f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt                      Syntax SyntaxUsed);
3221eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
3230b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  AttributeList *getNext() const { return NextInPosition; }
3240b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  void setNext(AttributeList *N) { NextInPosition = N; }
3255f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
3265f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// getNumArgs - Return the number of actual arguments to this attribute.
3275f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  unsigned getNumArgs() const { return NumArgs; }
3281eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
329831efaeb4ba2c0939db6eeb77229d9e47dd03c9cTed Kremenek  /// hasParameterOrArguments - Return true if this attribute has a parameter,
330831efaeb4ba2c0939db6eeb77229d9e47dd03c9cTed Kremenek  /// or has a non empty argument expression list.
331831efaeb4ba2c0939db6eeb77229d9e47dd03c9cTed Kremenek  bool hasParameterOrArguments() const { return ParmName || NumArgs; }
332831efaeb4ba2c0939db6eeb77229d9e47dd03c9cTed Kremenek
3335f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  /// getArg - Return the specified argument.
334b3d8748e797c6c2f1dc01186c8eeb3b1b5fe970cJohn McCall  Expr *getArg(unsigned Arg) const {
3355f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer    assert(Arg < NumArgs && "Arg access out of range!");
3360b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    return getArgsBuffer()[Arg];
3375f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer  }
3381eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
339eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek  class arg_iterator {
3400b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    Expr * const *X;
341eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek    unsigned Idx;
342eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek  public:
3430b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    arg_iterator(Expr * const *x, unsigned idx) : X(x), Idx(idx) {}
344eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek
345eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek    arg_iterator& operator++() {
346eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek      ++Idx;
347eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek      return *this;
348eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek    }
3491eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
350eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek    bool operator==(const arg_iterator& I) const {
351eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek      assert (X == I.X &&
352eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek              "compared arg_iterators are for different argument lists");
353eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek      return Idx == I.Idx;
354eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek    }
3551eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
356eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek    bool operator!=(const arg_iterator& I) const {
357eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek      return !operator==(I);
358eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek    }
3591eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
360b3d8748e797c6c2f1dc01186c8eeb3b1b5fe970cJohn McCall    Expr* operator*() const {
361eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek      return X[Idx];
362eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek    }
3631eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
364eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek    unsigned getArgNum() const {
365eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek      return Idx+1;
366eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek    }
367eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek  };
3681eb4433ac451dc16f4133a88af2d002ac26c58efMike Stump
369eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek  arg_iterator arg_begin() const {
3700b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    return arg_iterator(getArgsBuffer(), 0);
371eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek  }
372eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek
373eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek  arg_iterator arg_end() const {
3740b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    return arg_iterator(getArgsBuffer(), NumArgs);
375eb2b2a3f1898f146c6e153a64ec58ec5e1750bd2Ted Kremenek  }
3760a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor
3770a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor  const AvailabilityChange &getAvailabilityIntroduced() const {
3788e083e71d48f7f4d6ef40c00531c2e14df745486Sean Hunt    assert(getKind() == AT_Availability && "Not an availability attribute");
3790b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    return getAvailabilitySlot(IntroducedSlot);
3800a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor  }
3810a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor
3820a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor  const AvailabilityChange &getAvailabilityDeprecated() const {
3838e083e71d48f7f4d6ef40c00531c2e14df745486Sean Hunt    assert(getKind() == AT_Availability && "Not an availability attribute");
3840b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    return getAvailabilitySlot(DeprecatedSlot);
3850a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor  }
3860a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor
3870a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor  const AvailabilityChange &getAvailabilityObsoleted() const {
3888e083e71d48f7f4d6ef40c00531c2e14df745486Sean Hunt    assert(getKind() == AT_Availability && "Not an availability attribute");
3890b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    return getAvailabilitySlot(ObsoletedSlot);
3900b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
391b53e417ba487f4193ef3b0485b420e0fdae643a2Douglas Gregor
392b53e417ba487f4193ef3b0485b420e0fdae643a2Douglas Gregor  SourceLocation getUnavailableLoc() const {
3938e083e71d48f7f4d6ef40c00531c2e14df745486Sean Hunt    assert(getKind() == AT_Availability && "Not an availability attribute");
394b53e417ba487f4193ef3b0485b420e0fdae643a2Douglas Gregor    return UnavailableLoc;
395b53e417ba487f4193ef3b0485b420e0fdae643a2Douglas Gregor  }
396006e42f0c8b65b783d565ef10b938a9e82fc02e3Fariborz Jahanian
397006e42f0c8b65b783d565ef10b938a9e82fc02e3Fariborz Jahanian  const Expr * getMessageExpr() const {
3988e083e71d48f7f4d6ef40c00531c2e14df745486Sean Hunt    assert(getKind() == AT_Availability && "Not an availability attribute");
399006e42f0c8b65b783d565ef10b938a9e82fc02e3Fariborz Jahanian    return MessageExpr;
400006e42f0c8b65b783d565ef10b938a9e82fc02e3Fariborz Jahanian  }
4010d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko
4020d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  const ParsedType &getMatchingCType() const {
4030d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    assert(getKind() == AT_TypeTagForDatatype &&
4040d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko           "Not a type_tag_for_datatype attribute");
4050d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    return *getTypeTagForDatatypeDataSlot().MatchingCType;
4060d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  }
4070d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko
4080d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  bool getLayoutCompatible() const {
4090d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    assert(getKind() == AT_TypeTagForDatatype &&
4100d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko           "Not a type_tag_for_datatype attribute");
4110d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    return getTypeTagForDatatypeDataSlot().LayoutCompatible;
4120d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  }
4130d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko
4140d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  bool getMustBeNull() const {
4150d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    assert(getKind() == AT_TypeTagForDatatype &&
4160d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko           "Not a type_tag_for_datatype attribute");
4170d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    return getTypeTagForDatatypeDataSlot().MustBeNull;
4180d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  }
41951d8c52ad36129760eaa586f85176037e2cd0d0eMichael Han
42037453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly  const ParsedType &getTypeArg() const {
42137453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly    assert(getKind() == AT_VecTypeHint && "Not a type attribute");
42237453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly    return getTypeBuffer();
42337453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly  }
42437453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly
42576da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  const PropertyData &getPropertyData() const {
42676da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    assert(isDeclspecPropertyAttribute() && "Not a __delcspec(property) attribute");
42776da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    return getPropertyDataBuffer();
42876da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  }
42976da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall
43051d8c52ad36129760eaa586f85176037e2cd0d0eMichael Han  /// \brief Get an index into the attribute spelling list
43151d8c52ad36129760eaa586f85176037e2cd0d0eMichael Han  /// defined in Attr.td. This index is used by an attribute
43251d8c52ad36129760eaa586f85176037e2cd0d0eMichael Han  /// to pretty print itself.
43351d8c52ad36129760eaa586f85176037e2cd0d0eMichael Han  unsigned getAttributeSpellingListIndex() const;
4340b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall};
4350b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
4360b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall/// A factory, from which one makes pools, from which one creates
4370b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall/// individual attributes which are deallocated with the pool.
4380b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall///
4390b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall/// Note that it's tolerably cheap to create and destroy one of
4400b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall/// these as long as you don't actually allocate anything in it.
4410b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCallclass AttributeFactory {
4420b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCallpublic:
4430b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  enum {
4440b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    /// The required allocation size of an availability attribute,
4450b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    /// which we want to ensure is a multiple of sizeof(void*).
4460b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    AvailabilityAllocSize =
4470b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall      sizeof(AttributeList)
4480b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall      + ((3 * sizeof(AvailabilityChange) + sizeof(void*) - 1)
4490d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko         / sizeof(void*) * sizeof(void*)),
4500d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    TypeTagForDatatypeAllocSize =
4510d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko      sizeof(AttributeList)
4520d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko      + (sizeof(AttributeList::TypeTagForDatatypeData) + sizeof(void *) - 1)
45376da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall        / sizeof(void*) * sizeof(void*),
45476da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    PropertyAllocSize =
45576da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall      sizeof(AttributeList)
45676da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall      + (sizeof(AttributeList::PropertyData) + sizeof(void *) - 1)
4570d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko        / sizeof(void*) * sizeof(void*)
4580b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  };
4590b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
4600b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCallprivate:
4610b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  enum {
4620b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    /// The number of free lists we want to be sure to support
4630b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    /// inline.  This is just enough that availability attributes
4640b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    /// don't surpass it.  It's actually very unlikely we'll see an
4650b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    /// attribute that needs more than that; on x86-64 you'd need 10
4660b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    /// expression arguments, and on i386 you'd need 19.
4670b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    InlineFreeListsCapacity =
4680b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall      1 + (AvailabilityAllocSize - sizeof(AttributeList)) / sizeof(void*)
4690b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  };
4700b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
4710b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  llvm::BumpPtrAllocator Alloc;
4720b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
4730b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  /// Free lists.  The index is determined by the following formula:
4740b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  ///   (size - sizeof(AttributeList)) / sizeof(void*)
475686775deca8b8685eb90801495880e3abdd844c2Chris Lattner  SmallVector<AttributeList*, InlineFreeListsCapacity> FreeLists;
4760b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
4770b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  // The following are the private interface used by AttributePool.
4780b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  friend class AttributePool;
4790b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
4800b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  /// Allocate an attribute of the given size.
4810b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  void *allocate(size_t size);
4820b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
4830b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  /// Reclaim all the attributes in the given pool chain, which is
4840b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  /// non-empty.  Note that the current implementation is safe
4850b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  /// against reclaiming things which were not actually allocated
4860b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  /// with the allocator, although of course it's important to make
4870b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  /// sure that their allocator lives at least as long as this one.
4880b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  void reclaimPool(AttributeList *head);
4890b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
4900b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCallpublic:
4910b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  AttributeFactory();
4920b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  ~AttributeFactory();
4930b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall};
4940b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
4950b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCallclass AttributePool {
4960b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  AttributeFactory &Factory;
4970b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  AttributeList *Head;
4980b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
4990b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  void *allocate(size_t size) {
5000b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    return Factory.allocate(size);
5010a0d2b179085a52c10402feebeb6db8b4d96a140Douglas Gregor  }
5020b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
5030b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  AttributeList *add(AttributeList *attr) {
5040b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    // We don't care about the order of the pool.
5050b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    attr->NextInPool = Head;
5060b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    Head = attr;
5070b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    return attr;
5080b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
5090b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
5100b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  void takePool(AttributeList *pool);
5110b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
5120b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCallpublic:
5130b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  /// Create a new pool for a factory.
5140b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  AttributePool(AttributeFactory &factory) : Factory(factory), Head(0) {}
5150b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
5160b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  /// Move the given pool's allocations to this pool.
5170b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  AttributePool(AttributePool &pool) : Factory(pool.Factory), Head(pool.Head) {
5180b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    pool.Head = 0;
5190b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
5200b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
5210b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  AttributeFactory &getFactory() const { return Factory; }
5220b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
5230b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  void clear() {
5240b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    if (Head) {
5250b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall      Factory.reclaimPool(Head);
5260b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall      Head = 0;
5270b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    }
5280b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
5290b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
5300b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  /// Take the given pool's allocations and add them to this pool.
5310b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  void takeAllFrom(AttributePool &pool) {
5320b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    if (pool.Head) {
5330b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall      takePool(pool.Head);
5340b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall      pool.Head = 0;
5350b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    }
5360b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
5370b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
5380b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  ~AttributePool() {
5390b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    if (Head) Factory.reclaimPool(Head);
5400b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
5410b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
542ffcc3105d223899740e79f3f8199f3881df4d1deArgyrios Kyrtzidis  AttributeList *create(IdentifierInfo *attrName, SourceRange attrRange,
5430b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                        IdentifierInfo *scopeName, SourceLocation scopeLoc,
5440b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                        IdentifierInfo *parmName, SourceLocation parmLoc,
5450b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                        Expr **args, unsigned numArgs,
546f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith                        AttributeList::Syntax syntax,
547f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith                        SourceLocation ellipsisLoc = SourceLocation()) {
5480b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    void *memory = allocate(sizeof(AttributeList)
5490b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                            + numArgs * sizeof(Expr*));
550ffcc3105d223899740e79f3f8199f3881df4d1deArgyrios Kyrtzidis    return add(new (memory) AttributeList(attrName, attrRange,
5510b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                                          scopeName, scopeLoc,
5520b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                                          parmName, parmLoc,
553f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith                                          args, numArgs, syntax,
554f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith                                          ellipsisLoc));
5550b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
5560b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
557ffcc3105d223899740e79f3f8199f3881df4d1deArgyrios Kyrtzidis  AttributeList *create(IdentifierInfo *attrName, SourceRange attrRange,
5580b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                        IdentifierInfo *scopeName, SourceLocation scopeLoc,
5590b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                        IdentifierInfo *parmName, SourceLocation parmLoc,
5600b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                        const AvailabilityChange &introduced,
5610b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                        const AvailabilityChange &deprecated,
5620b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                        const AvailabilityChange &obsoleted,
563b53e417ba487f4193ef3b0485b420e0fdae643a2Douglas Gregor                        SourceLocation unavailable,
564006e42f0c8b65b783d565ef10b938a9e82fc02e3Fariborz Jahanian                        const Expr *MessageExpr,
56593f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt                        AttributeList::Syntax syntax) {
5660b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    void *memory = allocate(AttributeFactory::AvailabilityAllocSize);
567ffcc3105d223899740e79f3f8199f3881df4d1deArgyrios Kyrtzidis    return add(new (memory) AttributeList(attrName, attrRange,
5680b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                                          scopeName, scopeLoc,
5690b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                                          parmName, parmLoc,
5700b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                                          introduced, deprecated, obsoleted,
57193f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt                                          unavailable, MessageExpr, syntax));
5720b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
5730b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
5740b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  AttributeList *createIntegerAttribute(ASTContext &C, IdentifierInfo *Name,
5750b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                                        SourceLocation TokLoc, int Arg);
5760d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko
5770d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  AttributeList *createTypeTagForDatatype(
5780d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                    IdentifierInfo *attrName, SourceRange attrRange,
5790d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                    IdentifierInfo *scopeName, SourceLocation scopeLoc,
5800d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                    IdentifierInfo *argumentKindName,
5810d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                    SourceLocation argumentKindLoc,
5820d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                    ParsedType matchingCType, bool layoutCompatible,
5830d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                    bool mustBeNull, AttributeList::Syntax syntax) {
5840d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    void *memory = allocate(AttributeFactory::TypeTagForDatatypeAllocSize);
5850d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    return add(new (memory) AttributeList(attrName, attrRange,
5860d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                                          scopeName, scopeLoc,
5870d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                                          argumentKindName, argumentKindLoc,
5880d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                                          matchingCType, layoutCompatible,
5890d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                                          mustBeNull, syntax));
5900d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  }
59137453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly
59237453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly  AttributeList *createTypeAttribute(
59337453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly                    IdentifierInfo *attrName, SourceRange attrRange,
59437453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly                    IdentifierInfo *scopeName, SourceLocation scopeLoc,
59537453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly                    IdentifierInfo *parmName, SourceLocation parmLoc,
59637453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly                    ParsedType typeArg, AttributeList::Syntax syntaxUsed) {
59737453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly    void *memory = allocate(sizeof(AttributeList) + sizeof(void *));
59837453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly    return add(new (memory) AttributeList(attrName, attrRange,
59937453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly                                          scopeName, scopeLoc,
60037453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly                                          parmName, parmLoc,
60137453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly                                          typeArg, syntaxUsed));
60237453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly  }
60376da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall
60476da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  AttributeList *createPropertyAttribute(
60576da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                    IdentifierInfo *attrName, SourceRange attrRange,
60676da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                    IdentifierInfo *scopeName, SourceLocation scopeLoc,
60776da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                    IdentifierInfo *parmName, SourceLocation parmLoc,
60876da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                    IdentifierInfo *getterId, IdentifierInfo *setterId,
60976da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                    AttributeList::Syntax syntaxUsed) {
61076da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    void *memory = allocate(AttributeFactory::PropertyAllocSize);
61176da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    return add(new (memory) AttributeList(attrName, attrRange,
61276da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                                          scopeName, scopeLoc,
61376da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                                          parmName, parmLoc,
61476da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                                          getterId, setterId,
61576da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                                          syntaxUsed));
61676da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  }
6175f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer};
6185f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
619ac25503714ba1a384d4f1cae05b84bc785eb5fadDouglas Gregor/// addAttributeLists - Add two AttributeLists together
620ac25503714ba1a384d4f1cae05b84bc785eb5fadDouglas Gregor/// The right-hand list is appended to the left-hand list, if any
621ac25503714ba1a384d4f1cae05b84bc785eb5fadDouglas Gregor/// A pointer to the joined list is returned.
622ac25503714ba1a384d4f1cae05b84bc785eb5fadDouglas Gregor/// Note: the lists are not left unmodified.
623e594db5c2db5ca2a03203af2915fa88619417110Chris Lattnerinline AttributeList *addAttributeLists(AttributeList *Left,
624e594db5c2db5ca2a03203af2915fa88619417110Chris Lattner                                        AttributeList *Right) {
625ac25503714ba1a384d4f1cae05b84bc785eb5fadDouglas Gregor  if (!Left)
626ac25503714ba1a384d4f1cae05b84bc785eb5fadDouglas Gregor    return Right;
627ac25503714ba1a384d4f1cae05b84bc785eb5fadDouglas Gregor
628ac25503714ba1a384d4f1cae05b84bc785eb5fadDouglas Gregor  AttributeList *next = Left, *prev;
629ac25503714ba1a384d4f1cae05b84bc785eb5fadDouglas Gregor  do {
630ac25503714ba1a384d4f1cae05b84bc785eb5fadDouglas Gregor    prev = next;
631ac25503714ba1a384d4f1cae05b84bc785eb5fadDouglas Gregor    next = next->getNext();
632ac25503714ba1a384d4f1cae05b84bc785eb5fadDouglas Gregor  } while (next);
633ac25503714ba1a384d4f1cae05b84bc785eb5fadDouglas Gregor  prev->setNext(Right);
634ac25503714ba1a384d4f1cae05b84bc785eb5fadDouglas Gregor  return Left;
635ac25503714ba1a384d4f1cae05b84bc785eb5fadDouglas Gregor}
636ac25503714ba1a384d4f1cae05b84bc785eb5fadDouglas Gregor
6374e24f0f711e2c9fde79f19fa1c80deaab3f3b356Richard Smith/// CXX11AttributeList - A wrapper around a C++11 attribute list.
638bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt/// Stores, in addition to the list proper, whether or not an actual list was
639bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt/// (as opposed to an empty list, which may be ill-formed in some places) and
640bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt/// the source range of the list.
6414e24f0f711e2c9fde79f19fa1c80deaab3f3b356Richard Smithstruct CXX11AttributeList {
642bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt  AttributeList *AttrList;
643bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt  SourceRange Range;
644bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt  bool HasAttr;
6454e24f0f711e2c9fde79f19fa1c80deaab3f3b356Richard Smith  CXX11AttributeList (AttributeList *attrList, SourceRange range, bool hasAttr)
646bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt    : AttrList(attrList), Range(range), HasAttr (hasAttr) {
647bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt  }
6484e24f0f711e2c9fde79f19fa1c80deaab3f3b356Richard Smith  CXX11AttributeList ()
649bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt    : AttrList(0), Range(), HasAttr(false) {
650bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt  }
651bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt};
652bbd37c62e34db3f5a95c899723484a76c71d7757Sean Hunt
6537f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall/// ParsedAttributes - A collection of parsed attributes.  Currently
6547f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall/// we don't differentiate between the various attribute syntaxes,
6557f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall/// which is basically silly.
6567f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall///
6577f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall/// Right now this is a very lightweight container, but the expectation
6587f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall/// is that this will become significantly more serious.
6597f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCallclass ParsedAttributes {
6607f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCallpublic:
6610b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  ParsedAttributes(AttributeFactory &factory)
6620b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    : pool(factory), list(0) {
6630b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
6640b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
6650b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  ParsedAttributes(ParsedAttributes &attrs)
6660b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    : pool(attrs.pool), list(attrs.list) {
6670b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    attrs.list = 0;
6680b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
6690b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
6700b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  AttributePool &getPool() const { return pool; }
6717f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall
6727f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall  bool empty() const { return list == 0; }
6737f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall
6747f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall  void add(AttributeList *newAttr) {
6757f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall    assert(newAttr);
6767f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall    assert(newAttr->getNext() == 0);
6777f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall    newAttr->setNext(list);
6787f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall    list = newAttr;
6797f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall  }
6807f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall
6810b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  void addAll(AttributeList *newList) {
6827f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall    if (!newList) return;
6837f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall
6847f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall    AttributeList *lastInNewList = newList;
6857f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall    while (AttributeList *next = lastInNewList->getNext())
6867f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall      lastInNewList = next;
6877f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall
6887f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall    lastInNewList->setNext(list);
6897f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall    list = newList;
6907f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall  }
6917f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall
6927f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall  void set(AttributeList *newList) {
6937f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall    list = newList;
6947f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall  }
6957f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall
6960b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  void takeAllFrom(ParsedAttributes &attrs) {
6970b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    addAll(attrs.list);
6980b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    attrs.list = 0;
6990b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    pool.takeAllFrom(attrs.pool);
7000b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
7010b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
7020b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  void clear() { list = 0; pool.clear(); }
7037f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall  AttributeList *getList() const { return list; }
7047f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall
705711c52bb20d0c69063b52a99826fb7d2835501f1John McCall  /// Returns a reference to the attribute list.  Try not to introduce
706711c52bb20d0c69063b52a99826fb7d2835501f1John McCall  /// dependencies on this method, it may not be long-lived.
707711c52bb20d0c69063b52a99826fb7d2835501f1John McCall  AttributeList *&getListRef() { return list; }
708711c52bb20d0c69063b52a99826fb7d2835501f1John McCall
7090d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  /// Add attribute with expression arguments.
710ffcc3105d223899740e79f3f8199f3881df4d1deArgyrios Kyrtzidis  AttributeList *addNew(IdentifierInfo *attrName, SourceRange attrRange,
7110b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                        IdentifierInfo *scopeName, SourceLocation scopeLoc,
7120b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                        IdentifierInfo *parmName, SourceLocation parmLoc,
7130b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                        Expr **args, unsigned numArgs,
714f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith                        AttributeList::Syntax syntax,
715f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith                        SourceLocation ellipsisLoc = SourceLocation()) {
7160b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    AttributeList *attr =
717ffcc3105d223899740e79f3f8199f3881df4d1deArgyrios Kyrtzidis      pool.create(attrName, attrRange, scopeName, scopeLoc, parmName, parmLoc,
718f6565a9f7318b1ca6ea9510003dde7b89696daabRichard Smith                  args, numArgs, syntax, ellipsisLoc);
7190b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    add(attr);
7200b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    return attr;
7210b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
7220b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
7230d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  /// Add availability attribute.
724ffcc3105d223899740e79f3f8199f3881df4d1deArgyrios Kyrtzidis  AttributeList *addNew(IdentifierInfo *attrName, SourceRange attrRange,
7250b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                        IdentifierInfo *scopeName, SourceLocation scopeLoc,
7260b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                        IdentifierInfo *parmName, SourceLocation parmLoc,
7270b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                        const AvailabilityChange &introduced,
7280b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                        const AvailabilityChange &deprecated,
7290b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                        const AvailabilityChange &obsoleted,
730b53e417ba487f4193ef3b0485b420e0fdae643a2Douglas Gregor                        SourceLocation unavailable,
731006e42f0c8b65b783d565ef10b938a9e82fc02e3Fariborz Jahanian                        const Expr *MessageExpr,
73293f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt                        AttributeList::Syntax syntax) {
7330b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    AttributeList *attr =
734ffcc3105d223899740e79f3f8199f3881df4d1deArgyrios Kyrtzidis      pool.create(attrName, attrRange, scopeName, scopeLoc, parmName, parmLoc,
735b53e417ba487f4193ef3b0485b420e0fdae643a2Douglas Gregor                  introduced, deprecated, obsoleted, unavailable,
73693f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6Sean Hunt                  MessageExpr, syntax);
7370b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    add(attr);
7380b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    return attr;
7390b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
7400b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
7410d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  /// Add type_tag_for_datatype attribute.
7420d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  AttributeList *addNewTypeTagForDatatype(
7430d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                        IdentifierInfo *attrName, SourceRange attrRange,
7440d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                        IdentifierInfo *scopeName, SourceLocation scopeLoc,
7450d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                        IdentifierInfo *argumentKindName,
7460d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                        SourceLocation argumentKindLoc,
7470d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                        ParsedType matchingCType, bool layoutCompatible,
7480d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                        bool mustBeNull, AttributeList::Syntax syntax) {
7490d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    AttributeList *attr =
7500d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko      pool.createTypeTagForDatatype(attrName, attrRange,
7510d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                                    scopeName, scopeLoc,
7520d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                                    argumentKindName, argumentKindLoc,
7530d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                                    matchingCType, layoutCompatible,
7540d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko                                    mustBeNull, syntax);
7550d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    add(attr);
7560d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko    return attr;
7570d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko  }
7580d5a069f66df09b3308ccfdce84a88170034c657Dmitri Gribenko
75937453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly  /// Add an attribute with a single type argument.
76037453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly  AttributeList *
76137453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly  addNewTypeAttr(IdentifierInfo *attrName, SourceRange attrRange,
76237453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly                 IdentifierInfo *scopeName, SourceLocation scopeLoc,
76337453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly                 IdentifierInfo *parmName, SourceLocation parmLoc,
76437453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly                 ParsedType typeArg, AttributeList::Syntax syntaxUsed) {
76537453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly    AttributeList *attr =
76637453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly        pool.createTypeAttribute(attrName, attrRange, scopeName, scopeLoc,
76737453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly                                 parmName, parmLoc, typeArg, syntaxUsed);
76837453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly    add(attr);
76937453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly    return attr;
77037453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly  }
77137453b9580e293eef3bd60bd36047a93ac4515b1Joey Gouly
77276da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  /// Add microsoft __delspec(property) attribute.
77376da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  AttributeList *
77476da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  addNewPropertyAttr(IdentifierInfo *attrName, SourceRange attrRange,
77576da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                 IdentifierInfo *scopeName, SourceLocation scopeLoc,
77676da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                 IdentifierInfo *parmName, SourceLocation parmLoc,
77776da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                 IdentifierInfo *getterId, IdentifierInfo *setterId,
77876da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                 AttributeList::Syntax syntaxUsed) {
77976da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    AttributeList *attr =
78076da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall        pool.createPropertyAttribute(attrName, attrRange, scopeName, scopeLoc,
78176da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                                     parmName, parmLoc, getterId, setterId,
78276da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall                                     syntaxUsed);
78376da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    add(attr);
78476da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall    return attr;
78576da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall  }
78676da55d3a49e1805f51b1ced7c5da5bcd7f759d8John McCall
7870b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  AttributeList *addNewInteger(ASTContext &C, IdentifierInfo *name,
7880b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall                               SourceLocation loc, int arg) {
7890b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    AttributeList *attr =
7900b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall      pool.createIntegerAttribute(C, name, loc, arg);
7910b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    add(attr);
7920b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall    return attr;
7930b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  }
7940b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
7950b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall
7967f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCallprivate:
7970b7e678a11ece4288dc01aebb5b17e5eef8f8d2dJohn McCall  mutable AttributePool pool;
7987f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall  AttributeList *list;
7997f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall};
8007f040a9d817cd1c72b565e92abff473510bf9e1dJohn McCall
8013cd6feb87a62fb52c31cbc83655d76ace020513fAaron Ballman/// These constants match the enumerated choices of
8023cd6feb87a62fb52c31cbc83655d76ace020513fAaron Ballman/// err_attribute_argument_n_type and err_attribute_argument_type.
8033cd6feb87a62fb52c31cbc83655d76ace020513fAaron Ballmanenum AttributeArgumentNType {
8043cd6feb87a62fb52c31cbc83655d76ace020513fAaron Ballman  AANT_ArgumentIntOrBool,
8053cd6feb87a62fb52c31cbc83655d76ace020513fAaron Ballman  AANT_ArgumentIntegerConstant,
8063cd6feb87a62fb52c31cbc83655d76ace020513fAaron Ballman  AANT_ArgumentString,
8073cd6feb87a62fb52c31cbc83655d76ace020513fAaron Ballman  AANT_ArgumentIdentifier
8083cd6feb87a62fb52c31cbc83655d76ace020513fAaron Ballman};
8093cd6feb87a62fb52c31cbc83655d76ace020513fAaron Ballman
8105f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer}  // end namespace clang
8115f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer
8125f016e2cb5d11daeb237544de1c5d59f20fe1a6eReid Spencer#endif
813