Skip to content

Unparser

Backend C and C++ code generator.

Synopsis

Declared in <src/backend/unparser/unparser.h>

class Unparser;

Description

This class represents the backend C++ code generator within ROSE. It is separated from the AST IR so that it can be more easily developed as a separate modular piece of ROSE.

This is the source code generator. It traverses the AST (not using the newer traversal mechanisms) and generates C++ source code from the constructs within the AST. Special attention is given to formatting the generated code.

Note: Large parts of documentation contained in ROSE/src/unparser.docs.

Internal: This class could be simplified now that comments and CPP directives are a part of the AST.

Metadata:

  • Authors: Lee, Quinlan, Schordan, ...
  • Version: 0.5 cvs-version-#: (Name:)
  • Date: (Date: 2006/04/24 00:21:29)
  • Bug: No known bugs.
  • Warning: Formatting still overly complex (can be simplified now that comments are part of the AST).
  • TODO: Finish documentation; make formatting easily tailorable to different styles (low priority at the moment).

Types

Name
FortranDirectiveContextGuard
FortranLineWrapLayout

Enums

Name
FortranDirectiveKind

Member Functions

Name Description
Unparser
Unparser(Unparser const& other) = delete; [constructor]
constructor
~Unparser
virtual ~Unparser(); [destructor] [virtual]
destructor
operator=
Unparser& operator=(Unparser const& other) = delete; [deleted]
Copy assignment operator
claimPreprocessingInfoReceipt
void claimPreprocessingInfoReceipt( PreprocessingInfo const* record, SgLocatedNode const* owner, int relativePosition);
emitFortranCharacterLiteral
void emitFortranCharacterLiteral( std::string const& value, char delimiter);
emitFortranComment
void emitFortranComment(std::string const& text);
emitFortranSelectedDirective
void emitFortranSelectedDirective(SgPragmaDeclaration const* pragma);
emitFortranText
void emitFortranText(std::string const& text);
fortranDirectiveContinuationPrefix
char const* fortranDirectiveContinuationPrefix(bool fixedFormat) const;
fortranLineWrapLayout
FortranLineWrapLayout fortranLineWrapLayout() const;
fortranSourceContext
Rose::FortranSource::Context const& fortranSourceContext(SgSourceFile const* file);
getFortranDirectiveKind
FortranDirectiveKind getFortranDirectiveKind() const;
get_name_qualification_context
NameQualificationContext& get_name_qualification_context();
get_output_stream
UnparseFormat& get_output_stream();
get the output stream wrapper
isCompilerGenerated
bool isCompilerGenerated(SgLocatedNode* n);
true if SgLocatedNode is part of a compiler generated part of the AST (e.g template instatiation)
isPartOfTransformation
bool isPartOfTransformation(SgLocatedNode* n);
true if SgLocatedNode is part of a transformation on the AST
preprocessingInfoText
std::string preprocessingInfoText(PreprocessingInfo const* info) const;
requireExactAuxiliaryDeclarationOwner
SgAuxiliaryDeclarationList* requireExactAuxiliaryDeclarationOwner( SgNode* node, char const* contract);
requireExactStatementChild
void requireExactStatementChild( SgNode* parent, SgStatement* statement, char const* contract);
requireFortranDirectiveKind
void requireFortranDirectiveKind(FortranDirectiveKind kind) const;
setFortranDirectiveKind
void setFortranDirectiveKind(FortranDirectiveKind kind);
tokenUnparseContext
TokenUnparseFrontierContext const& tokenUnparseContext() const;
tokenUnparseFrontier
TokenUnparseFrontierFileContext const& tokenUnparseFrontier(SgSourceFile* sourceFile) const;
unparseFile
void unparseFile( SgSourceFile* file, SgUnparse_Info& info, SgScopeStatement* unparseScope = nullptr);
friend string globalUnparseToString ( SgNode* astNode );

Static Member Functions

Name Description
computeNameQualification
static void computeNameQualification( SgSourceFile* file, NameQualificationContext& nameQualifications);
remove unneccessary white space to build a condensed string

Data Members

Name Description
cur This is a cursor mechanism which is not encapsulated into the curprint() member function.
cur_index used to index the preprocessor list
currentFile
delegate delegate unparser that can be used to replace the output of this unparser
opt holds all desired options for this unparser
prevdir_was_cppDeclaration The previous directive was a CPP statment (otherwise it was a comment)
u_debug
u_exprStmt
u_fortran_locatedNode
u_fortran_type
u_name
u_sage
u_type

Private Types

Name
ExactChildOwnershipIndex
PreprocessingInfoReceipt

Private Member Functions

Name
emitFortranQuotedLiteralSource
void emitFortranQuotedLiteralSource( std::string const& literal, char delimiter);
emitFortranRawText
void emitFortranRawText(std::string const& text);

Private Data Members

Name
exactAuxiliaryOwners
exactChildOwnershipIndices
exactFortranDirectiveTokens
fortranCompilerDirectiveContinuationPrefix
fortranDirectiveKind
fortranSourceContexts
nameQualifications
ownedNameQualifications
preprocessingInfoReceipts
preprocessingInfoRewrites
tokenUnparseFrontiers

Created with MrDocs