clang API Documentation

Classes | Namespaces | Functions
ASTContext.h File Reference
#include "clang/Basic/AddressSpaces.h"
#include "clang/Basic/IdentifierTable.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/OperatorKinds.h"
#include "clang/Basic/VersionTuple.h"
#include "clang/AST/Decl.h"
#include "clang/AST/NestedNameSpecifier.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/AST/TemplateName.h"
#include "clang/AST/Type.h"
#include "clang/AST/CanonicalType.h"
#include "clang/AST/UsuallyTinyPtrVector.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Support/Allocator.h"
#include <vector>
Include dependency graph for ASTContext.h:

Go to the source code of this file.

Classes

class  clang::ASTContext
class  clang::ASTContext::CanonicalTemplateTemplateParm
 Representation of a "canonical" template template parameter that is used in canonical template names.
class  clang::ASTContext::import_iterator
 Iterator that visits import declarations. More...

Namespaces

namespace  llvm
namespace  clang
namespace  clang::Builtin

Functions

static Selector clang::GetNullarySelector (StringRef name, ASTContext &Ctx)
 Utility function for constructing a nullary selector.
static Selector clang::GetUnarySelector (StringRef name, ASTContext &Ctx)
 Utility function for constructing an unary selector.
void * operator new (size_t Bytes, const clang::ASTContext &C, size_t Alignment) throw ()
 Placement new for using the ASTContext's allocator.
void operator delete (void *Ptr, const clang::ASTContext &C, size_t) throw ()
 Placement delete companion to the new above.
void * operator new[] (size_t Bytes, const clang::ASTContext &C, size_t Alignment=8) throw ()
void operator delete[] (void *Ptr, const clang::ASTContext &C, size_t) throw ()
 Placement delete[] companion to the new[] above.

Function Documentation

void operator delete ( void *  Ptr,
const clang::ASTContext C,
size_t   
) throw () [inline]

Placement delete companion to the new above.

This operator is just a companion to the new above. There is no way of invoking it directly; see the new operator for more details. This operator is called implicitly by the compiler if a placement new expression using the ASTContext throws in the object constructor.

Definition at line 1919 of file ASTContext.h.

References clang::ASTContext::Deallocate().

Referenced by clang::Attr::operator delete(), and clang::PreprocessedEntity::operator delete().

void operator delete[] ( void *  Ptr,
const clang::ASTContext C,
size_t   
) throw () [inline]

Placement delete[] companion to the new[] above.

This operator is just a companion to the new[] above. There is no way of invoking it directly; see the new[] operator for more details. This operator is called implicitly by the compiler if a placement new[] expression using the ASTContext throws in the object constructor.

Definition at line 1954 of file ASTContext.h.

References clang::ASTContext::Deallocate().

void* operator new ( size_t  Bytes,
const clang::ASTContext C,
size_t  Alignment 
) throw () [inline]

Placement new for using the ASTContext's allocator.

This placement form of operator new uses the ASTContext's allocator for obtaining memory. It is a non-throwing new, which means that it returns null on error. (If that is what the allocator does. The current does, so if this ever changes, this operator will have to be changed, too.) Usage looks like this (assuming there's an ASTContext 'Context' in scope):

 // Default alignment (8)
 IntegerLiteral *Ex = new (Context) IntegerLiteral(arguments);
 // Specific alignment
 IntegerLiteral *Ex2 = new (Context, 4) IntegerLiteral(arguments);

Please note that you cannot use delete on the pointer; it must be deallocated using an explicit destructor call followed by Context.Deallocate(Ptr).

Parameters:
BytesThe number of bytes to allocate. Calculated by the compiler.
CThe ASTContext that provides the allocator.
AlignmentThe alignment of the allocated memory (if the underlying allocator supports it).
Returns:
The allocated memory. Could be NULL.

Definition at line 1909 of file ASTContext.h.

Referenced by clang::Attr::operator new(), and clang::PreprocessedEntity::operator new().

void* operator new[] ( size_t  Bytes,
const clang::ASTContext C,
size_t  Alignment = 8 
) throw () [inline]

This placement form of operator new[] uses the ASTContext's allocator for obtaining memory. It is a non-throwing new[], which means that it returns null on error. Usage looks like this (assuming there's an ASTContext 'Context' in scope):

 // Default alignment (8)
 char *data = new (Context) char[10];
 // Specific alignment
 char *data = new (Context, 4) char[10];

Please note that you cannot use delete on the pointer; it must be deallocated using an explicit destructor call followed by Context.Deallocate(Ptr).

Parameters:
BytesThe number of bytes to allocate. Calculated by the compiler.
CThe ASTContext that provides the allocator.
AlignmentThe alignment of the allocated memory (if the underlying allocator supports it).
Returns:
The allocated memory. Could be NULL.

Definition at line 1943 of file ASTContext.h.

References clang::ASTContext::Allocate().