Skip to content

TargetCodeFragment

An abstract base class for all fragments of the original code (except header includes) that need to be copied to our generated source code. More...

#include <TargetCodeFragment.h>

Inherited by TargetCodeDecl, TargetCodeRegion

Public Types

Name
enum TargetCodeFragmentKind { TCFK_TargetCodeFragment, TCFK_TargetCodeRegion, TCFK_TargetCodeDecl}
Enum for LLVMs RTTI.

Public Functions

Name
TargetCodeFragmentKind getKind() const
Accessor for LLVMs RTTI.
TargetCodeFragment(clang::ASTContext & Context, TargetCodeFragmentKind Kind)
virtual ~TargetCodeFragment() =0
Destroy the Target Code Fragment:: Target Code Fragment object.
virtual std::string PrintPretty() =0
Tries to use Clang's PrettyPrinter when possible (this is currently only for target regions).
virtual clang::SourceRange getRealRange() =0
Get the source range of the fragment.
virtual clang::SourceRange getInnerRange()
Gets the 'inner' source range.
virtual clang::SourceRange getSpellingRange() =0
Get the spelling source range.
clang::OpenMPDirectiveKind getTargetCodeKind()
Accessor to TargetCodeKind.
const clang::LangOptions & GetLangOpts()
Accessor to lang opts of the current context.
clang::PrintingPolicy getPP()
bool classof(const TargetCodeFragment * TCF)

Public Attributes

Name
bool NeedsSemicolon
Does the source code generation need to add a semicolon to this fragment.
clang::OpenMPDirectiveKind TargetCodeKind
What kind of code are we copying.
bool HasExtraBraces

Protected Attributes

Name
const TargetCodeFragmentKind Kind
Variable for LLVMs RTTI.
clang::ASTContext & Context
clang::PrintingPolicy PP

Detailed Description

1
class TargetCodeFragment;

An abstract base class for all fragments of the original code (except header includes) that need to be copied to our generated source code.

This includes target regions as well as functions, global variables and types used by target regions (as far as we can detect that) as well as functions and variables that are flagged with the 'omp declare target' pragma.

Public Types Documentation

enum TargetCodeFragmentKind

Enumerator Value Description
TCFK_TargetCodeFragment
TCFK_TargetCodeRegion
TCFK_TargetCodeDecl

Enum for LLVMs RTTI.

Public Functions Documentation

function getKind

1
inline TargetCodeFragmentKind getKind() const

Accessor for LLVMs RTTI.

function TargetCodeFragment

1
2
3
4
inline TargetCodeFragment(
    clang::ASTContext & Context,
    TargetCodeFragmentKind Kind
)

function ~TargetCodeFragment

1
virtual ~TargetCodeFragment() =0

Destroy the Target Code Fragment:: Target Code Fragment object.

function PrintPretty

1
virtual std::string PrintPretty() =0

Tries to use Clang's PrettyPrinter when possible (this is currently only for target regions).

Reimplemented by: TargetCodeRegion::PrintPretty, TargetCodeDecl::PrintPretty

function getRealRange

1
virtual clang::SourceRange getRealRange() =0

Get the source range of the fragment.

Reimplemented by: TargetCodeRegion::getRealRange, TargetCodeDecl::getRealRange

function getInnerRange

1
inline virtual clang::SourceRange getInnerRange()

Gets the 'inner' source range.

Reimplemented by: TargetCodeRegion::getInnerRange

This can differ for target regions from the source range.

function getSpellingRange

1
virtual clang::SourceRange getSpellingRange() =0

Get the spelling source range.

Reimplemented by: TargetCodeRegion::getSpellingRange, TargetCodeDecl::getSpellingRange

That is the range without macro expansions.

function getTargetCodeKind

1
inline clang::OpenMPDirectiveKind getTargetCodeKind()

Accessor to TargetCodeKind.

function GetLangOpts

1
inline const clang::LangOptions & GetLangOpts()

Accessor to lang opts of the current context.

function getPP

1
inline clang::PrintingPolicy getPP()

function classof

1
2
3
static inline bool classof(
    const TargetCodeFragment * TCF
)

Public Attributes Documentation

variable NeedsSemicolon

1
bool NeedsSemicolon;

Does the source code generation need to add a semicolon to this fragment.

variable TargetCodeKind

1
clang::OpenMPDirectiveKind TargetCodeKind;

What kind of code are we copying.

TODO: this can create problems with non annotated function?

variable HasExtraBraces

1
bool HasExtraBraces;

Protected Attributes Documentation

variable Kind

1
const TargetCodeFragmentKind Kind;

Variable for LLVMs RTTI.

variable Context

1
clang::ASTContext & Context;

variable PP

1
clang::PrintingPolicy PP;

Last update: 2021-11-24
Back to top