clang 20.0.0git
Classes | Namespaces | Macros | Typedefs | Enumerations | Functions
ASTContext.h File Reference

Defines the clang::ASTContext interface. More...

#include "clang/AST/ASTFwd.h"
#include "clang/AST/CanonicalType.h"
#include "clang/AST/CommentCommandTraits.h"
#include "clang/AST/ComparisonCategories.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/ExternalASTSource.h"
#include "clang/AST/PrettyPrinter.h"
#include "clang/AST/RawCommentList.h"
#include "clang/AST/TemplateName.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/PartialDiagnostic.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/PointerIntPair.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/Support/TypeSize.h"
#include <optional>
#include "clang/Basic/OpenCLImageTypes.def"
#include "clang/Basic/OpenCLExtensionTypes.def"
#include "clang/Basic/AArch64SVEACLETypes.def"
#include "clang/Basic/PPCTypes.def"
#include "clang/Basic/RISCVVTypes.def"
#include "clang/Basic/WebAssemblyReferenceTypes.def"
#include "clang/Basic/AMDGPUTypes.def"
#include "clang/Basic/HLSLIntangibleTypes.def"

Go to the source code of this file.

Classes

struct  clang::TypeInfo
 
struct  clang::TypeInfoChars
 
class  clang::ASTContext
 Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic analysis of a file. More...
 
struct  clang::ASTContext::CUDAConstantEvalContext
 
struct  clang::ASTContext::CUDAConstantEvalContextRAII
 
struct  clang::ASTContext::BuiltinVectorTypeInfo
 
struct  clang::ASTContext::SectionInfo
 

Namespaces

namespace  llvm
 Diagnostic wrappers for TextAPI types for error reporting.
 
namespace  clang
 The JSON file list parser is used to communicate input to InstallAPI.
 
namespace  clang::Builtin
 
namespace  clang::comments
 
namespace  clang::interp
 
namespace  clang::serialization
 

Macros

#define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix)    CanQualType SingletonId;
 
#define EXT_OPAQUE_TYPE(ExtType, Id, Ext)    CanQualType Id##Ty;
 
#define SVE_TYPE(Name, Id, SingletonId)    CanQualType SingletonId;
 
#define PPC_VECTOR_TYPE(Name, Id, Size)    CanQualType Id##Ty;
 
#define RVV_TYPE(Name, Id, SingletonId)    CanQualType SingletonId;
 
#define WASM_TYPE(Name, Id, SingletonId)   CanQualType SingletonId;
 
#define AMDGPU_TYPE(Name, Id, SingletonId)   CanQualType SingletonId;
 
#define HLSL_INTANGIBLE_TYPE(Name, Id, SingletonId)   CanQualType SingletonId;
 
#define OPT_LIST(V)
 
#define V(N, I)   ObjCEncOptions& set##N() { Bits |= 1 << I; return *this; }
 
#define V(N, I)   bool N() const { return Bits & 1 << I; }
 

Typedefs

typedef SmallVector< CXXBaseSpecifier *, 4 > clang::CXXCastPath
 A simple array of base specifiers.
 

Enumerations

enum class  clang::AlignRequirementKind { clang::None , clang::RequiredByTypedef , clang::RequiredByRecord , clang::RequiredByEnum }
 

Functions

const StreamingDiagnosticclang::operator<< (const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
 Insertion operator for diagnostics.
 
Selector clang::GetNullarySelector (StringRef name, ASTContext &Ctx)
 Utility function for constructing a nullary selector.
 
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)
 Placement new for using the ASTContext's allocator.
 
void operator delete (void *Ptr, const clang::ASTContext &C, size_t)
 Placement delete companion to the new above.
 
void * operator new[] (size_t Bytes, const clang::ASTContext &C, size_t Alignment)
 This placement form of operator new[] uses the ASTContext's allocator for obtaining memory.
 
void operator delete[] (void *Ptr, const clang::ASTContext &C, size_t)
 Placement delete[] companion to the new[] above.
 

Detailed Description

Defines the clang::ASTContext interface.

Definition in file ASTContext.h.

Macro Definition Documentation

◆ AMDGPU_TYPE

#define AMDGPU_TYPE (   Name,
  Id,
  SingletonId 
)    CanQualType SingletonId;

Definition at line 1175 of file ASTContext.h.

◆ EXT_OPAQUE_TYPE

#define EXT_OPAQUE_TYPE (   ExtType,
  Id,
  Ext 
)     CanQualType Id##Ty;

Definition at line 1161 of file ASTContext.h.

◆ HLSL_INTANGIBLE_TYPE

#define HLSL_INTANGIBLE_TYPE (   Name,
  Id,
  SingletonId 
)    CanQualType SingletonId;

Definition at line 1177 of file ASTContext.h.

◆ IMAGE_TYPE

#define IMAGE_TYPE (   ImgType,
  Id,
  SingletonId,
  Access,
  Suffix 
)     CanQualType SingletonId;

Definition at line 1153 of file ASTContext.h.

◆ OPT_LIST

#define OPT_LIST (   V)
Value:
V(ExpandPointedToStructures, 0) \
V(ExpandStructures, 1) \
V(IsOutermostType, 2) \
V(EncodingProperty, 3) \
V(IsStructField, 4) \
V(EncodeBlockParameters, 5) \
V(EncodeClassNames, 6) \
#define V(N, I)
Definition: ASTContext.h:3341

Definition at line 3328 of file ASTContext.h.

◆ PPC_VECTOR_TYPE

#define PPC_VECTOR_TYPE (   Name,
  Id,
  Size 
)     CanQualType Id##Ty;

Definition at line 1167 of file ASTContext.h.

◆ RVV_TYPE

#define RVV_TYPE (   Name,
  Id,
  SingletonId 
)     CanQualType SingletonId;

Definition at line 1170 of file ASTContext.h.

◆ SVE_TYPE

#define SVE_TYPE (   Name,
  Id,
  SingletonId 
)     CanQualType SingletonId;

Definition at line 1164 of file ASTContext.h.

◆ V [1/2]

#define V (   N,
 
)    ObjCEncOptions& set##N() { Bits |= 1 << I; return *this; }

◆ V [2/2]

#define V (   N,
 
)    bool N() const { return Bits & 1 << I; }

Definition at line 3341 of file ASTContext.h.

◆ WASM_TYPE

#define WASM_TYPE (   Name,
  Id,
  SingletonId 
)    CanQualType SingletonId;

Definition at line 1173 of file ASTContext.h.

Function Documentation

◆ operator delete()

void operator delete ( void *  Ptr,
const clang::ASTContext C,
size_t   
)
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 3544 of file ASTContext.h.

◆ operator delete[]()

void operator delete[] ( void *  Ptr,
const clang::ASTContext C,
size_t   
)
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 3582 of file ASTContext.h.

◆ operator new()

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

Placement new for using the ASTContext's allocator.

This placement form of operator new uses the ASTContext's allocator for obtaining memory.

IMPORTANT: These are also declared in clang/AST/ASTContextAllocate.h! Any changes here need to also be made there.

We intentionally avoid using a nothrow specification here so that the calls to this operator will not perform a null check on the result – the underlying allocator never returns null pointers.

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);

Memory allocated through this placement new operator does not need to be explicitly freed, as ASTContext will free all of this memory when it gets destroyed. Please note that you cannot use delete on the pointer.

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 nullptr.

Definition at line 3533 of file ASTContext.h.

◆ operator new[]()

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

This placement form of operator new[] uses the ASTContext's allocator for obtaining memory.

We intentionally avoid using a nothrow specification here so that the calls to this operator will not perform a null check on the result – the underlying allocator never returns null pointers.

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];

Memory allocated through this placement new[] operator does not need to be explicitly freed, as ASTContext will free all of this memory when it gets destroyed. Please note that you cannot use delete on the pointer.

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 nullptr.

Definition at line 3571 of file ASTContext.h.