//===--- DeclObjC.h - Classes for representing declarations -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the DeclObjC interface and subclasses.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_AST_DECLOBJC_H
#define LLVM_CLANG_AST_DECLOBJC_H
#include "clang/AST/Decl.h"
#include "clang/Basic/IdentifierTable.h"
#include "llvm/ADT/DenseMap.h"
namespace clang {
class Expr;
class Stmt;
class FunctionDecl;
class AttributeList;
class ObjCIvarDecl;
class ObjCMethodDecl;
class ObjCProtocolDecl;
class ObjCCategoryDecl;
class ObjCPropertyDecl;
class ObjCPropertyImplDecl;
/// ObjCList - This is a simple template class used to hold various lists of
/// decls etc, which is heavily used by the ObjC front-end. This only use case
/// this supports is setting the list all at once and then reading elements out
/// of it.
template <typename T>
class ObjCList {
/// List is a new[]'d array of pointers to objects that are not owned by this
/// list.
T **List;
unsigned NumElts;
void operator=(const ObjCList &); // DO NOT IMPLEMENT
ObjCList(const ObjCList&); // DO NOT IMPLEMENT
public:
ObjCList() : List(0), NumElts(0) {}
~ObjCList() {
delete[] List;
}
void set(T* const* InList, unsigned Elts) {
assert(List == 0 && "Elements already set!");
List = new T*[Elts];
NumElts = Elts;
memcpy(List, InList, sizeof(T*)*Elts);
}
typedef T* const * iterator;
iterator begin() const { return List; }
iterator end() const { return List+NumElts; }
unsigned size() const { return NumElts; }
bool empty() const { return NumElts == 0; }
T* operator[](unsigned idx) const {
assert(idx < NumElts &&