clang API Documentation

Public Member Functions | Static Public Member Functions | Friends
clang::CXXPseudoDestructorExpr Class Reference

Represents a C++ pseudo-destructor (C++ [expr.pseudo]). More...

#include <ExprCXX.h>

Inheritance diagram for clang::CXXPseudoDestructorExpr:
Inheritance graph
[legend]
Collaboration diagram for clang::CXXPseudoDestructorExpr:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CXXPseudoDestructorExpr (ASTContext &Context, Expr *Base, bool isArrow, SourceLocation OperatorLoc, NestedNameSpecifierLoc QualifierLoc, TypeSourceInfo *ScopeType, SourceLocation ColonColonLoc, SourceLocation TildeLoc, PseudoDestructorTypeStorage DestroyedType)
 CXXPseudoDestructorExpr (EmptyShell Shell)
ExprgetBase () const
bool hasQualifier () const
 Determines whether this member expression actually had a C++ nested-name-specifier prior to the name of the member, e.g., x->Base::foo.
NestedNameSpecifierLoc getQualifierLoc () const
 Retrieves the nested-name-specifier that qualifies the type name, with source-location information.
NestedNameSpecifiergetQualifier () const
 If the member name was qualified, retrieves the nested-name-specifier that precedes the member name. Otherwise, returns NULL.
bool isArrow () const
 Determine whether this pseudo-destructor expression was written using an '->' (otherwise, it used a '.').
SourceLocation getOperatorLoc () const
 Retrieve the location of the '.' or '->' operator.
TypeSourceInfogetScopeTypeInfo () const
 Retrieve the scope type in a qualified pseudo-destructor expression.
SourceLocation getColonColonLoc () const
 Retrieve the location of the '::' in a qualified pseudo-destructor expression.
SourceLocation getTildeLoc () const
 Retrieve the location of the '~'.
TypeSourceInfogetDestroyedTypeInfo () const
 Retrieve the source location information for the type being destroyed.
IdentifierInfogetDestroyedTypeIdentifier () const
 In a dependent pseudo-destructor expression for which we do not have full type information on the destroyed type, provides the name of the destroyed type.
QualType getDestroyedType () const
 Retrieve the type being destroyed.
SourceLocation getDestroyedTypeLoc () const
 Retrieve the starting location of the type being destroyed.
void setDestroyedType (IdentifierInfo *II, SourceLocation Loc)
 Set the name of destroyed type for a dependent pseudo-destructor expression.
void setDestroyedType (TypeSourceInfo *Info)
 Set the destroyed type.
SourceRange getSourceRange () const LLVM_READONLY
child_range children ()

Static Public Member Functions

static bool classof (const Stmt *T)
static bool classof (const CXXPseudoDestructorExpr *)

Friends

class ASTStmtReader

Detailed Description

Represents a C++ pseudo-destructor (C++ [expr.pseudo]).

A pseudo-destructor is an expression that looks like a member access to a destructor of a scalar type, except that scalar types don't have destructors. For example:

 typedef int T;
 void f(int *p) {
   p->T::~T();
 }

Pseudo-destructors typically occur when instantiating templates such as:

 template<typename T>
 void destroy(T* ptr) {
   ptr->T::~T();
 }

for scalar types. A pseudo-destructor expression has no run-time semantics beyond evaluating the base expression.

Definition at line 1751 of file ExprCXX.h.


Constructor & Destructor Documentation

CXXPseudoDestructorExpr::CXXPseudoDestructorExpr ( ASTContext Context,
Expr Base,
bool  isArrow,
SourceLocation  OperatorLoc,
NestedNameSpecifierLoc  QualifierLoc,
TypeSourceInfo ScopeType,
SourceLocation  ColonColonLoc,
SourceLocation  TildeLoc,
PseudoDestructorTypeStorage  DestroyedType 
)

Definition at line 152 of file ExprCXX.cpp.

clang::CXXPseudoDestructorExpr::CXXPseudoDestructorExpr ( EmptyShell  Shell) [inline, explicit]

Definition at line 1791 of file ExprCXX.h.


Member Function Documentation

child_range clang::CXXPseudoDestructorExpr::children ( ) [inline]

Reimplemented from clang::Stmt.

Definition at line 1883 of file ExprCXX.h.

static bool clang::CXXPseudoDestructorExpr::classof ( const Stmt T) [inline, static]

Reimplemented from clang::Expr.

Definition at line 1877 of file ExprCXX.h.

static bool clang::CXXPseudoDestructorExpr::classof ( const CXXPseudoDestructorExpr ) [inline, static]

Definition at line 1880 of file ExprCXX.h.

Expr* clang::CXXPseudoDestructorExpr::getBase ( ) const [inline]

Definition at line 1795 of file ExprCXX.h.

SourceLocation clang::CXXPseudoDestructorExpr::getColonColonLoc ( ) const [inline]

Retrieve the location of the '::' in a qualified pseudo-destructor expression.

Definition at line 1833 of file ExprCXX.h.

QualType CXXPseudoDestructorExpr::getDestroyedType ( ) const

Retrieve the type being destroyed.

Definition at line 188 of file ExprCXX.cpp.

References clang::PseudoDestructorTypeStorage::getTypeSourceInfo().

IdentifierInfo* clang::CXXPseudoDestructorExpr::getDestroyedTypeIdentifier ( ) const [inline]

In a dependent pseudo-destructor expression for which we do not have full type information on the destroyed type, provides the name of the destroyed type.

Definition at line 1852 of file ExprCXX.h.

References clang::PseudoDestructorTypeStorage::getIdentifier().

TypeSourceInfo* clang::CXXPseudoDestructorExpr::getDestroyedTypeInfo ( ) const [inline]

Retrieve the source location information for the type being destroyed.

This type-source information is available for non-dependent pseudo-destructor expressions and some dependent pseudo-destructor expressions. Returns NULL if we only have the identifier for a dependent pseudo-destructor expression.

Definition at line 1845 of file ExprCXX.h.

References clang::PseudoDestructorTypeStorage::getTypeSourceInfo().

SourceLocation clang::CXXPseudoDestructorExpr::getDestroyedTypeLoc ( ) const [inline]

Retrieve the starting location of the type being destroyed.

Definition at line 1860 of file ExprCXX.h.

References clang::PseudoDestructorTypeStorage::getLocation().

SourceLocation clang::CXXPseudoDestructorExpr::getOperatorLoc ( ) const [inline]

Retrieve the location of the '.' or '->' operator.

Definition at line 1818 of file ExprCXX.h.

NestedNameSpecifier* clang::CXXPseudoDestructorExpr::getQualifier ( ) const [inline]

If the member name was qualified, retrieves the nested-name-specifier that precedes the member name. Otherwise, returns NULL.

Definition at line 1809 of file ExprCXX.h.

References clang::NestedNameSpecifierLoc::getNestedNameSpecifier().

NestedNameSpecifierLoc clang::CXXPseudoDestructorExpr::getQualifierLoc ( ) const [inline]

Retrieves the nested-name-specifier that qualifies the type name, with source-location information.

Definition at line 1804 of file ExprCXX.h.

TypeSourceInfo* clang::CXXPseudoDestructorExpr::getScopeTypeInfo ( ) const [inline]

Retrieve the scope type in a qualified pseudo-destructor expression.

Pseudo-destructor expressions can have extra qualification within them that is not part of the nested-name-specifier, e.g., p->T::~T(). Here, if the object type of the expression is (or may be) a scalar type, T may also be a scalar type and, therefore, cannot be part of a nested-name-specifier. It is stored as the "scope type" of the pseudo- destructor expression.

Definition at line 1829 of file ExprCXX.h.

SourceRange CXXPseudoDestructorExpr::getSourceRange ( ) const

SourceLocation tokens are not useful in isolation - they are low level value objects created/interpreted by SourceManager. We assume AST clients will have a pointer to the respective SourceManager.

Reimplemented from clang::Stmt.

Definition at line 195 of file ExprCXX.cpp.

References clang::PseudoDestructorTypeStorage::getLocation(), and clang::PseudoDestructorTypeStorage::getTypeSourceInfo().

SourceLocation clang::CXXPseudoDestructorExpr::getTildeLoc ( ) const [inline]

Retrieve the location of the '~'.

Definition at line 1836 of file ExprCXX.h.

bool clang::CXXPseudoDestructorExpr::hasQualifier ( ) const [inline]

Determines whether this member expression actually had a C++ nested-name-specifier prior to the name of the member, e.g., x->Base::foo.

Definition at line 1800 of file ExprCXX.h.

bool clang::CXXPseudoDestructorExpr::isArrow ( ) const [inline]

Determine whether this pseudo-destructor expression was written using an '->' (otherwise, it used a '.').

Definition at line 1815 of file ExprCXX.h.

void clang::CXXPseudoDestructorExpr::setDestroyedType ( IdentifierInfo II,
SourceLocation  Loc 
) [inline]

Set the name of destroyed type for a dependent pseudo-destructor expression.

Definition at line 1866 of file ExprCXX.h.

void clang::CXXPseudoDestructorExpr::setDestroyedType ( TypeSourceInfo Info) [inline]

Set the destroyed type.

Definition at line 1871 of file ExprCXX.h.


Friends And Related Function Documentation

friend class ASTStmtReader [friend]

Reimplemented from clang::Stmt.

Definition at line 1780 of file ExprCXX.h.


The documentation for this class was generated from the following files: