clang API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Friends
clang::UserDefinedLiteral Class Reference

A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit.ext]). More...

#include <ExprCXX.h>

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

List of all members.

Public Types

enum  LiteralOperatorKind {
  LOK_Raw, LOK_Template, LOK_Integer, LOK_Floating,
  LOK_String, LOK_Character
}
 The kind of literal operator which is invoked. More...

Public Member Functions

 UserDefinedLiteral (const ASTContext &C, Expr *Fn, ArrayRef< Expr * > Args, QualType T, ExprValueKind VK, SourceLocation LitEndLoc, SourceLocation SuffixLoc)
 UserDefinedLiteral (const ASTContext &C, EmptyShell Empty)
LiteralOperatorKind getLiteralOperatorKind () const
 Returns the kind of literal operator invocation which this expression represents.
ExprgetCookedLiteral ()
 If this is not a raw user-defined literal, get the underlying cooked literal (representing the literal with the suffix removed).
const ExprgetCookedLiteral () const
SourceLocation getLocStart () const
SourceLocation getLocEnd () const
SourceLocation getUDSuffixLoc () const
 Returns the location of a ud-suffix in the expression.
const IdentifierInfogetUDSuffix () const
 Returns the ud-suffix specified for this literal.

Static Public Member Functions

static bool classof (const Stmt *S)

Friends

class ASTStmtReader
class ASTStmtWriter

Detailed Description

A call to a literal operator (C++11 [over.literal]) written as a user-defined literal (C++11 [lit.ext]).

Represents a user-defined literal, e.g. "foo"_bar or 1.23_xyz. While this is semantically equivalent to a normal call, this AST node provides better information about the syntactic representation of the literal.

Since literal operators are never found by ADL and can only be declared at namespace scope, a user-defined literal is never dependent.

Definition at line 365 of file ExprCXX.h.


Member Enumeration Documentation

The kind of literal operator which is invoked.

Enumerator:
LOK_Raw 

Raw form: operator "" X (const char *)

LOK_Template 

Raw form: operator "" X<cs...> ()

LOK_Integer 

operator "" X (unsigned long long)

LOK_Floating 

operator "" X (long double)

LOK_String 

operator "" X (const CharT *, size_t)

LOK_Character 

operator "" X (CharT)

Definition at line 379 of file ExprCXX.h.


Constructor & Destructor Documentation

clang::UserDefinedLiteral::UserDefinedLiteral ( const ASTContext C,
Expr Fn,
ArrayRef< Expr * >  Args,
QualType  T,
ExprValueKind  VK,
SourceLocation  LitEndLoc,
SourceLocation  SuffixLoc 
) [inline]

Definition at line 370 of file ExprCXX.h.

clang::UserDefinedLiteral::UserDefinedLiteral ( const ASTContext C,
EmptyShell  Empty 
) [inline, explicit]

Definition at line 375 of file ExprCXX.h.


Member Function Documentation

static bool clang::UserDefinedLiteral::classof ( const Stmt S) [inline, static]

Reimplemented from clang::CallExpr.

Definition at line 417 of file ExprCXX.h.

References clang::Stmt::getStmtClass().

If this is not a raw user-defined literal, get the underlying cooked literal (representing the literal with the suffix removed).

Definition at line 756 of file ExprCXX.cpp.

References clang::CallExpr::getArg(), getLiteralOperatorKind(), LOK_Raw, and LOK_Template.

Referenced by getCookedLiteral().

Definition at line 396 of file ExprCXX.h.

References getCookedLiteral().

Reimplemented from clang::CallExpr.

Definition at line 405 of file ExprCXX.h.

References clang::CallExpr::getRParenLoc().

Returns the ud-suffix specified for this literal.

Definition at line 764 of file ExprCXX.cpp.

References clang::CallExpr::getCalleeDecl().

Returns the location of a ud-suffix in the expression.

For a string literal, there may be multiple identical suffixes. This returns the first.

Definition at line 412 of file ExprCXX.h.


Friends And Related Function Documentation

friend class ASTStmtReader [friend]

Reimplemented from clang::Stmt.

Definition at line 421 of file ExprCXX.h.

friend class ASTStmtWriter [friend]

Reimplemented from clang::Stmt.

Definition at line 422 of file ExprCXX.h.


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