clang API Documentation

Defines | Enumerations | Functions
ASTContext.cpp File Reference
#include "clang/AST/ASTContext.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/TypeLoc.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/ExternalASTSource.h"
#include "clang/AST/ASTMutationListener.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/Mangle.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Capacity.h"
#include "CXXABI.h"
#include <map>
#include "clang/AST/TypeNodes.def"
Include dependency graph for ASTContext.cpp:

Go to the source code of this file.

Defines

#define TYPE(Name, Parent)   0,
#define ABSTRACT_TYPE(Name, Parent)
#define TYPE(Name, Parent)
#define ABSTRACT_TYPE(Name, Parent)
#define TYPE(Class, Base)
#define ABSTRACT_TYPE(Class, Base)
#define NON_CANONICAL_TYPE(Class, Base)
#define DEPENDENT_TYPE(Class, Base)   case Type::Class:
#define TYPE(Class, Base)
#define ABSTRACT_TYPE(Class, Base)
#define NON_CANONICAL_TYPE(Class, Base)   case Type::Class:
#define TYPE(Class, Base)
#define ABSTRACT_TYPE(Class, Base)
#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE(Class, Base)   case Type::Class:
#define NON_CANONICAL_TYPE(Class, Base)   case Type::Class:
#define DEPENDENT_TYPE(Class, Base)   case Type::Class:

Enumerations

enum  FloatingRank { HalfRank, FloatRank, DoubleRank, LongDoubleRank }

Functions

static const LangAS::Map * getAddressSpaceMap (const TargetInfo &T, const LangOptions &LOpts)
static bool NeedsInjectedClassNameType (const RecordDecl *D)
static bool hasAnyPackExpansions (const TemplateArgument *Args, unsigned NumArgs)
static bool CmpProtocolNames (const ObjCProtocolDecl *LHS, const ObjCProtocolDecl *RHS)
static bool areSortedAndUniqued (ObjCProtocolDecl *const *Protocols, unsigned NumProtocols)
static void SortAndUniqueProtocols (ObjCProtocolDecl **Protocols, unsigned &NumProtocols)
static QualType getDecltypeForExpr (const Expr *e, const ASTContext &Context)
static FloatingRank getFloatingRank (QualType T)
static RecordDeclCreateRecordDecl (const ASTContext &Ctx, RecordDecl::TagKind TK, DeclContext *DC, IdentifierInfo *Id)
static bool isTypeTypedefedAsBOOL (QualType T)
static std::string charUnitsToString (const CharUnits &CU)
static char ObjCEncodingForPrimitiveKind (const ASTContext *C, QualType T)
static char ObjCEncodingForEnumType (const ASTContext *C, const EnumType *ET)
static void EncodeBitField (const ASTContext *Ctx, std::string &S, QualType T, const FieldDecl *FD)
static bool areCompatVectorTypes (const VectorType *LHS, const VectorType *RHS)
static void getIntersectionOfProtocols (ASTContext &Context, const ObjCObjectPointerType *LHSOPT, const ObjCObjectPointerType *RHSOPT, SmallVectorImpl< ObjCProtocolDecl * > &IntersectionOfProtocols)
static QualType DecodeTypeFromStr (const char *&Str, const ASTContext &Context, ASTContext::GetBuiltinTypeError &Error, bool &RequiresICE, bool AllowTypeModifiers)

Define Documentation

#define ABSTRACT_TYPE (   Name,
  Parent 
)
#define ABSTRACT_TYPE (   Name,
  Parent 
)
#define ABSTRACT_TYPE (   Class,
  Base 
)
#define ABSTRACT_TYPE (   Class,
  Base 
)
#define ABSTRACT_TYPE (   Class,
  Base 
)
#define DEPENDENT_TYPE (   Class,
  Base 
)    case Type::Class:
#define DEPENDENT_TYPE (   Class,
  Base 
)    case Type::Class:
#define NON_CANONICAL_TYPE (   Class,
  Base 
)
#define NON_CANONICAL_TYPE (   Class,
  Base 
)    case Type::Class:
#define NON_CANONICAL_TYPE (   Class,
  Base 
)    case Type::Class:
#define NON_CANONICAL_UNLESS_DEPENDENT_TYPE (   Class,
  Base 
)    case Type::Class:
#define TYPE (   Name,
  Parent 
)    0,
#define TYPE (   Name,
  Parent 
)
Value:
if (counts[Idx])                                                      \
    llvm::errs() << "    " << counts[Idx] << " " << #Name               \
                 << " types\n";                                         \
  TotalBytes += counts[Idx] * sizeof(Name##Type);                       \
  ++Idx;
#define TYPE (   Class,
  Base 
)
#define TYPE (   Class,
  Base 
)
#define TYPE (   Class,
  Base 
)

Enumeration Type Documentation

Enumerator:
HalfRank 
FloatRank 
DoubleRank 
LongDoubleRank 

Definition at line 53 of file ASTContext.cpp.


Function Documentation

static bool areCompatVectorTypes ( const VectorType LHS,
const VectorType RHS 
) [static]

areCompatVectorTypes - Return true if the two specified vector types are compatible.

Definition at line 5191 of file ASTContext.cpp.

References clang::VectorType::getElementType(), clang::VectorType::getNumElements(), and clang::Type::isCanonicalUnqualified().

Referenced by clang::ASTContext::mergeTypes().

static bool areSortedAndUniqued ( ObjCProtocolDecl *const *  Protocols,
unsigned  NumProtocols 
) [static]

Definition at line 2741 of file ASTContext.cpp.

References CmpProtocolNames().

Referenced by clang::ASTContext::getObjCObjectType().

static std::string charUnitsToString ( const CharUnits CU) [inline, static]
static bool CmpProtocolNames ( const ObjCProtocolDecl LHS,
const ObjCProtocolDecl RHS 
) [static]

CmpProtocolNames - Comparison predicate for sorting protocols alphabetically.

Definition at line 2736 of file ASTContext.cpp.

References clang::NamedDecl::getDeclName().

Referenced by areSortedAndUniqued(), and SortAndUniqueProtocols().

static RecordDecl* CreateRecordDecl ( const ASTContext Ctx,
RecordDecl::TagKind  TK,
DeclContext DC,
IdentifierInfo Id 
) [static]
static QualType DecodeTypeFromStr ( const char *&  Str,
const ASTContext Context,
ASTContext::GetBuiltinTypeError Error,
bool &  RequiresICE,
bool  AllowTypeModifiers 
) [static]

DecodeTypeFromStr - This decodes one type descriptor from Str, advancing the pointer over the consumed characters. This returns the resultant type. If AllowTypeModifiers is false then modifier like * are not parsed, just basic types. This allows "v2i*" to be parsed as a pointer to a v2i instead of a vector of "i*".

RequiresICE is filled in on return to indicate whether the value is required to be an Integer Constant Expression.

Definition at line 6308 of file ASTContext.cpp.

References clang::ASTContext::BoolTy, clang::ASTContext::CharTy, clang::ASTContext::DoubleTy, clang::ASTContext::FloatTy, clang::ASTContext::GE_Missing_setjmp, clang::ASTContext::GE_Missing_stdio, clang::ASTContext::GE_Missing_ucontext, clang::VectorType::GenericVector, clang::ASTContext::getAddrSpaceQualType(), clang::ASTContext::getArrayDecayedType(), clang::ASTContext::getBuiltinVaListType(), clang::ASTContext::getCFConstantStringType(), clang::ASTContext::getComplexType(), clang::ASTContext::getFILEType(), clang::ASTContext::getjmp_bufType(), clang::ASTContext::getLValueReferenceType(), clang::ASTContext::getObjCIdType(), clang::ASTContext::getObjCSelType(), clang::ASTContext::getPointerDiffType(), clang::ASTContext::getPointerType(), clang::ASTContext::getsigjmp_bufType(), clang::ASTContext::getSizeType(), clang::ASTContext::getucontext_tType(), clang::ASTContext::getVectorType(), clang::ASTContext::getVolatileType(), clang::ASTContext::Int128Ty, clang::ASTContext::IntTy, clang::QualType::isNull(), clang::ASTContext::LongDoubleTy, clang::ASTContext::LongLongTy, clang::ASTContext::LongTy, clang::ASTContext::ShortTy, clang::ASTContext::SignedCharTy, clang::ASTContext::UnsignedCharTy, clang::ASTContext::UnsignedInt128Ty, clang::ASTContext::UnsignedIntTy, clang::ASTContext::UnsignedLongLongTy, clang::ASTContext::UnsignedLongTy, clang::ASTContext::UnsignedShortTy, clang::ASTContext::VoidTy, clang::QualType::withConst(), and clang::QualType::withRestrict().

Referenced by clang::ASTContext::GetBuiltinType().

static void EncodeBitField ( const ASTContext Ctx,
std::string &  S,
QualType  T,
const FieldDecl FD 
) [static]
static const LangAS::Map* getAddressSpaceMap ( const TargetInfo T,
const LangOptions LOpts 
) [static]
static QualType getDecltypeForExpr ( const Expr e,
const ASTContext Context 
) [static]

getDecltypeForExpr - Given an expr, will return the decltype for that expression, according to the rules in C++0x [dcl.type.simple]p4

Definition at line 2921 of file ASTContext.cpp.

References clang::ASTContext::DependentTy, clang::ASTContext::getLValueReferenceType(), clang::Expr::getType(), clang::Expr::IgnoreParens(), clang::Expr::isLValue(), and clang::Expr::isTypeDependent().

Referenced by clang::ASTContext::getDecltypeType().

static FloatingRank getFloatingRank ( QualType  T) [static]

getFloatingRank - Return a relative rank for floating point types. This routine will assert if passed a built-in type that isn't a float.

Definition at line 3580 of file ASTContext.cpp.

References DoubleRank, FloatRank, clang::BuiltinType::getKind(), HalfRank, and LongDoubleRank.

Referenced by clang::ASTContext::getFloatingTypeOfSizeWithinDomain(), and clang::ASTContext::getFloatingTypeOrder().

static void getIntersectionOfProtocols ( ASTContext Context,
const ObjCObjectPointerType LHSOPT,
const ObjCObjectPointerType RHSOPT,
SmallVectorImpl< ObjCProtocolDecl * > &  IntersectionOfProtocols 
) [static]

getIntersectionOfProtocols - This routine finds the intersection of set of protocols inherited from two distinct objective-c pointer objects. It is used to build composite qualifier list of the composite type of the conditional expression involving two objective-c pointer objects.

Definition at line 5479 of file ASTContext.cpp.

References clang::ASTContext::CollectInheritedProtocols(), clang::ObjCObjectType::getInterface(), clang::ObjCObjectType::getNumProtocols(), clang::ObjCObjectPointerType::getObjectType(), clang::ObjCObjectType::qual_begin(), and clang::ObjCObjectType::qual_end().

Referenced by clang::ASTContext::areCommonBaseCompatible().

static bool hasAnyPackExpansions ( const TemplateArgument Args,
unsigned  NumArgs 
) [static]

Definition at line 2461 of file ASTContext.cpp.

References NumArgs.

Referenced by clang::ASTContext::getTemplateSpecializationType().

static bool isTypeTypedefedAsBOOL ( QualType  T) [static]

Definition at line 4028 of file ASTContext.cpp.

static bool NeedsInjectedClassNameType ( const RecordDecl D) [static]
static char ObjCEncodingForEnumType ( const ASTContext C,
const EnumType ET 
) [static]
static char ObjCEncodingForPrimitiveKind ( const ASTContext C,
QualType  T 
) [static]
static void SortAndUniqueProtocols ( ObjCProtocolDecl **  Protocols,
unsigned &  NumProtocols 
) [static]

Definition at line 2755 of file ASTContext.cpp.

References CmpProtocolNames().

Referenced by clang::ASTContext::getObjCObjectType().