clang API Documentation

Public Member Functions | Public Attributes
clang::NumericLiteralParser Class Reference

#include <LiteralSupport.h>

Collaboration diagram for clang::NumericLiteralParser:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 NumericLiteralParser (const char *begin, const char *end, SourceLocation Loc, Preprocessor &PP)
bool isIntegerLiteral () const
bool isFloatingLiteral () const
bool hasUDSuffix () const
StringRef getUDSuffix () const
unsigned getUDSuffixOffset () const
unsigned getRadix () const
bool GetIntegerValue (llvm::APInt &Val)
llvm::APFloat::opStatus GetFloatValue (llvm::APFloat &Result)

Public Attributes

bool hadError
bool isUnsigned
bool isLong
bool isLongLong
bool isFloat
bool isImaginary
bool isMicrosoftInteger

Detailed Description

NumericLiteralParser - This performs strict semantic analysis of the content of a ppnumber, classifying it as either integer, floating, or erroneous, determines the radix of the value and can convert it to a useful value.

Definition at line 38 of file LiteralSupport.h.


Constructor & Destructor Documentation

NumericLiteralParser::NumericLiteralParser ( const char *  begin,
const char *  end,
SourceLocation  TokLoc,
Preprocessor pp 
)

integer-constant: [C99 6.4.4.1] decimal-constant integer-suffix octal-constant integer-suffix hexadecimal-constant integer-suffix user-defined-integer-literal: [C++11 lex.ext] decimal-literal ud-suffix octal-literal ud-suffix hexadecimal-literal ud-suffix decimal-constant: nonzero-digit decimal-constant digit octal-constant: 0 octal-constant octal-digit hexadecimal-constant: hexadecimal-prefix hexadecimal-digit hexadecimal-constant hexadecimal-digit hexadecimal-prefix: one of 0x 0X integer-suffix: unsigned-suffix [long-suffix] unsigned-suffix [long-long-suffix] long-suffix [unsigned-suffix] long-long-suffix [unsigned-sufix] nonzero-digit: 1 2 3 4 5 6 7 8 9 octal-digit: 0 1 2 3 4 5 6 7 hexadecimal-digit: 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F unsigned-suffix: one of u U long-suffix: one of l L long-long-suffix: one of ll LL

floating-constant: [C99 6.4.4.2] TODO: add rules...

Definition at line 388 of file LiteralSupport.cpp.

References clang::Preprocessor::AdvanceToTokenCharacter(), clang::Preprocessor::Diag(), clang::Preprocessor::getLangOpts(), hadError, isFloat, isFloatingLiteral(), isImaginary, isLong, isLongLong, isMicrosoftInteger, and isUnsigned.


Member Function Documentation

llvm::APFloat::opStatus NumericLiteralParser::GetFloatValue ( llvm::APFloat &  Result)

GetFloatValue - Convert this numeric literal to a floating value, using the specified APFloat fltSemantics (specifying float, double, etc). The optional bool isExact (passed-by-reference) has its value set to true if the returned APFloat can represent the number in the literal exactly, and false otherwise.

Definition at line 750 of file LiteralSupport.cpp.

Referenced by BuildFloatingLiteral().

bool NumericLiteralParser::GetIntegerValue ( llvm::APInt &  Val)

GetIntegerValue - Convert this numeric literal value to an APInt that matches Val's input width. If there is an overflow (i.e., if the unsigned value read is larger than the APInt's bits will hold), set Val to the low bits of the result and return true. Otherwise, return false.

GetIntegerValue - Convert this numeric literal value to an APInt that matches Val's input width. If there is an overflow, set Val to the low bits of the result and return true. Otherwise, return false.

Definition at line 696 of file LiteralSupport.cpp.

References HexDigitValue().

unsigned clang::NumericLiteralParser::getRadix ( ) const [inline]

Definition at line 80 of file LiteralSupport.h.

StringRef clang::NumericLiteralParser::getUDSuffix ( ) const [inline]

Definition at line 71 of file LiteralSupport.h.

unsigned clang::NumericLiteralParser::getUDSuffixOffset ( ) const [inline]

Definition at line 75 of file LiteralSupport.h.

bool clang::NumericLiteralParser::hasUDSuffix ( ) const [inline]

Definition at line 68 of file LiteralSupport.h.

bool clang::NumericLiteralParser::isFloatingLiteral ( ) const [inline]

Definition at line 64 of file LiteralSupport.h.

Referenced by NumericLiteralParser().

bool clang::NumericLiteralParser::isIntegerLiteral ( ) const [inline]

Definition at line 61 of file LiteralSupport.h.


Member Data Documentation

Definition at line 53 of file LiteralSupport.h.

Referenced by NumericLiteralParser().

Definition at line 57 of file LiteralSupport.h.

Referenced by NumericLiteralParser().

Definition at line 58 of file LiteralSupport.h.

Referenced by NumericLiteralParser().

Definition at line 55 of file LiteralSupport.h.

Referenced by NumericLiteralParser().

Definition at line 56 of file LiteralSupport.h.

Referenced by NumericLiteralParser().

Definition at line 59 of file LiteralSupport.h.

Referenced by NumericLiteralParser().

Definition at line 54 of file LiteralSupport.h.

Referenced by NumericLiteralParser().


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