class NumericLiteralParser

Declaration

class NumericLiteralParser { /* full declaration omitted */ };

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.

Declared at: clang/include/clang/Lex/LiteralSupport.h:42

Member Variables

private const clang::SourceManager& SM
private const clang::LangOptions& LangOpts
private clang::DiagnosticsEngine& Diags
private const char* const ThisTokBegin
private const char* const ThisTokEnd
private const char* DigitsBegin
private const char* SuffixBegin
private const char* s
private unsigned int radix
private bool saw_exponent
private bool saw_period
private bool saw_ud_suffix
private bool saw_fixed_point_suffix
private SmallString<32> UDSuffixBuf
public bool hadError
public bool isUnsigned
public bool isLong
public bool isLongLong
public bool isSizeT
public bool isHalf
public bool isFloat
public bool isImaginary
public bool isFloat16
public bool isFloat128
public bool isFract
public bool isAccum
public bool isBitInt
public uint8_t MicrosoftInteger

Method Overview

Methods

bool GetFixedPointValue(llvm::APInt& StoreVal,
                        unsigned int Scale)

Description

GetFixedPointValue - Convert this numeric literal value into a scaled integer that represents this value. Returns true if an overflow occurred when calculating the integral part of the scaled integer or calculating the digit sequence of the exponent.

Declared at: clang/include/clang/Lex/LiteralSupport.h:122

Parameters

llvm::APInt& StoreVal
unsigned int Scale

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

Description

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.

Declared at: clang/include/clang/Lex/LiteralSupport.h:116

Parameters

llvm::APFloat& Result

bool GetIntegerValue(llvm::APInt& Val)

Description

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.

Declared at: clang/include/clang/Lex/LiteralSupport.h:109

Parameters

llvm::APInt& Val

NumericLiteralParser(
    llvm::StringRef TokSpelling,
    clang::SourceLocation TokLoc,
    const clang::SourceManager& SM,
    const clang::LangOptions& LangOpts,
    const clang::TargetInfo& Target,
    clang::DiagnosticsEngine& Diags)

Declared at: clang/include/clang/Lex/LiteralSupport.h:59

Parameters

llvm::StringRef TokSpelling
clang::SourceLocation TokLoc
const clang::SourceManager& SM
const clang::LangOptions& LangOpts
const clang::TargetInfo& Target
clang::DiagnosticsEngine& Diags

void ParseDecimalOrOctalCommon(
    clang::SourceLocation TokLoc)

Declared at: clang/include/clang/Lex/LiteralSupport.h:134

Parameters

clang::SourceLocation TokLoc

void ParseNumberStartingWithZero(
    clang::SourceLocation TokLoc)

Declared at: clang/include/clang/Lex/LiteralSupport.h:133

Parameters

clang::SourceLocation TokLoc

const char* SkipBinaryDigits(const char* ptr)

Description

SkipBinaryDigits - Read and skip over any binary digits, up to End. Return a pointer to the first non-binary digit or End.

Declared at: clang/include/clang/Lex/LiteralSupport.h:177

Parameters

const char* ptr

const char* SkipDigits(const char* ptr)

Description

SkipDigits - Read and skip over any digits, up to End. Return a pointer to the first non-hex digit or End.

Declared at: clang/include/clang/Lex/LiteralSupport.h:169

Parameters

const char* ptr

const char* SkipHexDigits(const char* ptr)

Description

SkipHexDigits - Read and skip over any hex digits, up to End. Return a pointer to the first non-hex digit or End.

Declared at: clang/include/clang/Lex/LiteralSupport.h:152

Parameters

const char* ptr

const char* SkipOctalDigits(const char* ptr)

Description

SkipOctalDigits - Read and skip over any octal digits, up to End. Return a pointer to the first non-hex digit or End.

Declared at: clang/include/clang/Lex/LiteralSupport.h:160

Parameters

const char* ptr

void checkSeparator(
    clang::SourceLocation TokLoc,
    const char* Pos,
    clang::NumericLiteralParser::
        CheckSeparatorKind IsAfterDigits)

Description

Ensure that we don't have a digit separator here.

Declared at: clang/include/clang/Lex/LiteralSupport.h:147

Parameters

clang::SourceLocation TokLoc
const char* Pos
clang::NumericLiteralParser::CheckSeparatorKind IsAfterDigits

bool containsDigits(const char* Start,
                    const char* End)

Description

Determine whether the sequence of characters [Start, End) contains any real digits (not digit separators).

Declared at: clang/include/clang/Lex/LiteralSupport.h:140

Parameters

const char* Start
const char* End

llvm::StringRef getLiteralDigits() const

Description

Get the digits that comprise the literal. This excludes any prefix or suffix associated with the literal.

Declared at: clang/include/clang/Lex/LiteralSupport.h:126

unsigned int getRadix() const

Declared at: clang/include/clang/Lex/LiteralSupport.h:103

llvm::StringRef getUDSuffix() const

Declared at: clang/include/clang/Lex/LiteralSupport.h:92

unsigned int getUDSuffixOffset() const

Declared at: clang/include/clang/Lex/LiteralSupport.h:96

bool hasUDSuffix() const

Declared at: clang/include/clang/Lex/LiteralSupport.h:89

static bool isDigitSeparator(char C)

Declared at: clang/include/clang/Lex/LiteralSupport.h:136

Parameters

char C

bool isFixedPointLiteral() const

Declared at: clang/include/clang/Lex/LiteralSupport.h:78

bool isFloatingLiteral() const

Declared at: clang/include/clang/Lex/LiteralSupport.h:85

bool isIntegerLiteral() const

Declared at: clang/include/clang/Lex/LiteralSupport.h:82

static bool isValidUDSuffix(
    const clang::LangOptions& LangOpts,
    llvm::StringRef Suffix)

Declared at: clang/include/clang/Lex/LiteralSupport.h:101

Parameters

const clang::LangOptions& LangOpts
llvm::StringRef Suffix