Program Listing for File sageBuilder.h

Program Listing for File sageBuilder.h#

↰ Return to documentation for file (src/frontend/SageIII/sageInterface/sageBuilder.h)

#ifndef ROSE_SAGE_BUILDER_INTERFACE
#define ROSE_SAGE_BUILDER_INTERFACE

#include <string>

#include "sageInterface.h"

// forward declarations required for templated functions using those functions
namespace SageInterface {
  ROSE_DLL_API void setOneSourcePositionForTransformation (SgNode * root);
  ROSE_DLL_API void setSourcePosition(SgNode* node);
}

namespace SageBuilder
{

#if 0
//---------------------AST creation/building/construction-----------------
  SgExpression* buildConst(SgType* t, const string & val);
  SgExpression* buildConstInt(int val);

  // build sth in languages, but not in SAGE AST
  // how to specify position info?  then

  SgClassDeclaration* buildClassDeclaration(...,class_type);
  // or
  SgClassDeclaration* buildStruct(...);
  SgClassDeclaration* buildClass(...);
  SgClassDeclaration* buildUnion(...);

  // build B from dependent A
 SgTemplateInstantiationMemberFunctionDecl*  buildForwardFunctionDeclaration
     (SgTemplateInstantiationMemberFunctionDecl * memberFunctionInstantiation);

  //previous attempt: src/midend/astUtil/astInterface
  //  AstNodePtr AstInterface::CreateConst( const string& val, const string& valtype) const
  //  AstNodePtr AstInterfaceBase::CreateConstInt( int val)
#endif

//----------------------------------------------------------

extern std::list<SgScopeStatement*> ScopeStack;

// DQ (11/30/2010): Added support for building Fortran case insensitive symbol table handling.
extern bool symbol_table_case_insensitive_semantics;

ROSE_DLL_API void pushScopeStack (SgScopeStatement* stmt);

// DQ (3/20/2017): This function is not called (the function above is the more useful one that is used).
// ROSE_DLL_API void pushScopeStack (SgNode* node);

ROSE_DLL_API void popScopeStack();
ROSE_DLL_API SgScopeStatement* topScopeStack();
ROSE_DLL_API bool emptyScopeStack();
ROSE_DLL_API void clearScopeStack();

// DQ (3/11/2012): Added new function to the API for the internal scope stack.
SgScopeStatement* getGlobalScopeFromScopeStack();

// DQ (3/20/2017): This function is not used.
// bool isInScopeStack(SgScopeStatement * scope);

bool inSwitchScope();

// DQ (3/20/2017): This function is not used.
// TV: for debug purpose
// std::string stringFromScopeStack();



#if 0
// DQ (3/20/2017): These functions are not used (suggest using the API in the symbol table initialization).
//----------------------------------------------------------

ROSE_DLL_API void setCaseInsensitive();
ROSE_DLL_API void setCaseSensitive();
ROSE_DLL_API void setCaseFromScope(SgScopeStatement* scope);

#endif


// *************************************************************************************************************
// DQ (5/1/2012): This is another possible interface: supporting how we set the source code position and mark is
// as either a transformation or as actual code to be assigned a source position as part of the AST construction.
// *************************************************************************************************************

enum SourcePositionClassification
   {
     e_sourcePositionError,
     e_sourcePositionDefault,
     e_sourcePositionTransformation,
     e_sourcePositionCompilerGenerated,
     e_sourcePositionNullPointers,
     e_sourcePositionFrontendConstruction,
     e_sourcePosition_last
   };

extern SourcePositionClassification SourcePositionClassificationMode;

ROSE_DLL_API SourcePositionClassification getSourcePositionClassificationMode();

ROSE_DLL_API std::string display(SourcePositionClassification & scp);

ROSE_DLL_API void setSourcePositionClassificationMode(SourcePositionClassification X);

ROSE_DLL_API SgName appendTemplateArgumentsToName( const SgName & name, const SgTemplateArgumentPtrList & templateArgumentsList);

SgName unparseTemplateArgumentToString (SgTemplateArgument* templateArgument);

// *************************************************************************************************************



//--------------------------------------------------------------

ROSE_DLL_API SgTypeBool *  buildBoolType();
ROSE_DLL_API SgTypeNullptr* buildNullptrType();
ROSE_DLL_API SgTypeChar *  buildCharType();
ROSE_DLL_API SgTypeDouble* buildDoubleType();
ROSE_DLL_API SgTypeFloat*  buildFloatType();
ROSE_DLL_API SgTypeInt *   buildIntType();
ROSE_DLL_API SgTypeLong*    buildLongType();
ROSE_DLL_API SgTypeLongDouble* buildLongDoubleType();
ROSE_DLL_API SgTypeLongLong * buildLongLongType();
ROSE_DLL_API SgTypeShort*    buildShortType();
ROSE_DLL_API SgTypeFloat80*  buildFloat80Type();
ROSE_DLL_API SgTypeFloat128* buildFloat128Type();

// CR (2/20/2020): Added builder for Jovial fixed type
ROSE_DLL_API SgTypeFixed* buildFixedType(SgExpression* fraction, SgExpression* scale);

ROSE_DLL_API SgTypeString* buildStringType();
// SgTypeString* buildStringType( SgExpression* stringLengthExpression, size_t stringLengthLiteral );
ROSE_DLL_API SgTypeString* buildStringType( SgExpression* stringLengthExpression );

ROSE_DLL_API SgTypeVoid * buildVoidType();
ROSE_DLL_API SgTypeWchar* buildWcharType();

// DQ (2/16/2018): Adding support for char16_t and char32_t (C99 and C++11 specific types).
ROSE_DLL_API SgTypeChar16* buildChar16Type();
ROSE_DLL_API SgTypeChar32* buildChar32Type();

ROSE_DLL_API SgTypeSignedChar*  buildSignedCharType();
ROSE_DLL_API SgTypeSignedInt*   buildSignedIntType();
ROSE_DLL_API SgTypeSignedLong*  buildSignedLongType();
ROSE_DLL_API SgTypeSignedLongLong* buildSignedLongLongType();
ROSE_DLL_API SgTypeSignedShort* buildSignedShortType();

#if 1
ROSE_DLL_API SgTypeSigned128bitInteger* buildSigned128bitIntegerType();
ROSE_DLL_API SgTypeUnsigned128bitInteger* buildUnsigned128bitIntegerType();
#endif

ROSE_DLL_API SgTypeUnsignedChar* buildUnsignedCharType();
ROSE_DLL_API SgTypeUnsignedInt* buildUnsignedIntType();
ROSE_DLL_API SgTypeUnsignedLong*    buildUnsignedLongType();
ROSE_DLL_API SgTypeUnsignedLongLong*    buildUnsignedLongLongType();
ROSE_DLL_API SgTypeUnsignedShort*    buildUnsignedShortType();
ROSE_DLL_API SgTypeUnknown * buildUnknownType();

ROSE_DLL_API SgAutoType * buildAutoType();

// CR (2/20/2020): Added builder functions for type size (kind) expressions for Fortran and Jovial
ROSE_DLL_API SgTypeBool * buildBoolType(SgExpression* kind_expr);
ROSE_DLL_API SgTypeInt * buildIntType(SgExpression* kind_expr);
ROSE_DLL_API SgTypeFloat * buildFloatType(SgExpression* kind_expr);
ROSE_DLL_API SgTypeUnsignedInt* buildUnsignedIntType(SgExpression* kind_expr);

ROSE_DLL_API SgType* buildFortranImplicitType(SgName name);

ROSE_DLL_API SgPointerType* buildPointerType(SgType *base_type = NULL);

ROSE_DLL_API SgReferenceType* buildReferenceType(SgType *base_type = NULL);

ROSE_DLL_API SgRvalueReferenceType* buildRvalueReferenceType(SgType *base_type);

ROSE_DLL_API SgDeclType* buildDeclType(SgExpression *base_expression, SgType* base_type);

ROSE_DLL_API SgTypeOfType* buildTypeOfType(SgExpression *base_expression, SgType* base_type);

// Liao, entirely phase out this function ! Build a modifier type with no modifiers set
//SgModifierType* buildModifierType(SgType *base_type = NULL);

// DQ (7/29/2010): Changed return type from SgType to SgModifierType for a number of the functions below.
ROSE_DLL_API SgModifierType* buildModifierType(SgType* base_type = NULL);

ROSE_DLL_API SgModifierType* buildConstType(SgType* base_type = NULL);

ROSE_DLL_API SgModifierType* buildAliasedType(SgType* base_type = NULL);

ROSE_DLL_API SgModifierType* buildVolatileType(SgType* base_type = NULL);

ROSE_DLL_API SgModifierType* buildConstVolatileType(SgType* base_type = NULL);

ROSE_DLL_API SgModifierType* buildRestrictType(SgType* base_type);

ROSE_DLL_API SgArrayType* buildArrayType(SgType* base_type=NULL, SgExpression* index=NULL);

// RASMUSSEN (1/25/2018)
ROSE_DLL_API SgArrayType* buildArrayType(SgType* base_type, SgExprListExp* dim_info);

// DQ (8/27/2010): Added Fortran specific support for types based on kind expressions.
ROSE_DLL_API SgModifierType* buildFortranKindType(SgType* base_type, SgExpression* kindExpression );

ROSE_DLL_API SgFunctionType* buildFunctionType(SgType* return_type, SgFunctionParameterTypeList * typeList=NULL);

ROSE_DLL_API SgFunctionType* buildFunctionType(SgType* return_type, SgFunctionParameterList * argList=NULL);

// DQ (1/10/2020): removed the default argument since we need to make sure it is used.
// ROSE_DLL_API SgMemberFunctionType* buildMemberFunctionType(SgType* return_type, SgFunctionParameterTypeList * typeList, SgScopeStatement *struct_name, unsigned int mfunc_specifier, unsigned int ref_qualifiers = 0);
ROSE_DLL_API SgMemberFunctionType* buildMemberFunctionType(SgType* return_type, SgFunctionParameterTypeList * typeList, SgScopeStatement *struct_name, unsigned int mfunc_specifier, unsigned int ref_qualifiers = 0);

// DQ (3/20/2017): This function is not used (so let's see if we can remove it).
// ROSE_DLL_API SgMemberFunctionType* buildMemberFunctionType(SgType* return_type, SgFunctionParameterList* argList = NULL, SgClassDefinition *struct_name = NULL, unsigned int mfunc_specifier = 0);

ROSE_DLL_API SgMemberFunctionType* buildMemberFunctionType(SgType* return_type, SgFunctionParameterTypeList* typeList, SgType *classType, unsigned int mfunc_specifier, unsigned int ref_qualifiers = 0);

// PP (07/14/2016):
ROSE_DLL_API
SgClassType*
buildClassTemplateType(SgTemplateClassDeclaration* template_decl, Rose_STL_Container<SgNode *>& template_args);

ROSE_DLL_API
SgClassType*
buildTemplateClassType(SgTemplateClassDeclaration* template_decl, Rose_STL_Container<SgNode *>& template_args);


ROSE_DLL_API SgType* buildOpaqueType(std::string const type_name, SgScopeStatement * scope);

// DQ (7/29/2010): Changed return type from SgType to SgModifierType for a number of the functions below.
ROSE_DLL_API SgModifierType* buildUpcStrictType(SgType *base_type = NULL);

ROSE_DLL_API SgModifierType* buildUpcRelaxedType(SgType *base_type = NULL);

ROSE_DLL_API SgModifierType* buildUpcSharedType(SgType *base_type = NULL, long layout = -1);
// SgModifierType* buildUpcSharedType(SgType *base_type = NULL);

ROSE_DLL_API SgModifierType* buildUpcBlockIndefiniteType(SgType *base_type = NULL);

ROSE_DLL_API SgModifierType* buildUpcBlockStarType(SgType *base_type = NULL);

ROSE_DLL_API SgModifierType* buildUpcBlockNumberType(SgType *base_type, long block_factor);

ROSE_DLL_API SgTypeComplex* buildComplexType(SgType *base_type = NULL);

ROSE_DLL_API SgTypeImaginary* buildImaginaryType(SgType *base_type = NULL);

ROSE_DLL_API SgConstVolatileModifier * buildConstVolatileModifier (SgConstVolatileModifier::cv_modifier_enum mtype=SgConstVolatileModifier::e_unknown);

ROSE_DLL_API SgTypeMatrix* buildMatrixType();

ROSE_DLL_API SgTypeTuple* buildTupleType(SgType *t1 = NULL, SgType *t2 = NULL, SgType *t3 = NULL, SgType *t4 = NULL, SgType *t5 = NULL, SgType *t6 = NULL, SgType *t7 = NULL, SgType *t8 = NULL, SgType *t9 = NULL, SgType *t10 = NULL);

ROSE_DLL_API SgNonrealType* buildNonrealType(const SgName & name,  SgDeclarationScope* scope);


//--------------------------------------------------------------

// JJW (11/19/2008): _nfi versions of functions set file info objects to NULL (used in frontend)

ROSE_DLL_API SgVariantExpression * buildVariantExpression();

ROSE_DLL_API SgNullExpression* buildNullExpression();
ROSE_DLL_API SgNullExpression* buildNullExpression_nfi();

ROSE_DLL_API SgBoolValExp* buildBoolValExp(int value = 0);
ROSE_DLL_API SgBoolValExp* buildBoolValExp(bool value = 0);
ROSE_DLL_API SgBoolValExp* buildBoolValExp_nfi(int value);

ROSE_DLL_API SgCharVal* buildCharVal(char value = 0);
ROSE_DLL_API SgCharVal* buildCharVal_nfi(char value, const std::string& str);

ROSE_DLL_API SgNullptrValExp* buildNullptrValExp();
ROSE_DLL_API SgNullptrValExp* buildNullptrValExp_nfi();

ROSE_DLL_API SgVoidVal* buildVoidVal();
ROSE_DLL_API SgVoidVal* buildVoidVal_nfi();

ROSE_DLL_API SgWcharVal* buildWcharVal(wchar_t value = 0);
ROSE_DLL_API SgWcharVal* buildWcharVal_nfi(wchar_t value, const std::string& str);

// DQ (2/16/2018): Adding support for char16_t and char32_t (C99 and C++11 specific types).
ROSE_DLL_API SgChar16Val* buildChar16Val(unsigned short value = 0);
ROSE_DLL_API SgChar16Val* buildChar16Val_nfi(unsigned short value, const std::string& str);
ROSE_DLL_API SgChar32Val* buildChar32Val(unsigned int value = 0);
ROSE_DLL_API SgChar32Val* buildChar32Val_nfi(unsigned int value, const std::string& str);

// DQ (3/20/2017): This function has never existed (inputs must be SgValueExp pointers).
// ROSE_DLL_API SgComplexVal* buildComplexVal(long double real_value = 0.0, long double imaginary_value = 0.0 );
ROSE_DLL_API SgComplexVal* buildComplexVal(SgValueExp* real_value, SgValueExp* imaginary_value);
ROSE_DLL_API SgComplexVal* buildComplexVal_nfi(SgValueExp* real_value, SgValueExp* imaginary_value, const std::string& str);
ROSE_DLL_API SgComplexVal* buildImaginaryVal(long double imaginary_value);
ROSE_DLL_API SgComplexVal* buildImaginaryVal(SgValueExp* imaginary_value);
ROSE_DLL_API SgComplexVal* buildImaginaryVal_nfi(SgValueExp* imaginary_value, const std::string& str);

ROSE_DLL_API SgDoubleVal* buildDoubleVal(double value = 0.0);
ROSE_DLL_API SgDoubleVal* buildDoubleVal_nfi(double value, const std::string& str);

ROSE_DLL_API SgFloatVal* buildFloatVal(float value = 0.0);
ROSE_DLL_API SgFloatVal* buildFloatVal_nfi(float value = 0.0);
ROSE_DLL_API SgFloatVal* buildFloatVal_nfi(float value, const std::string& str);
ROSE_DLL_API SgFloatVal* buildFloatVal_nfi(const std::string& str);

ROSE_DLL_API SgIntVal* buildIntVal(int value = 0);
ROSE_DLL_API SgIntVal* buildIntValHex(int value = 0);
ROSE_DLL_API SgIntVal* buildIntVal_nfi(int value = 0);
ROSE_DLL_API SgIntVal* buildIntVal_nfi(int value, const std::string& str);
ROSE_DLL_API SgIntVal* buildIntVal_nfi(const std::string& str);

ROSE_DLL_API SgLongIntVal* buildLongIntVal(long value = 0);
ROSE_DLL_API SgLongIntVal* buildLongIntValHex(long value = 0);
ROSE_DLL_API SgLongIntVal* buildLongIntVal_nfi(long value, const std::string& str);

ROSE_DLL_API SgLongLongIntVal* buildLongLongIntVal(long long value = 0);
ROSE_DLL_API SgLongLongIntVal* buildLongLongIntValHex(long long value = 0);
ROSE_DLL_API SgLongLongIntVal* buildLongLongIntVal_nfi(long long value, const std::string& str);
// !Build enum val without file info: nfi
ROSE_DLL_API SgEnumVal* buildEnumVal_nfi(long long int value, SgEnumDeclaration* decl, SgName name);
// !Build enum val with transformation file info
ROSE_DLL_API SgEnumVal* buildEnumVal(long long int value, SgEnumDeclaration* decl, SgName name);
ROSE_DLL_API SgEnumVal* buildEnumVal(SgEnumFieldSymbol * sym);

ROSE_DLL_API SgLongDoubleVal* buildLongDoubleVal(long double value = 0.0);
ROSE_DLL_API SgLongDoubleVal* buildLongDoubleVal_nfi(long double value, const std::string& str);

ROSE_DLL_API SgFloat80Val* buildFloat80Val(long double value = 0.0);
ROSE_DLL_API SgFloat80Val* buildFloat80Val_nfi(long double value, const std::string& str);

ROSE_DLL_API SgFloat128Val* buildFloat128Val(long double value = 0.0);
ROSE_DLL_API SgFloat128Val* buildFloat128Val_nfi(long double value, const std::string& str);

ROSE_DLL_API SgShortVal* buildShortVal(short value = 0);
ROSE_DLL_API SgShortVal* buildShortValHex(short value = 0);
ROSE_DLL_API SgShortVal* buildShortVal_nfi(short value, const std::string& str);

ROSE_DLL_API SgStringVal* buildStringVal(std::string value="");
ROSE_DLL_API SgStringVal* buildStringVal_nfi(std::string value);

ROSE_DLL_API SgUnsignedCharVal* buildUnsignedCharVal(unsigned char v = 0);
ROSE_DLL_API SgUnsignedCharVal* buildUnsignedCharValHex(unsigned char v = 0);
ROSE_DLL_API SgUnsignedCharVal* buildUnsignedCharVal_nfi(unsigned char v, const std::string& str);

ROSE_DLL_API SgUnsignedShortVal* buildUnsignedShortVal(unsigned short v = 0);
ROSE_DLL_API SgUnsignedShortVal* buildUnsignedShortValHex(unsigned short v = 0);
ROSE_DLL_API SgUnsignedShortVal* buildUnsignedShortVal_nfi(unsigned short v, const std::string& str);

ROSE_DLL_API SgUnsignedIntVal* buildUnsignedIntVal(unsigned int v = 0);
ROSE_DLL_API SgUnsignedIntVal* buildUnsignedIntValHex(unsigned int v = 0);
ROSE_DLL_API SgUnsignedIntVal* buildUnsignedIntVal_nfi(unsigned int v, const std::string& str);

ROSE_DLL_API SgUnsignedLongVal* buildUnsignedLongVal(unsigned long v = 0);
ROSE_DLL_API SgUnsignedLongVal* buildUnsignedLongValHex(unsigned long v = 0);
ROSE_DLL_API SgUnsignedLongVal* buildUnsignedLongVal_nfi(unsigned long v, const std::string& str);

ROSE_DLL_API SgUnsignedLongLongIntVal* buildUnsignedLongLongIntVal(unsigned long long v = 0);
ROSE_DLL_API SgUnsignedLongLongIntVal* buildUnsignedLongLongIntValHex(unsigned long long v = 0);
ROSE_DLL_API SgUnsignedLongLongIntVal* buildUnsignedLongLongIntVal_nfi(unsigned long long v, const std::string& str);

ROSE_DLL_API SgTemplateParameterVal* buildTemplateParameterVal(int template_parameter_position = -1);
ROSE_DLL_API SgTemplateParameterVal* buildTemplateParameterVal_nfi(int template_parameter_position, const std::string& str);

ROSE_DLL_API SgTemplateType* buildTemplateType(SgName name="");

ROSE_DLL_API SgTemplateParameter * buildTemplateParameter (SgTemplateParameter::template_parameter_enum parameterType, SgType*);

ROSE_DLL_API SgNonrealDecl * buildNonrealDecl(const SgName & name, SgDeclarationScope * scope, SgDeclarationScope * child_scope = NULL);

ROSE_DLL_API SgNonrealRefExp * buildNonrealRefExp_nfi(SgNonrealSymbol * sym);

ROSE_DLL_API SgUpcThreads* buildUpcThreads();
ROSE_DLL_API SgUpcThreads* buildUpcThreads_nfi();

ROSE_DLL_API SgUpcMythread* buildUpcMythread();
ROSE_DLL_API SgUpcMythread* buildUpcMythread_nfi();

ROSE_DLL_API SgThisExp* buildThisExp(SgSymbol* sym);
ROSE_DLL_API SgThisExp* buildThisExp_nfi(SgSymbol* sym);

ROSE_DLL_API SgSuperExp* buildSuperExp(SgClassSymbol* sym);
ROSE_DLL_API SgSuperExp* buildSuperExp_nfi(SgClassSymbol* sym);

ROSE_DLL_API SgClassExp* buildClassExp(SgClassSymbol* sym);
ROSE_DLL_API SgClassExp* buildClassExp_nfi(SgClassSymbol* sym);

ROSE_DLL_API SgLambdaRefExp* buildLambdaRefExp(SgType* return_type, SgFunctionParameterList* params, SgScopeStatement* scope);

#define BUILD_UNARY_PROTO(suffix) \
ROSE_DLL_API Sg##suffix * build##suffix(SgExpression* op =NULL); \
ROSE_DLL_API Sg##suffix * build##suffix##_nfi(SgExpression* op);

BUILD_UNARY_PROTO(AddressOfOp)
BUILD_UNARY_PROTO(BitComplementOp)
BUILD_UNARY_PROTO(MinusOp)
BUILD_UNARY_PROTO(NotOp)
BUILD_UNARY_PROTO(PointerDerefExp)
BUILD_UNARY_PROTO(UnaryAddOp)
BUILD_UNARY_PROTO(MinusMinusOp)
BUILD_UNARY_PROTO(PlusPlusOp)
BUILD_UNARY_PROTO(RealPartOp)
BUILD_UNARY_PROTO(ImagPartOp)
BUILD_UNARY_PROTO(ConjugateOp)
BUILD_UNARY_PROTO(VarArgStartOneOperandOp)
BUILD_UNARY_PROTO(VarArgEndOp)

//Matlab transpose op
BUILD_UNARY_PROTO(MatrixTransposeOp)


ROSE_DLL_API SgCastExp * buildCastExp(SgExpression *  operand_i = NULL,
                SgType * expression_type = NULL,
                SgCastExp::cast_type_enum cast_type = SgCastExp::e_C_style_cast);
ROSE_DLL_API SgCastExp * buildCastExp_nfi(SgExpression *  operand_i,
                SgType * expression_type,
                SgCastExp::cast_type_enum cast_type);

ROSE_DLL_API SgVarArgOp * buildVarArgOp_nfi(SgExpression *  operand_i, SgType * expression_type);

ROSE_DLL_API SgMinusOp *buildMinusOp(SgExpression* operand_i, SgUnaryOp::Sgop_mode  a_mode);
ROSE_DLL_API SgMinusOp *buildMinusOp_nfi(SgExpression* operand_i, SgUnaryOp::Sgop_mode  a_mode);
ROSE_DLL_API SgMinusMinusOp *buildMinusMinusOp(SgExpression* operand_i, SgUnaryOp::Sgop_mode  a_mode);
ROSE_DLL_API SgMinusMinusOp *buildMinusMinusOp_nfi(SgExpression* operand_i, SgUnaryOp::Sgop_mode  a_mode);

ROSE_DLL_API SgPlusPlusOp* buildPlusPlusOp(SgExpression* operand_i, SgUnaryOp::Sgop_mode  a_mode);
ROSE_DLL_API SgPlusPlusOp* buildPlusPlusOp_nfi(SgExpression* operand_i, SgUnaryOp::Sgop_mode  a_mode);

ROSE_DLL_API SgThrowOp* buildThrowOp(SgExpression *, SgThrowOp::e_throw_kind);

ROSE_DLL_API SgNewExp * buildNewExp(SgType* type,
                       SgExprListExp* exprListExp,
                       SgConstructorInitializer* constInit,
                       SgExpression* expr,
                       short int val,
                       SgFunctionDeclaration* funcDecl);

ROSE_DLL_API SgDeleteExp* buildDeleteExp(SgExpression* variable,
                            short is_array,
                            short need_global_specifier,
                            SgFunctionDeclaration* deleteOperatorDeclaration);

ROSE_DLL_API SgTypeIdOp* buildTypeIdOp(SgExpression *operand_expr, SgType *operand_type);


#undef BUILD_UNARY_PROTO

#define BUILD_BINARY_PROTO(suffix) \
ROSE_DLL_API Sg##suffix * build##suffix(SgExpression* lhs =NULL, SgExpression* rhs =NULL); \
ROSE_DLL_API Sg##suffix * build##suffix##_nfi(SgExpression* lhs, SgExpression* rhs);

BUILD_BINARY_PROTO(AddOp)
BUILD_BINARY_PROTO(AndAssignOp)
BUILD_BINARY_PROTO(AndOp)
BUILD_BINARY_PROTO(ArrowExp)
BUILD_BINARY_PROTO(ArrowStarOp)
BUILD_BINARY_PROTO(AssignOp)
BUILD_BINARY_PROTO(BitAndOp)
BUILD_BINARY_PROTO(BitOrOp)
BUILD_BINARY_PROTO(BitXorOp)

BUILD_BINARY_PROTO(CommaOpExp)
BUILD_BINARY_PROTO(ConcatenationOp)
BUILD_BINARY_PROTO(DivAssignOp)
BUILD_BINARY_PROTO(DivideOp)
BUILD_BINARY_PROTO(DotExp)
BUILD_BINARY_PROTO(DotStarOp)
BUILD_BINARY_PROTO(EqualityOp)

BUILD_BINARY_PROTO(ExponentiationOp)
BUILD_BINARY_PROTO(ExponentiationAssignOp)
BUILD_BINARY_PROTO(GreaterOrEqualOp)
BUILD_BINARY_PROTO(GreaterThanOp)
BUILD_BINARY_PROTO(IntegerDivideOp)
BUILD_BINARY_PROTO(IntegerDivideAssignOp)
BUILD_BINARY_PROTO(IorAssignOp)
BUILD_BINARY_PROTO(IsOp)
BUILD_BINARY_PROTO(IsNotOp)

BUILD_BINARY_PROTO(LessOrEqualOp)
BUILD_BINARY_PROTO(LessThanOp)
BUILD_BINARY_PROTO(LshiftAssignOp)
BUILD_BINARY_PROTO(LshiftOp)

BUILD_BINARY_PROTO(MembershipOp)
BUILD_BINARY_PROTO(MinusAssignOp)
BUILD_BINARY_PROTO(ModAssignOp)
BUILD_BINARY_PROTO(ModOp)
BUILD_BINARY_PROTO(MultAssignOp)
BUILD_BINARY_PROTO(MultiplyOp)

BUILD_BINARY_PROTO(NonMembershipOp)
BUILD_BINARY_PROTO(NotEqualOp)
BUILD_BINARY_PROTO(OrOp)
BUILD_BINARY_PROTO(PlusAssignOp)
BUILD_BINARY_PROTO(PntrArrRefExp)
BUILD_BINARY_PROTO(RshiftAssignOp)

BUILD_BINARY_PROTO(RshiftOp)
BUILD_BINARY_PROTO(ScopeOp)
BUILD_BINARY_PROTO(SubtractOp)
BUILD_BINARY_PROTO(XorAssignOp)

BUILD_BINARY_PROTO(VarArgCopyOp)
BUILD_BINARY_PROTO(VarArgStartOp)

BUILD_BINARY_PROTO(PowerOp);
BUILD_BINARY_PROTO(ElementwisePowerOp);
BUILD_BINARY_PROTO(ElementwiseMultiplyOp);
BUILD_BINARY_PROTO(ElementwiseDivideOp);
BUILD_BINARY_PROTO(LeftDivideOp);
BUILD_BINARY_PROTO(ElementwiseLeftDivideOp);
BUILD_BINARY_PROTO(ElementwiseAddOp);
BUILD_BINARY_PROTO(ElementwiseSubtractOp);

// DQ (7/25/2020): Adding C++20 support
BUILD_BINARY_PROTO(SpaceshipOp)

#undef BUILD_BINARY_PROTO

ROSE_DLL_API SgConditionalExp * buildConditionalExp(SgExpression* test =NULL, SgExpression* a =NULL, SgExpression* b =NULL);
SgConditionalExp * buildConditionalExp_nfi(SgExpression* test, SgExpression* a, SgExpression* b, SgType* t);

ROSE_DLL_API SgExprListExp * buildExprListExp(SgExpression * expr1 = NULL, SgExpression* expr2 = NULL, SgExpression* expr3 = NULL, SgExpression* expr4 = NULL, SgExpression* expr5 = NULL, SgExpression* expr6 = NULL, SgExpression* expr7 = NULL, SgExpression* expr8 = NULL, SgExpression* expr9 = NULL, SgExpression* expr10 = NULL);
ROSE_DLL_API SgExprListExp * buildExprListExp(const std::vector<SgExpression*>& exprs);
SgExprListExp * buildExprListExp_nfi();
SgExprListExp * buildExprListExp_nfi(const std::vector<SgExpression*>& exprs);

SgSubscriptExpression * buildSubscriptExpression_nfi(SgExpression* lower_bound, SgExpression* upper_bound, SgExpression* stride);

ROSE_DLL_API SgTupleExp * buildTupleExp(SgExpression * expr1 = NULL, SgExpression* expr2 = NULL, SgExpression* expr3 = NULL, SgExpression* expr4 = NULL, SgExpression* expr5 = NULL, SgExpression* expr6 = NULL, SgExpression* expr7 = NULL, SgExpression* expr8 = NULL, SgExpression* expr9 = NULL, SgExpression* expr10 = NULL);
ROSE_DLL_API SgTupleExp * buildTupleExp(const std::vector<SgExpression*>& exprs);
SgTupleExp * buildTupleExp_nfi();
SgTupleExp * buildTupleExp_nfi(const std::vector<SgExpression*>& exprs);

ROSE_DLL_API SgListExp * buildListExp(SgExpression * expr1 = NULL, SgExpression* expr2 = NULL, SgExpression* expr3 = NULL, SgExpression* expr4 = NULL, SgExpression* expr5 = NULL, SgExpression* expr6 = NULL, SgExpression* expr7 = NULL, SgExpression* expr8 = NULL, SgExpression* expr9 = NULL, SgExpression* expr10 = NULL);
ROSE_DLL_API SgListExp * buildListExp(const std::vector<SgExpression*>& exprs);
SgListExp * buildListExp_nfi();
SgListExp * buildListExp_nfi(const std::vector<SgExpression*>& exprs);

ROSE_DLL_API SgComprehension * buildComprehension(SgExpression *target, SgExpression *iter, SgExprListExp *ifs);
SgComprehension * buildComprehension_nfi(SgExpression *target, SgExpression *iter, SgExprListExp *ifs);

ROSE_DLL_API SgListComprehension * buildListComprehension(SgExpression *elt, SgExprListExp *generators);
SgListComprehension * buildListComprehension_nfi(SgExpression *elt, SgExprListExp *generators);

ROSE_DLL_API SgSetComprehension * buildSetComprehension(SgExpression *elt, SgExprListExp *generators);
SgSetComprehension * buildSetComprehension_nfi(SgExpression *elt, SgExprListExp *generators);

ROSE_DLL_API SgDictionaryComprehension * buildDictionaryComprehension(SgKeyDatumPair *kd_pair, SgExprListExp *generators);
SgDictionaryComprehension * buildDictionaryComprehension_nfi(SgKeyDatumPair *kd_pair, SgExprListExp *generators);


ROSE_DLL_API SgVarRefExp * buildVarRefExp(const SgName& name, SgScopeStatement* scope=NULL);

ROSE_DLL_API SgVarRefExp * buildVarRefExp(const std::string& varName, SgScopeStatement* scope=NULL);

ROSE_DLL_API SgVarRefExp * buildVarRefExp(const char* varName, SgScopeStatement* scope=NULL);

ROSE_DLL_API SgVarRefExp * buildVarRefExp(SgVariableSymbol* varSymbol);
ROSE_DLL_API SgVarRefExp * buildVarRefExp_nfi(SgVariableSymbol* varSymbol);

ROSE_DLL_API SgVarRefExp * buildVarRefExp(SgVariableDeclaration* vardecl);

ROSE_DLL_API SgVarRefExp * buildVarRefExp(SgInitializedName* initname, SgScopeStatement* scope=NULL);


ROSE_DLL_API SgVarRefExp* buildOpaqueVarRefExp(const std::string& varName,SgScopeStatement* scope=NULL);

// DQ (9/4/2013): Added support for building compound literals (similar to a SgVarRefExp).
SgCompoundLiteralExp* buildCompoundLiteralExp_nfi(SgVariableSymbol* varSymbol);
SgCompoundLiteralExp* buildCompoundLiteralExp(SgVariableSymbol* varSymbol);

ROSE_DLL_API SgLabelRefExp * buildLabelRefExp(SgLabelSymbol * s);

ROSE_DLL_API SgFunctionRefExp * buildFunctionRefExp(const SgName& name, const SgType* func_type, SgScopeStatement* scope=NULL);

ROSE_DLL_API SgFunctionRefExp * buildFunctionRefExp(const char* name, const SgType* func_type, SgScopeStatement* scope=NULL);

ROSE_DLL_API SgFunctionRefExp * buildFunctionRefExp(const SgName& name,SgScopeStatement* scope=NULL);

ROSE_DLL_API SgFunctionRefExp * buildFunctionRefExp(const char* name,SgScopeStatement* scope=NULL);

ROSE_DLL_API SgFunctionRefExp * buildFunctionRefExp(const SgFunctionDeclaration* func_decl);

ROSE_DLL_API SgFunctionRefExp * buildFunctionRefExp(SgFunctionSymbol* sym);

SgFunctionRefExp * buildFunctionRefExp_nfi(SgFunctionSymbol* sym);

SgTemplateFunctionRefExp* buildTemplateFunctionRefExp_nfi(SgTemplateFunctionSymbol* sym);

SgTemplateMemberFunctionRefExp* buildTemplateMemberFunctionRefExp_nfi(SgTemplateMemberFunctionSymbol* sym, bool virtual_call, bool need_qualifier);

SgMemberFunctionRefExp * buildMemberFunctionRefExp_nfi(SgMemberFunctionSymbol* sym, bool virtual_call, bool need_qualifier);
ROSE_DLL_API SgMemberFunctionRefExp * buildMemberFunctionRefExp(SgMemberFunctionSymbol* sym, bool virtual_call, bool need_qualifier);
SgClassNameRefExp * buildClassNameRefExp_nfi(SgClassSymbol* sym);
ROSE_DLL_API SgClassNameRefExp * buildClassNameRefExp(SgClassSymbol* sym);

ROSE_DLL_API SgFunctionCallExp* buildFunctionCallExp(SgFunctionSymbol* sym, SgExprListExp* parameters=NULL);
SgFunctionCallExp* buildFunctionCallExp_nfi(SgExpression* f, SgExprListExp* parameters=NULL);
ROSE_DLL_API SgFunctionCallExp* buildFunctionCallExp(SgExpression* f, SgExprListExp* parameters=NULL);

ROSE_DLL_API SgFunctionCallExp*
buildFunctionCallExp(const SgName& name, SgType* return_type, SgExprListExp* parameters=NULL, SgScopeStatement* scope=NULL);



ROSE_DLL_API SgFunctionCallExp*
buildMemberFunctionCall (std::string className, SgExpression *objectExpression, std::string functionName, SgExprListExp *params, SgScopeStatement *scope);

ROSE_DLL_API SgFunctionCallExp* buildMemberFunctionCall (SgExpression*     objectExpression, SgMemberFunctionSymbol* functionSymbol,
                                          SgExprListExp*    params);

SgTypeTraitBuiltinOperator*
buildTypeTraitBuiltinOperator(SgName functionName, SgNodePtrList parameters);

SgCudaKernelCallExp * buildCudaKernelCallExp_nfi(
  SgExpression * kernel,
  SgExprListExp* parameters = NULL,
  SgCudaKernelExecConfig * config = NULL
);

SgCudaKernelExecConfig * buildCudaKernelExecConfig_nfi(
  SgExpression *grid = NULL,
  SgExpression *blocks = NULL,
  SgExpression *shared = NULL,
  SgExpression *stream = NULL
);

ROSE_DLL_API SgAssignInitializer * buildAssignInitializer(SgExpression * operand_i = NULL, SgType * expression_type = NULL);
ROSE_DLL_API SgAssignInitializer * buildAssignInitializer_nfi(SgExpression * operand_i = NULL, SgType * expression_type = NULL);

ROSE_DLL_API SgAggregateInitializer * buildAggregateInitializer(SgExprListExp * initializers = NULL, SgType * type = NULL);
ROSE_DLL_API SgAggregateInitializer * buildAggregateInitializer_nfi(SgExprListExp * initializers, SgType * type = NULL);

ROSE_DLL_API SgCompoundInitializer * buildCompoundInitializer(SgExprListExp * initializers = NULL, SgType * type = NULL);
ROSE_DLL_API SgCompoundInitializer * buildCompoundInitializer_nfi(SgExprListExp * initializers, SgType * type = NULL);

// DQ (!/4/2009): Added support for building SgConstructorInitializer
ROSE_DLL_API SgConstructorInitializer * buildConstructorInitializer( SgMemberFunctionDeclaration *declaration,SgExprListExp *args,SgType *expression_type,bool need_name,bool need_qualifier,bool need_parenthesis_after_name,bool associated_class_unknown);
ROSE_DLL_API SgConstructorInitializer * buildConstructorInitializer_nfi( SgMemberFunctionDeclaration *declaration,SgExprListExp *args,SgType *expression_type,bool need_name,bool need_qualifier,bool need_parenthesis_after_name,bool associated_class_unknown);

ROSE_DLL_API SgBracedInitializer * buildBracedInitializer(SgExprListExp * initializers = NULL, SgType * expression_type = NULL);
ROSE_DLL_API SgBracedInitializer * buildBracedInitializer_nfi(SgExprListExp * initializers = NULL, SgType * expression_type = NULL);

ROSE_DLL_API SgSizeOfOp* buildSizeOfOp(SgExpression* exp = NULL);
ROSE_DLL_API SgSizeOfOp* buildSizeOfOp_nfi(SgExpression* exp);

ROSE_DLL_API SgSizeOfOp* buildSizeOfOp(SgType* type = NULL);
ROSE_DLL_API SgSizeOfOp* buildSizeOfOp_nfi(SgType* type);

ROSE_DLL_API SgAlignOfOp* buildAlignOfOp(SgExpression* exp = NULL);
ROSE_DLL_API SgAlignOfOp* buildAlignOfOp_nfi(SgExpression* exp);

ROSE_DLL_API SgAlignOfOp* buildAlignOfOp(SgType* type = NULL);
ROSE_DLL_API SgAlignOfOp* buildAlignOfOp_nfi(SgType* type);

ROSE_DLL_API SgNoexceptOp* buildNoexceptOp(SgExpression* exp = NULL);
ROSE_DLL_API SgNoexceptOp* buildNoexceptOp_nfi(SgExpression* exp);

ROSE_DLL_API SgTypeExpression *buildTypeExpression(SgType* type);

// DQ (8/11/2014): Added support for C++11 decltype used in new function return syntax.
ROSE_DLL_API SgFunctionParameterRefExp *buildFunctionParameterRefExp(int parameter_number, int parameter_level );
ROSE_DLL_API SgFunctionParameterRefExp *buildFunctionParameterRefExp_nfi(int parameter_number, int parameter_level );


ROSE_DLL_API SgLambdaExp* buildLambdaExp    (SgLambdaCaptureList* lambda_capture_list, SgClassDeclaration* lambda_closure_class, SgFunctionDeclaration* lambda_function);
ROSE_DLL_API SgLambdaExp* buildLambdaExp_nfi(SgLambdaCaptureList* lambda_capture_list, SgClassDeclaration* lambda_closure_class, SgFunctionDeclaration* lambda_function);

#if 0
ROSE_DLL_API SgLambdaCapture* buildLambdaCapture    (SgInitializedName* capture_variable, SgInitializedName* source_closure_variable, SgInitializedName* closure_variable);
ROSE_DLL_API SgLambdaCapture* buildLambdaCapture_nfi(SgInitializedName* capture_variable, SgInitializedName* source_closure_variable, SgInitializedName* closure_variable);
#else
ROSE_DLL_API SgLambdaCapture* buildLambdaCapture    (SgExpression* capture_variable, SgExpression* source_closure_variable, SgExpression* closure_variable);
ROSE_DLL_API SgLambdaCapture* buildLambdaCapture_nfi(SgExpression* capture_variable, SgExpression* source_closure_variable, SgExpression* closure_variable);
#endif

ROSE_DLL_API SgLambdaCaptureList* buildLambdaCaptureList    ();
ROSE_DLL_API SgLambdaCaptureList* buildLambdaCaptureList_nfi();

// DQ (7/25/2020): Adding C++17 support
 ROSE_DLL_API SgFoldExpression * buildFoldExpression(SgExpression* operands, std::string operator_token_string, bool is_left_associative);
ROSE_DLL_API SgFoldExpression * buildFoldExpression_nfi(SgExpression* operands, std::string operator_token_string, bool is_left_associative);

// DQ (7/25/2020): Adding C++20 support
ROSE_DLL_API SgAwaitExpression * buildAwaitExpression();
ROSE_DLL_API SgAwaitExpression * buildAwaitExpression_nfi();

// DQ (7/25/2020): Adding C++20 support
ROSE_DLL_API SgChooseExpression * buildChooseExpression();
ROSE_DLL_API SgChooseExpression * buildChooseExpression_nfi();




 ROSE_DLL_API SgRangeExp* buildRangeExp(SgExpression *start);


 ROSE_DLL_API SgMatrixExp* buildMatrixExp(SgExprListExp *firstRow);

 ROSE_DLL_API SgMagicColonExp* buildMagicColonExp();



// ! Build a range expression using start:end:stride for Ada
 ROSE_DLL_API SgRangeExp* buildRangeExp(SgExpression *start, SgExpression *end, SgExpression *stride);

//
//--------------------------------------------------------------


ROSE_DLL_API SgInitializedName* buildInitializedName(const SgName & name, SgType* type, SgInitializer* init = NULL);
ROSE_DLL_API SgInitializedName* buildInitializedName(const std::string &name, SgType* type);
ROSE_DLL_API SgInitializedName* buildInitializedName(const char* name, SgType* type);
ROSE_DLL_API SgInitializedName* buildInitializedName_nfi(const SgName & name, SgType* type, SgInitializer* init);

ROSE_DLL_API SgFunctionParameterTypeList *
buildFunctionParameterTypeList(SgFunctionParameterList * paralist);

ROSE_DLL_API SgFunctionParameterTypeList *
buildFunctionParameterTypeList(SgExprListExp * expList);

ROSE_DLL_API SgFunctionParameterTypeList *
buildFunctionParameterTypeList(SgType* type0 = NULL, SgType* type1 = NULL,
                               SgType* type2 = NULL, SgType* type3 = NULL,
                               SgType* type4 = NULL, SgType* type5 = NULL,
                               SgType* type6 = NULL, SgType* type7 = NULL);


//--------------------------------------------------------------

ROSE_DLL_API SgVariableDeclaration*
buildVariableDeclaration(const SgName & name, SgType *type, SgInitializer *varInit=NULL, SgScopeStatement* scope=NULL);

ROSE_DLL_API SgVariableDeclaration*
buildVariableDeclaration(const std::string & name, SgType *type, SgInitializer *varInit=NULL, SgScopeStatement* scope=NULL);

ROSE_DLL_API SgVariableDeclaration*
buildVariableDeclaration(const char* name, SgType *type, SgInitializer *varInit=NULL, SgScopeStatement* scope=NULL);

// DQ (6/25/2019): Added support to force building the varialbe declaration from the variable use (e.g. within a class)
// instead of from a declaration.  Variable declaration built from a use are reused when the declaration is seen (later
// in processing of the class members).
// ROSE_DLL_API SgVariableDeclaration*
// buildVariableDeclaration_nfi(const SgName & name, SgType *type, SgInitializer *varInit, SgScopeStatement* scope);
ROSE_DLL_API SgVariableDeclaration*
buildVariableDeclaration_nfi(const SgName & name, SgType *type, SgInitializer *varInit, SgScopeStatement* scope, bool builtFromUseOnly = false, SgStorageModifier::storage_modifier_enum sm = SgStorageModifier::e_default);

ROSE_DLL_API SgVariableDefinition*
buildVariableDefinition_nfi (SgVariableDeclaration* decl, SgInitializedName* init_name,  SgInitializer *init);


// DQ (8/31/2012): Note that this macro can't be used in header files since it can only be set
// after sage3.h has been read.  The reason is that this is a portability problem when "rose_config.h"
// appears in header files of applications using ROSE's header files.
// DQ (12/6/2011): Adding support for template declarations into the AST.
// SgTemplateDeclaration*
ROSE_DLL_API SgTemplateVariableDeclaration* buildTemplateVariableDeclaration_nfi(const SgName & name, SgType *type, SgInitializer *varInit, SgScopeStatement* scope);

ROSE_DLL_API SgTemplateVariableDeclaration* buildTemplateVariableDeclaration(const SgName & name, SgType *type, SgInitializer *varInit, SgScopeStatement* scope);

ROSE_DLL_API SgTypedefDeclaration*
buildTypedefDeclaration(const std::string& name, SgType* base_type, SgScopeStatement* scope = NULL, bool has_defining_base=false);

ROSE_DLL_API SgTypedefDeclaration*
buildTypedefDeclaration_nfi(const std::string& name, SgType* base_type, SgScopeStatement* scope = NULL, bool has_defining_base=false);

ROSE_DLL_API SgTemplateTypedefDeclaration*
buildTemplateTypedefDeclaration_nfi(const SgName & name, SgType* base_type, SgScopeStatement* scope = NULL, bool has_defining_base=false);

#if 1
// ROSE_DLL_API SgTemplateInstantiationTypedefDeclaration*
// buildTemplateInstantiationTypedefDeclaration_nfi(SgName name, SgType* base_type, SgScopeStatement* scope, bool has_defining_base, SgTemplateTypedefDeclaration* templateTypedefDeclaration, SgTemplateArgumentPtrList templateArgumentList);
// ROSE_DLL_API SgTemplateInstantiationTypedefDeclaration*
// buildTemplateInstantiationTypedefDeclaration_nfi(SgName name, SgType* base_type, SgScopeStatement* scope, bool has_defining_base, SgTemplateTypedefDeclaration* templateTypedefDeclaration);
// ROSE_DLL_API SgTemplateInstantiationTypedefDeclaration*
// buildTemplateInstantiationTypedefDeclaration_nfi();
ROSE_DLL_API SgTemplateInstantiationTypedefDeclaration*
buildTemplateInstantiationTypedefDeclaration_nfi(SgName & name, SgType* base_type, SgScopeStatement* scope, bool has_defining_base, SgTemplateTypedefDeclaration* templateTypedefDeclaration, SgTemplateArgumentPtrList & templateArgumentsList);
#endif

ROSE_DLL_API SgFunctionParameterList * buildFunctionParameterList(SgInitializedName* in1 = NULL, SgInitializedName* in2 = NULL, SgInitializedName* in3 = NULL, SgInitializedName* in4 = NULL, SgInitializedName* in5 = NULL, SgInitializedName* in6 = NULL, SgInitializedName* in7 = NULL, SgInitializedName* in8 = NULL, SgInitializedName* in9 = NULL, SgInitializedName* in10 = NULL);
SgFunctionParameterList * buildFunctionParameterList_nfi();

ROSE_DLL_API SgFunctionParameterList*
buildFunctionParameterList(SgFunctionParameterTypeList * paraTypeList);

ROSE_DLL_API SgFunctionParameterList*
buildFunctionParameterList_nfi(SgFunctionParameterTypeList * paraTypeList);

SgCtorInitializerList * buildCtorInitializerList_nfi();
ROSE_DLL_API void setTemplateNameInTemplateInstantiations( SgFunctionDeclaration* func, const SgName & name );

// DQ (9/13/2012): Need to set the parents of SgTemplateArgument IR nodes now that they are passed in as part of the SageBuilder API.
ROSE_DLL_API void setTemplateArgumentParents( SgDeclarationStatement* decl );
ROSE_DLL_API void testTemplateArgumentParents( SgDeclarationStatement* decl );
ROSE_DLL_API SgTemplateArgumentPtrList* getTemplateArgumentList( SgDeclarationStatement* decl );

ROSE_DLL_API void testTemplateParameterParents( SgDeclarationStatement* decl );
ROSE_DLL_API void setTemplateParameterParents( SgDeclarationStatement* decl );
ROSE_DLL_API SgTemplateParameterPtrList* getTemplateParameterList( SgDeclarationStatement* decl );

ROSE_DLL_API void setTemplateArgumentsInDeclaration               ( SgDeclarationStatement* decl, SgTemplateArgumentPtrList* templateArgumentsList_input );
ROSE_DLL_API void setTemplateSpecializationArgumentsInDeclaration ( SgDeclarationStatement* decl, SgTemplateArgumentPtrList* templateSpecializationArgumentsList_input );
ROSE_DLL_API void setTemplateParametersInDeclaration              ( SgDeclarationStatement* decl, SgTemplateParameterPtrList* templateParametersList_input );

// DQ (7/26/2012): Changing the API to include template arguments so that we can generate names with and without template arguments (to support name mangiling).
ROSE_DLL_API SgFunctionDeclaration * buildNondefiningFunctionDeclaration(
  const SgName & name,
  SgType * return_type,
  SgFunctionParameterList *parlist,
  SgScopeStatement* scope = NULL,
  SgExprListExp* decoratorList = NULL,
  bool buildTemplateInstantiation = false,
  SgTemplateArgumentPtrList * templateArgumentsList = NULL,
  SgStorageModifier::storage_modifier_enum sm = SgStorageModifier::e_default,
  bool forceFreeFunctionScope = false
);

ROSE_DLL_API SgFunctionDeclaration * buildNondefiningFunctionDeclaration(
  const SgFunctionDeclaration * funcdecl,
  SgScopeStatement * scope = NULL,
  SgExprListExp * decoratorList = NULL
);

// DQ (8/11/2013): Even though template functions can't use partial specialization, they can be specialized,
// however the specialization does not define a template and instead defines a template instantiation, so we
// don't need the SgTemplateArgumentPtrList in this function.
// SgTemplateFunctionDeclaration* buildNondefiningTemplateFunctionDeclaration (const SgName & name, SgType* return_type, SgFunctionParameterList *parlist, SgScopeStatement* scope=NULL, SgExprListExp* decoratorList = NULL);
ROSE_DLL_API SgTemplateFunctionDeclaration*
buildNondefiningTemplateFunctionDeclaration (const SgName & name, SgType* return_type, SgFunctionParameterList *parlist, SgScopeStatement* scope=NULL, SgExprListExp* decoratorList = NULL, SgTemplateParameterPtrList* templateParameterList = NULL);

// DQ (8/11/2013): Note that access to the SgTemplateParameterPtrList should be handled through the first_nondefining_declaration (which is a required parameter).
// DQ (12/1/2011): Adding support for template declarations into the AST.
ROSE_DLL_API SgTemplateFunctionDeclaration*
buildDefiningTemplateFunctionDeclaration (const SgName & name, SgType* return_type, SgFunctionParameterList *parlist, SgScopeStatement* scope, SgExprListExp* decoratorList, SgTemplateFunctionDeclaration* first_nondefining_declaration);

// DQ (11/8/2020): Define a function to build a default constructor for a class.
// ROSE_DLL_API SgMemberFunctionDeclaration* buildConstructor ( const SgName & typeName, SgClassType* initializedName_classType, SgClassDefinition* classDefinition);
ROSE_DLL_API SgMemberFunctionDeclaration* buildDefaultConstructor ( SgClassType* classType );

// SgMemberFunctionDeclaration * buildNondefiningMemberFunctionDeclaration (const SgName & name, SgType* return_type, SgFunctionParameterList *parlist, SgScopeStatement* scope=NULL, SgExprListExp* decoratorList = NULL);
// SgMemberFunctionDeclaration * buildNondefiningMemberFunctionDeclaration (const SgName & name, SgType* return_type, SgFunctionParameterList *parlist, SgScopeStatement* scope=NULL, SgExprListExp* decoratorList = NULL, unsigned int functionConstVolatileFlags = 0);
// SgMemberFunctionDeclaration* buildNondefiningMemberFunctionDeclaration (const SgName & name, SgType* return_type, SgFunctionParameterList *parlist, SgScopeStatement* scope=NULL, SgExprListExp* decoratorList = NULL, unsigned int functionConstVolatileFlags = 0, bool buildTemplateInstantiation = false);
ROSE_DLL_API SgMemberFunctionDeclaration*
buildNondefiningMemberFunctionDeclaration (const SgName & name, SgType* return_type, SgFunctionParameterList *parlist, SgScopeStatement* scope, SgExprListExp* decoratorList, unsigned int functionConstVolatileFlags, bool buildTemplateInstantiation, SgTemplateArgumentPtrList* templateArgumentsList);

// DQ (8/12/2013): This function needs to supporte SgTemplateParameterPtrList and SgTemplateArgumentPtrList parameters.
// SgTemplateMemberFunctionDeclaration* buildNondefiningTemplateMemberFunctionDeclaration (const SgName & name, SgType* return_type, SgFunctionParameterList *parlist, SgScopeStatement* scope = NULL, SgExprListExp* decoratorList = NULL, unsigned int functionConstVolatileFlags = 0);
ROSE_DLL_API SgTemplateMemberFunctionDeclaration*
buildNondefiningTemplateMemberFunctionDeclaration (const SgName & name, SgType* return_type, SgFunctionParameterList *parlist, SgScopeStatement* scope, SgExprListExp* decoratorList, unsigned int functionConstVolatileFlags, SgTemplateParameterPtrList* templateParameterList );

// DQ (12/1/2011): Adding support for template declarations in the AST.
ROSE_DLL_API SgTemplateMemberFunctionDeclaration*
buildDefiningTemplateMemberFunctionDeclaration (const SgName & name, SgType* return_type, SgFunctionParameterList *parlist, SgScopeStatement* scope, SgExprListExp* decoratorList, unsigned int functionConstVolatileFlags, SgTemplateMemberFunctionDeclaration* first_nondefing_declaration );

// SgMemberFunctionDeclaration* buildNondefiningMemberFunctionDeclaration (const SgName & name, SgMemberFunctionType* func_type, SgFunctionParameterList* paralist, SgScopeStatement* scope=NULL);

// DQ (8/11/2013): Note that the specification of the SgTemplateArgumentPtrList is somewhat redundant with the required parameter first_nondefinng_declaration (I think).
// SgMemberFunctionDeclaration* buildDefiningMemberFunctionDeclaration (const SgName & name, SgType* return_type, SgFunctionParameterList *parlist, SgScopeStatement* scope, SgExprListExp* decoratorList, bool buildTemplateInstantiation, unsigned int functionConstVolatileFlags, SgMemberFunctionDeclaration* first_nondefinng_declaration);
ROSE_DLL_API SgMemberFunctionDeclaration*
buildDefiningMemberFunctionDeclaration (const SgName & name, SgType* return_type, SgFunctionParameterList *parlist, SgScopeStatement* scope, SgExprListExp* decoratorList, bool buildTemplateInstantiation, unsigned int functionConstVolatileFlags, SgMemberFunctionDeclaration* first_nondefinng_declaration, SgTemplateArgumentPtrList* templateArgumentsList);

#if 0
// DQ (3/20/2017): This function is not used (so let's see if we can remove it).
// DQ (8/29/2012): This is re-enabled because the backstroke project is using it (also added back the default parameters; which I don't think I like in the API).
// DQ (7/26/2012): I would like to remove this from the API (at least for now while debugging the newer API required for template argument handling).
ROSE_DLL_API SgMemberFunctionDeclaration*
buildDefiningMemberFunctionDeclaration (const SgName & name, SgMemberFunctionType* func_type, SgScopeStatement* scope, SgExprListExp* decoratorList = NULL /* , unsigned int functionConstVolatileFlags = 0 */, SgMemberFunctionDeclaration* first_nondefinng_declaration = NULL);
#endif

#if 0
// DQ (3/20/2017): This function is not used (so let's see if we can remove it).
// SgMemberFunctionDeclaration*
ROSE_DLL_API SgMemberFunctionDeclaration*
buildNondefiningMemberFunctionDeclaration (const SgMemberFunctionDeclaration* funcdecl, SgScopeStatement* scope=NULL, SgExprListExp* decoratorList = NULL, unsigned int functionConstVolatileFlags = 0);
#endif

// DQ (8/28/2012): This preserves the original API with a simpler function (however for C++ at least, it is frequently not sufficent).
// We need to decide if the SageBuilder API should include these sorts of functions.
ROSE_DLL_API SgMemberFunctionDeclaration* buildNondefiningMemberFunctionDeclaration(const SgName& name, SgType* return_type, SgFunctionParameterList* parameter_list, SgScopeStatement* scope = NULL);

// DQ (8/28/2012): This preserves the original API with a simpler function (however for C++ at least, it is frequently not sufficent).
// We need to decide if the SageBuilder API should include these sorts of functions.
ROSE_DLL_API SgMemberFunctionDeclaration* buildDefiningMemberFunctionDeclaration(const SgName& name, SgType* return_type, SgFunctionParameterList* parameter_list, SgScopeStatement* scope = NULL);

// DQ (8/11/2013): Note that the specification of the SgTemplateArgumentPtrList is somewhat redundant with the required parameter first_nondefinng_declaration (I think).
// SgFunctionDeclaration* buildDefiningFunctionDeclaration (const SgName & name, SgType* return_type, SgFunctionParameterList * parlist, SgScopeStatement* scope, SgExprListExp* decoratorList, bool buildTemplateInstantiation, SgFunctionDeclaration* first_nondefinng_declaration);
ROSE_DLL_API SgFunctionDeclaration*
buildDefiningFunctionDeclaration (const SgName & name, SgType* return_type, SgFunctionParameterList * parlist, SgScopeStatement* scope, SgExprListExp* decoratorList, bool buildTemplateInstantiation = false, SgFunctionDeclaration* first_nondefinng_declaration = NULL, SgTemplateArgumentPtrList* templateArgumentsList = NULL, bool forceFreeFunctionScope = false);

// DQ (8/28/2012): This preserves the original API with a simpler function (however for C++ at least, it is frequently not sufficient).
// We need to decide if the SageBuilder API should include these sorts of functions.
ROSE_DLL_API SgFunctionDeclaration* buildDefiningFunctionDeclaration(const SgName& name, SgType* return_type, SgFunctionParameterList* parameter_list, SgScopeStatement* scope = NULL, bool forceFreeFunctionScope = false);

// DQ (8/28/2012): This preserves the original API with a simpler function (however for C++ at least, it is frequently not sufficient).
// We need to decide if the SageBuilder API should include these sorts of functions.
ROSE_DLL_API SgProcedureHeaderStatement* buildProcedureHeaderStatement(const SgName& name, SgType* return_type, SgFunctionParameterList* parameter_list, SgProcedureHeaderStatement::subprogram_kind_enum, SgScopeStatement* scope = NULL);

ROSE_DLL_API SgProcedureHeaderStatement*
buildProcedureHeaderStatement(const char* name, SgType* return_type, SgFunctionParameterList * parlist, SgProcedureHeaderStatement::subprogram_kind_enum, SgScopeStatement* scope, SgProcedureHeaderStatement* first_nondefining_declaration );

// CR (9/24/2020)
ROSE_DLL_API SgProcedureHeaderStatement*
buildNondefiningProcedureHeaderStatement(const SgName & name, SgType* return_type, SgFunctionParameterList* param_list,
                                         SgProcedureHeaderStatement::subprogram_kind_enum, SgScopeStatement* scope=NULL);

ROSE_DLL_API SgExprStatement*
buildFunctionCallStmt(const SgName& name, SgType* return_type, SgExprListExp* parameters=NULL, SgScopeStatement* scope=NULL);

ROSE_DLL_API SgExprStatement*
buildFunctionCallStmt(SgExpression* function, SgExprListExp* parameters=NULL);



ROSE_DLL_API SgLabelStatement * buildLabelStatement(const SgName& name, SgStatement * stmt = NULL, SgScopeStatement* scope=NULL);
SgLabelStatement * buildLabelStatement_nfi(const SgName& name, SgStatement * stmt, SgScopeStatement* scope);

ROSE_DLL_API SgGotoStatement * buildGotoStatement(SgLabelStatement *  label=NULL);
SgGotoStatement * buildGotoStatement_nfi(SgLabelStatement *  label);

ROSE_DLL_API SgGotoStatement * buildGotoStatement(SgLabelSymbol*  symbol);

// DQ (11/22/2017): Added support for computed code goto as defined by GNU C/C++ extension.
SgGotoStatement * buildGotoStatement_nfi(SgExpression*  expr);

ROSE_DLL_API SgCaseOptionStmt * buildCaseOptionStmt( SgExpression * key = NULL,SgStatement *body = NULL);
SgCaseOptionStmt * buildCaseOptionStmt_nfi( SgExpression * key,SgStatement *body);

ROSE_DLL_API SgDefaultOptionStmt * buildDefaultOptionStmt( SgStatement *body = NULL);
SgDefaultOptionStmt * buildDefaultOptionStmt_nfi( SgStatement *body);

ROSE_DLL_API SgExprStatement* buildExprStatement(SgExpression*  exp = NULL);
SgExprStatement* buildExprStatement_nfi(SgExpression*  exp);

// DQ (3/27/2015): Added support for SgStatementExpression.
ROSE_DLL_API SgStatementExpression* buildStatementExpression(SgStatement* exp);
ROSE_DLL_API SgStatementExpression* buildStatementExpression_nfi(SgStatement* exp);

ROSE_DLL_API SgSwitchStatement* buildSwitchStatement(SgStatement *item_selector = NULL,SgStatement *body = NULL);
inline SgSwitchStatement* buildSwitchStatement(SgExpression *item_selector, SgStatement *body = NULL) {
  return buildSwitchStatement(buildExprStatement(item_selector), body);
}
ROSE_DLL_API SgSwitchStatement* buildSwitchStatement_nfi(SgStatement *item_selector,SgStatement *body);

ROSE_DLL_API SgIfStmt * buildIfStmt(SgStatement* conditional, SgStatement * true_body, SgStatement * false_body);
inline SgIfStmt * buildIfStmt(SgExpression* conditional, SgStatement * true_body, SgStatement * false_body) {
  return buildIfStmt(buildExprStatement(conditional), true_body, false_body);
}

ROSE_DLL_API SgIfStmt* buildIfStmt_nfi(SgStatement* conditional, SgStatement * true_body, SgStatement * false_body);

// CR (9/3/2018)
ROSE_DLL_API SgFortranDo * buildFortranDo(SgExpression* initialization, SgExpression* bound, SgExpression* increment, SgBasicBlock* loop_body);

ROSE_DLL_API SgForInitStatement* buildForInitStatement();
ROSE_DLL_API SgForInitStatement* buildForInitStatement(const SgStatementPtrList & statements);
ROSE_DLL_API SgForInitStatement* buildForInitStatement_nfi(SgStatementPtrList & statements);

// DQ (10/12/2012): Added new function for a single statement.
ROSE_DLL_API SgForInitStatement* buildForInitStatement( SgStatement* statement );

ROSE_DLL_API SgForStatement * buildForStatement(SgStatement* initialize_stmt,  SgStatement * test, SgExpression * increment, SgStatement * loop_body, SgStatement * else_body = NULL);
ROSE_DLL_API SgForStatement * buildForStatement_nfi(SgStatement* initialize_stmt, SgStatement * test, SgExpression * increment, SgStatement * loop_body, SgStatement * else_body = NULL);
ROSE_DLL_API SgForStatement * buildForStatement_nfi(SgForInitStatement * init_stmt, SgStatement * test, SgExpression * increment, SgStatement * loop_body, SgStatement * else_body = NULL);
ROSE_DLL_API void buildForStatement_nfi(SgForStatement* result, SgForInitStatement * init_stmt, SgStatement * test, SgExpression * increment, SgStatement * loop_body, SgStatement * else_body = NULL);

// DQ (3/26/2018): Adding support for range based for statement.
// ROSE_DLL_API SgRangeBasedForStatement* buildRangeBasedForStatement_nfi(SgVariableDeclaration* initializer, SgExpression* range, SgStatement* body);
ROSE_DLL_API SgRangeBasedForStatement* buildRangeBasedForStatement_nfi(
     SgVariableDeclaration* initializer, SgVariableDeclaration* range,
     SgVariableDeclaration* begin_declaration, SgVariableDeclaration* end_declaration,
     SgExpression* not_equal_expression, SgExpression* increment_expression,
     SgStatement* body);

// EDG 4.8 handled the do-while statement differently (more similar to a block scope than before in EDG 4.7 (i.e. with an end-of-construct statement).
// So we need an builder function that can use the existing SgDoWhileStatement scope already on the stack.
ROSE_DLL_API void buildDoWhileStatement_nfi(SgDoWhileStmt* result, SgStatement * body, SgStatement * condition);

ROSE_DLL_API SgUpcForAllStatement * buildUpcForAllStatement_nfi(SgStatement* initialize_stmt, SgStatement * test, SgExpression * increment, SgExpression* affinity, SgStatement * loop_body);
ROSE_DLL_API SgUpcForAllStatement * buildUpcForAllStatement_nfi(SgForInitStatement * init_stmt, SgStatement * test, SgExpression * increment, SgExpression* affinity, SgStatement * loop_body);

// DQ (3/3/2013): Added UPC specific build functions.
ROSE_DLL_API SgUpcNotifyStatement* buildUpcNotifyStatement_nfi(SgExpression* exp);

ROSE_DLL_API SgUpcWaitStatement* buildUpcWaitStatement_nfi(SgExpression* exp);

ROSE_DLL_API SgUpcBarrierStatement* buildUpcBarrierStatement_nfi(SgExpression* exp);

ROSE_DLL_API SgUpcFenceStatement* buildUpcFenceStatement_nfi();


ROSE_DLL_API SgWhileStmt * buildWhileStmt(SgStatement *  condition, SgStatement *body, SgStatement *else_body = NULL);
inline SgWhileStmt * buildWhileStmt(SgExpression *  condition, SgStatement *body, SgStatement* else_body = NULL) {
  return buildWhileStmt(buildExprStatement(condition), body, else_body);
}
SgWhileStmt * buildWhileStmt_nfi(SgStatement *  condition, SgStatement *body, SgStatement *else_body = NULL);

ROSE_DLL_API SgWithStatement* buildWithStatement(SgExpression* expr, SgStatement* body);
SgWithStatement* buildWithStatement_nfi(SgExpression* expr, SgStatement* body);

ROSE_DLL_API SgDoWhileStmt * buildDoWhileStmt(SgStatement *  body, SgStatement *condition);
inline SgDoWhileStmt * buildDoWhileStmt(SgStatement* body, SgExpression *  condition) {
  return buildDoWhileStmt(body, buildExprStatement(condition));
}
SgDoWhileStmt * buildDoWhileStmt_nfi(SgStatement *  body, SgStatement *condition);

ROSE_DLL_API SgPragmaDeclaration * buildPragmaDeclaration(const std::string & name, SgScopeStatement* scope=NULL);
SgPragmaDeclaration * buildPragmaDeclaration_nfi(const std::string & name, SgScopeStatement* scope);

ROSE_DLL_API SgPragma* buildPragma(const std::string & name);

ROSE_DLL_API SgEmptyDeclaration* buildEmptyDeclaration();

ROSE_DLL_API SgBasicBlock * buildBasicBlock(SgStatement * stmt1 = NULL, SgStatement* stmt2 = NULL, SgStatement* stmt3 = NULL, SgStatement* stmt4 = NULL, SgStatement* stmt5 = NULL, SgStatement* stmt6 = NULL, SgStatement* stmt7 = NULL, SgStatement* stmt8 = NULL, SgStatement* stmt9 = NULL, SgStatement* stmt10 = NULL);
ROSE_DLL_API SgBasicBlock * buildBasicBlock_nfi();
SgBasicBlock * buildBasicBlock_nfi(const std::vector<SgStatement*>&);

// CR (7/24/2020): Added additional functionality
SgBasicBlock * buildBasicBlock_nfi(SgScopeStatement* parent);

ROSE_DLL_API SgExprStatement*
buildAssignStatement(SgExpression* lhs,SgExpression* rhs);

// DQ (8/16/2011): Generated a new version of this function to define consistant semantics.
ROSE_DLL_API SgExprStatement* buildAssignStatement_ast_translate(SgExpression* lhs,SgExpression* rhs);

ROSE_DLL_API SgBreakStmt* buildBreakStmt();
SgBreakStmt* buildBreakStmt_nfi();

ROSE_DLL_API SgContinueStmt* buildContinueStmt();
SgContinueStmt* buildContinueStmt_nfi();

ROSE_DLL_API SgPassStatement* buildPassStatement();
SgPassStatement* buildPassStatement_nfi();

ROSE_DLL_API SgAssertStmt* buildAssertStmt(SgExpression* test);
ROSE_DLL_API SgAssertStmt* buildAssertStmt(SgExpression *test, SgExpression *exceptionArgument);
SgAssertStmt* buildAssertStmt_nfi(SgExpression* test);

ROSE_DLL_API SgYieldExpression* buildYieldExpression(SgExpression* value);
SgYieldExpression* buildYieldExpression_nfi(SgExpression* value);

ROSE_DLL_API SgKeyDatumPair* buildKeyDatumPair    (SgExpression* key, SgExpression* datum);
SgKeyDatumPair* buildKeyDatumPair_nfi(SgExpression* key, SgExpression* datum);

ROSE_DLL_API SgDictionaryExp* buildDictionaryExp    (std::vector<SgKeyDatumPair*> pairs);
SgDictionaryExp* buildDictionaryExp_nfi(std::vector<SgKeyDatumPair*> pairs);

ROSE_DLL_API SgActualArgumentExpression* buildActualArgumentExpression(SgName arg_name, SgExpression* arg);
SgActualArgumentExpression* buildActualArgumentExpression_nfi(SgName arg_name, SgExpression* arg);

ROSE_DLL_API SgDeleteExp* buildDeleteExp(SgExpression *target, bool is_array = false, bool need_global_specifier = false, SgFunctionDeclaration *deleteOperatorDeclaration = NULL);
SgDeleteExp* buildDeleteExp_nfi(SgExpression *target, bool is_array = false, bool need_global_specifier = false, SgFunctionDeclaration *deleteOperatorDeclaration = NULL);

ROSE_DLL_API SgDeclarationScope * buildDeclarationScope();

// SgClassDefinition* buildClassDefinition(SgClassDeclaration *d = NULL);
ROSE_DLL_API SgClassDefinition* buildClassDefinition(SgClassDeclaration *d = NULL, bool buildTemplateInstantiation = false);

// SgClassDefinition* buildClassDefinition_nfi(SgClassDeclaration *d = NULL);
SgClassDefinition* buildClassDefinition_nfi(SgClassDeclaration *d = NULL, bool buildTemplateInstantiation = false);

// DQ (11/19/2011): Added more template declaration support.
SgTemplateClassDefinition* buildTemplateClassDefinition(SgTemplateClassDeclaration *d = NULL );

// DQ (6/6/2012): Added support to get the template arguments into place before computing the type.
// SgClassDeclaration* buildNondefiningClassDeclaration_nfi(const SgName& name, SgClassDeclaration::class_types kind, SgScopeStatement* scope);
// SgClassDeclaration* buildNondefiningClassDeclaration_nfi(const SgName& name, SgClassDeclaration::class_types kind, SgScopeStatement* scope, bool buildTemplateInstantiation = false);
ROSE_DLL_API SgClassDeclaration* buildNondefiningClassDeclaration_nfi(const SgName& name, SgClassDeclaration::class_types kind, SgScopeStatement* scope, bool buildTemplateInstantiation, SgTemplateArgumentPtrList* templateArgumentsList);

// DQ (8/11/2013): We need to hand in both the SgTemplateParameterPtrList and the SgTemplateArgumentPtrList because class templates can be partially specialized.
ROSE_DLL_API SgTemplateClassDeclaration* buildNondefiningTemplateClassDeclaration_nfi(const SgName& name, SgClassDeclaration::class_types kind, SgScopeStatement* scope, SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateSpecializationArgumentList);

ROSE_DLL_API SgTemplateClassDeclaration* buildNondefiningTemplateClassDeclaration(const SgName& name, SgClassDeclaration::class_types kind, SgScopeStatement* scope, SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateSpecializationArgumentList);

ROSE_DLL_API SgClassDeclaration* buildNondefiningClassDeclaration ( SgName name, SgScopeStatement* scope );
ROSE_DLL_API SgClassDeclaration* buildDefiningClassDeclaration    ( SgName name, SgScopeStatement* scope );

ROSE_DLL_API SgClassDeclaration* buildClassDeclaration    ( SgName name, SgScopeStatement* scope );

ROSE_DLL_API SgEnumDeclaration* buildNondefiningEnumDeclaration_nfi(const SgName& name, SgScopeStatement* scope);

ROSE_DLL_API SgClassDeclaration * buildStructDeclaration(const SgName& name, SgScopeStatement* scope=NULL);
ROSE_DLL_API SgClassDeclaration * buildStructDeclaration(const std::string& name, SgScopeStatement* scope=NULL);
ROSE_DLL_API SgClassDeclaration * buildStructDeclaration(const char* name, SgScopeStatement* scope=NULL);

ROSE_DLL_API SgStmtDeclarationStatement* buildStmtDeclarationStatement(SgStatement* stmt);
ROSE_DLL_API SgStmtDeclarationStatement* buildStmtDeclarationStatement_nfi(SgStatement* stmt);

ROSE_DLL_API SgNamespaceDeclarationStatement *  buildNamespaceDeclaration(const SgName& name, SgScopeStatement* scope=NULL);
ROSE_DLL_API SgNamespaceDeclarationStatement *  buildNamespaceDeclaration_nfi(const SgName& name, bool unnamednamespace, SgScopeStatement* scope );
ROSE_DLL_API SgNamespaceDefinitionStatement * buildNamespaceDefinition(SgNamespaceDeclarationStatement* d=NULL);

ROSE_DLL_API SgNaryComparisonOp* buildNaryComparisonOp(SgExpression* lhs);
ROSE_DLL_API SgNaryComparisonOp* buildNaryComparisonOp_nfi(SgExpression* lhs);
ROSE_DLL_API SgNaryBooleanOp* buildNaryBooleanOp(SgExpression* lhs);
ROSE_DLL_API SgNaryBooleanOp* buildNaryBooleanOp_nfi(SgExpression* lhs);

ROSE_DLL_API SgStringConversion* buildStringConversion(SgExpression* exp);
ROSE_DLL_API SgStringConversion* buildStringConversion_nfi(SgExpression* exp);

// DQ (6/6/2012): Addeding support to include template arguments in the generated type (template argument must be provided as early as possible).
// DQ (1/24/2009): Added this "_nfi" function but refactored buildStructDeclaration to also use it (this needs to be done uniformally).
// SgClassDeclaration * buildClassDeclaration_nfi(const SgName& name, SgClassDeclaration::class_types kind, SgScopeStatement* scope, SgClassDeclaration* nonDefiningDecl, bool buildTemplateInstantiation = false);
// SgClassDeclaration * buildClassDeclaration_nfi(const SgName& name, SgClassDeclaration::class_types kind, SgScopeStatement* scope, SgClassDeclaration* nonDefiningDecl, bool buildTemplateInstantiation);
ROSE_DLL_API SgClassDeclaration* buildClassDeclaration_nfi(const SgName& name, SgClassDeclaration::class_types kind, SgScopeStatement* scope, SgClassDeclaration* nonDefiningDecl, bool buildTemplateInstantiation, SgTemplateArgumentPtrList* templateArgumentsList);

// DQ (8/11/2013): I think that the specification of both SgTemplateParameterPtrList and SgTemplateArgumentPtrList is redundant with the nonDefiningDecl (which is a required parameter).
// DQ (11/19/2011): Added to support template class declaration using EDG 4.x support (to support the template declarations directly in the AST).
ROSE_DLL_API SgTemplateClassDeclaration* buildTemplateClassDeclaration_nfi(const SgName& name, SgClassDeclaration::class_types kind, SgScopeStatement* scope, SgTemplateClassDeclaration* nonDefiningDecl,
                                                                           SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateSpecializationArgumentList );
ROSE_DLL_API SgTemplateClassDeclaration* buildTemplateClassDeclaration(const SgName& name, SgClassDeclaration::class_types kind, SgScopeStatement* scope, SgTemplateClassDeclaration* nonDefiningDecl,
                                                                           SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateSpecializationArgumentList );

ROSE_DLL_API SgDerivedTypeStatement * buildDerivedTypeStatement (const SgName& name, SgScopeStatement* scope=NULL);

ROSE_DLL_API SgModuleStatement * buildModuleStatement(const SgName& name, SgScopeStatement* scope /*=NULL*/);

template <class DeclClass> ROSE_DLL_API
DeclClass * buildClassDeclarationStatement_nfi(const SgName& name, SgClassDeclaration::class_types kind,
                                               SgScopeStatement* scope=NULL, SgClassDeclaration* nonDefiningDecl=NULL);

ROSE_DLL_API SgEnumDeclaration * buildEnumDeclaration(const SgName& name, SgScopeStatement* scope=NULL);

ROSE_DLL_API SgEnumDeclaration * buildEnumDeclaration_nfi(const SgName& name, SgScopeStatement* scope=NULL);

ROSE_DLL_API SgReturnStmt* buildReturnStmt(SgExpression* expression = NULL);
ROSE_DLL_API SgReturnStmt* buildReturnStmt_nfi(SgExpression* expression);

ROSE_DLL_API SgNullStatement* buildNullStatement();
SgNullStatement* buildNullStatement_nfi();

ROSE_DLL_API SgAttributeSpecificationStatement * buildAttributeSpecificationStatement(SgAttributeSpecificationStatement::attribute_spec_enum kind);

ROSE_DLL_API SgFortranIncludeLine* buildFortranIncludeLine(std::string filename);

ROSE_DLL_API SgCommonBlockObject* buildCommonBlockObject(std::string name="", SgExprListExp* exp_list=NULL);

ROSE_DLL_API SgCommonBlock* buildCommonBlock(SgCommonBlockObject* first_block=NULL);

// driscoll6 (6/9/2011): Adding support for try stmts.
ROSE_DLL_API SgCatchOptionStmt* buildCatchOptionStmt(SgVariableDeclaration* condition=NULL, SgStatement* body=NULL);

// driscoll6 (6/9/2011): Adding support for try stmts.
ROSE_DLL_API SgTryStmt* buildTryStmt(SgStatement* body,
                                     SgCatchOptionStmt* catch0=NULL,
                                     SgCatchOptionStmt* catch1=NULL,
                                     SgCatchOptionStmt* catch2=NULL,
                                     SgCatchOptionStmt* catch3=NULL,
                                     SgCatchOptionStmt* catch4=NULL);

// charles4 (9/16/2011): Adding support for try stmts.
//SgTryStmt* buildTryStmt(SgStatement *try_body, SgCatchStatementSeq *catches, SgStatement *finally_body = NULL);

// charles4 (9/16/2011): Adding support for try stmts.
ROSE_DLL_API SgTryStmt* buildTryStmt(SgBasicBlock *try_body, SgBasicBlock *finally_body = NULL);

// charles4 (9/16/2011): Adding support for Catch Blocks.
ROSE_DLL_API SgCatchStatementSeq *buildCatchStatementSeq(SgCatchOptionStmt * = NULL);

ROSE_DLL_API SgExecStatement* buildExecStatement(SgExpression* executable, SgExpression* globals = NULL, SgExpression* locals = NULL);
SgExecStatement* buildExecStatement_nfi(SgExpression* executable, SgExpression* globals = NULL, SgExpression* locals = NULL);

// DQ (4/30/2010): Added support for building asm statements.
ROSE_DLL_API SgAsmStmt* buildAsmStatement(std::string s);
SgAsmStmt* buildAsmStatement_nfi(std::string s);

ROSE_DLL_API SgAsmStmt* buildMultibyteNopStatement( int n );

ROSE_DLL_API SgBaseClass* buildBaseClass ( SgClassDeclaration* classDeclaration, SgClassDefinition* classDefinition, bool isVirtual, bool isDirect );

ROSE_DLL_API SgNonrealBaseClass* buildNonrealBaseClass ( SgNonrealDecl* classDeclaration, SgClassDefinition* classDefinition, bool isVirtual, bool isDirect );

// SgAccessModifier buildAccessModifier ( unsigned int access );

ROSE_DLL_API SgStaticAssertionDeclaration* buildStaticAssertionDeclaration(SgExpression* condition, const SgName & string_literal);

ROSE_DLL_API SgMicrosoftAttributeDeclaration* buildMicrosoftAttributeDeclaration (const SgName & name);

ROSE_DLL_API SgUsingDirectiveStatement* buildUsingDirectiveStatement(SgNamespaceDeclarationStatement * ns_decl);

//--------------------------------------------------------------


ROSE_DLL_API SgFile* buildFile(const std::string& inputFileName,const std::string& outputFileName, SgProject* project = NULL, bool clear_globalScopeAcrossFiles = false);


ROSE_DLL_API SgSourceFile* buildSourceFile(const std::string& outputFileName, SgProject* project=NULL, bool clear_globalScopeAcrossFiles = false);


ROSE_DLL_API SgSourceFile* buildSourceFile(const std::string& inputFileName, const std::string& outputFileName, SgProject* project, bool clear_globalScopeAcrossFiles = false);

// DQ (11/8/2019): Support function for the new file (to support changing the file names in the source position info objects of each AST subtree node.
// ROSE_DLL_API void fixupSourcePositionFileSpecification(SgNode* subtreeRoot, const std::string& newFileName);
ROSE_DLL_API void fixupSourcePositionFileSpecification(SgNode* subtreeRoot, const std::string& newFileName);

// DQ (11/10/2019): Support for sharing IR nodes when buildFile() is applied to an existing file.
ROSE_DLL_API void fixupSharingSourcePosition(SgNode* subtreeRoot, int new_file_id);

ROSE_DLL_API PreprocessingInfo* buildComment(SgLocatedNode* target, const std::string & content,
               PreprocessingInfo::RelativePositionType position=PreprocessingInfo::before,
               PreprocessingInfo::DirectiveType dtype= PreprocessingInfo::CpreprocessorUnknownDeclaration);

ROSE_DLL_API PreprocessingInfo* buildCpreprocessorDefineDeclaration(SgLocatedNode* target,
                const std::string & content,
               PreprocessingInfo::RelativePositionType position=PreprocessingInfo::before);

ROSE_DLL_API PreprocessingInfo* buildHeader(const std::string& header_filename,
               PreprocessingInfo::RelativePositionType position=PreprocessingInfo::before,
               bool isSystemHeader =false);

// 03/17/2014 PHL
// //! Build an equivalence statement from two expression operands
ROSE_DLL_API SgEquivalenceStatement*
buildEquivalenceStatement(SgExpression* lhs,SgExpression* rhs);

ROSE_DLL_API void fixupCopyOfAstFromSeparateFileInNewTargetAst(SgStatement *insertionPoint, bool insertionPointIsScope,
                                                               SgStatement *toInsert, SgStatement* original_before_copy);
ROSE_DLL_API void fixupCopyOfNodeFromSeparateFileInNewTargetAst(SgStatement* insertionPoint, bool insertionPointIsScope,
                                                                SgNode* node_copy, SgNode* node_original);
ROSE_DLL_API SgType* getTargetFileTypeSupport(SgType* snippet_type, SgScopeStatement* targetScope);
ROSE_DLL_API SgType* getTargetFileType(SgType* snippet_type, SgScopeStatement* targetScope);

// DQ (12/6/2020): This is the original function (modified slightly, but mostly I have defined a new function that
// will not effect the AST snippet support that is used by this function.
ROSE_DLL_API SgSymbol* findAssociatedSymbolInTargetAST(SgDeclarationStatement* snippet_declaration, SgScopeStatement* targetScope);

// DQ (12/6/2020): This is the new function (modified in API and made suitable for the codeSegregation support).
ROSE_DLL_API SgDeclarationStatement* findAssociatedDeclarationInTargetAST(SgDeclarationStatement* snippet_declaration, SgScopeStatement* targetScope);

ROSE_DLL_API void errorCheckingTargetAST (SgNode* node_copy, SgNode* node_original, SgFile* targetFile, bool failOnWarning);



//----------------------------------------------------------




 //----------------------build unary expressions----------------------

template <class T>
  T* buildUnaryExpression(SgExpression* operand) {
  SgExpression* myoperand=operand;
  T* result = new T(myoperand, NULL);
  ROSE_ASSERT(result);
  if (myoperand!=NULL) {
    myoperand->set_parent(result);
    // set lvalue, it asserts operand!=NULL
    markLhsValues(result);
  }
  SageInterface::setOneSourcePositionForTransformation(result);
  return result;
 }


template <class T>
T* buildUnaryExpression_nfi(SgExpression* operand) {
  SgExpression* myoperand = operand;
  T* result = new T(myoperand, NULL);
  ROSE_ASSERT(result);

  if (myoperand != NULL) {
    myoperand->set_parent(result);
    // set lvalue, it asserts operand!=NULL
    markLhsValues(result);
  }
  SageInterface::setSourcePosition(result);

  result->set_need_paren(false);
  return result;
 }

//---------------------binary expressions-----------------------


 template <class T>
   T* buildBinaryExpression(SgExpression* lhs, SgExpression* rhs) {
   SgExpression* mylhs, *myrhs;
   mylhs = lhs;
   myrhs = rhs;
   T* result = new T(mylhs,myrhs, NULL);
   ROSE_ASSERT(result);
   if (mylhs!=NULL) {
     mylhs->set_parent(result);
     // set lvalue
     markLhsValues(result);
   }
   if (myrhs!=NULL) myrhs->set_parent(result);
   SageInterface::setOneSourcePositionForTransformation(result);
   return result;
 }


 template <class T>
   T* buildBinaryExpression_nfi(SgExpression* lhs, SgExpression* rhs) {
   SgExpression* mylhs, *myrhs;
   mylhs = lhs;
   myrhs = rhs;
   T* result = new T(mylhs,myrhs, NULL);
   ROSE_ASSERT(result);
   if (mylhs!=NULL)  {
    mylhs->set_parent(result);
    // set lvalue
    markLhsValues(result);
   }
   if (myrhs!=NULL) myrhs->set_parent(result);
   SageInterface::setSourcePosition(result);
   result->set_need_paren(false);

   return result;
 }

} // end of namespace

#endif //ROSE_SAGE_BUILDER_INTERFACE