class StringLiteralParser

Declaration

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

Description

StringLiteralParser - This decodes string escape characters and performs wide string analysis and Translation Phase #6 (concatenation of string literals) (C99 5.1.1.2p1).

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

Member Variables

private const clang::SourceManager& SM
private const clang::LangOptions& Features
private const clang::TargetInfo& Target
private clang::DiagnosticsEngine* Diags
private unsigned int MaxTokenLength
private unsigned int SizeBound
private unsigned int CharByteWidth
private tok::TokenKind Kind
private SmallString<512> ResultBuf
private char* ResultPtr
private SmallString<32> UDSuffixBuf
private unsigned int UDSuffixToken
private unsigned int UDSuffixOffset
public bool hadError
public bool Pascal

Method Overview

Methods

bool CopyStringFragment(const clang::Token& Tok,
                        const char* TokBegin,
                        llvm::StringRef Fragment)

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

Parameters

const clang::Token& Tok
const char* TokBegin
llvm::StringRef Fragment

void DiagnoseLexingError(
    clang::SourceLocation Loc)

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

Parameters

clang::SourceLocation Loc

unsigned int GetNumStringChars() const

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

llvm::StringRef GetString() const

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

unsigned int GetStringLength() const

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

StringLiteralParser(
    ArrayRef<clang::Token> StringToks,
    const clang::SourceManager& sm,
    const clang::LangOptions& features,
    const clang::TargetInfo& target,
    clang::DiagnosticsEngine* diags = nullptr)

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

Parameters

ArrayRef<clang::Token> StringToks
const clang::SourceManager& sm
const clang::LangOptions& features
const clang::TargetInfo& target
clang::DiagnosticsEngine* diags = nullptr

StringLiteralParser(
    ArrayRef<clang::Token> StringToks,
    clang::Preprocessor& PP)

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

Parameters

ArrayRef<clang::Token> StringToks
clang::Preprocessor& PP

unsigned int getOffsetOfStringByte(
    const clang::Token& TheTok,
    unsigned int ByteNo) const

Description

getOffsetOfStringByte - This function returns the offset of the specified byte of the string data represented by Token. This handles advancing over escape sequences in the string. If the Diagnostics pointer is non-null, then this will do semantic checking of the string literal and emit errors and warnings.

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

Parameters

const clang::Token& TheTok
unsigned int ByteNo

llvm::StringRef getUDSuffix() const

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

unsigned int getUDSuffixOffset() const

Description

Get the spelling offset of the first byte of the ud-suffix.

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

unsigned int getUDSuffixToken() const

Description

Get the index of a token containing a ud-suffix.

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

void init(ArrayRef<clang::Token> StringToks)

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

Parameters

ArrayRef<clang::Token> StringToks

bool isOrdinary() const

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

bool isPascal() const

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

bool isUTF16() const

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

bool isUTF32() const

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

bool isUTF8() const

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

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

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

Parameters

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

bool isWide() const

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