clang 8.0.0

Public Types | Public Member Functions | List of all members
clang::OffsetOfNode Class Reference

Helper class for OffsetOfExpr. More...

`#include "clang/AST/Expr.h"`

## Public Types
enum | Kind { Array = 0x00, Field = 0x01, Identifier = 0x02, Base = 0x03 }
| The kind of offsetof node we have. More...

## Public Member Functions
| OffsetOfNode (SourceLocation LBracketLoc, unsigned Index, SourceLocation RBracketLoc)
| Create an offsetof node that refers to an array element. More...
| OffsetOfNode (SourceLocation DotLoc, FieldDecl *Field, SourceLocation NameLoc)
| Create an offsetof node that refers to a field. More...
| OffsetOfNode (SourceLocation DotLoc, IdentifierInfo *Name, SourceLocation NameLoc)
| Create an offsetof node that refers to an identifier. More...
| OffsetOfNode (const CXXBaseSpecifier *Base)
| Create an offsetof node that refers into a C++ base class. More...
Kind | getKind () const
| Determine what kind of offsetof node this is. More...
unsigned | getArrayExprIndex () const
| For an array element node, returns the index into the array of expressions. More...
FieldDecl * | getField () const
| For a field offsetof node, returns the field. More...
IdentifierInfo * | getFieldName () const
| For a field or identifier offsetof node, returns the name of the field. More...
CXXBaseSpecifier * | getBase () const
| For a base class node, returns the base specifier. More...
SourceRange | getSourceRange () const LLVM_READONLY
| Retrieve the source range that covers this offsetof node. More...
SourceLocation | getBeginLoc () const LLVM_READONLY
SourceLocation | getEndLoc () const LLVM_READONLY

## Detailed Description

Helper class for OffsetOfExpr.

Definition at line 2013 of file Expr.h.

## Member Enumeration Documentation

## ◆ Kind

enum clang::OffsetOfNode::Kind

The kind of offsetof node we have.

Enumerator
Array | An index into an array.
Field | A field.
Identifier | A field in a dependent type, known only by its name.
Base | An implicit indirection through a C++ base class, when the field found is in a base class.

Definition at line 2016 of file Expr.h.

## Constructor & Destructor Documentation

## ◆ OffsetOfNode() [1/4]

clang::OffsetOfNode::OffsetOfNode | ( | SourceLocation | LBracketLoc,
|  | unsigned | Index,
|  | SourceLocation | RBracketLoc
| ) |  |
| inline

Create an offsetof node that refers to an array element.

Definition at line 2047 of file Expr.h.

## ◆ OffsetOfNode() [2/4]

clang::OffsetOfNode::OffsetOfNode | ( | SourceLocation | DotLoc,
|  | FieldDecl * | Field,
|  | SourceLocation | NameLoc
| ) |  |
| inline

Create an offsetof node that refers to a field.

Definition at line 2052 of file Expr.h.

## ◆ OffsetOfNode() [3/4]

clang::OffsetOfNode::OffsetOfNode | ( | SourceLocation | DotLoc,
|  | IdentifierInfo * | Name,
|  | SourceLocation | NameLoc
| ) |  |
| inline

Create an offsetof node that refers to an identifier.

Definition at line 2057 of file Expr.h.

## ◆ OffsetOfNode() [4/4]

clang::OffsetOfNode::OffsetOfNode | ( | const CXXBaseSpecifier * | Base | ) |
| inline explicit

Create an offsetof node that refers into a C++ base class.

Definition at line 2063 of file Expr.h.

## Member Function Documentation

## ◆ getArrayExprIndex()

unsigned clang::OffsetOfNode::getArrayExprIndex | ( |  | ) | const
| inline

For an array element node, returns the index into the array of expressions.

Definition at line 2071 of file Expr.h.

References getKind().

Referenced by EvaluateComparisonBinaryOperator(), PrintFloatingLiteral(), and clang::ASTNodeImporter::VisitOffsetOfExpr().

## ◆ getBase()

CXXBaseSpecifier* clang::OffsetOfNode::getBase | ( |  | ) | const
| inline

For a base class node, returns the base specifier.

Definition at line 2087 of file Expr.h.

References getKind().

Referenced by EvaluateComparisonBinaryOperator(), and clang::ASTNodeImporter::VisitOffsetOfExpr().

## ◆ getBeginLoc()

SourceLocation clang::OffsetOfNode::getBeginLoc | ( |  | ) | const
| inline

Definition at line 2099 of file Expr.h.

References clang::SourceRange::getBegin().

Referenced by clang::ASTNodeImporter::VisitOffsetOfExpr().

## ◆ getEndLoc()

SourceLocation clang::OffsetOfNode::getEndLoc | ( |  | ) | const
| inline

Definition at line 2100 of file Expr.h.

References clang::SourceRange::getEnd().

Referenced by clang::ASTNodeImporter::VisitOffsetOfExpr().

## ◆ getField()

FieldDecl* clang::OffsetOfNode::getField | ( |  | ) | const
| inline

For a field offsetof node, returns the field.

Definition at line 2077 of file Expr.h.

References clang::SubobjectAdjustment::Field, and getKind().

Referenced by EvaluateComparisonBinaryOperator(), and clang::ASTNodeImporter::VisitOffsetOfExpr().

## ◆ getFieldName()

IdentifierInfo * OffsetOfNode::getFieldName | ( |  | ) | const

For a field or identifier offsetof node, returns the name of the field.

Definition at line 1493 of file Expr.cpp.

References getKind(), and Identifier.

Referenced by PrintFloatingLiteral(), and clang::ASTNodeImporter::VisitOffsetOfExpr().

## ◆ getKind()

Kind clang::OffsetOfNode::getKind | ( |  | ) | const
| inline

Determine what kind of offsetof node this is.

Definition at line 2067 of file Expr.h.

Referenced by EvaluateComparisonBinaryOperator(), PrintFloatingLiteral(), and clang::ASTNodeImporter::VisitOffsetOfExpr().

## ◆ getSourceRange()

SourceRange clang::OffsetOfNode::getSourceRange | ( |  | ) | const
| inline

Retrieve the source range that covers this offsetof node.

For an array element node, the source range contains the locations of the square brackets. For a field or identifier node, the source range contains the location of the period (if there is one) and the identifier.

Definition at line 2098 of file Expr.h.

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

- include/clang/AST/Expr.h
- lib/AST/Expr.cpp