class TokenRewriter

Declaration

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

Declared at: clang/include/clang/Rewrite/Core/TokenRewriter.h:30

Member Variables

private std::list<Token> TokenList
TokenList - This is the list of raw tokens that make up this file. Each of these tokens has a unique SourceLocation, which is a FileID.
private std::map<SourceLocation, TokenRefTy> TokenAtLoc
TokenAtLoc - This map indicates which token exists at a specific SourceLocation. Since each token has a unique SourceLocation, this is a one to one map. The token can return its own location directly, to map backwards.
private std::unique_ptr<ScratchBuffer> ScratchBuf
ScratchBuf - This is the buffer that we create scratch tokens from.

Method Overview

  • private clang::TokenRewriter::TokenRefTy AddToken(const clang::Token & T, clang::TokenRewriter::TokenRefTy Where)
  • public clang::TokenRewriter::token_iterator AddTokenAfter(clang::TokenRewriter::token_iterator I, const char * Val)
  • public clang::TokenRewriter::token_iterator AddTokenBefore(clang::TokenRewriter::token_iterator I, const char * Val)
  • private clang::TokenRewriter::TokenRefTy RemapIterator(clang::TokenRewriter::token_iterator I)
  • public TokenRewriter(clang::FileID FID, clang::SourceManager & SM, const clang::LangOptions & LO)
  • public TokenRewriter(const clang::TokenRewriter &)
  • public clang::TokenRewriter::token_iterator token_begin() const
  • public clang::TokenRewriter::token_iterator token_end() const
  • public ~TokenRewriter()

Methods

clang::TokenRewriter::TokenRefTy AddToken(
    const clang::Token& T,
    clang::TokenRewriter::TokenRefTy Where)

Description

AddToken - Add the specified token into the Rewriter before the other position.

Declared at: clang/include/clang/Rewrite/Core/TokenRewriter.h:75

Parameters

const clang::Token& T
clang::TokenRewriter::TokenRefTy Where

clang::TokenRewriter::token_iterator
AddTokenAfter(
    clang::TokenRewriter::token_iterator I,
    const char* Val)

Declared at: clang/include/clang/Rewrite/Core/TokenRewriter.h:63

Parameters

clang::TokenRewriter::token_iterator I
const char* Val

clang::TokenRewriter::token_iterator
AddTokenBefore(
    clang::TokenRewriter::token_iterator I,
    const char* Val)

Declared at: clang/include/clang/Rewrite/Core/TokenRewriter.h:61

Parameters

clang::TokenRewriter::token_iterator I
const char* Val

clang::TokenRewriter::TokenRefTy RemapIterator(
    clang::TokenRewriter::token_iterator I)

Description

RemapIterator - Convert from token_iterator (a const iterator) to TokenRefTy (a non-const iterator).

Declared at: clang/include/clang/Rewrite/Core/TokenRewriter.h:71

Parameters

clang::TokenRewriter::token_iterator I

TokenRewriter(clang::FileID FID,
              clang::SourceManager& SM,
              const clang::LangOptions& LO)

Description

TokenRewriter - This creates a TokenRewriter for the file with the specified FileID.

Declared at: clang/include/clang/Rewrite/Core/TokenRewriter.h:50

Parameters

clang::FileID FID
clang::SourceManager& SM
const clang::LangOptions& LO

TokenRewriter(const clang::TokenRewriter&)

Declared at: clang/include/clang/Rewrite/Core/TokenRewriter.h:52

Parameters

const clang::TokenRewriter&

clang::TokenRewriter::token_iterator token_begin()
    const

Declared at: clang/include/clang/Rewrite/Core/TokenRewriter.h:58

clang::TokenRewriter::token_iterator token_end()
    const

Declared at: clang/include/clang/Rewrite/Core/TokenRewriter.h:59

~TokenRewriter()

Declared at: clang/include/clang/Rewrite/Core/TokenRewriter.h:54