8#include <rose_config.h>
10#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
11 #include "roseAdapter.h"
12 #include "markLhsValues.h"
14 #include "Outliner.hh"
17 #include "transformationSupport.h"
20#include <boost/algorithm/string/trim.hpp>
23#include "AstConsistencyTests.h"
32#define BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS 0
33#define BUILDER_MAKE_REDUNDANT_CALLS_TO_SYMBOL_TABLE_LOOKUP 0
40namespace EDG_ROSE_Translation
45#if defined(ROSE_BUILD_CXX_LANGUAGE_SUPPORT) && !defined(ROSE_USE_CLANG_FRONTEND)
47 extern bool suppress_detection_of_transformations;
50 bool suppress_detection_of_transformations;
62 static bool initialized =
false;
72template <
class actualFunction>
78template <
class actualFunction>
113 ASSERT_not_null(classType);
115 SgClassDeclaration* classDeclaration = isSgClassDeclaration(classType->get_declaration());
116 ASSERT_not_null(classDeclaration);
118 SgName className = classDeclaration->get_name();
121 ASSERT_not_null(definingClassDeclaration);
123 ASSERT_not_null(classDefinition);
126 ASSERT_not_null(functionParameterList);
130 ASSERT_not_null(return_type);
133 bool buildTemplateInstantiation =
false;
136 unsigned int functionConstVolatileFlags = 0;
138 SgTemplateArgumentPtrList templateArgumentsList;
141 classDefinition, decoratorList, functionConstVolatileFlags, buildTemplateInstantiation, &templateArgumentsList);
142 ASSERT_not_null(first_nondefining_declaration);
144 first_nondefining_declaration->get_specialFunctionModifier().setConstructor();
145 ROSE_ASSERT(first_nondefining_declaration->get_specialFunctionModifier().isConstructor() ==
true);
155 classDefinition, decoratorList, buildTemplateInstantiation, functionConstVolatileFlags, first_nondefining_declaration, &templateArgumentsList);
156 ASSERT_not_null(memberFunctionDeclaration);
158 memberFunctionDeclaration->get_specialFunctionModifier().setConstructor();
159 ROSE_ASSERT(memberFunctionDeclaration->get_specialFunctionModifier().isConstructor() ==
true);
165 memberFunctionDeclaration->get_declarationModifier().get_accessModifier().setPublic();
167 ROSE_ASSERT (memberFunctionDeclaration->get_declarationModifier().get_accessModifier().isPublic() ==
true);
169 return memberFunctionDeclaration;
194 case e_sourcePositionError: s =
"e_sourcePositionError";
break;
204 printf (
"Error: default reached in SageBuilder::display(SourcePositionClassification & scp): scp = %d \n",scp);
218SgScopeStatement::find_symbol_by_type_of_function (
const SgName & name,
const SgType* func_type, SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateArgumentsList)
245 switch((VariantT)T::static_variant)
247 case V_SgFunctionDeclaration:
248 case V_SgProcedureHeaderStatement:
249 case V_SgTemplateInstantiationFunctionDecl:
252 if ((VariantT)T::static_variant == V_SgTemplateInstantiationFunctionDecl)
254 ROSE_ASSERT(templateArgumentsList != NULL);
258 ROSE_ASSERT(templateArgumentsList == NULL);
262 func_symbol = lookup_nontemplate_function_symbol(name,func_type,templateArgumentsList);
264 ROSE_ASSERT(isSgTemplateFunctionSymbol(func_symbol) == NULL);
268 case V_SgMemberFunctionDeclaration:
269 case V_SgTemplateInstantiationMemberFunctionDecl:
273 if ((VariantT)T::static_variant == V_SgTemplateInstantiationMemberFunctionDecl)
275 ROSE_ASSERT(templateArgumentsList != NULL);
279 ROSE_ASSERT(templateArgumentsList == NULL);
281 func_symbol = lookup_nontemplate_member_function_symbol(name,func_type,templateArgumentsList);
285 case V_SgTemplateFunctionDeclaration:
289 ROSE_ASSERT(templateArgumentsList == NULL);
292 ROSE_ASSERT(templateParameterList != NULL);
302 func_symbol = lookup_template_function_symbol(name,func_type,templateParameterList);
307 case V_SgTemplateMemberFunctionDeclaration:
311 ROSE_ASSERT(templateArgumentsList == NULL);
314 ROSE_ASSERT(templateParameterList != NULL);
319 func_symbol = lookup_template_member_function_symbol(name,func_type,templateParameterList);
325 printf (
"In SgScopeStatement::find_symbol_by_type_of_function(): default reached --- variantT(T::static_variant) = %d \n",T::static_variant);
335template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgTemplateFunctionDeclaration>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
336template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgTemplateInstantiationMemberFunctionDecl>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
337template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgTemplateInstantiationFunctionDecl>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
338template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgMemberFunctionDeclaration>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
339template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgTemplateMemberFunctionDeclaration>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
340template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgFunctionDeclaration>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
345 ASSERT_not_null(stmt);
383 ASSERT_not_null(isSgGlobal(tempScope));
401 bool returnVar =
false;
402 std::list<SgScopeStatement*>::iterator i;
405 if (isSgSwitchStatement(*i) !=
nullptr)
430#define DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST 0
432#if DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST
433 printf (
"In SageBuilder::appendTemplateArgumentsToName(): CRITICAL FUNCTION TO BE REFACTORED (name = %s) \n",name.str());
438 ASSERT_not_null(info);
441 info->set_requiresGlobalNameQualification();
444 info->set_SkipClassDefinition();
445 info->set_SkipEnumDefinition();
446 info->set_use_generated_name_for_template_arguments(
true);
448 bool emptyArgumentList = templateArgumentsList.empty();
453 if (emptyArgumentList ==
false)
456 SgTemplateArgumentPtrList::const_iterator i = templateArgumentsList.begin();
457 bool need_separator =
false;
459 bool exit_after_name_is_generated =
false;
461 while (i != templateArgumentsList.end())
474#if DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST
475 printf (
"In SageBuilder::appendTemplateArgumentsToName(): (top of loop) templateArgumentsList element *i = %p = %s returnName = %s \n",*i,(*i)->class_name().c_str(),returnName.str());
485 bool used_fully_qualified_name =
false;
487#define DEBUG_TEMPLATE_ARGUMENT_NAMES 0
492 ASSERT_not_null(templateArgument);
499 ASSERT_not_null(type);
501#if DEBUG_TEMPLATE_ARGUMENT_NAMES
502 printf (
"In SageBuilder::appendTemplateArgumentsToName(): case SgTemplateArgument::type_argument: BEFORE stripType: type = %p = %s \n",type,type->
class_name().c_str());
505#if DEBUG_TEMPLATE_ARGUMENT_NAMES
506 printf (
"In SageBuilder::appendTemplateArgumentsToName(): case SgTemplateArgument::type_argument: AFTER stripType: type = %p = %s \n",type,type->
class_name().c_str());
509 if (isSgPointerType(templateArgument->
get_type()) !=
nullptr)
512#if DEBUG_TEMPLATE_ARGUMENT_NAMES
513 printf (
"Found a templateArgument->get_type() that is SgPointerType: name = %s \n",name.str());
518 if (namedType !=
nullptr)
522 ASSERT_not_null(declaration);
526 case V_SgTemplateInstantiationDecl:
527 case V_SgTemplateClassDeclaration:
528 case V_SgClassDeclaration:
531 string fully_qualified_name = classDeclaration->get_qualified_name();
532#if DEBUG_TEMPLATE_ARGUMENT_NAMES
533 printf (
"fully_qualified_name = %s \n",fully_qualified_name.c_str());
535 returnName += fully_qualified_name;
536 used_fully_qualified_name =
true;
540 case V_SgTemplateInstantiationTypedefDeclaration:
541 case V_SgTemplateTypedefDeclaration:
542 case V_SgTypedefDeclaration:
545 string fully_qualified_name = typedefDeclaration->get_qualified_name();
546#if DEBUG_TEMPLATE_ARGUMENT_NAMES
547 printf (
"fully_qualified_name = %s \n",fully_qualified_name.c_str());
549 returnName += fully_qualified_name;
550 used_fully_qualified_name =
true;
554 case V_SgEnumDeclaration:
557 string fully_qualified_name = enumDeclaration->get_qualified_name();
558#if DEBUG_TEMPLATE_ARGUMENT_NAMES
559 printf (
"fully_qualified_name = %s \n",fully_qualified_name.c_str());
561 returnName += fully_qualified_name;
562 used_fully_qualified_name =
true;
567 case V_SgNonrealDecl:
569 SgNonrealDecl* nonrealDeclaration = isSgNonrealDecl(declaration);
570 string fully_qualified_name = nonrealDeclaration->get_qualified_name();
571#if DEBUG_TEMPLATE_ARGUMENT_NAMES
572 printf (
"fully_qualified_name = %s \n",fully_qualified_name.c_str());
574 returnName += fully_qualified_name;
575 used_fully_qualified_name =
true;
582 printf (
"In SageBuilder::appendTemplateArgumentsToName(): default reached: get_type() != NULL: declaration = %s \n",declaration->
class_name().c_str());
589#if DEBUG_TEMPLATE_ARGUMENT_NAMES
590 printf (
"In SageBuilder::appendTemplateArgumentsToName(): not a SgNamedType: get_type() != NULL: type = %s \n",type->
class_name().c_str());
600 ROSE_ASSERT (templateArgument->
get_expression() != NULL || templateArgument->get_initializedName() != NULL);
601 ROSE_ASSERT (templateArgument->
get_expression() == NULL || templateArgument->get_initializedName() == NULL);
605 ASSERT_not_null(expression);
609 SgVarRefExp* varRefExp = isSgVarRefExp(expression);
610 if (varRefExp != NULL)
614 ROSE_ASSERT(variableSymbol != NULL);
616 ROSE_ASSERT(initializedName != NULL);
618#if DEBUG_TEMPLATE_ARGUMENT_NAMES
619 printf (
"fully_qualified_name = %s \n",fully_qualified_name.c_str());
621 returnName += fully_qualified_name;
622 used_fully_qualified_name =
true;
627#if DEBUG_TEMPLATE_ARGUMENT_NAMES
628 printf (
"In SageBuilder::appendTemplateArgumentsToName(): Case of template argument varRefExp == NULL: expression = %p = %s \n",
636 ROSE_ASSERT(initializedName != NULL);
637 printf (
"initializedName = %p = %s \n",initializedName,initializedName->get_name().str());
639 printf (
"In SageBuilder::appendTemplateArgumentsToName(): Case of template argument initializedName != NULL: Unclear what do do in this case \n");
649 ASSERT_not_null(decl);
650#if DEBUG_TEMPLATE_ARGUMENT_NAMES
651 printf (
"In SageBuilder::appendTemplateArgumentsToName(): case SgTemplateArgument::template_template_argument: decl = %p = %s \n",decl,decl->
class_name().c_str());
653 exit_after_name_is_generated =
true;
655 ROSE_ASSERT(tpl_decl == NULL);
662#if DEBUG_TEMPLATE_ARGUMENT_NAMES
663 printf(
"WARNING: start_of_pack_expansion_argument in evaluateNameQualificationForTemplateArgumentList (can happen from some debug output)\n");
671 printf(
"Error argument_undefined in evaluateNameQualificationForTemplateArgumentList \n");
679 printf(
"Error default reached in evaluateNameQualificationForTemplateArgumentList \n");
688 if (used_fully_qualified_name ==
false)
693#if DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST
694 printf (
"In SageBuilder::appendTemplateArgumentsToName(): (after appending template name) *i = %p returnName = %s \n",*i,returnName.str());
696 need_separator =
true;
699#if DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST
700 printf (
"In SageBuilder::appendTemplateArgumentsToName(): (bottom of loop) returnName = %s \n",returnName.str());
704 if (emptyArgumentList ==
false)
707#if DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST || DEBUG_TEMPLATE_ARGUMENT_NAMES
708 printf (
"Leaving SageBuilder::appendTemplateArgumentsToName(): returnName = %s \n",returnName.str());
714 if (exit_after_name_is_generated ==
true)
716 printf (
"Exiting as a test! \n");
731 ROSE_ASSERT(templateArgument != NULL);
734 ROSE_ASSERT(info != NULL);
739 info->set_SkipClassDefinition();
740 info->set_SkipEnumDefinition();
741 info->set_use_generated_name_for_template_arguments(
true);
752SgTemplateArgumentPtrList*
758 ROSE_ASSERT(decl != NULL);
760 SgTemplateArgumentPtrList* templateArgumentsList = NULL;
764 case V_SgNamespaceAliasDeclarationStatement:
765 case V_SgNamespaceDeclarationStatement:
766 case V_SgEnumDeclaration:
767 case V_SgVariableDeclaration:
768 case V_SgTypedefDeclaration:
769 case V_SgProcedureHeaderStatement:
770 case V_SgJovialTableStatement:
771 case V_SgJavaPackageDeclaration:
772 case V_SgFunctionDeclaration:
773 case V_SgMemberFunctionDeclaration:
774 case V_SgClassDeclaration:
776 templateArgumentsList = NULL;
780 case V_SgTemplateInstantiationDecl:
786 case V_SgTemplateClassDeclaration:
788 templateArgumentsList = &(isSgTemplateClassDeclaration(decl)->get_templateSpecializationArguments());
792 case V_SgTemplateInstantiationFunctionDecl:
798 case V_SgTemplateFunctionDeclaration:
800 templateArgumentsList = &(isSgTemplateFunctionDeclaration(decl)->get_templateSpecializationArguments());
804 case V_SgTemplateInstantiationMemberFunctionDecl:
806 templateArgumentsList = &(isSgTemplateInstantiationMemberFunctionDecl(decl)->
get_templateArguments());
810 case V_SgTemplateMemberFunctionDeclaration:
812 templateArgumentsList = &(isSgTemplateMemberFunctionDeclaration(decl)->get_templateSpecializationArguments());
816 case V_SgTemplateVariableDeclaration:
818 templateArgumentsList = &(isSgTemplateVariableDeclaration(decl)->get_templateSpecializationArguments());
822 case V_SgTemplateVariableInstantiation:
824 templateArgumentsList = &(isSgTemplateVariableInstantiation(decl)->get_templateArguments());
828 case V_SgTemplateTypedefDeclaration:
830 templateArgumentsList = &(isSgTemplateTypedefDeclaration(decl)->get_templateSpecializationArguments());
834 case V_SgTemplateInstantiationTypedefDeclaration:
836 templateArgumentsList = &(isSgTemplateInstantiationTypedefDeclaration(decl)->get_templateArguments());
840 case V_SgTemplateDeclaration:
842 templateArgumentsList = NULL;
846 case V_SgNonrealDecl:
848 templateArgumentsList = &(isSgNonrealDecl(decl)->get_tpl_args());
854 printf (
"getTemplateArgumentList(): Default reached in switch: decl = %p = %s \n",decl,decl->
class_name().c_str());
859 return templateArgumentsList;
864SgTemplateParameterPtrList*
870 ROSE_ASSERT(decl != NULL);
872 SgTemplateParameterPtrList* templateParameterList = NULL;
876 case V_SgNamespaceAliasDeclarationStatement:
877 case V_SgNamespaceDeclarationStatement:
878 case V_SgEnumDeclaration:
879 case V_SgVariableDeclaration:
880 case V_SgTypedefDeclaration:
881 case V_SgProcedureHeaderStatement:
882 case V_SgJovialTableStatement:
883 case V_SgJavaPackageDeclaration:
884 case V_SgFunctionDeclaration:
885 case V_SgMemberFunctionDeclaration:
886 case V_SgClassDeclaration:
887 case V_SgTemplateInstantiationTypedefDeclaration:
888 case V_SgTemplateInstantiationFunctionDecl:
889 case V_SgTemplateInstantiationMemberFunctionDecl:
890 case V_SgTemplateVariableInstantiation:
891 case V_SgTemplateInstantiationDecl:
893 templateParameterList = NULL;
897 case V_SgTemplateClassDeclaration:
899 templateParameterList = &(isSgTemplateClassDeclaration(decl)->get_templateParameters());
903 case V_SgTemplateFunctionDeclaration:
905 templateParameterList = &(isSgTemplateFunctionDeclaration(decl)->get_templateParameters());
909 case V_SgTemplateMemberFunctionDeclaration:
911 templateParameterList = &(isSgTemplateMemberFunctionDeclaration(decl)->get_templateParameters());
915 case V_SgTemplateVariableDeclaration:
917 templateParameterList = &(isSgTemplateVariableDeclaration(decl)->get_templateParameters());
921 case V_SgTemplateTypedefDeclaration:
923 templateParameterList = &(isSgTemplateTypedefDeclaration(decl)->get_templateParameters());
927 case V_SgNonrealDecl:
929 templateParameterList = &(isSgNonrealDecl(decl)->get_tpl_params());
933 case V_SgTemplateDeclaration:
935 templateParameterList = &(isSgTemplateDeclaration(decl)->get_templateParameters());
941 printf (
"getTemplateParameterList(): Default reached in switch: decl = %p = %s \n",decl,decl->
class_name().c_str());
946 return templateParameterList;
956 ROSE_ASSERT(decl != NULL);
960 if (templateArgumentsList != NULL)
963 ROSE_ASSERT(first_decl != NULL);
965 SgTemplateArgumentPtrList::iterator i = templateArgumentsList->begin();
966 while (i != templateArgumentsList->end())
981 (*i)->set_parent(first_decl);
986 if (declaration != NULL)
988#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
989 printf (
"In setTemplateArgumentParents(): Template argument already set to declaration = %p = %s \n",declaration,declaration->
class_name().c_str());
994#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
995 printf (
"Error: In setTemplateArgumentParents(): I think it is an error for the template argument parent to be set to %p = %s \n",parent,parent->
class_name().c_str());
1013 ROSE_ASSERT(decl != NULL);
1017 if (templateParameterList != NULL)
1020 ROSE_ASSERT(first_decl != NULL);
1022 SgTemplateParameterPtrList::iterator i = templateParameterList->begin();
1023 while (i != templateParameterList->end())
1037 (*i)->set_parent(first_decl);
1054 ROSE_ASSERT(decl != NULL);
1058 if (templateArgumentsList != NULL)
1060 SgTemplateArgumentPtrList::iterator i = templateArgumentsList->begin();
1061 while (i != templateArgumentsList->end())
1066 printf (
"Error: In testTemplateArgumentParents(): decl = %p = %s has template argument = %p with null parent \n",decl,decl->
class_name().c_str(),*i);
1068 ROSE_ASSERT(parent != NULL);
1087 ROSE_ASSERT(decl != NULL);
1091 if (templateParameterList != NULL)
1093 SgTemplateParameterPtrList::iterator i = templateParameterList->begin();
1094 while (i != templateParameterList->end())
1099 printf (
"Error: In testTemplateParameterParents(): decl = %p = %s has template argument = %p with null parent \n",decl,decl->
class_name().c_str(),*i);
1101 ROSE_ASSERT(parent != NULL);
1120 ROSE_ASSERT(templateArgumentsList_input != NULL);
1122 ROSE_ASSERT(decl->
variantT() == V_SgTemplateInstantiationDecl ||
1123 decl->
variantT() == V_SgTemplateInstantiationFunctionDecl ||
1124 decl->
variantT() == V_SgTemplateInstantiationMemberFunctionDecl ||
1125 decl->
variantT() == V_SgTemplateInstantiationTypedefDeclaration);
1129 if (templateArgumentsList_from_declaration != NULL)
1131 *templateArgumentsList_from_declaration = *templateArgumentsList_input;
1146 ROSE_ASSERT(templateSpecializationArgumentsList_input != NULL);
1148 ROSE_ASSERT(decl->
variantT() == V_SgTemplateClassDeclaration || decl->
variantT() == V_SgTemplateFunctionDeclaration ||
1149 decl->
variantT() == V_SgTemplateMemberFunctionDeclaration || decl->
variantT() == V_SgTemplateVariableDeclaration );
1151 SgTemplateArgumentPtrList* templateSpecializationArgumentsList_from_declaration =
getTemplateArgumentList(decl);
1153 if (templateSpecializationArgumentsList_from_declaration != NULL)
1155 *templateSpecializationArgumentsList_from_declaration = *templateSpecializationArgumentsList_input;
1169 ROSE_ASSERT(templateParameterList_input != NULL);
1171 ROSE_ASSERT(decl->
variantT() == V_SgTemplateClassDeclaration || decl->
variantT() == V_SgTemplateFunctionDeclaration ||
1172 decl->
variantT() == V_SgTemplateMemberFunctionDeclaration || decl->
variantT() == V_SgTemplateVariableDeclaration );
1176 if (templateParameterList_from_declaration != NULL)
1178 *templateParameterList_from_declaration = *templateParameterList_input;
1187#define DEBUG__buildInitializedName 0
1193#if DEBUG__buildInitializedName
1194 std::cout <<
"SageBuilder::buildInitializedName" << std::endl;
1195 std::cout <<
" name = " << name << std::endl;
1197 ASSERT_not_null(type);
1200 ROSE_ASSERT(initializedName);
1203 return initializedName;
1212 string var_name(name);
1217#if DEBUG__buildInitializedName
1218 std::cout <<
"SageBuilder::buildInitializedName_nfi" << std::endl;
1219 std::cout <<
" name = " << name << std::endl;
1221 ROSE_ASSERT(type != NULL);
1224 ROSE_ASSERT(initializedName != NULL);
1229 initializedName->set_declptr(declptr);
1234 return initializedName;
1247 ROSE_ASSERT(name.is_null() ==
false);
1248 ROSE_ASSERT(type != NULL);
1251 ROSE_ASSERT(varDecl);
1264 bool isFortranParameter =
false;
1272 if (v_symbol != NULL)
1276 ROSE_ASSERT (default_initName != NULL);
1278 ROSE_ASSERT (new_initName != NULL);
1279 ROSE_ASSERT (default_initName != new_initName);
1282 std::replace (n_list.begin(), n_list.end(),default_initName, new_initName );
1283 ROSE_ASSERT (varDecl->get_decl_item (name)==new_initName);
1287 ROSE_ASSERT (old_parent != NULL);
1288 ROSE_ASSERT (isSgFunctionParameterList(old_parent) != NULL);
1296 ROSE_ASSERT (var_def != NULL);
1299 new_initName->set_declptr(var_def);
1301 delete (default_initName);
1307 isFortranParameter =
true;
1311 if (! isFortranParameter)
1317 ROSE_ASSERT(initName != NULL);
1318 ROSE_ASSERT((initName->get_declptr())!=NULL);
1336 unsetNodesMarkedAsModified(varDecl);
1352#define DEBUG_BUILD_VARIABLE_DECLARATION 0
1354#if DEBUG_BUILD_VARIABLE_DECLARATION
1355 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): name = %s scope = %p varInit = %p \n",name.str(),scope,varInit);
1358 printf (
" --- scope = %p = %s \n",scope,scope->
class_name().c_str());
1364#if DEBUG_BUILD_VARIABLE_DECLARATION
1365 printf (
"Scope determined from the SageBuilder::topScopeStack() \n");
1370 ROSE_ASSERT (scope != NULL);
1371 ROSE_ASSERT(type != NULL);
1376#if DEBUG_BUILD_VARIABLE_DECLARATION
1377 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): variableSymbol = %p \n",variableSymbol);
1382 if (variableSymbol == NULL)
1385#if DEBUG_BUILD_VARIABLE_DECLARATION
1387 ROSE_ASSERT(tmp_initializedName != NULL);
1388 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): variableSymbol == NULL: varDecl = %p: initializedName = %p = %s \n",varDecl,tmp_initializedName,tmp_initializedName->get_name().str());
1389 printf (
" --- tmp_initializedName->get_initptr() = %p \n",tmp_initializedName->get_initptr());
1392 if (builtFromUseOnly ==
true)
1394#if DEBUG_BUILD_VARIABLE_DECLARATION
1395 printf (
"In buildVariableDeclaration_nfi(): this is the first reference to this variable: building a new SgVariableDeclaration: varDecl = %p name = %s \n",varDecl,name.str());
1397 varDecl->set_builtFromUseOnly(
true);
1403 ROSE_ASSERT(initializedName != NULL);
1407#if DEBUG_BUILD_VARIABLE_DECLARATION
1408 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): initializedName->get_parent() = %p \n",initializedName->
get_parent());
1411 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): initializedName->get_parent() = %p = %s \n",initializedName->
get_parent(),initializedName->
get_parent()->
class_name().c_str());
1413 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): associatedVariableDeclaration = %p \n",associatedVariableDeclaration);
1415#if DEBUG_BUILD_VARIABLE_DECLARATION
1418 if (associatedVariableDeclaration != NULL && associatedVariableDeclaration->
get_parent() != NULL)
1420 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): associatedVariableDeclaration->get_parent() = %p = %s \n",
1425#if DEBUG_BUILD_VARIABLE_DECLARATION
1426 printf (
"associatedVariableDeclaration = %p \n",associatedVariableDeclaration);
1427 if (associatedVariableDeclaration != NULL)
1429 printf (
"associatedVariableDeclaration->get_builtFromUseOnly() = %s \n",associatedVariableDeclaration->get_builtFromUseOnly() ?
"true" :
"false");
1434 bool reuseTheAssociatedVariableDeclaration = ((associatedVariableDeclaration != NULL) && (associatedVariableDeclaration->get_builtFromUseOnly() ==
true));
1435 if (reuseTheAssociatedVariableDeclaration ==
true)
1441 ROSE_ASSERT(associatedVariableDeclaration != NULL);
1444 varDecl = associatedVariableDeclaration;
1447 varDecl->set_builtFromUseOnly(
false);
1458#if DEBUG_BUILD_VARIABLE_DECLARATION
1459 if (
variable->get_initptr() != NULL)
1461 printf (
"Found initializer associated with variable declaration being reused: variable = %p name = %s \n",
variable,
variable->get_name().str());
1469 ROSE_ASSERT(reuseTheAssociatedVariableDeclaration ==
false);
1475 if (associatedVariableDeclaration == NULL)
1477 ROSE_ASSERT(initializedName->
get_parent() != NULL);
1479 if (scopeStatement != NULL)
1481#if DEBUG_BUILD_VARIABLE_DECLARATION
1482 printf (
"scopeStatement = %p = %s \n",scopeStatement,scopeStatement->
class_name().c_str());
1487#if DEBUG_BUILD_VARIABLE_DECLARATION
1499#if DEBUG_BUILD_VARIABLE_DECLARATION
1500 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): initializedName->get_scope() = %p = %s \n",initializedName->get_scope(),initializedName->get_scope()->
class_name().c_str());
1503 if (scopeStatement != NULL)
1505 additional_variable = initializedName;
1509 if (additional_variable->get_initptr() != NULL)
1511#if DEBUG_BUILD_VARIABLE_DECLARATION
1512 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): borrowed SgInitializedName is alread initialized \n");
1513 printf (
" --- additional_variable->get_initptr() = %p \n",additional_variable->get_initptr());
1514 printf (
" --- varInit = %p \n",varInit);
1521 additional_variable->set_initptr(varInit);
1524#if DEBUG_BUILD_VARIABLE_DECLARATION || 0
1525 printf (
" --- additional_variable->get_scope() = %p = %s \n",additional_variable->get_scope(),additional_variable->get_scope()->
class_name().c_str());
1526 printf (
" --- Reusing the SgInitializedName (not associated with a previous SgVariableDeclaration where the parent is a SgScopeStatement) \n");
1531#if DEBUG_BUILD_VARIABLE_DECLARATION
1532 printf (
" --- Building a new SgInitializedName \n");
1537#if DEBUG_BUILD_VARIABLE_DECLARATION
1538 ROSE_ASSERT(initializedName->get_scope() != NULL);
1542 if (additional_variable != initializedName)
1544 additional_variable->set_prev_decl_item(initializedName);
1549#if DEBUG_BUILD_VARIABLE_DECLARATION
1550 ROSE_ASSERT(initializedName->
get_parent() != NULL);
1552 ROSE_ASSERT(additional_variable->
get_parent() != NULL);
1553 printf (
"additional_variable->get_parent() = %p = %s \n",additional_variable->
get_parent(),additional_variable->
get_parent()->
class_name().c_str());
1558 ASSERT_not_null(initializedName->get_scope());
1561 if (additional_variable != initializedName)
1563 additional_variable->set_scope(initializedName->get_scope());
1567#if DEBUG_BUILD_VARIABLE_DECLARATION
1568 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): After sharing the exisitng SgInitializedName: initializedName = %p = %s \n",initializedName,initializedName->get_name().str());
1569 printf (
" --- initializedName->get_initptr() = %p \n",initializedName->get_initptr());
1570 printf (
" --- additional_variable->get_initptr() = %p \n",additional_variable->get_initptr());
1580 ASSERT_not_null(varDecl);
1582 varDecl->get_declarationModifier().get_storageModifier().set_modifier(sm);
1603 ASSERT_not_null(initName);
1604 ASSERT_not_null(initName->get_declptr());
1606 if (initName->get_scope())
1609#if DEBUG_BUILD_VARIABLE_DECLARATION
1610 printf (
"WARNING: Note in buildVariableDeclaration_nfi(): initName->get_scope() == NULL \n");
1618 SgVariableDefinition* variableDefinition_original = isSgVariableDefinition(initName->get_declptr());
1619 ASSERT_not_null(variableDefinition_original);
1634 unsetNodesMarkedAsModified(varDecl);
1636 ASSERT_not_null(varDecl);
1638#if DEBUG_BUILD_VARIABLE_DECLARATION
1639 printf (
"Leaving buildVariableDeclaration_nfi(): varDecl = %p varDecl->get_parent() = %p \n",varDecl,varDecl->
get_parent());
1651 ROSE_ASSERT (decl!=NULL);
1652 ROSE_ASSERT (init_name !=NULL);
1656 if (!isSgFunctionType(init_name->get_type()))
1662 ROSE_ASSERT (copyOfFileInfo != NULL);
1666 ROSE_ASSERT (defn_stmt != NULL);
1684 ROSE_ASSERT(defn_stmt != NULL);
1703 ROSE_ASSERT (scope != NULL);
1704 ROSE_ASSERT(type != NULL);
1707 ROSE_ASSERT(varDecl);
1723 ROSE_ASSERT(initName);
1724 ROSE_ASSERT((initName->get_declptr())!=NULL);
1729 SgVariableDefinition* variableDefinition_original = isSgVariableDefinition(initName->get_declptr());
1730 ROSE_ASSERT(variableDefinition_original != NULL);
1742 SgTemplateArgumentPtrList & tpl_args
1749#define DEBUG__SageBuilder__buildTemplateVariableInstantiation_nfi 0
1755 SgTemplateArgumentPtrList & tpl_args
1757#if DEBUG__SageBuilder__buildTemplateVariableInstantiation_nfi
1758 std::cout <<
"SageBuilder::buildTemplateVariableInstantiation_nfi" << std::endl;
1759 std::cout <<
" name = " << name.getString() << std::endl;
1760 std::cout <<
" type = " << std::hex << type <<
" : " << ( type ? type->
class_name() :
"" ) << std::endl;
1761 std::cout <<
" scope = " << std::hex << scope <<
" : " << ( scope ? scope->
class_name() :
"" ) << std::endl;
1763 ROSE_ASSERT (type != NULL);
1765 SgName nameWithoutTemplateArguments = name;
1767#if DEBUG__SageBuilder__buildTemplateVariableInstantiation_nfi
1768 std::cout <<
" nameWithoutTemplateArguments = " << nameWithoutTemplateArguments.getString() << std::endl;
1769 std::cout <<
" nameWithTemplateArguments = " << nameWithTemplateArguments.getString() << std::endl;
1772 ROSE_ASSERT (scope != NULL);
1773 ROSE_ASSERT(type != NULL);
1776 ROSE_ASSERT(varDecl);
1777#if DEBUG__SageBuilder__buildTemplateVariableInstantiation_nfi
1778 std::cout <<
" varDecl = " << std::hex << varDecl <<
" : " << ( varDecl ? varDecl->
class_name() :
"" ) << std::endl;
1782 varDecl->get_templateArguments() = tpl_args;
1793 ROSE_ASSERT(initName);
1794 ROSE_ASSERT((initName->get_declptr()) !=
nullptr);
1795#if DEBUG__SageBuilder__buildTemplateVariableInstantiation_nfi
1796 std::cout <<
" initName = " << std::hex << initName <<
" : " << ( initName ? initName->
class_name() :
"" ) << std::endl;
1799 SgVariableDefinition* variableDefinition_original = isSgVariableDefinition(initName->get_declptr());
1800 ROSE_ASSERT(variableDefinition_original != NULL);
1837 ROSE_ASSERT (base_type != NULL);
1845 ASSERT_not_null(scope);
1851 ASSERT_not_null(stripedBaseType);
1853 SgNamedType* namedType = isSgNamedType(stripedBaseType);
1862 base_decl = namedType->get_declaration();
1865 ROSE_ASSERT(base_decl != NULL);
1872#ifndef ROSE_USE_CLANG_FRONTEND
1885 if (declaration && !isSgAdaDiscriminatedTypeDecl(declaration))
1887 mprintf (
"Found a valid declaration = %p = %s \n",declaration,declaration->
class_name().c_str());
1893 ROSE_ASSERT(parent_scope != NULL);
1900 ROSE_ASSERT(type_decl != NULL);
1920 SgClassDeclaration* def_class = isSgClassDeclaration(base_class->get_definingDeclaration());
1921 SgClassDeclaration* nondef_class = isSgClassDeclaration(base_class->get_firstNondefiningDeclaration());
1923 if (has_defining_base)
1925 if (def_class != NULL)
1931 if (nondef_class != NULL)
1940 ROSE_ASSERT(typedef_symbol);
1953 ROSE_ASSERT (base_type != NULL);
1961 ROSE_ASSERT(scope != NULL);
1974 if (declaration != NULL)
1979 ROSE_ASSERT(parent_scope != NULL);
1982 SgNamedType* namedType = isSgNamedType(base_type);
1986 if (namedType != NULL)
1991 ROSE_ASSERT(declarationStatement != NULL);
1992 if (declarationStatement != NULL)
1995 if (templateInstantiationDecl != NULL)
1997 SgName name = templateInstantiationDecl->get_name();
1999 if (scope->lookup_template_typedef_symbol(name) != NULL)
2001 printf (
"Error: it appears that there is already a symbol in scope = %p = %s for name = %s \n",scope,scope->
class_name().c_str(),name.str());
2003 ROSE_ASSERT(scope->lookup_template_typedef_symbol(name) == NULL);
2011 ROSE_ASSERT(type_decl != NULL);
2018 ROSE_ASSERT(type_decl->get_type() == NULL);
2021 ROSE_ASSERT(typedefType != NULL);
2024 type_decl->set_type(typedefType);
2027 ROSE_ASSERT(type_decl->get_type() != NULL);
2037 SgNamedType* namedType = isSgNamedType(base_type);
2041 if (namedType != NULL)
2046 ROSE_ASSERT(declarationStatement != NULL);
2047 if (declarationStatement != NULL)
2050 if (templateInstantiationDecl != NULL)
2052 SgName name = templateInstantiationDecl->get_name();
2054 if (scope->lookup_template_typedef_symbol(name) != NULL)
2056 printf (
"Error: it appears that there is already a symbol in scope = %p = %s for name = %s \n",scope,scope->
class_name().c_str(),name.str());
2058 ROSE_ASSERT(scope->lookup_template_typedef_symbol(name) == NULL);
2064 ROSE_ASSERT(typedef_symbol);
2069 ROSE_ASSERT(scope->lookup_template_typedef_symbol(name) != NULL);
2074#define DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi 0
2080 SgTemplateArgumentPtrList & templateArgumentsList
2082#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2083 std::cout <<
"SageBuilder::buildTemplateInstantiationTypedefDeclaration_nfi" << std::endl;
2084 std::cout <<
" name = " << name.getString() << std::endl;
2085 std::cout <<
" base_type = " << std::hex << base_type <<
" : " << ( base_type ? base_type->
class_name() :
"" ) << std::endl;
2087 ROSE_ASSERT (base_type != NULL);
2089 SgName nameWithoutTemplateArguments = name;
2091#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2092 std::cout <<
" nameWithoutTemplateArguments = " << nameWithoutTemplateArguments.getString() << std::endl;
2093 std::cout <<
" nameWithTemplateArguments = " << nameWithTemplateArguments.getString() << std::endl;
2097 ROSE_ASSERT(scope != NULL);
2109 if (declaration != NULL)
2114 ROSE_ASSERT(parent_scope != NULL);
2119 ROSE_ASSERT(templateTypedefDeclaration != NULL);
2121 SgTemplateTypedefSymbol* prexisting_template_typedef_symbol = scope->lookup_template_typedef_symbol(nameWithTemplateArguments);
2122 if (prexisting_template_typedef_symbol != NULL)
2125 ROSE_ASSERT(declarationStatement != NULL);
2126#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2127 std::cout <<
" declarationStatement = " << declarationStatement <<
" : " << declarationStatement->
class_name() << std::endl;
2130 ROSE_ASSERT(return_declaration != NULL);
2131 return return_declaration;
2133 ROSE_ASSERT(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) == NULL);
2140 ROSE_ASSERT(type_decl != NULL);
2141 ROSE_ASSERT(type_decl->get_base_type() == base_type);
2143#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2144 std::cout <<
" type_decl = " << std::hex << type_decl <<
" : " << ( type_decl ? type_decl->
class_name() :
"" ) << std::endl;
2145 std::cout <<
" ->get_base_type() = " << std::hex << type_decl->get_base_type() <<
" : " << ( type_decl->get_base_type() ? type_decl->get_base_type()->
class_name() :
"" ) << std::endl;
2150 ROSE_ASSERT(type_decl->get_type() == NULL);
2154 type_decl->set_templateName(nameWithoutTemplateArguments);
2156 ROSE_ASSERT(scope != NULL);
2161 ROSE_ASSERT(type_decl->get_name() == nameWithTemplateArguments);
2164 if (scope->lookup_template_typedef_symbol(nameWithTemplateArguments) != NULL)
2166 printf (
"Error: it appears that there is already a symbol in scope = %p = %s for name = %s \n",scope,scope->
class_name().c_str(),name.str());
2168 ROSE_ASSERT(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) == NULL);
2172 ROSE_ASSERT(type_decl->get_type() == NULL);
2175 ROSE_ASSERT(new_typedefType != NULL);
2177 type_decl->set_type(new_typedefType);
2178 ROSE_ASSERT(type_decl->get_type() != NULL);
2179 ROSE_ASSERT(type_decl->
get_scope() != NULL);
2192 ROSE_ASSERT(type_decl->get_type() != NULL);
2193 ROSE_ASSERT(scope != NULL);
2195#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2196 std::cout <<
" type_decl = " << std::hex << type_decl <<
" : " << ( type_decl ? type_decl->
class_name() :
"" ) << std::endl;
2197 std::cout <<
" ->get_base_type() = " << std::hex << type_decl->get_base_type() <<
" : " << ( type_decl->get_base_type() ? type_decl->get_base_type()->
class_name() :
"" ) << std::endl;
2202 if (scope->lookup_template_typedef_symbol(nameWithTemplateArguments) != NULL)
2204 printf (
"Error: it appears that there is already a symbol in scope = %p = %s for nameWithTemplateArguments = %s \n",scope,scope->
class_name().c_str(),nameWithTemplateArguments.str());
2206 ROSE_ASSERT(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) == NULL);
2209 ROSE_ASSERT(typedef_symbol);
2211 scope->
insert_symbol(nameWithTemplateArguments,typedef_symbol);
2214 ROSE_ASSERT(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) != NULL);
2217#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2218 std::cout <<
" type_decl = " << std::hex << type_decl <<
" : " << ( type_decl ? type_decl->
class_name() :
"" ) << std::endl;
2219 std::cout <<
" ->get_base_type() = " << std::hex << type_decl->get_base_type() <<
" : " << ( type_decl->get_base_type() ? type_decl->get_base_type()->
class_name() :
"" ) << std::endl;
2235 ROSE_ASSERT (parameterList);
2251 if (in10)
appendArg(parameterList, in10);
2253 return parameterList;
2259 ROSE_ASSERT (parameterList);
2265 return parameterList;
2272 ROSE_ASSERT (ctorInitList);
2278 return ctorInitList;
2287 if (paralist == NULL)
2289 printf (
"WARNING: In buildFunctionParameterTypeList(): Accepting NULL input and returning NULL pointer. \n");
2299 ROSE_ASSERT(typePtrList != NULL);
2301 SgInitializedNamePtrList args = paralist->
get_args();
2302 SgInitializedNamePtrList::const_iterator i;
2303 for(i = args.begin(); i != args.end(); i++)
2304 (typePtrList->
get_arguments()).push_back( (*i)->get_type() );
2315 if (expList ==NULL)
return NULL;
2316 SgExpressionPtrList expPtrList = expList->get_expressions();
2319 ROSE_ASSERT(typePtrList);
2321 SgExpressionPtrList::const_iterator i;
2322 for (i=expPtrList.begin();i!=expPtrList.end();i++)
2337 ROSE_ASSERT(typePtrList);
2341 if (type0 != NULL) types.push_back(type0);
2342 if (type1 != NULL) types.push_back(type1);
2343 if (type2 != NULL) types.push_back(type2);
2344 if (type3 != NULL) types.push_back(type3);
2345 if (type4 != NULL) types.push_back(type4);
2346 if (type5 != NULL) types.push_back(type5);
2347 if (type6 != NULL) types.push_back(type6);
2348 if (type7 != NULL) types.push_back(type7);
2360 ROSE_ASSERT(return_type != NULL);
2363 ROSE_ASSERT(typeList != NULL);
2366 ROSE_ASSERT(fTable);
2372 SgFunctionType* funcType = isSgFunctionType(fTable->lookup_function_type(typeName));
2374 if (funcType == NULL)
2378 ROSE_ASSERT(funcType);
2380 if (typeList != NULL)
2383 if (funcType->get_argument_list() != NULL)
2385 delete funcType->get_argument_list();
2386 funcType->set_argument_list(NULL);
2388 ROSE_ASSERT(funcType->get_argument_list() == NULL);
2390 funcType->set_argument_list(typeList);
2394 fTable->insert_function_type(typeName,funcType);
2412 ROSE_ASSERT(fTable != NULL);
2413 ROSE_ASSERT(typeList != NULL);
2416 SgType* typeInTable = fTable->lookup_function_type(typeName);
2419 if (typeInTable == NULL)
2421 bool has_ellipses =
false;
2424 ROSE_ASSERT(partialFunctionType != NULL);
2427 if (partialFunctionType->get_argument_list() != NULL)
2429 delete partialFunctionType->get_argument_list();
2430 partialFunctionType->set_argument_list(NULL);
2432 ROSE_ASSERT(partialFunctionType->get_argument_list() == NULL);
2439 partialFunctionType->set_argument_list(typeList);
2441 ROSE_ASSERT(partialFunctionType->get_argument_list() != NULL);
2450 partialFunctionType->set_argument_list(NULL);
2453 delete partialFunctionType;
2454 partialFunctionType = NULL;
2459 ROSE_ASSERT(funcType->get_argument_list() != NULL);
2462 if (typeInTable ==
nullptr)
2464 ASSERT_not_null(funcType);
2465 fTable->insert_function_type(typeName,funcType);
2471 ASSERT_require(typeInTable != funcType);
2475 funcType = isSgMemberFunctionType(typeInTable);
2476 ASSERT_not_null(funcType);
2496 ROSE_ASSERT(return_type != NULL);
2497 ROSE_ASSERT(struct_name != NULL);
2498 ROSE_ASSERT(struct_name->
get_parent() != NULL);
2503 if (classDefinition == NULL && decl_scope == NULL)
2505 printf (
"Error: (classDefinition == NULL && decl_scope == NULL): struct_name = %p = %s name = %s \n",
2508 ROSE_ASSERT(classDefinition != NULL || decl_scope != NULL);
2511 if (classDefinition != NULL)
2515 else if (decl_scope != NULL)
2517 declaration = isSgDeclarationStatement(decl_scope->
get_parent());
2524 ROSE_ASSERT(declaration != NULL);
2526 if (typeList ==
nullptr) {
2527 printf (
"WARNING: typeList == NULL \n");
2533 ROSE_ASSERT(classDeclaration != NULL || nrdecl != NULL);
2535 SgType* classType = NULL;
2536 if (classDeclaration != NULL)
2538 classType = classDeclaration->get_type();
2540 else if (decl_scope != NULL)
2542 classType = nrdecl->get_type();
2548 ROSE_ASSERT(classType != NULL);
2556 ROSE_ASSERT(base_type != NULL);
2558 ROSE_ASSERT(classType != NULL);
2560 return pointerToMemberType;
2568 ASSERT_not_null(scope);
2577 if (type_symbol == NULL)
2580 ASSERT_not_null(type_decl);
2588 ROSE_ASSERT(type_symbol);
2604 type_decl = type_symbol->get_declaration();
2605 result = type_decl->get_type();
2607 ASSERT_not_null(result);
2617 ASSERT_not_null(argList);
2622 if (func_type->get_argument_list() != typeList)
2639 if (isSgMemberFunctionDeclaration(func) != NULL)
2641#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
2642 printf (
"WARNING: setting parent of function to match scope by default \n");
2646 ROSE_ASSERT(scope != NULL);
2648 if (isSgTemplateInstantiationMemberFunctionDecl(func) != NULL)
2656#if !ENFORCE_NO_FUNCTION_TEMPLATE_DECLARATIONS_IN_TEMPLATE_CLASS_INSTANTIATIONS
2663 if (isSgTemplateFunctionDeclaration(func) != NULL)
2665 if (isSgTemplateInstantiationMemberFunctionDecl(func) != NULL)
2667 ROSE_ASSERT(isSgTemplateClassDefinition(scope) != NULL);
2679template <
class actualFunction>
2681SageBuilder::buildNondefiningFunctionDeclaration_T (
2684 SgTemplateArgumentPtrList* templateArgumentsList, SgTemplateParameterPtrList* templateParameterList,
2695 if (scope ==
nullptr)
2699 ASSERT_not_null(scope);
2701 if (XXX_name.is_null() ==
true)
2704 mprintf (
"NOTE: In buildNondefiningFunctionDeclaration_T(): XXX_name.is_null() == true: This is a function with an empty name (allowed as compiler generated initializing constructors to un-named classes, structs, and unions in C++ \n");
2707 SgName nameWithoutTemplateArguments = XXX_name;
2708 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
2710 bool buildTemplateInstantiation = ((VariantT)actualFunction::static_variant == V_SgTemplateInstantiationFunctionDecl || (VariantT)actualFunction::static_variant == V_SgTemplateInstantiationMemberFunctionDecl);
2713 bool buildTemplateDeclaration = ((VariantT)actualFunction::static_variant == V_SgTemplateFunctionDeclaration || (VariantT)actualFunction::static_variant == V_SgTemplateMemberFunctionDeclaration);
2717 if (buildTemplateInstantiation ==
true)
2719 ASSERT_not_null(templateArgumentsList);
2724 if (nameWithTemplateArguments.is_null() ==
true)
2728 mprintf (
"NOTE: In buildNondefiningFunctionDeclaration_T(): nameWithTemplateArguments.is_null() == true: This is a function with an empty name (allowed as compiler generated initializing constructors to un-named classes, structs, and unions in C++ \n");
2731 if (nameWithoutTemplateArguments.is_null() ==
true)
2735 mprintf (
"NOTE: In buildNondefiningFunctionDeclaration_T(): nameWithoutTemplateArguments.is_null() == true: This is a function with an empty name (allowed as compiler generated initializing constructors to un-named classes, structs, and unions in C++ \n");
2738 ASSERT_not_null(return_type);
2739 ASSERT_not_null(paralist);
2745#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
2746 printf (
"Warning: In buildNondefiningFunctionDeclaration_T(): nameWithoutTemplateArguments = %s nameWithTemplateArguments = %s \n",nameWithoutTemplateArguments.str(),nameWithTemplateArguments.str());
2756 if (isMemberFunction ==
true)
2766 ASSERT_not_null(func_type);
2769 actualFunction* func =
nullptr;
2787 func_symbol = scope->find_symbol_by_type_of_function<actualFunction>(nameWithTemplateArguments,func_type,templateParameterList,templateArgumentsList);
2790 if (func_symbol == NULL)
2793 ROSE_ASSERT(func_type != NULL);
2797 if (func_symbol != NULL)
2799 switch((VariantT)actualFunction::static_variant)
2801 case V_SgFunctionDeclaration:
2802 case V_SgProcedureHeaderStatement:
2803 case V_SgTemplateInstantiationFunctionDecl:
2805 ROSE_ASSERT(isSgFunctionSymbol(func_symbol) != NULL);
2808 case V_SgMemberFunctionDeclaration:
2809 case V_SgTemplateInstantiationMemberFunctionDecl:
2811 ROSE_ASSERT(isSgMemberFunctionSymbol(func_symbol) != NULL);
2814 case V_SgTemplateFunctionDeclaration:
2816 ROSE_ASSERT(isSgTemplateFunctionSymbol(func_symbol) != NULL);
2819 case V_SgTemplateMemberFunctionDeclaration:
2821 ROSE_ASSERT(isSgTemplateMemberFunctionSymbol(func_symbol) != NULL);
2827 printf (
"default reach in buildNondefiningFunctionDeclaration_T(): variantT(actualFunction::static_variant) = %d \n",actualFunction::static_variant);
2834 ROSE_ASSERT(scope != NULL);
2835 if ( isSgGlobal(scope) != NULL
2836 && scope != func_symbol->get_scope()
2838 && !scope->symbol_exists(nameWithTemplateArguments, func_symbol) )
2840 scope->
insert_symbol(nameWithTemplateArguments, func_symbol);
2844 if (func_symbol == NULL)
2846 func =
new actualFunction (nameWithTemplateArguments,func_type,NULL);
2847 ROSE_ASSERT(func != NULL);
2850 func->get_declarationModifier().get_storageModifier().set_modifier(sm);
2853 ROSE_ASSERT(func->get_file_info() == NULL);
2856 func->set_scope(scope);
2859 checkThatNoTemplateInstantiationIsDeclaredInTemplateDefinitionScope(func,scope);
2862 ROSE_ASSERT(func->get_parameterList() != NULL);
2870 if (isSgMemberFunctionDeclaration(func))
2875 if (isSgTemplateMemberFunctionDeclaration(func) != NULL)
2880 ROSE_ASSERT(memberFunctionDeclaration != NULL);
2884 ROSE_ASSERT(func_symbol != NULL);
2885 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
2890 if (isSgTemplateFunctionDeclaration(func))
2896 ROSE_ASSERT(templatedeclaration != NULL);
2898 ROSE_ASSERT(template_symbol != NULL);
2899 ROSE_ASSERT(template_symbol->get_symbol_basis() != NULL);
2900 func_symbol = template_symbol;
2905 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
2909 ROSE_ASSERT(func_symbol != NULL);
2910 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
2911 scope->
insert_symbol(nameWithTemplateArguments, func_symbol);
2913 ROSE_ASSERT(func->get_symbol_from_symbol_table() != NULL);
2915 if (isSgFunctionDeclaration(func) == NULL)
2921 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
2929 ROSE_ASSERT(buildTemplateDeclaration ==
false || templateParameterList != NULL);
2935 ROSE_ASSERT(scope->lookup_function_symbol(nameWithTemplateArguments) != NULL ||
2936 scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL ||
2937 scope->lookup_template_member_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
2939#if BUILDER_MAKE_REDUNDANT_CALLS_TO_SYMBOL_TABLE_LOOKUP
2943 if (scope->lookup_function_symbol(nameWithTemplateArguments,templateArgumentList) == NULL || scope->lookup_template_symbol(nameWithTemplateArguments,templateParameterList,NULL) != NULL)
2946 printf (
"Need to make sure this is a template function declaration... \n");
2952 ROSE_ASSERT(func->get_scope() != NULL);
2954 if (isSgFunctionDeclaration(func) == NULL)
2960 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
2962 func->set_firstNondefiningDeclaration(func);
2963 func->set_definingDeclaration(NULL);
2966 ROSE_ASSERT(func->get_firstNondefiningDeclaration() == func);
2968 ROSE_ASSERT(func->get_definingDeclaration() == NULL);
2972 if (testMemberDecl != NULL)
2974 ROSE_ASSERT(testMemberDecl->
get_scope() != NULL);
2975 ROSE_ASSERT(testMemberDecl->get_class_scope() != NULL);
2976 ROSE_ASSERT(testMemberDecl->get_associatedClassDeclaration() != NULL);
2981 ROSE_ASSERT(func_symbol != NULL);
2983 ROSE_ASSERT(scope != NULL);
2991 SgNode* associatedSymbolBasis = func_symbol->get_symbol_basis();
2992 ROSE_ASSERT(associatedSymbolBasis != NULL);
2995 ROSE_ASSERT(associatedDeclaration != NULL);
2999 if (functionDeclaration != NULL)
3001 func_type = functionDeclaration->get_type();
3005 if (templateFunctionDeclaration != NULL)
3010 printf (
"This code should not be reachable! \n");
3013 func_type = templateFunctionDeclaration->get_type();
3021 ROSE_ASSERT(func_type != NULL);
3023 func =
new actualFunction(nameWithTemplateArguments,func_type,NULL);
3024 ROSE_ASSERT(func != NULL);
3026#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3033 func->set_scope(scope);
3035 ROSE_ASSERT(func->get_symbol_from_symbol_table() == NULL);
3038 checkThatNoTemplateInstantiationIsDeclaredInTemplateDefinitionScope(func,scope);
3044 if (functionDeclaration != NULL)
3046 prevDecl = functionDeclaration;
3050 ROSE_ASSERT(templateFunctionDeclaration != NULL);
3051 prevDecl = templateFunctionDeclaration;
3054 ROSE_ASSERT(prevDecl != NULL);
3061 printf (
"WARNING: Switching declaration in functionSymbol to point to the non-defining declaration \n");
3062 function_symbol->set_declaration(isSgFunctionDeclaration(func));
3063 ROSE_ASSERT(function_symbol->get_declaration() != NULL);
3068 if (nondefiningDeclaration == NULL)
3070 nondefiningDeclaration = func;
3073 ROSE_ASSERT(nondefiningDeclaration != NULL);
3074 ROSE_ASSERT(func != NULL);
3075 ROSE_ASSERT(prevDecl != NULL);
3077 func->set_firstNondefiningDeclaration(nondefiningDeclaration);
3081 ROSE_ASSERT(func->get_firstNondefiningDeclaration()->get_symbol_from_symbol_table() != NULL);
3085 if (func->get_symbol_from_symbol_table() == NULL)
3087 ROSE_ASSERT(nondefiningDeclaration != NULL);
3088 ROSE_ASSERT(func->get_firstNondefiningDeclaration() == nondefiningDeclaration);
3092 ROSE_ASSERT(scope != NULL);
3093 ROSE_ASSERT(func->get_scope() != NULL);
3094 ROSE_ASSERT(func->get_scope() == scope);
3098 if (testMemberDecl != NULL)
3100 ROSE_ASSERT(testMemberDecl->
get_scope() != NULL);
3101 ROSE_ASSERT(testMemberDecl->get_associatedClassDeclaration() != NULL);
3105 if (isSgFunctionDeclaration(func) == NULL)
3116 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3120 ROSE_ASSERT(func != NULL);
3122 ROSE_ASSERT(func->get_file_info() == NULL);
3124 ROSE_ASSERT(func->get_firstNondefiningDeclaration() != NULL);
3125 ROSE_ASSERT(func_symbol != NULL);
3126 ROSE_ASSERT(func_symbol->get_symbol_basis() == func->get_firstNondefiningDeclaration());
3127 ROSE_ASSERT(func->get_symbol_from_symbol_table() != NULL || func->get_firstNondefiningDeclaration()->get_symbol_from_symbol_table() != NULL);
3130 ROSE_ASSERT(func->get_parameterList() != NULL);
3131 delete func->get_parameterList();
3132 func->set_parameterList(NULL);
3135 if (buildTemplateInstantiation ==
true)
3141 if (buildTemplateDeclaration ==
true)
3147 ROSE_ASSERT(templateFunctionDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateFunctionDeclaration->get_templateParameters().size()));
3150 ROSE_ASSERT(templateMemberFunctionDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateMemberFunctionDeclaration->get_templateParameters().size()));
3159 i_name->set_scope(scope);
3165#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3167 if (SourcePositionClassificationMode != e_sourcePositionTransformation)
3169 detectTransformations_local(paralist);
3173 ASSERT_not_null(scope);
3174 ASSERT_not_null(func->get_scope());
3175 ASSERT_require(func->get_scope() == scope);
3182#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
3183 printf (
"Warning: SageBuilder::buildNondefiningFunctionDeclaration_T(): scope parameter may not be the same as the topScopeStack() (e.g. for member functions) \n");
3188 func->set_parent(scope);
3189 ASSERT_not_null(func->get_firstNondefiningDeclaration());
3194 ROSE_ASSERT(func->get_file_info() == NULL);
3199 ROSE_ASSERT(func->get_file_info() != NULL);
3201#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3203 if (SourcePositionClassificationMode != e_sourcePositionTransformation)
3205 detectTransformations_local(func);
3215 ROSE_ASSERT (f_func != NULL);
3229 ROSE_ASSERT(func->get_firstNondefiningDeclaration() != NULL);
3230 SgSymbol* symbol_from_first_nondefining_function = func->get_firstNondefiningDeclaration()->get_symbol_from_symbol_table();
3231 ROSE_ASSERT(symbol_from_first_nondefining_function != NULL);
3234 if (func != func->get_firstNondefiningDeclaration())
3236 SgSymbol* symbol_from_nondefining_function = func->get_symbol_from_symbol_table();
3237 ROSE_ASSERT(symbol_from_nondefining_function == NULL);
3241 if (isSgFunctionDeclaration(func) == NULL)
3247 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3253#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3255 if (SourcePositionClassificationMode !=e_sourcePositionTransformation)
3257 detectTransformations_local(func);
3262 if (functionConstVolatileFlags & SgMemberFunctionType::e_restrict)
3264 func->get_declarationModifier().get_typeModifier().setRestrict();
3267 unsetNodesMarkedAsModified(func);
3278 ROSE_ASSERT(funcdecl!=NULL);
3279 SgName name=funcdecl->get_name();
3281 SgType* return_type = funcType->get_return_type();
3286 ROSE_ASSERT(funcType== ref_funcType);
3291 returnFunction->set_linkage(funcdecl->get_linkage());
3292 if (funcdecl->get_declarationModifier().get_storageModifier().
isExtern() ==
true)
3294 returnFunction->get_declarationModifier().get_storageModifier().
setExtern();
3297 ROSE_ASSERT (returnFunction->get_linkage() == funcdecl->get_linkage());
3298 ROSE_ASSERT (returnFunction->get_declarationModifier().get_storageModifier().
isExtern() ==
3299 funcdecl->get_declarationModifier().get_storageModifier().
isExtern());
3308 return returnFunction;
3317 result = buildNondefiningFunctionDeclaration_T <SgProcedureHeaderStatement> (name,return_type,paralist,
false, scope, decoratorList,
false, NULL, NULL, sm);
3322 if (buildTemplateInstantiation ==
true)
3324 result = buildNondefiningFunctionDeclaration_T <SgTemplateInstantiationFunctionDecl> (name,return_type,paralist,
false, scope, decoratorList,
false, templateArgumentsList, NULL, sm);
3328 result = buildNondefiningFunctionDeclaration_T <SgFunctionDeclaration> (name,return_type,paralist,
false, scope, decoratorList,
false, NULL, NULL, sm);
3341 unsigned int memberFunctionModifiers = 0;
3355 unsigned int memberFunctionModifiers = 0;
3362 if (member_func_symbol != NULL)
3364 nondefining_decl = member_func_symbol->get_declaration();
3388 ROSE_ASSERT(result != NULL);
3404 ROSE_ASSERT(first_nondefining_declaration != NULL);
3408 SgTemplateFunctionDeclaration* result = buildDefiningFunctionDeclaration_T <SgTemplateFunctionDeclaration> (name,return_type,paralist,
false, scope, decoratorList, 0, first_nondefining_declaration, NULL);
3420 SgTemplateMemberFunctionDeclaration* result = buildDefiningFunctionDeclaration_T <SgTemplateMemberFunctionDeclaration> (name,return_type,paralist,
true, scope, decoratorList, functionConstVolatileFlags, first_nondefining_declaration, NULL);
3421 ROSE_ASSERT(result != NULL);
3423 ROSE_ASSERT(result->get_definition() != NULL);
3430 SgExprListExp* decoratorList,
unsigned int functionConstVolatileFlags,
bool buildTemplateInstantiation, SgTemplateArgumentPtrList* templateArgumentsList)
3437 if (buildTemplateInstantiation ==
true)
3440 result = buildNondefiningFunctionDeclaration_T <SgTemplateInstantiationMemberFunctionDecl> (name,return_type,paralist,
true,scope,decoratorList,functionConstVolatileFlags,templateArgumentsList,NULL,
SgStorageModifier::e_default);
3445 result = buildNondefiningFunctionDeclaration_T <SgMemberFunctionDeclaration> (name,return_type,paralist,
true,scope,decoratorList,functionConstVolatileFlags,NULL,NULL,
SgStorageModifier::e_default);
3447 ROSE_ASSERT(result != NULL);
3451 ROSE_ASSERT(ctor != NULL);
3458 ROSE_ASSERT(result->get_associatedClassDeclaration() != NULL);
3460 if (result->get_associatedClassDeclaration() == NULL)
3462 printf (
"Warning, must set the SgMemberFunctionDeclaration::associatedClassDeclaration \n");
3464 ROSE_ASSERT(scope != NULL);
3466 ROSE_ASSERT(classDefinition != NULL);
3468 ROSE_ASSERT(associatedDeclaration != NULL);
3469 SgClassDeclaration* associatedClassDeclaration = isSgClassDeclaration(associatedDeclaration);
3490 ROSE_ASSERT(result != NULL);
3492#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3496 detectTransformations_local(result);
3503 SgSymbol* associatedSymbol = scope->lookup_template_member_function_symbol(name,result->get_type(),templateParameterList);
3504 if (associatedSymbol == NULL)
3506 printf (
"ERROR: associatedSymbol == NULL \n");
3507 printf (
" --- result = %p = %s \n",result,result->
class_name().c_str());
3508 printf (
" --- scope = %p = %s \n",scope,scope->
class_name().c_str());
3509 printf (
" --- name = %s \n",name.str());
3510 printf (
" --- result->get_type() = %p = %s \n",result->get_type(),result->get_type()->
class_name().c_str());
3511 printf (
" --- result->get_type()->get_mangled() = %s \n",result->get_type()->get_mangled().str());
3513 ROSE_ASSERT(associatedSymbol != NULL);
3516 ROSE_ASSERT(ctor != NULL);
3524 ROSE_ASSERT(symbol_from_first_nondefining_function != NULL);
3530 ROSE_ASSERT(symbol_from_nondefining_function == NULL);
3533#if BUILDER_MAKE_REDUNDANT_CALLS_TO_SYMBOL_TABLE_LOOKUP
3536 if (scope->lookup_template_member_function_symbol(name,result->get_type(),templateParameterList) == NULL)
3538 printf (
"Error: scope->lookup_template_member_function_symbol(name,result->get_type()) == NULL (investigate this) \n");
3539 printf (
"--- function name = %s in scope = %p = %s result->get_type() = %p = %s \n",name.str(),scope,scope->
class_name().c_str(),result->get_type(),result->get_type()->
class_name().c_str());
3540 scope->
get_symbol_table()->
print(
"Error: scope->lookup_template_member_function_symbol(name,result->get_type()) == NULL (investigate this)");
3543 ROSE_ASSERT(scope->lookup_template_member_function_symbol(name,result->get_type(),templateParameterList) != NULL);
3545#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3549 detectTransformations_local(result);
3561 if (buildTemplateInstantiation ==
true)
3564 ROSE_ASSERT(templateInstantiationMemberFunctionDecl != NULL);
3568 ROSE_ASSERT(templateArgumentsList != NULL);
3569 string nameWithoutTemplateArguments = name;
3571 SgMemberFunctionType* func_type = isSgMemberFunctionType(first_nondefining_declaration->get_type());
3572 ROSE_ASSERT(func_type != NULL);
3576 if (func_symbol == NULL)
3578 printf (
"ERROR caught in SageBuilder::buildDefiningMemberFunctionDeclaration(): nameWithTemplateArguments = %s buildTemplateInstantiation = %s \n",nameWithTemplateArguments.c_str(),buildTemplateInstantiation ?
"true:" :
"false");
3579 printf (
"ERROR caught in SageBuilder::buildDefiningMemberFunctionDeclaration(): func_symbol == NULL for first_nondefining_declaration = %p = %s and func_type = %p = %s \n",
3580 templateInstantiationMemberFunctionDecl,templateInstantiationMemberFunctionDecl->
class_name().c_str(),func_type,func_type->
class_name().c_str());
3584 result = buildDefiningFunctionDeclaration_T <SgTemplateInstantiationMemberFunctionDecl> (name, return_type, paralist,
true, scope, decoratorList, functionConstVolatileFlags, templateInstantiationMemberFunctionDecl, templateArgumentsList);
3585 ROSE_ASSERT(isSgTemplateInstantiationMemberFunctionDecl(result) != NULL);
3586 ROSE_ASSERT(isSgTemplateInstantiationMemberFunctionDecl(result)->get_templateName().is_null() ==
false);
3590 ROSE_ASSERT(first_nondefining_declaration != NULL);
3596 result = buildDefiningFunctionDeclaration_T <SgMemberFunctionDeclaration> (name,return_type,paralist,
true,scope,decoratorList,functionConstVolatileFlags,first_nondefining_declaration, NULL);
3599 ROSE_ASSERT(result != NULL);
3603 ROSE_ASSERT(ctor != NULL);
3610 ROSE_ASSERT(result->get_associatedClassDeclaration() != NULL);
3620template <
class actualFunction>
3629#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
3630 printf (
"WARNING: This function for building defining function declarations has different semantics from that of the function to build defining class declarations. \n");
3633 ASSERT_not_null(first_nondefining_declaration);
3634 ASSERT_require(first_nondefining_declaration->get_firstNondefiningDeclaration() == first_nondefining_declaration);
3636 if (scope ==
nullptr)
3641 ASSERT_require(XXX_name.is_null() ==
false);
3642 ASSERT_not_null(scope);
3643 ASSERT_not_null(return_type);
3645 SgName nameWithoutTemplateArguments = XXX_name;
3646 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
3648 bool buildTemplateInstantiation = ((VariantT)actualFunction::static_variant == V_SgTemplateInstantiationFunctionDecl || (VariantT)actualFunction::static_variant == V_SgTemplateInstantiationMemberFunctionDecl);
3651 bool buildTemplateDeclaration = ((VariantT)actualFunction::static_variant == V_SgTemplateFunctionDeclaration || (VariantT)actualFunction::static_variant == V_SgTemplateMemberFunctionDeclaration);
3654 if (buildTemplateInstantiation ==
true)
3656 ASSERT_not_null(templateArgumentsList);
3658 SgTemplateArgumentPtrList & templateArgumentsList_from_first_nondefining_declaration = (isMemberFunction ==
false) ?
3660 isSgTemplateInstantiationMemberFunctionDecl(first_nondefining_declaration)->
get_templateArguments();
3662 ASSERT_not_null(templateArgumentsList);
3664 ASSERT_require(templateArgumentListsAreEquivalent ==
true);
3667 SgTemplateParameterPtrList* templateParameterList =
nullptr;
3668 if (buildTemplateDeclaration ==
true)
3671 templateParameterList = (isMemberFunction ==
false) ?
3672 &(isSgTemplateFunctionDeclaration(first_nondefining_declaration)->get_templateParameters()) :
3673 &(isSgTemplateMemberFunctionDeclaration(first_nondefining_declaration)->get_templateParameters());
3675 ASSERT_require(templateArgumentsList ==
nullptr);
3676 ASSERT_not_null(templateParameterList);
3679 if (buildTemplateInstantiation ==
true)
3681 ASSERT_not_null(templateArgumentsList);
3684 if (nameWithTemplateArguments ==
"insert < __normal_iterator< SgInitializedName ** , __type > > ")
3686 printf (
"In buildDefiningFunctionDeclaration_T(): Found function nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
3690 ASSERT_require(nameWithoutTemplateArguments.is_null() ==
false);
3691 ASSERT_require(nameWithTemplateArguments.is_null() ==
false);
3692 ASSERT_not_null(paralist);
3700 actualFunction* defining_func =
nullptr;
3706 ASSERT_not_null(first_nondefining_declaration);
3723 func_type = first_nondefining_declaration->get_type();
3724 ASSERT_not_null(func_type);
3727 ASSERT_require(func_type == first_nondefining_declaration->get_type());
3732 SgSymbol* func_symbol = scope->find_symbol_by_type_of_function<actualFunction>(nameWithTemplateArguments,func_type,templateParameterList,templateArgumentsList);
3735 ASSERT_not_null(func_symbol);
3737 if (func_symbol ==
nullptr)
3742 printf (
"Error: building a defining declaration requires that the associated non-defining declaration already exists and it's symbol found the the same scope's symbol table! \n");
3756 if (temp_function_sym !=
nullptr)
3758 func_type = temp_function_sym->get_declaration()->get_type();
3764 ASSERT_not_null(temp_template_sym);
3767 ASSERT_not_null(firstNondefiningFunctionDeclaration);
3770 defining_func =
new actualFunction(nameWithTemplateArguments,func_type,
nullptr);
3771 ASSERT_not_null(defining_func);
3773 ASSERT_not_null(firstNondefiningFunctionDeclaration);
3774 defining_func->set_firstNondefiningDeclaration(firstNondefiningFunctionDeclaration);
3780 if (decoratorList !=
nullptr)
3782 defining_func->set_decoratorList(decoratorList);
3787 defining_func->set_definingDeclaration(defining_func);
3791 ASSERT_not_null(func_body);
3797 if (templateFunctionDeclaration ==
nullptr)
3800 ASSERT_not_null(functionDeclaration);
3805 ASSERT_not_null(templateFunctionDeclaration);
3808 ASSERT_not_null(func_def);
3812 func_def->setCaseInsensitive(
true);
3813 func_body->setCaseInsensitive(
true);
3826 i_name->set_scope(func_def);
3829 ASSERT_not_null(variableSymbol);
3830 func_def->
insert_symbol(i_name->get_name(), variableSymbol);
3833 SgArrayType* arrayType = isSgArrayType(i_name->get_type());
3834 if (arrayType !=
nullptr)
3838 SgExpression* indexExpression = arrayType->get_index();
3840 if (indexExpression !=
nullptr)
3844 vector<SgVarRefExp* > varRefList;
3847 for (
size_t i = 0; i < varRefList.size(); i++)
3851 ASSERT_not_null(dimension_variableSymbol);
3852 ASSERT_require(dimension_variableSymbol != variableSymbol);
3855 SgSymbol* symbolFromLookup = func_def->lookup_symbol(dimension_variableSymbol->
get_name());
3856 if (symbolFromLookup !=
nullptr)
3858 SgVariableSymbol* variableSymbolFromLookup = isSgVariableSymbol(symbolFromLookup);
3859 ASSERT_not_null(variableSymbolFromLookup);
3861 varRefList[i]->set_symbol(variableSymbolFromLookup);
3862 ASSERT_require(dimension_variableSymbol != variableSymbol);
3873 defining_func->set_parent(scope);
3874 defining_func->set_scope(scope);
3876 ASSERT_not_null(defining_func->get_scope());
3878 checkThatNoTemplateInstantiationIsDeclaredInTemplateDefinitionScope(defining_func,scope);
3884 if (isMemberFunction ==
true)
3886 ASSERT_not_null(isSgMemberFunctionDeclaration(defining_func));
3893 if (buildTemplateInstantiation ==
true)
3899 if (buildTemplateDeclaration ==
true)
3905 ROSE_ASSERT(templateFunctionDeclaration ==
nullptr || (templateParameterList !=
nullptr && templateParameterList->size() == templateFunctionDeclaration->get_templateParameters().size()));
3907 ROSE_ASSERT(templateMemberFunctionDeclaration ==
nullptr || (templateParameterList !=
nullptr && templateParameterList->size() == templateMemberFunctionDeclaration->get_templateParameters().size()));
3911 if (functionConstVolatileFlags & SgMemberFunctionType::e_restrict)
3913 defining_func->get_declarationModifier().get_typeModifier().setRestrict();
3920 unsetNodesMarkedAsModified(defining_func);
3922 return defining_func;
3932 bool isTemplateInstantition = (templateInstantiationFunctionDecl != NULL) || (templateInstantiationMemberFunctionDecl != NULL);
3933 if (isTemplateInstantition ==
true)
3937 SgName templateNameWithoutArguments = name;
3943 bool isMemberFunction = (templateInstantiationMemberFunctionDecl != NULL);
3944 if (isMemberFunction ==
true)
3946 ROSE_ASSERT(templateInstantiationMemberFunctionDecl != NULL);
3947 ROSE_ASSERT(templateInstantiationFunctionDecl == NULL);
3949 if (templateInstantiationMemberFunctionDecl->
get_templateName().is_null() ==
true)
3953 templateInstantiationMemberFunctionDecl->
set_templateName(templateNameWithoutArguments);
3957 ROSE_ASSERT(templateInstantiationMemberFunctionDecl->
get_templateName().is_null() ==
false);
3961 ROSE_ASSERT(templateInstantiationFunctionDecl != NULL);
3962 ROSE_ASSERT(templateInstantiationMemberFunctionDecl == NULL);
3964 if (templateInstantiationFunctionDecl->
get_templateName().is_null() ==
true)
3968 templateInstantiationFunctionDecl->
set_templateName(templateNameWithoutArguments);
3973 ROSE_ASSERT(templateInstantiationFunctionDecl->
get_templateName().is_null() ==
false);
3983 if (buildTemplateInstantiation ==
true)
3987 ROSE_ASSERT(first_nondefining_declaration != NULL);
3989 func = buildDefiningFunctionDeclaration_T<SgTemplateInstantiationFunctionDecl>(name,return_type,paralist,
false,scope,decoratorList,0,templateInstantiationFunctionDecl, templateArgumentsList);
3991 ROSE_ASSERT(isSgTemplateInstantiationFunctionDecl(func) != NULL);
3992 ROSE_ASSERT(isSgTemplateInstantiationFunctionDecl(func)->get_templateName().is_null() ==
false);
3996 ROSE_ASSERT(first_nondefining_declaration != NULL);
3998 func = buildDefiningFunctionDeclaration_T<SgFunctionDeclaration>(name,return_type,paralist,
false,scope,decoratorList,0,first_nondefining_declaration, NULL);
4000 ROSE_ASSERT(isSgFunctionDeclaration(func) != NULL);
4013 ROSE_ASSERT(return_type != NULL);
4014 ROSE_ASSERT(parameter_list != NULL);
4025 if (func_symbol != NULL)
4027 nondefiningDeclaration = func_symbol->get_declaration();
4034 ROSE_ASSERT(nondefiningDeclaration != NULL);
4046 ASSERT_not_null(return_type);
4047 ASSERT_not_null(param_list);
4051 if (scope ==
nullptr) {
4057 nondef_decl = buildNondefiningFunctionDeclaration_T <SgProcedureHeaderStatement>
4058 ( name, return_type, param_list,
false, scope,
nullptr,
4061 ASSERT_not_null(isSgProcedureHeaderStatement(nondef_decl));
4064 nondef_decl->set_subprogram_kind(kind);
4073 ASSERT_not_null(return_type);
4074 ASSERT_not_null(parameter_list);
4078 if (scope ==
nullptr) {
4084 if (func_symbol ==
nullptr)
4086 nondef_decl = buildNondefiningFunctionDeclaration_T <SgProcedureHeaderStatement>
4087 ( name, return_type, parameter_list,
false, scope,
4092 nondef_decl = func_symbol->get_declaration();
4096 ASSERT_not_null(proc_header_stmt);
4109 ASSERT_not_null(firstNondefDecl);
4117 mlog[ERROR] <<
"unhandled subprogram kind for Fortran (or Jovial) function declaration:"
4122 func = buildDefiningFunctionDeclaration_T<SgProcedureHeaderStatement>(
SgName(name), returnType, params,
false,
4123 scope,
nullptr, 0U, firstNondefDecl,
nullptr);
4124 ASSERT_not_null(func);
4125 func->set_subprogram_kind(kind);
4136 ROSE_ASSERT(boolValue);
4147 ROSE_ASSERT(boolValue);
4155 ROSE_ASSERT(nullptrValue);
4157 return nullptrValue;
4163 ROSE_ASSERT(nullptrValue);
4165 return nullptrValue;
4171 ROSE_ASSERT(voidValue);
4179 ROSE_ASSERT(voidValue);
4187 ROSE_ASSERT(result);
4195 ROSE_ASSERT(result);
4203 ROSE_ASSERT(result);
4211 ROSE_ASSERT(result);
4220 ROSE_ASSERT(result);
4228 ROSE_ASSERT(result);
4237 ROSE_ASSERT(result);
4245 ROSE_ASSERT(result);
4254 ROSE_ASSERT(result);
4257 if (real_value != NULL)
4260 if (imaginary_value != NULL)
4263 ROSE_ASSERT(real_value == NULL || real_value->
get_parent() != NULL);
4264 ROSE_ASSERT(imaginary_value == NULL || imaginary_value->
get_parent() != NULL);
4272 ROSE_ASSERT(imaginary_value != NULL);
4274 ROSE_ASSERT(result != NULL);
4277 if (real_value != NULL)
4280 if (imaginary_value != NULL)
4283 ROSE_ASSERT(real_value == NULL || real_value->
get_parent() != NULL);
4284 ROSE_ASSERT(imaginary_value == NULL || imaginary_value->
get_parent() != NULL);
4293 ROSE_ASSERT(result);
4296 result->get_imaginary_value()->
set_parent(result);
4297 ROSE_ASSERT(result->get_imaginary_value()->
get_parent() != NULL);
4305 ROSE_ASSERT(imaginary_value != NULL);
4308 ROSE_ASSERT(result);
4312 ROSE_ASSERT(imaginary_value->
get_parent() != NULL);
4320 ROSE_ASSERT(imaginary_value != NULL);
4324 ROSE_ASSERT(result);
4327 ROSE_ASSERT(imaginary_value->
get_parent() != NULL);
4352 ROSE_ASSERT(result);
4360 ROSE_ASSERT(result);
4368 ROSE_ASSERT(result);
4383 ASSERT_not_null(intValue);
4391 ASSERT_not_null(intValue);
4399 ASSERT_not_null(intValue);
4407 ASSERT_not_null(intValue);
4420 ASSERT_not_null(intValue);
4428 ASSERT_not_null(intValue);
4436 ASSERT_not_null(intValue);
4444 ASSERT_not_null(intValue);
4452 ASSERT_not_null(enumVal);
4461 ASSERT_not_null(enumVal);
4468 ROSE_ASSERT(init_name != NULL);
4470 ROSE_ASSERT(assign_init != NULL);
4471 SgEnumVal * enum_val = isSgEnumVal(assign_init->get_operand_i());
4472 ROSE_ASSERT(enum_val != NULL);
4480 ASSERT_not_null(result);
4488 ASSERT_not_null(result);
4496 ASSERT_not_null(result);
4504 ASSERT_not_null(result);
4512 ASSERT_not_null(result);
4520 ASSERT_not_null(result);
4528 ASSERT_not_null(result);
4536 ASSERT_not_null(result);
4544 ASSERT_not_null(result);
4552 ASSERT_not_null(result);
4560 ASSERT_not_null(result);
4568 ASSERT_not_null(result);
4576 ASSERT_not_null(result);
4584 ASSERT_not_null(result);
4592 ASSERT_not_null(result);
4600 ASSERT_not_null(result);
4608 ASSERT_not_null(result);
4616 ASSERT_not_null(result);
4624 ASSERT_not_null(result);
4632 ASSERT_not_null(result);
4640 ASSERT_not_null(result);
4648 ASSERT_not_null(result);
4656 ASSERT_not_null(result);
4664 ASSERT_not_null(result);
4672 ASSERT_not_null(result);
4680 ASSERT_not_null(result);
4688 ASSERT_not_null(result);
4696 ASSERT_not_null(result);
4704 ASSERT_not_null(result);
4712 ASSERT_not_null(result);
4720 ASSERT_not_null(result);
4728 ASSERT_not_null(result);
4736 ASSERT_not_null(result);
4744 ASSERT_not_null(result);
4752 ASSERT_not_null(result);
4760 ASSERT_not_null(result);
4768 ASSERT_not_null(result);
4775 SgJovialBitVal* result =
new SgJovialBitVal(str);
4776 ASSERT_not_null(result);
4784 ASSERT_not_null (result);
4793 ROSE_ASSERT (result);
4801 ROSE_ASSERT(templateParameterValue);
4805 ROSE_ASSERT(templateParameterValue->
get_parent() == NULL);
4807 return templateParameterValue;
4813 ROSE_ASSERT(templateParameterValue);
4817 ROSE_ASSERT(templateParameterValue->
get_parent() == NULL);
4819 return templateParameterValue;
4822#define DEBUG_BUILD_NONREAL_DECL 0
4825 ROSE_ASSERT(scope != NULL);
4826#if DEBUG_BUILD_NONREAL_DECL
4827 printf(
"ENTER SageBuilder::buildNonrealDecl\n");
4828 printf(
" --- name = %s\n", name.str());
4829 printf(
" --- scope = %p (%s)\n", scope, scope->
class_name().c_str());
4837#if DEBUG_BUILD_NONREAL_DECL
4838 printf(
" --- nrdecl = %p (%s)\n", nrdecl, nrdecl->
class_name().c_str());
4843#if DEBUG_BUILD_NONREAL_DECL
4844 printf(
" --- symbol = %p (%s)\n", symbol, symbol->
class_name().c_str());
4848 type->set_declaration(nrdecl);
4850 nrdecl->set_type(type);
4852#if DEBUG_BUILD_NONREAL_DECL
4853 printf(
" --- type = %p (%s)\n", type, type->
class_name().c_str());
4856 if (child_scope == NULL) {
4858#if DEBUG_BUILD_NONREAL_DECL
4859 printf(
" --- child_scope = %p (new)\n", name.str(), child_scope);
4865#if DEBUG_BUILD_NONREAL_DECL
4866 printf(
" --- child_scope = %p (provided)\n", name.str(), child_scope);
4871 nrdecl->set_nonreal_decl_scope(child_scope);
4873#if DEBUG_BUILD_NONREAL_DECL
4874 printf(
"LEAVE SageBuilder::buildNonrealDecl\n");
4884 ROSE_ASSERT(result);
4893 ROSE_ASSERT(result);
4902 ROSE_ASSERT(result);
4911 ROSE_ASSERT(result);
4919 ROSE_ASSERT(result);
4927 ROSE_ASSERT(result);
4935 ROSE_ASSERT(result);
4943 ROSE_ASSERT(result);
4951 ROSE_ASSERT(result);
4959 ROSE_ASSERT(result);
5055#define BUILD_UNARY_DEF(suffix) \
5056 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix##_nfi(SgExpression* op) \
5058 return SageBuilder::buildUnaryExpression_nfi<Sg##suffix>(op); \
5060 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix(SgExpression* op) \
5062 return SageBuilder::buildUnaryExpression<Sg##suffix>(op); \
5065BUILD_UNARY_DEF(AddressOfOp)
5066BUILD_UNARY_DEF(BitComplementOp)
5067BUILD_UNARY_DEF(MinusOp)
5068BUILD_UNARY_DEF(NotOp)
5069BUILD_UNARY_DEF(PointerDerefExp)
5070BUILD_UNARY_DEF(UnaryAddOp)
5071BUILD_UNARY_DEF(AbsOp)
5072BUILD_UNARY_DEF(MinusMinusOp)
5073BUILD_UNARY_DEF(PlusPlusOp)
5074BUILD_UNARY_DEF(RealPartOp)
5075BUILD_UNARY_DEF(ImagPartOp)
5076BUILD_UNARY_DEF(ConjugateOp)
5077BUILD_UNARY_DEF(VarArgStartOneOperandOp)
5078BUILD_UNARY_DEF(VarArgEndOp)
5080BUILD_UNARY_DEF(MatrixTransposeOp)
5082#undef BUILD_UNARY_DEF
5085 SgType * expression_type,
5089 ROSE_ASSERT(result);
5090 if (operand_i) {operand_i->
set_parent(result); markLhsValues(result);}
5101 short int need_global_specifier,
5105 SgNewExp* result =
new SgNewExp(specified_type, placement_args, constructor_args, builtin_args, need_global_specifier, newOperatorDeclaration);
5106 ROSE_ASSERT(result);
5114 short need_global_specifier,
5118 need_global_specifier, deleteOperatorDeclaration);
5119 ROSE_ASSERT(result);
5129 ROSE_ASSERT(result != NULL);
5137 ROSE_ASSERT(result);
5138 if (operand_i) {operand_i->
set_parent(result); markLhsValues(result);}
5145 ROSE_ASSERT(result);
5146 if (operand_i) {operand_i->
set_parent(result); markLhsValues(result);}
5153 SgMinusMinusOp* result = buildUnaryExpression<SgMinusMinusOp>(operand_i);
5154 ROSE_ASSERT(result);
5161 SgMinusMinusOp* result = buildUnaryExpression_nfi<SgMinusMinusOp>(operand_i);
5162 ROSE_ASSERT(result);
5169 SgMinusOp* result = buildUnaryExpression<SgMinusOp>(operand_i);
5170 ROSE_ASSERT(result);
5177 SgMinusOp* result = buildUnaryExpression_nfi<SgMinusOp>(operand_i);
5178 ROSE_ASSERT(result);
5185 SgPlusPlusOp* result = buildUnaryExpression<SgPlusPlusOp>(operand_i);
5186 ROSE_ASSERT(result);
5194 SgPlusPlusOp* result = buildUnaryExpression_nfi<SgPlusPlusOp>(operand_i);
5195 ROSE_ASSERT(result);
5209 markLhsValues(result);
5215 operand_i -> set_parent(result);
5217 ROSE_ASSERT(result);
5224#define BUILD_BINARY_DEF(suffix) \
5225 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix##_nfi(SgExpression* lhs, SgExpression* rhs) \
5227 return buildBinaryExpression_nfi<Sg##suffix>(lhs, rhs); \
5229 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix(SgExpression* lhs, SgExpression* rhs) \
5231 return buildBinaryExpression<Sg##suffix>(lhs, rhs); \
5234BUILD_BINARY_DEF(AddOp)
5235BUILD_BINARY_DEF(AndAssignOp)
5236BUILD_BINARY_DEF(AndOp)
5237BUILD_BINARY_DEF(ArrowExp)
5238BUILD_BINARY_DEF(ArrowStarOp)
5239BUILD_BINARY_DEF(AssignOp)
5240BUILD_BINARY_DEF(AtOp)
5241BUILD_BINARY_DEF(BitAndOp)
5242BUILD_BINARY_DEF(BitOrOp)
5243BUILD_BINARY_DEF(BitXorOp)
5245BUILD_BINARY_DEF(CommaOpExp)
5246BUILD_BINARY_DEF(ConcatenationOp)
5247BUILD_BINARY_DEF(DivAssignOp)
5248BUILD_BINARY_DEF(DivideOp)
5249BUILD_BINARY_DEF(DotExp)
5250BUILD_BINARY_DEF(DotStarOp)
5251BUILD_BINARY_DEF(EqualityOp)
5253BUILD_BINARY_DEF(ExponentiationOp)
5254BUILD_BINARY_DEF(ExponentiationAssignOp)
5255BUILD_BINARY_DEF(GreaterOrEqualOp)
5256BUILD_BINARY_DEF(GreaterThanOp)
5257BUILD_BINARY_DEF(IntegerDivideOp)
5258BUILD_BINARY_DEF(IntegerDivideAssignOp)
5259BUILD_BINARY_DEF(IorAssignOp)
5260BUILD_BINARY_DEF(IsOp)
5261BUILD_BINARY_DEF(IsNotOp)
5263BUILD_BINARY_DEF(LessOrEqualOp)
5264BUILD_BINARY_DEF(LessThanOp)
5265BUILD_BINARY_DEF(LshiftAssignOp)
5266BUILD_BINARY_DEF(LshiftOp)
5268BUILD_BINARY_DEF(MembershipOp)
5269BUILD_BINARY_DEF(MinusAssignOp)
5270BUILD_BINARY_DEF(ModAssignOp)
5271BUILD_BINARY_DEF(ModOp)
5272BUILD_BINARY_DEF(MultAssignOp)
5273BUILD_BINARY_DEF(MultiplyOp)
5275BUILD_BINARY_DEF(NotEqualOp)
5276BUILD_BINARY_DEF(NonMembershipOp)
5277BUILD_BINARY_DEF(OrOp)
5278BUILD_BINARY_DEF(PlusAssignOp)
5279BUILD_BINARY_DEF(PntrArrRefExp)
5280BUILD_BINARY_DEF(RemOp)
5281BUILD_BINARY_DEF(RshiftAssignOp)
5282BUILD_BINARY_DEF(JavaUnsignedRshiftAssignOp)
5284BUILD_BINARY_DEF(RshiftOp)
5285BUILD_BINARY_DEF(JavaUnsignedRshiftOp)
5286BUILD_BINARY_DEF(ScopeOp)
5287BUILD_BINARY_DEF(SubtractOp)
5288BUILD_BINARY_DEF(XorAssignOp)
5290BUILD_BINARY_DEF(VarArgCopyOp)
5291BUILD_BINARY_DEF(VarArgStartOp)
5294BUILD_BINARY_DEF(ReplicationOp);
5297BUILD_BINARY_DEF(PowerOp);
5298BUILD_BINARY_DEF(ElementwisePowerOp);
5299BUILD_BINARY_DEF(ElementwiseMultiplyOp);
5300BUILD_BINARY_DEF(ElementwiseDivideOp);
5301BUILD_BINARY_DEF(LeftDivideOp);
5302BUILD_BINARY_DEF(ElementwiseLeftDivideOp);
5303BUILD_BINARY_DEF(ElementwiseAddOp);
5304BUILD_BINARY_DEF(ElementwiseSubtractOp);
5307BUILD_BINARY_DEF(SpaceshipOp)
5309#undef BUILD_BINARY_DEF
5317 ROSE_ASSERT(base_type != NULL);
5321 if (dim_info == NULL)
5332 ROSE_ASSERT(array_type);
5333 ROSE_ASSERT(array_type->get_dim_info() == NULL);
5338 array_type->set_dim_info(dim_info);
5339 array_type->set_rank(dim_info->get_expressions().size());
5347 ASSERT_not_null(result);
5349 if (index !=
nullptr) {
5370 if (a) {a->
set_parent(result); markLhsValues(a);}
5371 if (b) {b->
set_parent(result); markLhsValues(b);}
5379 ROSE_ASSERT(result);
5399 ASSERT_not_null(expr);
5413 ROSE_ASSERT(result);
5414 if (operand_i!=NULL)
5418 markLhsValues(result);
5427 ASSERT_not_null(result);
5432 markLhsValues(result);
5445 ROSE_ASSERT(result);
5446 if (initializers!=NULL)
5450 result->set_need_explicit_braces(
true);
5459 ROSE_ASSERT(result);
5460 if (initializers!=NULL)
5464 result->set_need_explicit_braces(
true);
5473 ROSE_ASSERT(result);
5474 if (initializers!=NULL)
5486 ROSE_ASSERT(result);
5487 if (initializers!=NULL)
5502 bool need_qualifier ,
5503 bool need_parenthesis_after_name ,
5504 bool associated_class_unknown )
5511 ROSE_ASSERT(declaration == NULL || declaration->get_associatedClassDeclaration() != NULL);
5514 need_qualifier, need_parenthesis_after_name, associated_class_unknown );
5515 ROSE_ASSERT(result != NULL);
5534 bool need_qualifier ,
5535 bool need_parenthesis_after_name ,
5536 bool associated_class_unknown )
5542 ROSE_ASSERT(declaration == NULL || declaration->get_associatedClassDeclaration() != NULL);
5545 ROSE_ASSERT(result != NULL);
5570 ROSE_ASSERT(result);
5571 if (initializers!=NULL)
5582 ROSE_ASSERT(result);
5583 if (initializers!=NULL)
5600 ROSE_ASSERT(result);
5604 markLhsValues(result);
5618 ROSE_ASSERT(result);
5622 markLhsValues(result);
5633 ROSE_ASSERT(result);
5643 ROSE_ASSERT(result);
5655 ROSE_ASSERT(result);
5659 markLhsValues(result);
5672 ROSE_ASSERT(result);
5676 markLhsValues(result);
5689 ROSE_ASSERT(result);
5693 markLhsValues(result);
5707 ROSE_ASSERT(result);
5711 markLhsValues(result);
5722 ROSE_ASSERT(result);
5731 ROSE_ASSERT(result);
5740 ROSE_ASSERT(expList);
5762 ROSE_ASSERT(expList);
5765 for (
size_t i = 0; i < exprs.size(); ++i) {
5774 ROSE_ASSERT(expList);
5783 ROSE_ASSERT(expList != NULL);
5786 for (
size_t i = 0; i < exprs.size(); ++i)
5792 testAstForUniqueNodes(expList);
5800 if (lower_bound == NULL)
5809 ROSE_ASSERT(lower_bound);
5810 ROSE_ASSERT(upper_bound);
5811 ROSE_ASSERT(stride);
5814 ROSE_ASSERT(subscript);
5828 ROSE_ASSERT(initname);
5835 if (initname->get_scope()!=NULL)
5840 varRef =
new SgVarRefExp(isSgVariableSymbol(symbol));
5842 ROSE_ASSERT(varRef);
5887 varSymbol = isSgVariableSymbol(symbol);
5895 name1->set_scope(scope);
5901 if (varSymbol == NULL)
5903 printf (
"Error: varSymbol == NULL for name = %s \n",name.str());
5905 ROSE_ASSERT(varSymbol != NULL);
5909 ROSE_ASSERT(varRef != NULL);
5911 ROSE_ASSERT (isSgVariableSymbol(varRef->get_symbol())->get_declaration()!=NULL);
5921 ROSE_ASSERT(symbol);
5931 ROSE_ASSERT(varRef);
5942 ROSE_ASSERT(varRef);
5953 ROSE_ASSERT(refexp != NULL);
5968 ROSE_ASSERT(scope != NULL);
5979 ROSE_ASSERT(isSgVariableSymbol(symbol));
6005 ROSE_ASSERT(compoundLiteral != NULL);
6009 return compoundLiteral;
6018 ROSE_ASSERT(compoundLiteral != NULL);
6022 return compoundLiteral;
6030 ROSE_ASSERT (s!= NULL);
6032 ROSE_ASSERT (result != NULL);
6041 if (paraTypeList==NULL)
return paraList;
6044 SgTypePtrList::iterator i;
6045 for (i=typeList.begin();i!=typeList.end();i++)
6058 ROSE_ASSERT (paraList);
6060 SgTypePtrList::iterator i;
6061 for (i=typeList.begin();i!=typeList.end();i++)
6073 ASSERT_not_null(funcType);
6075 ASSERT_not_null(func_type);
6077 bool isMemberFunc = isSgMemberFunctionType(func_type);
6079 if (scope ==
nullptr) {
6082 ASSERT_not_null(scope);
6084 if (symbol ==
nullptr)
6087 SgType* return_type = func_type->get_return_type();
6093 ASSERT_require(isMemberFunc ==
false);
6099 funcDecl = buildNondefiningFunctionDeclaration_T
6104 funcDecl = buildNondefiningFunctionDeclaration_T
6108 funcDecl->get_declarationModifier().get_storageModifier().
setExtern();
6111 ASSERT_not_null(symbol);
6116 ASSERT_not_null(func_ref);
6131 ROSE_ASSERT(func_decl != NULL);
6135 if (nondef_func != NULL)
6137 ROSE_ASSERT(nondef_func!= NULL);
6139 ROSE_ASSERT( symbol != NULL);
6142 else if (def_func != NULL)
6148 std::cerr<<
"Fatal error: SageBuilder::buildFunctionRefExp():defining and nondefining declarations for a function cannot be both NULL"<<std::endl;
6151 ROSE_ASSERT( symbol != NULL);
6162 ROSE_ASSERT(func_ref);
6172 ROSE_ASSERT(func_ref);
6180 ROSE_ASSERT(sym != NULL);
6183 ROSE_ASSERT(func_ref != NULL);
6186 ROSE_ASSERT(func_ref->get_symbol() != NULL);
6197 ROSE_ASSERT(func_ref);
6207 ROSE_ASSERT(func_ref);
6217 ROSE_ASSERT(func_ref);
6227 ROSE_ASSERT(class_ref);
6236 ROSE_ASSERT(class_ref);
6246 ROSE_ASSERT(scope != NULL);
6260 printf (
"Error: buildFunctionRefExp(): This function should not be used! \n");
6271 funcDecl->get_declarationModifier().get_storageModifier().
setExtern();
6274 ROSE_ASSERT(symbol);
6280 ROSE_ASSERT(func_ref);
6296 ROSE_ASSERT(expStmt);
6306 ROSE_ASSERT(expStmt);
6317 ROSE_ASSERT(expStmt);
6329 ROSE_ASSERT(expStmt);
6339 if (scope ==
nullptr) {
6342 ASSERT_not_null(scope);
6344 if (parameters ==
nullptr) {
6355 ASSERT_not_null(func_call_expr);
6357 return func_call_expr;
6365 ROSE_ASSERT (sym != NULL);
6366 if (parameters == NULL)
6368 ROSE_ASSERT (parameters != NULL);
6375 if (memberFunctionSymbol != NULL)
6378 bool virtual_call =
false;
6381 bool need_qualifier =
false;
6399 ROSE_ASSERT(func_call_expr);
6400 return func_call_expr;
6406 ROSE_ASSERT(f != NULL);
6408 ROSE_ASSERT(func_call_expr != NULL);
6413 if (parameters != NULL) {
6418 return func_call_expr;
6424 ROSE_ASSERT(f != NULL);
6426 ROSE_ASSERT(func_call_expr != NULL);
6429 if (parameters) parameters->
set_parent(func_call_expr);
6432 return func_call_expr;
6443 ROSE_ASSERT(scope != NULL);
6469 std::string functionName,
6475 ROSE_ASSERT(classSymbol);
6479 ROSE_ASSERT(classDeclaration != NULL);
6482 ROSE_ASSERT(classDefinition);
6486 ROSE_ASSERT(functionSymbol);
6509 ROSE_ASSERT(builtin_func_call_expr != NULL);
6511 SgNodePtrList & args = builtin_func_call_expr->get_args();
6512 for (SgNodePtrList::iterator it = parameters.begin(); it != parameters.end(); ++it) {
6513 args.push_back(*it);
6514 (*it)->set_parent(builtin_func_call_expr);
6517 return builtin_func_call_expr;
6524 ROSE_ASSERT(kernel);
6525 ROSE_ASSERT(parameters);
6526 ROSE_ASSERT(config);
6531 if (func_ref_exp == NULL && template_func_ref_exp == NULL)
6533 std::cerr <<
"SgCudaKernelCallExp accept only direct reference to a function. Got, " <<
typeid(*kernel).name()
6540 else if ( (func_ref_exp != NULL && func_ref_exp->get_symbol_i()->get_declaration()->get_functionModifier().isCudaKernel() ==
false) &&
6541 (template_func_ref_exp != NULL && template_func_ref_exp->get_symbol_i()->get_declaration()->get_functionModifier().isCudaKernel() ==
false) )
6543 std::cerr <<
"To build a SgCudaKernelCallExp the callee needs to be a kernel (having \"__global__\" attribute)." << std::endl;
6555 ROSE_ASSERT(kernel_call_expr);
6557 return kernel_call_expr;
6562 if (!grid || !blocks) {
6563 std::cerr <<
"SgCudaKernelExecConfig need fields 'grid' and 'blocks' to be set." << std::endl;
6580 ROSE_ASSERT(config);
6589 ROSE_ASSERT(lhs != NULL);
6590 ROSE_ASSERT(rhs != NULL);
6595 ROSE_ASSERT(assignOp);
6616 ROSE_ASSERT(lhs != NULL);
6617 ROSE_ASSERT(rhs != NULL);
6622 ROSE_ASSERT(assignOp);
6649 ROSE_ASSERT(labelstmt);
6669 ASSERT_not_null(labelStmt);
6672 if (stmt !=
nullptr) {
6686 ROSE_ASSERT(conditional);
6687 ROSE_ASSERT(true_body);
6689 ROSE_ASSERT(ifstmt);
6694 ifstmt->setCaseInsensitive(
true);
6699 if (false_body != NULL) false_body->
set_parent(ifstmt);
6709 if (isSgBasicBlock(true_body)|| isSgFortranDo(true_body)|| isSgIfStmt(true_body))
6722 ROSE_ASSERT(ifstmt);
6737 ASSERT_not_null(result);
6740 result->setCaseInsensitive(
true);
6747 increment->set_parent(result);
6761 ASSERT_not_null(result);
6764 result->setCaseInsensitive(
true);
6771 increment->set_parent(result);
6794 ROSE_ASSERT(forInit != NULL);
6796 ROSE_ASSERT(statement != NULL);
6797 forInit->append_init_stmt(statement);
6811 (*it)->set_parent(result);
6826 (*it)->set_parent(result);
6840 ROSE_ASSERT(result);
6843 result->setCaseInsensitive(
true);
6851 increment->set_parent(result);
6855 result->set_else_body(else_body);
6870 for_init_stmt->set_parent(result);
6875 ROSE_ASSERT(init_stmt);
6889 if (initialize_stmt)
6891 init_stmt->append_init_stmt(initialize_stmt);
6894 if (isSgVariableDeclaration(initialize_stmt))
6912 ROSE_ASSERT(result);
6917 result->setCaseInsensitive(
true);
6921 if (loop_body) loop_body->
set_parent(result);
6922 if (increment) increment->set_parent(result);
6923 if (else_body) else_body->
set_parent(result);
6925 result->set_else_body(else_body);
6927 if (initialize_stmt != NULL)
6930 ROSE_ASSERT(init_stmt);
6932 init_stmt->append_init_stmt(initialize_stmt);
6944 ROSE_ASSERT(result != NULL);
6960 ROSE_ASSERT(result != NULL);
6969 if (result->get_test() != NULL && test != result->get_test())
6971 delete result->get_test();
6972 result->set_test(NULL);
6975 if (result->get_increment() != NULL && increment != result->get_increment())
6977 delete result->get_increment();
6978 result->set_increment(NULL);
6987 if (result->get_else_body() != NULL && else_body != result->get_else_body())
6989 delete result->get_else_body();
6990 result->set_else_body(NULL);
6994 result->set_test(test);
6995 result->set_increment(increment);
6999 result->setCaseInsensitive(
true);
7003 if (loop_body) loop_body->
set_parent(result);
7004 if (increment) increment->set_parent(result);
7005 if (init_stmt) init_stmt->
set_parent(result);
7006 if (else_body) else_body->
set_parent(result);
7008 result->set_else_body(else_body);
7011 ROSE_ASSERT(result->get_test() != NULL);
7012 ROSE_ASSERT(result->get_increment() != NULL);
7036 ROSE_ASSERT(result != NULL);
7040 if (initializer != NULL) initializer->
set_parent(result);
7041 if (range != NULL) range->
set_parent(result);
7043 if (begin_declaration != NULL) begin_declaration->
set_parent(result);
7044 if (end_declaration != NULL) end_declaration->
set_parent(result);
7046 if (not_equal_expression != NULL) not_equal_expression->
set_parent(result);
7047 if (increment_expression != NULL) increment_expression->
set_parent(result);
7063 ASSERT_not_null(result);
7064 ASSERT_not_null(body);
7065 ASSERT_not_null(condition);
7067 ASSERT_require(result->
get_body() ==
nullptr);
7078 ASSERT_not_null(result->
get_body());
7092 ROSE_ASSERT(result);
7095 if (loop_body) loop_body->
set_parent(result);
7096 if (increment) increment->set_parent(result);
7099 if (initialize_stmt != NULL) {
7101 ROSE_ASSERT(init_stmt);
7103 init_stmt->append_init_stmt(initialize_stmt);
7114 ROSE_ASSERT(result);
7119 result->setCaseInsensitive(
true);
7123 if (loop_body) loop_body->
set_parent(result);
7124 if (increment) increment->set_parent(result);
7126 if (init_stmt) init_stmt->
set_parent(result);
7189 ROSE_ASSERT(condition);
7192 ROSE_ASSERT(result);
7197 result->setCaseInsensitive(
true);
7204 if (else_body != NULL) {
7205 result->set_else_body(else_body);
7216 ROSE_ASSERT(result);
7225 ROSE_ASSERT(expr != NULL && body != NULL);
7236 ROSE_ASSERT(expr != NULL && body != NULL);
7247 ROSE_ASSERT(condition);
7250 ROSE_ASSERT(result);
7260 ROSE_ASSERT(result);
7262 if (condition) condition->
set_parent(result);
7272 ROSE_ASSERT(result != NULL);
7283 ROSE_ASSERT(result);
7291 ROSE_ASSERT(result);
7299 ASSERT_not_null(result);
7307 ASSERT_not_null(result);
7315 ASSERT_not_null(result);
7323 ASSERT_not_null(result);
7331 ROSE_ASSERT(result);
7339 ROSE_ASSERT(result);
7346 SgDeleteExp *result =
new SgDeleteExp(target, is_array, need_global_specifier, deleteOperatorDeclaration);
7347 target->set_parent(result);
7354 SgDeleteExp *result =
new SgDeleteExp(target, is_array, need_global_specifier, deleteOperatorDeclaration);
7355 target->set_parent(result);
7363 ROSE_ASSERT(test != NULL);
7376 ROSE_ASSERT(result);
7380 markLhsValues(result);
7390 ROSE_ASSERT(test != NULL);
7392 if (exceptionArgument != NULL) {
7393 result -> set_exception_argument(exceptionArgument);
7403 ROSE_ASSERT(test != NULL);
7411 ROSE_ASSERT(value != NULL);
7420 ROSE_ASSERT(value != NULL);
7429 ROSE_ASSERT(key != NULL && datum != NULL);
7439 ROSE_ASSERT(key != NULL && datum != NULL);
7450 ROSE_ASSERT(result);
7451 for (
size_t i = 0; i < pairs.size(); ++i)
7452 result->append_pair(pairs[i]);
7460 ROSE_ASSERT(result);
7461 for (
size_t i = 0; i < pairs.size(); ++i)
7462 result->append_pair(pairs[i]);
7470 ROSE_ASSERT(target != NULL);
7471 ROSE_ASSERT(iter != NULL);
7473 ROSE_ASSERT(result);
7475 target->set_parent(result);
7486 ROSE_ASSERT(target != NULL);
7487 ROSE_ASSERT(iter != NULL);
7489 ROSE_ASSERT(result);
7490 target->set_parent(result);
7500 ROSE_ASSERT(elt != NULL);
7501 ROSE_ASSERT(generators != NULL);
7512 ROSE_ASSERT(elt != NULL);
7513 ROSE_ASSERT(generators != NULL);
7524 ROSE_ASSERT(elt != NULL);
7525 ROSE_ASSERT(generators != NULL);
7536 ROSE_ASSERT(elt != NULL);
7537 ROSE_ASSERT(generators != NULL);
7548 ROSE_ASSERT(kd_pair != NULL);
7549 ROSE_ASSERT(generators != NULL);
7560 ROSE_ASSERT(kd_pair != NULL);
7561 ROSE_ASSERT(generators != NULL);
7571 ROSE_ASSERT(arg != NULL);
7580 ROSE_ASSERT(arg != NULL);
7594 ROSE_ASSERT(pragma);
7599 ROSE_ASSERT(result);
7621 ROSE_ASSERT(result);
7631 ROSE_ASSERT(emptyDeclaration != NULL);
7644 ROSE_ASSERT(emptyDeclaration->
get_parent() != NULL);
7647 return emptyDeclaration;
7654 ROSE_ASSERT(result);
7659 result->setCaseInsensitive(
true);
7679 ROSE_ASSERT(result);
7683 result->setCaseInsensitive(
true);
7711 ROSE_ASSERT(result);
7720 ROSE_ASSERT (symbol != NULL);
7726 result->set_label_expression(l_exp);
7731 ROSE_ASSERT (l_stmt != NULL);
7734 ROSE_ASSERT(result);
7742 ROSE_ASSERT(result);
7753 result->set_selector_expression(label_expression);
7754 ROSE_ASSERT(result);
7766 if (expression == NULL)
7771 ROSE_ASSERT(result);
7772 if (expression != NULL) expression->
set_parent(result);
7781 ROSE_ASSERT(result);
7782 if (expression != NULL) expression->
set_parent(result);
7790 ROSE_ASSERT(result);
7800 ROSE_ASSERT(result);
7810 ROSE_ASSERT(result);
7819 ROSE_ASSERT(result);
7828 ROSE_ASSERT(result);
7831 result->setCaseInsensitive(
true);
7834 if (item_selector) item_selector->
set_parent(result);
7843 ROSE_ASSERT(result);
7855 ROSE_ASSERT(result);
7865 ROSE_ASSERT(result);
7874 if (locals != NULL && globals == NULL)
7875 ROSE_ASSERT(!
"buildExecStatement with non-NULL locals requires non-NULL globals");
7876 ROSE_ASSERT(executable != NULL);
7880 if (globals != NULL) globals->
set_parent(result);
7881 if (locals != NULL) locals->
set_parent(result);
7891 if (locals != NULL && globals == NULL)
7892 ROSE_ASSERT(!
"buildExecStatement with non-NULL locals requires non-NULL globals");
7893 ROSE_ASSERT(executable != NULL);
7897 if (globals != NULL) globals->
set_parent(result);
7898 if (locals != NULL) locals->
set_parent(result);
7907 ROSE_ASSERT(body != NULL);
7909 ROSE_ASSERT(async_stmt);
7919 ROSE_ASSERT(body != NULL);
7921 ROSE_ASSERT(finish_stmt);
7931 ROSE_ASSERT(expression);
7944 ROSE_ASSERT(body != NULL);
7946 ROSE_ASSERT(atomic_stmt);
7956 ROSE_ASSERT(expression);
7969 ROSE_ASSERT(expression);
7982 ROSE_ASSERT(expression);
8014 ROSE_ASSERT(body != NULL);
8033 if (catch0 != NULL) try_stmt->append_catch_statement(catch0);
8034 if (catch1 != NULL) try_stmt->append_catch_statement(catch1);
8035 if (catch2 != NULL) try_stmt->append_catch_statement(catch2);
8036 if (catch3 != NULL) try_stmt->append_catch_statement(catch3);
8037 if (catch4 != NULL) try_stmt->append_catch_statement(catch4);
8054 ROSE_ASSERT(try_body != NULL);
8056 try_body -> set_parent(try_stmt);
8062 try_stmt -> set_finally_body(finally_body);
8063 finally_body -> set_parent(try_stmt);
8077 if (catch_option_stmt) {
8078 catch_statement_sequence -> append_catch_statement(catch_option_stmt);
8079 catch_option_stmt -> set_parent(catch_statement_sequence);
8082 return catch_statement_sequence;
8089 if (condition) condition->
set_parent(result);
8097 ROSE_ASSERT(expression);
8112 ROSE_ASSERT(throw_stmt);
8124 ROSE_ASSERT(foreach_stmt);
8126 if (collection) collection -> set_parent(foreach_stmt);
8127 if (body) body -> set_parent(foreach_stmt);
8129 return foreach_stmt;
8135 ROSE_ASSERT(label_stmt);
8139 stmt -> set_parent(label_stmt);
8145 ROSE_ASSERT(lsymbol);
8146 label_stmt -> insert_symbol(lsymbol ->
get_name(), lsymbol);
8196 ROSE_ASSERT(result);
8197 result->set_assemblyCode(s);
8208 ROSE_ASSERT(result);
8209 result->set_assemblyCode(s);
8219#define NOP_1_BYTE_STRING "nop"
8220#define NOP_2_BYTE_STRING ".byte 0x66,0x90"
8221#define NOP_3_BYTE_STRING "nopl (%eax)"
8222#define NOP_4_BYTE_STRING "nopl 0x01(%eax)"
8223#define NOP_5_BYTE_STRING ".byte 0x0f,0x1f,0x44,0x00,0x00"
8224#define NOP_6_BYTE_STRING ".byte 0x66,0x0f,0x1f,0x44,0x00,0x00"
8225#define NOP_7_BYTE_STRING ".byte 0x0f,0x1f,0x80,0x00,0x00,0x00,0x00"
8226#define NOP_8_BYTE_STRING ".byte 0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00"
8227#define NOP_9_BYTE_STRING ".byte 0x66,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00"
8247 printf (
"Only supporting values of multi-byte nop's up to 9 bytes long. \n");
8252 return nopStatement;
8259 ROSE_ASSERT(condition != NULL);
8262 ROSE_ASSERT(result != NULL);
8279 ROSE_ASSERT(result != NULL);
8293 if (isSgReferenceType (base_type))
8295 cerr<<
"Error in SageBuilder::buildPointerType(): trying to build a pointer to a reference type! This is not allowed in C++."<<endl;
8300 ROSE_ASSERT(result != NULL);
8308 ROSE_ASSERT(result != NULL);
8314 ROSE_ASSERT(base_type != NULL);
8316 ROSE_ASSERT(result != NULL);
8323 ROSE_ASSERT(base_expression != NULL);
8327 if (isSgFunctionParameterRefExp(base_expression) != NULL)
8330 result->set_base_type(base_type);
8337 ROSE_ASSERT(result != NULL);
8350#define DEBUG_TYPEOF_TYPE 0
8352#if DEBUG_TYPEOF_TYPE
8353 printf (
"In SageBuilder::buildTypeOfType(): base_expression = %p = %s \n",base_expression,base_expression != NULL ? base_expression->
class_name().c_str() :
"NULL");
8354 printf (
" ------------------------------- base_type = %p = %s \n",base_type,base_type != NULL ? base_type->
class_name().c_str() :
"NULL");
8358 if (isSgFunctionParameterRefExp(base_expression) != NULL)
8360#if DEBUG_TYPEOF_TYPE
8361 printf (
"In SageBuilder::buildTypeOfType(): isSgFunctionParameterRefExp(base_expression) != NULL: calling new SgTypeOfType(base_expression,NULL) \n");
8366 ROSE_ASSERT(result != NULL);
8367#if DEBUG_TYPEOF_TYPE
8368 printf (
"In buildTypeOfType(): test 1: result = %p = %s \n",result,result->class_name().c_str());
8370 result->set_base_type(base_type);
8374 if (base_expression != NULL)
8376#if DEBUG_TYPEOF_TYPE
8377 printf (
"In SageBuilder::buildTypeOfType(): isSgFunctionParameterRefExp(base_expression) == NULL: base_expression != NULL: calling SgTypeOfType::createType(base_expression,NULL) \n");
8382 ROSE_ASSERT(result != NULL);
8383#if DEBUG_TYPEOF_TYPE
8384 printf (
"In buildTypeOfType(): test 2: result = %p = %s \n",result,result->class_name().c_str());
8389 ROSE_ASSERT(base_type != NULL);
8391#if DEBUG_TYPEOF_TYPE
8392 printf (
"In SageBuilder::buildTypeOfType(): isSgFunctionParameterRefExp(base_expression) == NULL: base_expression == NULL: calling SgTypeOfType::createType(base_type,NULL) \n");
8397 ROSE_ASSERT(result != NULL);
8399#if DEBUG_TYPEOF_TYPE
8400 printf (
"In buildTypeOfType(): test 3: result = %p = %s \n",result,result->class_name().c_str());
8403 if (result->get_base_type() != base_type)
8405 ROSE_ASSERT(result->get_base_type() != NULL);
8406#if DEBUG_TYPEOF_TYPE
8407 printf (
"result->get_base_type() = %p = %s \n",result->get_base_type(),result->get_base_type()->class_name().c_str());
8409 ROSE_ASSERT(base_type != NULL);
8410#if DEBUG_TYPEOF_TYPE
8411 printf (
"base_type = %p = %s \n",base_type,base_type->
class_name().c_str());
8417 ROSE_ASSERT(result != NULL);
8419 if (base_expression != NULL)
8425 ROSE_ASSERT(result != NULL);
8427#if DEBUG_TYPEOF_TYPE
8428 printf (
"In buildTypeOfType(): test 4: result = %p = %s \n",result,result->class_name().c_str());
8437 ROSE_ASSERT(result);
8438 if (kind_expr != NULL) kind_expr->
set_parent(result);
8448 ROSE_ASSERT(result);
8455 ROSE_ASSERT(result);
8462 ROSE_ASSERT(result);
8469 ROSE_ASSERT(result);
8476 ROSE_ASSERT(result);
8483 ROSE_ASSERT(result);
8491 ROSE_ASSERT(result);
8492 if (kind_expr != NULL) kind_expr->
set_parent(result);
8503 ROSE_ASSERT(result);
8509 ROSE_ASSERT(result);
8515 ROSE_ASSERT(result);
8521 ROSE_ASSERT(result);
8527 ROSE_ASSERT(result);
8533 ROSE_ASSERT(result);
8539 ROSE_ASSERT(result);
8545 ROSE_ASSERT(result);
8551 ROSE_ASSERT(result);
8557 ROSE_ASSERT(result);
8564 ROSE_ASSERT(result);
8571 ROSE_ASSERT(result);
8578 ROSE_ASSERT(result);
8585 ROSE_ASSERT(result);
8592 ROSE_ASSERT(result);
8599 ROSE_ASSERT(result);
8606 ROSE_ASSERT(result);
8613 ROSE_ASSERT(result);
8620 ROSE_ASSERT(result);
8627 ROSE_ASSERT(result);
8634 ROSE_ASSERT(result);
8641 ROSE_ASSERT(result);
8648 ROSE_ASSERT(result);
8655 ROSE_ASSERT(result);
8662 ROSE_ASSERT(result);
8669 ROSE_ASSERT(result);
8681 ROSE_ASSERT(result != NULL);
8696 SgTypeString* result = SgTypeString::createType(stringLengthExpression);
8697 ASSERT_not_null(result);
8705 if (kind_expr != NULL)
8714 ASSERT_not_null(result);
8725 ROSE_ASSERT(result);
8733 if (kind_expr != NULL)
8742 ASSERT_not_null(result);
8748 ASSERT_not_null(result);
8756 ROSE_ASSERT(result);
8778 ROSE_ASSERT(base_type != NULL);
8782 ROSE_ASSERT(result != NULL);
8785 ROSE_ASSERT(result != base_type);
8790 SgModifierType* result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8792 if (result != result2)
8795 printf (
"WARNING: In SageBuilder::buildModifierType(): using previously build SgModifierType from global type table: result2 = %p = %s \n",result2,result2->
class_name().c_str());
8800 ROSE_ASSERT(result2 != base_type);
8808 ROSE_ASSERT(base_type != NULL);
8812 ROSE_ASSERT(result!=NULL);
8818 SgModifierType *result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8820 if (result != result2)
8826 ROSE_ASSERT(result2 != base_type);
8835 ROSE_ASSERT(base_type != NULL);
8838 ROSE_ASSERT(result != NULL);
8840 result->set_type_kind(kindExpression);
8842 SgModifierType *result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8843 if (result != result2)
8855 ROSE_ASSERT(base_type != NULL);
8857 ROSE_ASSERT(result!=NULL);
8864 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8865 if (result != result2)
8877 ROSE_ASSERT(base_type != NULL);
8880 ROSE_ASSERT(result!=NULL);
8885 printf (
"In SageBuilder::buildConstVolatileType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
8890 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8891 if (result != result2) {
8899generate_type_list (
SgType* type)
8902 string returnString;
8904 unsigned char bit_array = (SgType::STRIP_MODIFIER_TYPE | SgType::STRIP_REFERENCE_TYPE | SgType::STRIP_RVALUE_REFERENCE_TYPE | SgType::STRIP_POINTER_TYPE | SgType::STRIP_ARRAY_TYPE | SgType::STRIP_TYPEDEF_TYPE);
8906 SgType* currentType = type;
8915 while (currentType != NULL)
8918 if ( (bit_array & SgType::STRIP_MODIFIER_TYPE) && (modType = isSgModifierType(currentType)) )
8920 currentType = modType->get_base_type();
8922 else if ( (bit_array & SgType::STRIP_REFERENCE_TYPE) && (refType = isSgReferenceType(currentType)) )
8924 currentType = refType->get_base_type();
8926 else if ( (bit_array & SgType::STRIP_RVALUE_REFERENCE_TYPE) && (rRefType = isSgRvalueReferenceType(currentType)) )
8928 currentType = rRefType->get_base_type();
8930 else if ( (bit_array & SgType::STRIP_POINTER_TYPE) && (pointType = isSgPointerType(currentType)) )
8932 currentType = pointType->get_base_type();
8934 else if ( (bit_array & SgType::STRIP_ARRAY_TYPE) && (arrayType = isSgArrayType(currentType)) )
8936 currentType = arrayType->get_base_type();
8938 else if ( (bit_array & SgType::STRIP_TYPEDEF_TYPE) && (typedefType = isSgTypedefType(currentType)) )
8948 returnString +=
" , ";
8951 return returnString;
8958 ROSE_ASSERT(base_type != NULL);
8965 if (!isSgPointerType(base_type) && !isSgReferenceType(base_type) && !isSgArrayType(base_type) && !isSgTypedefType(base_type) && !isSgModifierType(base_type))
8967 printf(
"ERROR: Base type of restrict type must be on a pointer or reference or array or typedef type: base_type = %p = %s \n",base_type,base_type->
class_name().c_str());
8968 printf (
" --- generate_type_list() = %s \n",generate_type_list(base_type).c_str());
8973 ASSERT_not_null(result);
8979 SgModifierType* result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8980 if (result != result2) {
8992 ASSERT_not_null(base_type);
8995 setModifiers(result);
8997 SgModifierType* result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8998 if (result != result2)
delete result;
9008 return _buildModifierType(base_type, op);
9015 return _buildModifierType(base_type, op);
9023 ROSE_ASSERT(base_type != NULL);
9026 ROSE_ASSERT(result!=NULL);
9032 SgModifierType *result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9033 if (result != result2) {
9043 ROSE_ASSERT(base_type != NULL);
9046 ROSE_ASSERT(result!=NULL);
9052 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9053 if (result != result2) {
9063 ROSE_ASSERT(base_type != NULL);
9066 ROSE_ASSERT(result!=NULL);
9074 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9075 if (result != result2) {
9085 ROSE_ASSERT(base_type != NULL);
9088 ROSE_ASSERT(result != NULL);
9094 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
9102 ROSE_ASSERT(base_type != NULL);
9105 ROSE_ASSERT(result!=NULL);
9111 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
9119 ROSE_ASSERT(base_type != NULL);
9122 ROSE_ASSERT(result!=NULL);
9128 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
9135 ROSE_ASSERT(base_type != NULL);
9137 ROSE_ASSERT(result!=NULL);
9144 ROSE_ASSERT(base_type != NULL);
9146 ROSE_ASSERT(result!=NULL);
9154 ROSE_ASSERT(result != NULL);
9162 ROSE_ASSERT(result != NULL);
9164 if(t1) result->append_type(t1);
9165 if(t2) result->append_type(t2);
9166 if(t3) result->append_type(t3);
9167 if(t4) result->append_type(t4);
9168 if(t5) result->append_type(t5);
9169 if(t6) result->append_type(t6);
9170 if(t7) result->append_type(t7);
9171 if(t8) result->append_type(t8);
9172 if(t9) result->append_type(t9);
9173 if(t10) result->append_type(t10);
9184 nrdecl->set_is_template_param (
true);
9185 return nrdecl->get_type();
9192 ROSE_ASSERT(result != NULL);
9194 result->append(start);
9202 ROSE_ASSERT(result != NULL);
9204 result->set_start(start);
9207 result->set_end(end);
9210 result->set_stride(stride);
9221 result->append_expression(firstRow);
9222 ROSE_ASSERT(result != NULL);
9232 ROSE_ASSERT(result != NULL);
9242 ROSE_ASSERT (result != NULL);
9243 result->set_modifier (mtype);
9276 ROSE_ASSERT(expr != NULL);
9288 ROSE_ASSERT(expr != NULL);
9299 ROSE_ASSERT(expr != NULL);
9302 if (lambda_capture_list != NULL)
9307 if (lambda_closure_class != NULL)
9312 if (lambda_function != NULL)
9317 if (lambda_closure_class != NULL)
9319 lambda_function->
set_parent(lambda_closure_class);
9323 printf (
"Warning: In SageBuilder::buildLambdaExp(): lambda_closure_class == NULL: lambda_function parent not set! \n");
9336 ROSE_ASSERT(expr != NULL);
9339 if (lambda_capture_list != NULL)
9344 if (lambda_closure_class != NULL)
9349 if (lambda_function != NULL)
9365 ROSE_ASSERT(lambdaCapture != NULL);
9368 return lambdaCapture;
9375 ROSE_ASSERT(lambdaCapture != NULL);
9378 return lambdaCapture;
9385 ROSE_ASSERT(lambdaCaptureList != NULL);
9388 return lambdaCaptureList;
9395 ROSE_ASSERT(lambdaCaptureList != NULL);
9398 return lambdaCaptureList;
9406 ROSE_ASSERT(result != NULL);
9416 ROSE_ASSERT(result != NULL);
9427 ROSE_ASSERT(result != NULL);
9436 ROSE_ASSERT(result != NULL);
9447 ROSE_ASSERT(result != NULL);
9457 ROSE_ASSERT(result != NULL);
9479 ROSE_ASSERT(result);
9492 return nonreal_decl_scope;
9503 ROSE_ASSERT(buildTemplateInstantiation ==
false || isSgTemplateInstantiationDecl(d) != NULL);
9512 ROSE_ASSERT(result);
9518 result->setCaseInsensitive(
true);
9536 ROSE_ASSERT(buildTemplateInstantiation ==
false || isSgTemplateInstantiationDecl(d) != NULL);
9545 ROSE_ASSERT(result);
9550 result->setCaseInsensitive(
true);
9560 SgName nameWithoutTemplateArguments = XXX_name;
9562 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
9567#define DEBUG_NONDEFINING_CLASS_DECLARATION 0
9570#if DEBUG_NONDEFINING_CLASS_DECLARATION
9571 printf (
"Building a SgClassDeclaration: buildNondefiningClassDeclaration_nfi() nameWithoutTemplateArguments = %s buildTemplateInstantiation = %s \n",nameWithoutTemplateArguments.str(),buildTemplateInstantiation ?
"true:" :
"false");
9572 printf (
" --- scope = %p = %s \n",scope,(scope != NULL) ? scope->
class_name().c_str() :
"null");
9579 if (buildTemplateInstantiation ==
true)
9581 ROSE_ASSERT(templateArgumentsList != NULL);
9584#if DEBUG_NONDEFINING_CLASS_DECLARATION
9585 printf (
"Building a SgClassDeclaration: buildNondefiningClassDeclaration_nfi() nameWithTemplateArguments = %s buildTemplateInstantiation = %s \n",nameWithTemplateArguments.str(),buildTemplateInstantiation ?
"true:" :
"false");
9589 SgTemplateArgumentPtrList emptyList;
9592#if DEBUG_NONDEFINING_CLASS_DECLARATION
9593 printf (
"In buildNondefiningClassDeclaration_nfi(): built new SgTemplateInstantiationDecl: nondefdecl = %p \n",nondefdecl);
9595 ROSE_ASSERT(nondefdecl->get_type() == NULL);
9596 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl) != NULL);
9597#if DEBUG_NONDEFINING_CLASS_DECLARATION
9598 printf (
"In buildNondefiningClassDeclaration_nfi(): nondefdecl->get_name() = %s nondefdecl->get_templateName() = %s \n",
9599 nondefdecl->get_name().str(),isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().str());
9602 ROSE_ASSERT(templateArgumentsList != NULL);
9604#if DEBUG_NONDEFINING_CLASS_DECLARATION
9605 printf (
"nondefdecl->get_name() = %s \n",nondefdecl->get_name().str());
9606 printf (
"nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
9607 printf (
"Output templateArgumentsList: \n");
9608 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
9610 printf (
" --- --- templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
9615 ROSE_ASSERT(nondefdecl->get_name() == nameWithTemplateArguments);
9616 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().is_null() ==
true);
9617 isSgTemplateInstantiationDecl(nondefdecl)->
set_templateName(nameWithoutTemplateArguments);
9622#if DEBUG_NONDEFINING_CLASS_DECLARATION
9623 printf (
"In buildNondefiningClassDeclaration_nfi(): built new SgClassDeclaration: nondefdecl = %p \n",nondefdecl);
9628 ROSE_ASSERT(nameWithoutTemplateArguments == nameWithTemplateArguments);
9631 ROSE_ASSERT(nondefdecl != NULL);
9632 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
9633 ROSE_ASSERT(nondefdecl->get_type() == NULL);
9657 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
9665 SgClassSymbol* mysymbol = scope->lookup_nontemplate_class_symbol(nameWithTemplateArguments,templateArgumentsList);
9667#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
9668 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): mysymbol = %p = %s \n",mysymbol,(mysymbol != NULL) ? mysymbol->
class_name().c_str() :
"null");
9670 if (mysymbol != NULL)
9672 firstNondefdecl = isSgClassDeclaration(mysymbol->get_declaration());
9673 ROSE_ASSERT(firstNondefdecl != NULL);
9675 ROSE_ASSERT(firstNondefdecl->get_type() != NULL);
9678 ROSE_ASSERT(nondefdecl->get_type() == NULL);
9680 if (nondefdecl->get_type() == NULL)
9682#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
9683 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): Why are we creating a new type instead of reusing the type (firstNondefdecl->get_type() = %p) from the firstNondefdecl = %p \n",firstNondefdecl->get_type(),firstNondefdecl);
9686#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
9687 printf (
"NOTE: Call nondefdecl->set_type(firstNondefdecl->get_type()); instead of nondefdecl->set_type(SgClassType::createType(firstNondefdecl)); \n");
9690 ROSE_ASSERT(nondefdecl->get_type() != NULL);
9692#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
9693 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str());
9695 ROSE_ASSERT(nondefdecl->get_type() == firstNondefdecl->get_type());
9698#if (REUSE_CLASS_DECLARATION_FROM_SYMBOL == 0)
9699 ROSE_ASSERT(nondefdecl != NULL);
9700 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
9706 printf (
"ERROR: In SgDeclarationStatement::set_firstNondefiningDeclaration(): nondefdecl = %p = %s IS NOT THE SAME AS firstNondefiningDeclaration = %p = %s \n",
9707 nondefdecl,nondefdecl->
class_name().c_str(),firstNondefdecl,firstNondefdecl->
class_name().c_str());
9709 nondefdecl->
get_file_info()->display(
"ERROR: In SgDeclarationStatement::set_firstNondefiningDeclaration(): nondefdecl: debug");
9711 firstNondefdecl->
get_file_info()->display(
"ERROR: In SgDeclarationStatement::set_firstNondefiningDeclaration(): firstNondefdecl: debug");
9723 ROSE_ASSERT(firstNondefdecl != NULL);
9724 ROSE_ASSERT(firstNondefdecl->get_type() != NULL);
9730 if (buildTemplateInstantiation ==
true)
9736 ROSE_ASSERT (nondefdecl->get_type() == firstNondefdecl->get_type());
9739 if (nondefdecl->get_type() != firstNondefdecl->get_type())
9742 printf (
"Deleting type in associated non-defining declaration (sharing type) nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str());
9743 printf (
"Skipping delete of %p so we can maintain unique type pointers \n",nondefdecl->get_type());
9745 printf (
"Setting the new type to be from firstNondefdecl = %p (sharing type) firstNondefdecl->get_type() = %p = %s \n",firstNondefdecl,firstNondefdecl->get_type(),firstNondefdecl->get_type()->
class_name().c_str());
9746 nondefdecl->set_type(firstNondefdecl->get_type());
9749 printf (
"Unclear if this code is executed \n");
9756 ROSE_ASSERT(nondefdecl == NULL);
9763#if REUSE_CLASS_DECLARATION_FROM_SYMBOL
9772 ROSE_ASSERT(nondefdecl != NULL);
9773 if (nondefdecl->get_type() == NULL)
9776 printf (
"SageBuilder::buildNondefiningClassDeclaration_nfi(): nondefdecl = %p \n",nondefdecl);
9787 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
9790 firstNondefdecl = nondefdecl;
9793 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
9794 ROSE_ASSERT(mysymbol->get_declaration()->get_definition() == NULL);
9801 if (buildTemplateInstantiation ==
true)
9805#if DEBUG_NONDEFINING_CLASS_DECLARATION
9806 printf (
"BEFORE scope->insert_symbol(): scope = %p = %s nameWithTemplateArguments = %s mysymbol = %p = %s \n",
9807 scope,scope->
class_name().c_str(),nameWithTemplateArguments.str(),mysymbol,mysymbol->
class_name().c_str());
9814 ROSE_ASSERT(nondefdecl->get_type() == NULL);
9815 if (nondefdecl->get_type() == NULL)
9820#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
9821 printf (
"NOTE: In buildNondefiningClassDeclaration_nfi(): 2nd time this is a performance issue (maybe) to call the lookup_nontemplate_class_symbol() again \n");
9831 SgClassSymbol* temp_classSymbol = nondefdecl->
get_scope()->lookup_nontemplate_class_symbol(nameWithTemplateArguments,templateArgumentsList);
9832#if DEBUG_NONDEFINING_CLASS_DECLARATION
9834 printf (
"In buildNondefiningClassDeclaration_nfi(): temp_classSymbol = %p \n",temp_classSymbol);
9835 printf (
"In buildNondefiningClassDeclaration_nfi(): nondefdecl->get_scope() = %p = %s scope = %p \n",nondefdecl->
get_scope(),nondefdecl->
get_scope()->
class_name().c_str(),scope);
9837 printf (
"In buildNondefiningClassDeclaration_nfi(): nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
9838 if (templateArgumentsList != NULL)
9840 printf (
" --- templateArgumentsList elements: \n");
9841 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
9843 printf (
" --- --- templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
9844 printf (
" --- --- templateArgumentsList->[%zu] = %s \n",i,templateArgumentsList->operator[](i)->class_name().c_str());
9845 templateArgumentsList->operator[](i)->
display(
"In SageBuilder::buildNondefiningClassDeclaration_nfi()");
9850 ROSE_ASSERT(nondefdecl->
get_scope()->lookup_class_symbol(nameWithTemplateArguments,templateArgumentsList) != NULL);
9851 ROSE_ASSERT(nondefdecl->
get_scope() == scope);
9855 ROSE_ASSERT(temp_classSymbol == NULL || temp_classSymbol->get_declaration()->get_definition() == NULL);
9858 ROSE_ASSERT(mysymbol != NULL);
9859 ROSE_ASSERT(firstNondefdecl != NULL);
9872 ROSE_ASSERT(nondefdecl->get_type() != NULL);
9874 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
9876#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
9877 printf (
"NOTE: In buildNondefiningClassDeclaration_nfi(): 3rd time this is a performance issue (maybe) to call the lookup_nontemplate_class_symbol() again \n");
9887 SgClassSymbol* temp_classSymbol = nondefdecl->
get_scope()->lookup_nontemplate_class_symbol(nameWithTemplateArguments,templateArgumentsList);
9889 ROSE_ASSERT(temp_classSymbol == NULL || temp_classSymbol->get_declaration()->get_definition() == NULL);
9891 ROSE_ASSERT(nondefdecl != NULL);
9892 ROSE_ASSERT(nondefdecl->get_name() == nameWithTemplateArguments);
9895 if (isSgTemplateInstantiationDecl(nondefdecl) != NULL)
9899 ROSE_ASSERT(finalName == nameWithTemplateArguments);
9900 ROSE_ASSERT(finalName == nondefdecl->get_name());
9903#if DEBUG_NONDEFINING_CLASS_DECLARATION
9904 printf (
"Leaving buildNondefiningClassDeclaration_nfi(): nondefdecl = %p nondefdecl->unparseNameToString() = %s \n",nondefdecl,nondefdecl->unparseNameToString().c_str());
9905 printf (
" --- nondefdecl = %p = %s \n",nondefdecl,nondefdecl->
class_name().c_str());
9908#if DEBUG_NONDEFINING_CLASS_DECLARATION
9910 printf (
"Leaving buildNondefiningClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
9911 SgSymbol* test_symbol = nondefdecl->
get_scope()->find_symbol_from_declaration(nondefdecl);
9913 printf (
"test_symbol = %p \n",test_symbol);
9916 printf (
"Leaving buildNondefiningClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
9925 ROSE_ASSERT(stmt != NULL);
9937 ROSE_ASSERT(stmt != NULL);
9951 std::string directive_string(name);
9957 if (params.length() > 0)
9958 directive_string +=
" " + params;
9960 directive_string +=
" " + def_string;
9963 ROSE_ASSERT(define_decl);
9983 ASSERT_not_null(forStmt);
9989 forStmt->setCaseInsensitive(
true);
9998 bool buildTemplateInstantiation =
false;
10012 SgDerivedTypeStatement* type_decl = buildClassDeclarationStatement_nfi <SgDerivedTypeStatement> (name, kind, scope);
10025 SgModuleStatement* module_stmt = buildClassDeclarationStatement_nfi <SgModuleStatement> (name, kind, scope);
10031 return module_stmt;
10039 SgJovialTableStatement* table_decl = buildClassDeclarationStatement_nfi <SgJovialTableStatement> (name, kind, scope);
10051 std::string type_name(name);
10054 type_name =
"_table_of_" + type_name;
10056 if (dim_info->get_expressions().size() > 0) {
10057 std::ostringstream address;
10058 address << (
void const *)dim_info;
10059 type_name +=
"_" + address.str();
10064 SgJovialTableStatement* table_decl = buildClassDeclarationStatement_nfi <SgJovialTableStatement> (type_name, kind, scope);
10072 ROSE_ASSERT(nondef_decl != NULL);
10076 ROSE_ASSERT(table_type != NULL);
10078 table_type->set_base_type(base_type);
10079 table_type->set_dim_info(dim_info);
10080 table_type->set_rank(dim_info->get_expressions().size());
10083 nondef_decl->set_type(table_type);
10089template <
class DeclClass> DeclClass *
10118 mysymbol = scope->lookup_class_symbol(name);
10120 if (mysymbol == NULL)
10123 if (nonDefiningDecl != NULL)
10127 ROSE_ASSERT(temp_mysymbol != NULL);
10129 mysymbol = isSgClassSymbol(temp_mysymbol);
10130 ROSE_ASSERT(mysymbol != NULL);
10133 ROSE_ASSERT(scope == nonDefiningDecl->
get_scope());
10138 if (mysymbol != NULL)
10140 nondefdecl = (mysymbol->get_declaration() == NULL)
10141 ? NULL : dynamic_cast<DeclClass*>(mysymbol->get_declaration());
10142 ROSE_ASSERT(nondefdecl != NULL);
10147 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
10152 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10153 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10158 DeclClass* nondefining_classDeclaration = (nondefdecl == NULL) ? NULL : dynamic_cast<DeclClass*>(nondefdecl);
10159 ROSE_ASSERT(nondefining_classDeclaration != NULL);
10161 ? NULL : dynamic_cast<DeclClass*>(nondefdecl->get_definingDeclaration());
10162 ROSE_ASSERT(defining_classDeclaration != NULL);
10164 return defining_classDeclaration;
10169 ROSE_ASSERT(nondefdecl == NULL);
10172 nondefdecl =
new DeclClass(name, kind, NULL, NULL);
10173 ROSE_ASSERT(nondefdecl != NULL);
10185 ROSE_ASSERT(scope != NULL);
10192 ROSE_ASSERT(nondefdecl->
get_scope() != NULL);
10193 ROSE_ASSERT(nondefdecl->get_type() == NULL);
10195 if (nondefdecl->get_type() == NULL)
10211 ROSE_ASSERT(class_type != NULL);
10213 nondefdecl->set_type(class_type);
10215 SgClassDeclaration* tmp_classDeclarationFromType = isSgClassDeclaration(class_type->get_declaration());
10216 ROSE_ASSERT(tmp_classDeclarationFromType != NULL);
10219 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10220 if (nondefdecl->get_type()->get_declaration() != nondefdecl)
10222 printf (
"ERROR: nondefdecl = %p = %s \n",nondefdecl,nondefdecl->
class_name().c_str());
10223 printf (
"ERROR: nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str());
10224 printf (
"ERROR: nondefdecl->get_type()->get_declaration() = %p = %s \n",nondefdecl->get_type()->get_declaration(),nondefdecl->get_type()->get_declaration()->
class_name().c_str());
10226 SgClassDeclaration* classDeclarationFromType = isSgClassDeclaration(nondefdecl->get_type()->get_declaration());
10227 ROSE_ASSERT(classDeclarationFromType != NULL);
10229 printf (
"nondefdecl->get_name() = %s \n",nondefdecl->get_name().str());
10230 printf (
"nondefdecl->get_type()->get_name() = %s \n",nondefdecl->get_type()->
get_name().str());
10231 printf (
"nondefdecl->get_type()->get_declaration()->get_name() = %s \n",classDeclarationFromType->get_name().str());
10233 printf (
"nondefdecl->get_mangled_name() = %s \n",nondefdecl->get_mangled_name().getString().c_str());
10234 printf (
"nondefdecl->get_type()->get_mangled() = %s \n",nondefdecl->get_type()->
get_mangled().getString().c_str());
10235 printf (
"nondefdecl->get_type()->get_declaration()->get_mangled_name() = %s \n",classDeclarationFromType->get_mangled_name().getString().c_str());
10238 printf (
"nondefdecl->get_type()->get_declaration()->get_firstNondefiningDeclaration() = %s \n",classDeclarationFromType->
get_firstNondefiningDeclaration() ?
"true" :
"false");
10248 ROSE_ASSERT(nondefdecl->get_type()->get_declaration() == nondefdecl);
10258#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
10260 if (SourcePositionClassificationMode != e_sourcePositionTransformation)
10262 detectTransformations(nondefdecl);
10273 ROSE_ASSERT(nondefdecl->
get_scope() == scope);
10286 DeclClass* defdecl =
new DeclClass(name,kind,NULL,classDef);
10287 ROSE_ASSERT(defdecl != NULL);
10288 ROSE_ASSERT(defdecl->get_type() == NULL);
10291 ROSE_ASSERT(defdecl->get_definition() != NULL);
10292 ROSE_ASSERT(defdecl != NULL);
10302 classDef->set_declaration(defdecl);
10303 defdecl->set_definingDeclaration(defdecl);
10305 defdecl->set_firstNondefiningDeclaration(nondefdecl);
10308 ROSE_ASSERT(defdecl->get_type() == NULL);
10315 if (defdecl->get_type() != NULL)
10322 ROSE_ASSERT (nondefdecl->get_type() != NULL);
10323 defdecl->set_type(nondefdecl->get_type());
10328 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10331 ROSE_ASSERT (nondefdecl->get_type() != NULL);
10332 ROSE_ASSERT (defdecl->get_type() != NULL);
10333 ROSE_ASSERT (defdecl->get_type()->get_declaration() != NULL);
10334 ROSE_ASSERT (defdecl->get_type()->get_declaration() != isSgDeclarationStatement(defdecl));
10338 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10347 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10352 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10356 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10366 ROSE_ASSERT(defdecl->get_parent() == NULL);
10371 ROSE_ASSERT(defdecl->get_definingDeclaration() == defdecl);
10372 ROSE_ASSERT(defdecl->get_firstNondefiningDeclaration() != defdecl->get_definingDeclaration());
10375 SgClassDeclaration* temp_firstNondefiningDeclaration = isSgClassDeclaration(defdecl->get_firstNondefiningDeclaration());
10376 SgClassDeclaration* temp_definingDeclaration = isSgClassDeclaration(defdecl->get_definingDeclaration());
10377 ROSE_ASSERT(temp_firstNondefiningDeclaration != NULL);
10378 ROSE_ASSERT(temp_definingDeclaration != NULL);
10379 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_name() == temp_definingDeclaration->get_name());
10380 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_type() == temp_definingDeclaration->get_type());
10412 ROSE_ASSERT(scope != NULL);
10419 ROSE_ASSERT(defdecl != NULL);
10424 namespaceDef->set_namespaceDeclaration(defdecl);
10433 mysymbol = scope->lookup_namespace_symbol(name);
10439 printf (
"Warning: In SageBuilder::buildNamespaceDeclaration_nfi(): scope == NULL \n");
10442 if (mysymbol != NULL)
10445 ROSE_ASSERT(namespaceDeclaration != NULL);
10446 nondefdecl = isSgNamespaceDeclarationStatement(namespaceDeclaration);
10448 ROSE_ASSERT(nondefdecl != NULL);
10449 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10455 if (namespaceDeclaration->
get_definition()->get_global_definition() == NULL)
10457 printf (
"ERROR: namespaceDeclaration->get_definition()->get_global_definition() == NULL: namespaceDeclaration = %p = %s namespaceDeclaration->get_definition() = %p \n",
10460 ROSE_ASSERT(namespaceDeclaration->
get_definition()->get_global_definition() != NULL);
10461 namespaceDef->set_global_definition(namespaceDeclaration->
get_definition()->get_global_definition());
10462 ROSE_ASSERT(namespaceDef->get_global_definition() != NULL);
10465 ROSE_ASSERT(namespaceDef->get_global_definition() == namespaceDef->get_global_definition()->get_global_definition());
10467 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
10469 ROSE_ASSERT(nondefdecl->
get_definition()->get_previousNamespaceDefinition() == NULL);
10473 ROSE_ASSERT(i != NULL);
10474 while (i != NULL && i->get_nextNamespaceDefinition() != NULL)
10476 i = i->get_nextNamespaceDefinition();
10477 ROSE_ASSERT(i->get_previousNamespaceDefinition() != NULL);
10480 ROSE_ASSERT(i != NULL);
10481 i->set_nextNamespaceDefinition(namespaceDef);
10482 namespaceDef->set_previousNamespaceDefinition(i);
10489 nondefdecl = defdecl;
10490 ROSE_ASSERT(nondefdecl != NULL);
10492 ROSE_ASSERT(namespaceDef->get_namespaceDeclaration() != NULL);
10496 namespaceDef->set_global_definition(global_definition_namespaceDef);
10497 ROSE_ASSERT(namespaceDef->get_global_definition() != NULL);
10500 global_definition_namespaceDef->set_global_definition(global_definition_namespaceDef);
10502 global_definition_namespaceDef->set_isUnionOfReentrantNamespaceDefinitions(
true);
10505 ROSE_ASSERT(global_definition_namespaceDef->
get_parent() == NULL);
10506 global_definition_namespaceDef->
set_parent(defdecl);
10507 ROSE_ASSERT(global_definition_namespaceDef->
get_parent() != NULL);
10510 ROSE_ASSERT(global_definition_namespaceDef->get_namespaceDeclaration() == NULL);
10511 global_definition_namespaceDef->set_namespaceDeclaration(nondefdecl);
10512 ROSE_ASSERT(global_definition_namespaceDef->get_namespaceDeclaration() != NULL);
10515 global_definition_namespaceDef->set_namespaceDeclaration(nondefdecl);
10516 ROSE_ASSERT(global_definition_namespaceDef->get_namespaceDeclaration() != NULL);
10520 defdecl->
get_definition()->set_global_definition(global_definition_namespaceDef);
10524 ROSE_ASSERT(global_definition_namespaceDef == global_definition_namespaceDef->get_global_definition());
10525 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
10526 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() == namespaceDef->get_global_definition());
10545 printf (
"Warning: no scope provided to support symbol table entry! \n");
10549 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
10551 ROSE_ASSERT(nondefdecl->
get_definition()->get_previousNamespaceDefinition() == NULL);
10552 ROSE_ASSERT(nondefdecl->
get_definition()->get_nextNamespaceDefinition() == NULL);
10555 ROSE_ASSERT(nondefdecl != NULL);
10575 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
10585 result->get_operands().push_back(lhs);
10596 result->get_operands().push_back(lhs);
10607 result->get_operands().push_back(lhs);
10618 result->get_operands().push_back(lhs);
10658 printf (
"In buildNondefiningClassDeclaration(): name = %s scope = %p = %s \n",name.str(),scope,scope != NULL ? scope->
class_name().c_str() :
"NULL");
10673 mysymbol = scope->lookup_class_symbol(name,NULL);
10684 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
10687 if (mysymbol != NULL)
10689 nondefdecl = isSgClassDeclaration(mysymbol->get_declaration());
10691 ROSE_ASSERT(nondefdecl != NULL);
10700 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10711 ROSE_ASSERT(nondefdecl != NULL);
10712 if (nondefdecl->get_type() == NULL)
10716 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): built class type: part 3: nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str());
10740 ROSE_ASSERT(nondefdecl->
get_scope() == NULL);
10745 ROSE_ASSERT(nondefdecl->
get_scope() != NULL);
10749 printf (
"In buildNondefiningClassDeclaration(): Adding SgClassSymbol: mysymbol = %p from nondefdecl = %p = %s to scope = %p = %s \n",mysymbol,nondefdecl,nondefdecl->
class_name().c_str(),scope,scope->
class_name().c_str());
10762 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10765 ROSE_ASSERT(scope == NULL || (scope != NULL && nondefdecl->
get_scope() != NULL));
10768 ROSE_ASSERT(nondefdecl != NULL);
10781 printf (
"WARNING: This function for building defining class declarations has different semantics from that of the function to build defining function declarations. \n");
10784 printf (
"In buildDefiningClassDeclaration(): name = %s scope = %p = %s \n",name.str(),scope,scope != NULL ? scope->
class_name().c_str() :
"NULL");
10795 ROSE_ASSERT(nondefiningClassDeclaration != NULL);
10798 ROSE_ASSERT(definingClassDefinition != NULL);
10801 SgClassType* classType = nondefiningClassDeclaration->get_type();
10802 ROSE_ASSERT(classType != NULL);
10809 ROSE_ASSERT(definingClassDeclaration != NULL);
10816 definingClassDefinition->set_declaration(definingClassDeclaration);
10826 ROSE_ASSERT(definingClassDeclaration->get_definition() != NULL);
10828 ROSE_ASSERT(definingClassDeclaration->
get_scope() == NULL);
10831 definingClassDeclaration->
set_scope(scope);
10832 ROSE_ASSERT(definingClassDeclaration->
get_scope() != NULL);
10833 ROSE_ASSERT(nondefiningClassDeclaration->
get_scope() != NULL);
10836 ROSE_ASSERT(definingClassDeclaration->get_definition()->
get_parent() != NULL);
10839 ROSE_ASSERT(definingClassDeclaration->get_type() != NULL);
10841 return definingClassDeclaration;
10848 ROSE_ASSERT(scope != NULL);
10850 ROSE_ASSERT(definingClassDeclaration != NULL);
10852 return definingClassDeclaration;
10869#define DEBUG_CLASS_DECLARATION 0
10873 printf (
"WARNING: In SageBuilder::buildClassDeclaration_nfi(): the nonDefiningDecl pointer = %p (input parameter) does not appear to be used. \n",nonDefiningDecl);
10879 if (nonDefiningDecl != NULL)
10881 ROSE_ASSERT(nonDefiningDecl->get_type() != NULL);
10882 ROSE_ASSERT(nonDefiningDecl->get_type()->get_declaration() != NULL);
10883 printf (
"nonDefiningDecl->get_type() = %p = %s \n",nonDefiningDecl->get_type(),nonDefiningDecl->get_type()->
class_name().c_str());
10884 printf (
"nonDefiningDecl->get_type()->get_declaration() = %p = %s \n",nonDefiningDecl->get_type()->get_declaration(),nonDefiningDecl->get_type()->get_declaration()->
class_name().c_str());
10886 printf (
"In buildClassDeclaration_nfi(): nonDefiningDecl: unparseNameToString() = %s \n",nonDefiningDecl->unparseNameToString().c_str());
10897 bool buildTemplateDeclaration = (isSgTemplateClassDeclaration(nonDefiningDecl) != NULL);
10900 if (buildTemplateDeclaration ==
true)
10903 printf (
"ERROR: If buildTemplateDeclaration == true, then we should have called a different function to build the associated SgTemplateClassDeclaration \n");
10905 ROSE_ASSERT(buildTemplateDeclaration ==
false);
10908 printf (
"In SageBuilder::buildClassDeclaration_nfi(): XXX_name = %s \n",XXX_name.str());
10909 printf (
"In SageBuilder::buildClassDeclaration_nfi(): the nonDefiningDecl pointer = %p = %s \n",nonDefiningDecl,nonDefiningDecl != NULL ? nonDefiningDecl->
class_name().c_str() :
"null");
10910 printf (
"In SageBuilder::buildClassDeclaration_nfi(): buildTemplateDeclaration = %s \n",buildTemplateDeclaration ?
"true" :
"false");
10911 printf (
" --- templateArgumentsList = %p \n",templateArgumentsList);
10912 if (templateArgumentsList != NULL)
10914 printf (
" --- templateArgumentsList.size() = %zu \n",templateArgumentsList->size());
10915 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
10917 printf (
" --- --- argument pointer: templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
10926 printf (
"In SageBuilder::buildClassDeclaration_nfi(): no scope was provided so using the SageBuilder::topScopeStack() = %p = %s \n",scope,scope->
class_name().c_str());
10932 printf (
"In SageBuilder::buildClassDeclaration_nfi(): scope was provided scope = %p = %s \n",scope,scope->
class_name().c_str());
10937 printf (
"Building a SgClassDeclaration: buildClassDeclaration_nfi() XXX_name = %s buildTemplateInstantiation = %s \n",XXX_name.str(),buildTemplateInstantiation ?
"true" :
"false");
10947 SgName nameWithoutTemplateArguments = XXX_name;
10948 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
10949 if (buildTemplateInstantiation ==
true)
10951 ROSE_ASSERT(templateArgumentsList != NULL);
10955#if DEBUG_CLASS_DECLARATION
10956 printf (
"In SageBuilder::buildClassDeclaration_nfi():\n");
10957 printf (
" -- nameWithoutTemplateArguments = %s\n", nameWithoutTemplateArguments.str());
10958 printf (
" -- nameWithTemplateArguments = %s\n", nameWithTemplateArguments.str());
10971#if DEBUG_CLASS_DECLARATION
10972 printf (
"Looking up the SgClassSymbol in scope = %p = %s nameWithTemplateArguments = %s \n",scope,scope->
class_name().c_str(),nameWithTemplateArguments.str());
10983 printf (
"This was a redundant call to lookup_class_symbol \n");
10988 if (buildTemplateDeclaration ==
true)
10990#if DEBUG_CLASS_DECLARATION
10991 printf (
"Note: In SageBuilder::buildClassDeclaration_nfi(): Need to look up a template symbol \n");
10993 ROSE_ASSERT(nonDefiningDecl != NULL);
10995 SgTemplateParameterPtrList templateParameterList;
10996 SgTemplateArgumentPtrList templateSpecializationArgumentList;
10998 ROSE_ASSERT(scope->lookup_template_class_symbol(nameWithTemplateArguments,&templateParameterList,&templateSpecializationArgumentList) != NULL);
11000 mysymbol = scope->lookup_template_class_symbol(nameWithTemplateArguments,&templateParameterList,&templateSpecializationArgumentList);
11002 ROSE_ASSERT(mysymbol != NULL);
11004 printf (
"ERROR: Need to look up a template symbol \n");
11010#if DEBUG_CLASS_DECLARATION
11011 printf (
"In SageBuilder::buildClassDeclaration_nfi(): calling lookup_class_symbol(nameWithTemplateArguments = %s,templateArgumentsList->size() = %zu \n",
11012 nameWithTemplateArguments.str(),(templateArgumentsList != NULL) ? templateArgumentsList->size() : 999);
11013 if (templateArgumentsList != NULL)
11015 printf (
" --- templateArgumentsList elements: \n");
11016 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
11018 printf (
" --- --- templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
11019 printf (
" --- --- templateArgumentsList->[%zu] = %s \n",i,templateArgumentsList->operator[](i)->class_name().c_str());
11020 templateArgumentsList->operator[](i)->
display(
"In SageBuilder::buildClassDeclaration_nfi()");
11024 mysymbol = scope->lookup_class_symbol(nameWithTemplateArguments,templateArgumentsList);
11025#if DEBUG_CLASS_DECLARATION
11026 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
11029 if (mysymbol == NULL)
11031#if DEBUG_CLASS_DECLARATION
11032 printf (
"WARNING: scope->lookup_class_symbol(nameWithTemplateArguments = %s,templateArgumentsList->size() = %zu) == NULL \n",nameWithTemplateArguments.str(),templateArgumentsList->size());
11037#if DEBUG_CLASS_DECLARATION
11038 printf (
"Checking lookup_class_symbol() using nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
11040 ROSE_ASSERT(scope->lookup_class_symbol(nameWithoutTemplateArguments,templateArgumentsList) == NULL);
11042#if DEBUG_CLASS_DECLARATION
11043 printf (
"nonDefiningDecl = %p \n",nonDefiningDecl);
11045 if (nonDefiningDecl != NULL)
11047#if DEBUG_CLASS_DECLARATION
11048 printf (
"nonDefiningDecl = %p = %s \n",nonDefiningDecl,nonDefiningDecl->
class_name().c_str());
11052 ROSE_ASSERT(temp_mysymbol != NULL);
11054 mysymbol = isSgClassSymbol(temp_mysymbol);
11055 ROSE_ASSERT(mysymbol != NULL);
11058 ROSE_ASSERT(scope == nonDefiningDecl->
get_scope());
11066 if (mysymbol != NULL)
11068 SgClassDeclaration* symbol_declaration = isSgClassDeclaration(mysymbol->get_declaration());
11069 ROSE_ASSERT(symbol_declaration != NULL);
11070 ROSE_ASSERT(symbol_declaration->
get_scope() == scope);
11072 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Testing scope->get_symbol_table()->exists(mysymbol) == true (expensive) \n");
11086#if DEBUG_CLASS_DECLARATION
11087 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
11090 if (mysymbol != NULL)
11092 nondefdecl = isSgClassDeclaration(mysymbol->get_declaration());
11094 ROSE_ASSERT(nondefdecl != NULL);
11096#if DEBUG_CLASS_DECLARATION
11097 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol->get_declaration(): nondefdecl = %p = %s nondefdecl->get_definition() = %p = %s \n",
11098 nondefdecl,nondefdecl->class_name().c_str(),nondefdecl->get_definition(),
11099 nondefdecl->get_definition() != NULL ? nondefdecl->get_definition()->class_name().c_str() :
"NULL");
11104 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
11107 ROSE_ASSERT(nondefdecl == nondefdecl->get_firstNondefiningDeclaration());
11112#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11114 detectTransformations(nondefdecl);
11118 ROSE_ASSERT(nondefdecl->get_type() != NULL);
11121 if (nondefdecl->get_parent() == NULL)
11123#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11124 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Note that nondefdecl->get_parent() == NULL, this might be OK. \n");
11133 if (nondefdecl->get_definingDeclaration() != NULL)
11135#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11136 printf (
"ERROR: In SageBuilder::buildClassDeclaration_nfi(): Non defining declaration nondefdecl = %p = %s already has a defining declaration, so we would be build another nondefdecl->get_definingDeclaration() = %p = %s \n",
11137 nondefdecl,nondefdecl->class_name().c_str(),nondefdecl->get_definingDeclaration(),nondefdecl->get_definingDeclaration()->class_name().c_str());
11139 SgClassDeclaration* nondefining_classDeclaration = isSgClassDeclaration(nondefdecl);
11140 ROSE_ASSERT(nondefining_classDeclaration != NULL);
11141 SgClassDeclaration* defining_classDeclaration = isSgClassDeclaration(nondefdecl->get_definingDeclaration());
11142 ROSE_ASSERT(defining_classDeclaration != NULL);
11144#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11145 printf (
"In SageBuilder::buildClassDeclaration_nfi(): nondefining_classDeclaration: scope = %p = %s name = %s \n",
11146 nondefining_classDeclaration->
get_scope(),nondefining_classDeclaration->
get_scope()->
class_name().c_str(),nondefining_classDeclaration->get_name().str());
11147 printf (
"In SageBuilder::buildClassDeclaration_nfi(): defining_classDeclaration: scope = %p = %s name = %s \n",
11148 defining_classDeclaration->
get_scope(),defining_classDeclaration->
get_scope()->
class_name().c_str(),defining_classDeclaration->get_name().str());
11149 defining_classDeclaration->
get_file_info()->display(
"already has a defining declaration");
11152 printf (
"Error: In SageBuilder::buildClassDeclaration_nfi(): exiting as part of test \n");
11156#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11157 printf (
"WARNING: In SageBuilder::buildClassDeclaration_nfi(): but a defining declaration was found to have already been built (might be an error), so returning it defining_classDeclaration = %p \n",defining_classDeclaration);
11162 printf (
"Exiting as a test! \n");
11165 return defining_classDeclaration;
11172 ROSE_ASSERT(nondefdecl->get_definingDeclaration() == defdecl);
11173 ROSE_ASSERT(nondefdecl->get_firstNondefiningDeclaration() != defdecl);
11178#if DEBUG_CLASS_DECLARATION
11179 printf (
"In SageBuilder::buildClassDeclaration_nfi(): building a nondefining declaration since it does not exist \n");
11182 ROSE_ASSERT(nondefdecl == NULL);
11186 if (buildTemplateInstantiation ==
true)
11189#if DEBUG_CLASS_DECLARATION
11190 printf (
"************************************************************************* \n");
11191 printf (
"Building SgTemplateInstantiationDecl with empty SgTemplateArgumentPtrList \n");
11192 printf (
" --- using nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
11193 printf (
"************************************************************************* \n");
11195 SgTemplateArgumentPtrList emptyList;
11198 ROSE_ASSERT(nondefdecl != NULL);
11199#if DEBUG_CLASS_DECLARATION
11200 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Build SgTemplateInstantiationDecl: nondefdecl = %p \n",nondefdecl);
11204 ROSE_ASSERT(nondefdecl->get_type() == NULL);
11205 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl) != NULL);
11207 printf (
"In buildClassDeclaration_nfi(): nondefdecl->get_name() = %s nondefdecl->get_templateName() = %s \n",nondefdecl->get_name().str(),isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().str());
11209#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11218 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().is_null() ==
true);
11221 ROSE_ASSERT(templateArgumentsList != NULL);
11231 if (templateArgumentsList->size() == 0)
11233 printf (
"Warning: In SageBuilder::buildClassDeclaration_nfi(): templateArgumentsList->size() == 0 \n");
11237 nondefdecl->set_firstNondefiningDeclaration(nondefdecl);
11254#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11255 printf (
"Warning: In buildClassDeclaration_nfi(): calling set_templateName(nameWithTemplateArguments = %s) for nondefining declaration \n",nameWithTemplateArguments.str());
11260 isSgTemplateInstantiationDecl(nondefdecl)->
set_templateName(nameWithoutTemplateArguments);
11267 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().is_null() ==
false);
11273 if (
hasTemplateSyntax(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName()) ==
false)
11275#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11276 printf (
"WARNING: No template syntax present in name of template class instantiation (nondefdecl) \n");
11281#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11286 ROSE_ASSERT(nondefdecl->get_file_info() == NULL);
11291#if DEBUG_CLASS_DECLARATION
11292 printf (
"WARNING: In buildClassDeclaration_nfi(): Are we building a new SgClassDeclaration as a nondefining declaration when we should be using the nonDefiningDecl = %p \n",nonDefiningDecl);
11293 printf (
" --- nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
11298 ROSE_ASSERT(nondefdecl != NULL);
11299#if DEBUG_CLASS_DECLARATION
11300 printf (
"In buildClassDeclaration_nfi(): (no file info set): nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
11302 ROSE_ASSERT(nameWithoutTemplateArguments == nameWithTemplateArguments);
11304#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11310 nondefdecl->set_firstNondefiningDeclaration(nondefdecl);
11315 ROSE_ASSERT(nondefdecl->get_file_info() == NULL);
11318 ROSE_ASSERT(nondefdecl != NULL);
11322 ROSE_ASSERT(nondefdecl == nondefdecl->get_firstNondefiningDeclaration());
11331 ROSE_ASSERT(scope != NULL);
11333#if DEBUG_CLASS_DECLARATION
11334 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Set the scope of the new non-defining declaration to %p = %s \n",scope,scope->
class_name().c_str());
11336 nondefdecl->set_scope(scope);
11337 ROSE_ASSERT(nondefdecl->get_scope() != NULL);
11346 printf (
"In buildClassDeclaration_nfi(): setting the parent of the non defining declaration to be the scope by default) \n");
11353 ROSE_ASSERT(nondefdecl->get_type() == NULL);
11355 if (nondefdecl->get_type() == NULL)
11357#if DEBUG_CLASS_DECLARATION
11359 printf (
"Calling scope->get_type_table()->lookup_type(): nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
11361 printf (
"WE NEED THE MANGLED NAME FOR THIS TO BE RELEVANT! \n");
11367#if DEBUG_CLASS_DECLARATION
11368 printf (
"In SageBuilder::buildClassDeclaration_nfi(): kind == SgClassDeclaration::e_java_parameter = %s \n",(kind ==
SgClassDeclaration::e_java_parameter) ?
"true" :
"false");
11373#if DEBUG_CLASS_DECLARATION
11374 printf (
"In SageBuilder::buildClassDeclaration_nfi(): nondefdecl->get_type() == NULL: building a new class_type = %p = %s \n",class_type,class_type->class_name().c_str());
11376 nondefdecl->set_type(class_type);
11377#if DEBUG_CLASS_DECLARATION
11378 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): built class type: part 4: nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
11380 SgClassDeclaration* tmp_classDeclarationFromType = isSgClassDeclaration(class_type->get_declaration());
11381 ROSE_ASSERT(tmp_classDeclarationFromType != NULL);
11382#if DEBUG_CLASS_DECLARATION
11384 printf (
"tmp_classDeclarationFromType: scope = %p = %s \n",scope,scope->
class_name().c_str());
11385 printf (
"tmp_classDeclarationFromType = %p = %s \n",tmp_classDeclarationFromType,tmp_classDeclarationFromType->
class_name().c_str());
11386 printf (
"tmp_classDeclarationFromType name = %s \n",tmp_classDeclarationFromType->get_name().str());
11389 tmp_classDeclarationFromType->
get_file_info()->display(
"tmp_classDeclarationFromType: debug");
11394 ROSE_ASSERT(nondefdecl->get_type() != NULL);
11395 if (nondefdecl->get_type()->get_declaration() != nondefdecl)
11397 printf (
"ERROR: nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
11398 printf (
"ERROR: nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
11399 printf (
"ERROR: nondefdecl->get_type()->get_declaration() = %p = %s \n",nondefdecl->get_type()->get_declaration(),nondefdecl->get_type()->get_declaration()->class_name().c_str());
11401 SgClassDeclaration* classDeclarationFromType = isSgClassDeclaration(nondefdecl->get_type()->get_declaration());
11402 ROSE_ASSERT(classDeclarationFromType != NULL);
11404 printf (
"nondefdecl->get_name() = %s \n",nondefdecl->get_name().str());
11405 printf (
"nondefdecl->get_type()->get_name() = %s \n",nondefdecl->get_type()->get_name().str());
11406 printf (
"nondefdecl->get_type()->get_declaration()->get_name() = %s \n",classDeclarationFromType->get_name().str());
11408 printf (
"nondefdecl->get_mangled_name() = %s \n",nondefdecl->get_mangled_name().getString().c_str());
11409 printf (
"nondefdecl->get_type()->get_mangled() = %s \n",nondefdecl->get_type()->get_mangled().getString().c_str());
11410 printf (
"nondefdecl->get_type()->get_declaration()->get_mangled_name() = %s \n",classDeclarationFromType->get_mangled_name().getString().c_str());
11413 printf (
"nondefdecl->get_type()->get_declaration()->get_firstNondefiningDeclaration() = %s \n",classDeclarationFromType->
get_firstNondefiningDeclaration() ?
"true" :
"false");
11414 printf (
"nondefdecl->get_firstNondefiningDeclaration() = %s \n",nondefdecl->get_firstNondefiningDeclaration() ?
"true" :
"false");
11420 if (parent != NULL)
11422 printf (
"nondefdecl->get_parent() = %p = %s \n",parent,parent->
class_name().c_str());
11427#if DEBUG_CLASS_DECLARATION
11428 nondefdecl->get_type()->get_declaration()->get_file_info()->display(
"nondefdecl->get_type()->get_declaration()");
11435 if (nondefdecl->get_file_info() == NULL)
11437 printf (
"ERROR: In SageBuilder::buildClassDeclaration_nfi(): nondefdecl = %p = %s does not have its source position information setup \n",nondefdecl,nondefdecl->class_name().c_str());
11438 printf (
" --- nondefdecl = %s \n",nondefdecl->get_name().str());
11439 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p \n",nondefdecl->get_firstNondefiningDeclaration());
11440 printf (
" --- nondefdecl->get_definingDeclaration() = %p \n",nondefdecl->get_definingDeclaration());
11441 printf (
" --- nondefdecl->get_type() = %p \n",nondefdecl->get_type());
11442 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
11443 printf (
"The real error is: (nondefdecl->get_type()->get_declaration() != nondefdecl) \n");
11447 ROSE_ASSERT(nondefdecl->get_file_info() != NULL);
11448 nondefdecl->get_file_info()->display(
"nondefdecl");
11452 ROSE_ASSERT(nondefdecl->get_type()->get_declaration() == nondefdecl);
11455 printf (
"In buildClassDeclaration_nfi(): after set_type(): nondefdecl = %p = %s nondefdecl->get_type() = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str(),nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
11466 ROSE_ASSERT (nondefdecl->get_startOfConstruct() != NULL);
11468#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11472 detectTransformations(nondefdecl);
11480 nondefdecl->setForward();
11486 printf (
"WARNING: In buildClassDeclaration_nfi(): Skipping the setting of the parents (for both defining and nondefining declaration) to be the same as the scope \n");
11495 printf (
"In buildClassDeclaration_nfi(): Insert the new SgClassSymbol = %p from nondefdecl = %p = %s into the scope = %p = %s \n",mysymbol,nondefdecl,nondefdecl->
class_name().c_str(),scope,scope->
class_name().c_str());
11501 ROSE_ASSERT(nondefdecl->get_scope() == scope);
11508 printf (
"Warning: no scope provided to support symbol table entry! \n");
11521 if (buildTemplateInstantiation ==
true)
11524 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
11528 ROSE_ASSERT((*templateArgumentsList)[i]->get_parent() != NULL);
11538 (*templateArgumentsList)[i]->set_parent(nondefdecl);
11553 printf (
"Building a SgClassDeclaration: buildClassDeclaration_nfi() buildTemplateInstantiation = %s \n",buildTemplateInstantiation ?
"true:" :
"false");
11558 if (buildTemplateInstantiation ==
true)
11561 SgTemplateArgumentPtrList emptyList;
11567 ROSE_ASSERT(defdecl->get_type() == NULL);
11568 ROSE_ASSERT(isSgTemplateInstantiationDecl(defdecl) != NULL);
11570 printf (
"In buildClassDeclaration_nfi(): defdecl->get_name() = %s defdecl->get_templateName() = %s \n",defdecl->get_name().str(),isSgTemplateInstantiationDecl(defdecl)->get_templateName().str());
11574 ROSE_ASSERT(isSgTemplateInstantiationDecl(defdecl)->get_templateName().is_null() ==
true);
11577 printf (
"Warning: In buildClassDeclaration_nfi(): calling set_templateName(name = %s) for defining declaration \n",name.str());
11586 ROSE_ASSERT(name.getString().find(
'<') == string::npos);
11589 SgName templateName = generateTemplateNameFromTemplateNameWithTemplateArguments(name);
11590 printf (
"In buildClassDeclaration_nfi(): templateName = %s \n",templateName.str());
11605 printf (
"In buildClassDeclaration_nfi(): nameWithoutTemplateArguments = %s nameWithTemplateArguments = %s \n",nameWithoutTemplateArguments.str(),nameWithTemplateArguments.str());
11607 isSgTemplateInstantiationDecl(defdecl)->
set_templateName(nameWithoutTemplateArguments);
11609#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11613 printf (
"WARNING: In buildClassDeclaration_nfi(): nameWithTemplateArguments = %s is not using template syntax \n",nameWithTemplateArguments.str());
11622 ROSE_ASSERT(isSgTemplateInstantiationDecl(defdecl)->get_templateName().is_null() ==
false);
11625 if (isSgTemplateInstantiationDecl(defdecl)->get_templateName().getString().find(
'>') == string::npos)
11627#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11628 printf (
"WARNING: No template syntax present in name of template class instantiation (defdecl) \n");
11633 printf (
"Should we have set the template instantiation name at this point? \n");
11637 ROSE_ASSERT(defdecl->get_definition() != NULL);
11638 ROSE_ASSERT(isSgTemplateInstantiationDefn(defdecl->get_definition()) != NULL);
11643 printf (
"Building a SgClassDeclaration, but we might require a SgTemplateClassDeclaration \n");
11650 if (buildTemplateDeclaration ==
true)
11652 printf (
"In buildClassDeclaration_nfi(): I think we also want template specialization arguments to be more general: using nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
11658 ROSE_ASSERT(defdecl->get_type() == NULL);
11660 printf (
"Exiting afte test! \n");
11670 printf (
"In SageBuilder::buildClassDeclaration_nfi(): build a SgClassDeclaration: defdecl = %p \n",defdecl);
11674 ROSE_ASSERT(defdecl->get_type() == NULL);
11678 ROSE_ASSERT(defdecl->get_definition() != NULL);
11679 ROSE_ASSERT(isSgTemplateInstantiationDefn(defdecl->get_definition()) == NULL);
11681 ROSE_ASSERT(defdecl != NULL);
11684 printf (
"In buildClassDeclaration_nfi(): nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
11688 nondefdecl->set_definingDeclaration(defdecl);
11690 ROSE_ASSERT(nondefdecl->get_definingDeclaration() == defdecl);
11691 ROSE_ASSERT(nondefdecl->get_firstNondefiningDeclaration() != defdecl);
11697 classDef->set_declaration(defdecl);
11698 defdecl->set_definingDeclaration(defdecl);
11712 defdecl->set_firstNondefiningDeclaration(nondefdecl);
11714 if (buildTemplateInstantiation ==
true)
11721 ROSE_ASSERT(defdecl->get_type() == NULL);
11728 if (defdecl->get_type() != NULL)
11732 if (defdecl->get_type()->get_declaration() == isSgDeclarationStatement(defdecl))
11735 ROSE_ASSERT (nondefdecl->get_type() != NULL);
11738 if (nondefdecl->get_type() != defdecl->get_type())
11741 printf (
"Deleting defdecl->get_type() = %p = %s (using type from nondefdecl = %p) \n",defdecl->get_type(),defdecl->get_type()->class_name().c_str(),nondefdecl);
11742 printf (
"Skipping delete of %p to maintain unique type pointers \n",defdecl->get_type());
11744 delete defdecl->get_type();
11747 defdecl->set_type(NULL);
11749 printf (
"In SageBuilder::buildClassDeclaration(): built class type: part 5: defdecl->get_type() = %p = %s \n",defdecl->get_type(),defdecl->get_type()->class_name().c_str());
11753 printf (
"Is this executed! \n");
11757 ROSE_ASSERT (nondefdecl->get_type() != NULL);
11758 defdecl->set_type(nondefdecl->get_type());
11760 printf (
"In SageBuilder::buildClassDeclaration(): built class type: part 6: nondefdecl->get_type() = %p = %s \n",defdecl->get_type(),defdecl->get_type()->class_name().c_str());
11764 ROSE_ASSERT(classType != NULL);
11765 SgClassDeclaration* local_classDeclaration = isSgClassDeclaration(classType->get_declaration());
11766 ROSE_ASSERT (local_classDeclaration != NULL);
11767 printf (
"In buildClassDeclaration_nfi(): classType = %p local_classDeclaration = %p \n",classType,local_classDeclaration);
11776 ROSE_ASSERT (nondefdecl->get_type() != NULL);
11777 defdecl->set_type(nondefdecl->get_type());
11779 printf (
"In buildClassDeclaration_nfi(): defdecl = %p = %s defdecl->get_type() = %p = %s \n",defdecl,defdecl->class_name().c_str(),defdecl->get_type(),defdecl->get_type()->class_name().c_str());
11782 ROSE_ASSERT (nondefdecl->get_firstNondefiningDeclaration() != NULL);
11786 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()))
11788 printf (
"WARNING: In buildClassDeclaration_nfi(): inner test: commented out test for equality between the declaration asociated with the type and that associated with the firstNondefiningDeclaration \n");
11789 printf (
" --- nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
11790 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
11791 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl->get_firstNondefiningDeclaration(),nondefdecl->get_firstNondefiningDeclaration()->class_name().c_str());
11797 ROSE_ASSERT (nondefdecl->get_type()->get_declaration() == isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()));
11801 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
11804 ROSE_ASSERT (nondefdecl->get_type() != NULL);
11807 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl))
11809 printf (
"nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
11810 printf (
"nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
11811 printf (
"nondefdecl->get_type()->get_declaration() = %p = %s \n",nondefdecl->get_type()->get_declaration(),nondefdecl->get_type()->get_declaration()->class_name().c_str());
11812 printf (
"nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl->get_firstNondefiningDeclaration(),nondefdecl->get_firstNondefiningDeclaration()->class_name().c_str());
11816 ROSE_ASSERT (defdecl->get_type() != NULL);
11817 ROSE_ASSERT (defdecl->get_type()->get_declaration() != NULL);
11818 ROSE_ASSERT (defdecl->get_type()->get_declaration() != isSgDeclarationStatement(defdecl));
11819 ROSE_ASSERT (nondefdecl->get_firstNondefiningDeclaration() != NULL);
11820 ROSE_ASSERT (nondefdecl->get_firstNondefiningDeclaration() == nondefdecl);
11822 ROSE_ASSERT (nondefdecl->get_type()->get_declaration() == isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()));
11828 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()))
11830 printf (
"WARNING: In buildClassDeclaration_nfi(): outer test (test 1): commented out test for equality between the declaration asociated with the type and that associated with the firstNondefiningDeclaration \n");
11831 printf (
" --- nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
11832 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
11833 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl->get_firstNondefiningDeclaration(),nondefdecl->get_firstNondefiningDeclaration()->class_name().c_str());
11836 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl))
11838 printf (
"WARNING: In buildClassDeclaration_nfi(): outer test (test 2): commented out test for equality between the declaration asociated with the type and that associated with the firstNondefiningDeclaration \n");
11839 printf (
" --- nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
11840 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
11841 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
11848 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
11851 defdecl->set_type(nondefdecl->get_type());
11854 printf (
"In buildClassDeclaration_nfi(): after calling set_type() again: defdecl = %p = %s defdecl->get_type() = %p = %s \n",
11855 defdecl,defdecl->class_name().c_str(),defdecl->get_type(),defdecl->get_type()->class_name().c_str());
11858 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
11863 nondefdecl->setForward();
11867 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
11872 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
11876 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
11880 ROSE_ASSERT(mysymbol);
11882 printf (
"@@@@@@@@@@@@@@ In buildClassDeclaration_nfi(): setting scope of defining and non-defining declaration to scope = %s \n",scope->
class_name().c_str());
11883 defdecl->set_scope(scope);
11884 nondefdecl->set_scope(scope);
11890 nondefdecl->set_parent(scope);
11893 defdecl->set_parent(scope);
11905 ROSE_ASSERT(defdecl->get_parent() == NULL);
11910 ROSE_ASSERT(defdecl->get_definingDeclaration() == defdecl);
11911 ROSE_ASSERT(defdecl->get_firstNondefiningDeclaration() != defdecl->get_definingDeclaration());
11917 SgClassDeclaration* temp_firstNondefiningDeclaration = isSgClassDeclaration(defdecl->get_firstNondefiningDeclaration());
11918 SgClassDeclaration* temp_definingDeclaration = isSgClassDeclaration(defdecl->get_definingDeclaration());
11919 ROSE_ASSERT(temp_firstNondefiningDeclaration != NULL);
11920 ROSE_ASSERT(temp_definingDeclaration != NULL);
11923 printf (
"Leaving buildClassDeclaration_nfi(): defdecl = %p = %s = %s \n",defdecl,defdecl->class_name().c_str(),defdecl->get_name().str());
11924 printf (
" --- defdecl->get_firstNondefiningDeclaration() = %p \n",defdecl->get_firstNondefiningDeclaration());
11925 printf (
" --- defdecl->get_definingDeclaration() = %p \n",defdecl->get_definingDeclaration());
11927 printf (
" --- defdecl->get_firstNondefiningDeclaration()->get_name() = %s \n",temp_firstNondefiningDeclaration->get_name().str());
11928 printf (
" --- defdecl->get_definingDeclaration()->get_name() = %s \n",temp_definingDeclaration->get_name().str());
11930 printf (
" --- defdecl->get_firstNondefiningDeclaration()->get_type() = %p = %s \n",
11931 temp_firstNondefiningDeclaration->get_type(),temp_firstNondefiningDeclaration->get_type()->
unparseToString().c_str());
11932 printf (
" --- defdecl->get_definingDeclaration()->get_type() = %p = %s \n",
11933 temp_definingDeclaration->get_type(),temp_definingDeclaration->get_type()->
unparseToString().c_str());
11935 printf (
" --- nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
11936 printf (
" --- nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
11939 printf (
"Leaving buildClassDeclaration_nfi(): defdecl: unparseNameToString() = %s \n",defdecl->unparseNameToString().c_str());
11943 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_name() == temp_definingDeclaration->get_name());
11944 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_type() == temp_definingDeclaration->get_type());
11949 if (definingDeclaration != NULL && nondefiningDeclaration != NULL)
11955 printf (
"NOTE: buildClassDeclaration_nfi(): Setting the templateDeclaration for the defining declaration = %p using the value = %p from the nondefiningDeclaration = %p \n",
11956 definingDeclaration,templateDeclaration,nondefiningDeclaration);
11966 if (definingDeclaration != NULL)
11971 printf (
"NOTE: buildClassDeclaration_nfi(): definingDeclaration->get_templateDeclaration() == NULL \n");
11978 printf (
"Leaving buildClassDeclaration_nfi(): defdecl = %p defdecl->unparseNameToString() = %s \n",defdecl,defdecl->unparseNameToString().c_str());
11983 printf (
"Leaving buildClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
11984 SgSymbol* test_symbol = nondefdecl->get_scope()->find_symbol_from_declaration(nondefdecl);
11987 printf (
"Leaving buildClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
11988 ROSE_ASSERT(nondefdecl->get_symbol_from_symbol_table() != NULL);
12013 ROSE_ASSERT(scope != NULL);
12015 ROSE_ASSERT(definingClassDeclaration != NULL);
12017 return definingClassDeclaration;
12036 ROSE_ASSERT(result);
12041 result->setCaseInsensitive(
true);
12060 printf(
"In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(XXX_name = %p):\n", XXX_name.str());
12067 ROSE_ASSERT(scope != NULL);
12070 printf (
"SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): XXX_name = %s scope = %p = %s \n",XXX_name.str(),scope,scope->
class_name().c_str());
12074 SgName nameWithoutTemplateArguments = XXX_name;
12078 printf (
"SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): nameWithTemplateSpecializationArguments = %s \n",nameWithTemplateSpecializationArguments.str());
12106 mysymbol = scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList);
12113 printf (
"Warning: In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): scope == NULL \n");
12116 printf (
"In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
12119 if (mysymbol != NULL)
12125 ROSE_ASSERT(classType != NULL);
12135 if (nondefdecl->get_type() != NULL)
12137 printf (
"Note: SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): nondefdecl->get_type() != NULL: name = %s \n",nondefdecl->get_name().str());
12142 ROSE_ASSERT(nondefdecl != NULL);
12145 ROSE_ASSERT(templateParameterList != NULL);
12146 nondefdecl->get_templateParameters() = *templateParameterList;
12157 nondefdecl->set_nonreal_decl_scope(nonreal_decl_scope);
12163 printf(
"In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(XXX_name = %p): nrscope = %p (new)\n", XXX_name.str(), nonreal_decl_scope);
12173 ROSE_ASSERT(templateSpecializationArgumentList != NULL);
12174 nondefdecl->get_templateSpecializationArguments() = *templateSpecializationArgumentList;
12177 if (nondefdecl->get_templateParameters().size() == 0)
12179#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12180 printf (
"WARNING: In buildNondefiningTemplateClassDeclaration_nfi(): (part 1) nondefdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations nondefdecl = %p \n",nondefdecl);
12200 nondefdecl->set_templateName(nameWithoutTemplateArguments);
12207 ROSE_ASSERT(nondefdecl != NULL);
12210 ROSE_ASSERT(templateParameterList != NULL);
12211 nondefdecl->get_templateParameters() = *templateParameterList;
12221 if (nondefdecl->get_templateParameters().size() == 0)
12223#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12224 printf (
"WARNING: In buildNondefiningTemplateClassDeclaration_nfi(): (part 2) nondefdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations nondefdecl = %p \n",nondefdecl);
12230 nondefdecl->set_templateName(nameWithoutTemplateArguments);
12234 if (nondefdecl->get_type() == NULL)
12241 ROSE_ASSERT(nondefdecl->get_type() != NULL);
12260 printf (
"In buildNondefiningTemplateClassDeclaration_nfi(): Commented out setting the parent to the scope. \n");
12270 if (nondefdecl->get_type() == NULL)
12277 ROSE_ASSERT(nondefdecl->get_type() != NULL);
12279 printf (
"In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): built class type: part 1: nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str());
12288 printf (
"Building a SgTemplateSymbol using nameWithTemplateSpecializationArguments = %s and nondefdecl = %p = %s \n",nameWithTemplateSpecializationArguments.str(),nondefdecl,nondefdecl->
class_name().c_str());
12294 ROSE_ASSERT(mysymbol != NULL);
12300 ROSE_ASSERT(scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList) == NULL);
12304 scope->
insert_symbol(nameWithTemplateSpecializationArguments, mysymbol);
12306 printf (
"SageBuilder::buildNondefiningTemplateClassDeclaration_nfi() (after building symbol): scope = %p = %s \n",scope,scope->
class_name().c_str());
12308 ROSE_ASSERT(nondefdecl->
get_scope() != NULL);
12315 ROSE_ASSERT(scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList) != NULL);
12334 ROSE_ASSERT(templateClassDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateClassDeclaration->get_templateParameters().size()));
12351 if (defdecl->get_type() != NULL)
12355 if (defdecl->get_type()->get_declaration() == isSgDeclarationStatement(defdecl) )
12357 delete defdecl->get_type();
12362 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12363 ROSE_ASSERT (nondefdecl->get_type()->get_declaration() == isSgDeclarationStatement(nondefdecl));
12364 defdecl->set_type(nondefdecl->get_type());
12367 ROSE_ASSERT(nondefdecl->get_type() != NULL);
12385 ROSE_ASSERT(defdecl->get_definingDeclaration() == defdecl);
12386 ROSE_ASSERT(defdecl->get_firstNondefiningDeclaration() != defdecl->get_definingDeclaration());
12388 ROSE_ASSERT(defdecl->get_scope() != NULL);
12392 ROSE_ASSERT(nondefdecl->
get_parent() == NULL);
12395 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
12401 printf (
"Leaving buildNondefiningTemplateClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
12403 SgSymbol* test_symbol = nondefdecl->
get_scope()->find_symbol_from_declaration(tmp_classDeclaration);
12406 printf (
"Leaving buildNondefiningTemplateClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
12415 SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateSpecializationArgumentList )
12424 SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateSpecializationArgumentList )
12433 printf (
"In buildTemplateClassDeclaration_nfi(): nonDefiningDecl = %p \n",nonDefiningDecl);
12434 if (nonDefiningDecl != NULL)
12437 printf (
"--- nonDefiningDecl->get_definingDeclaration() = %p \n",nonDefiningDecl->
get_definingDeclaration());
12442 ROSE_ASSERT(scope != NULL);
12445 SgName nameWithoutTemplateArguments = XXX_name;
12454 if (nonDefiningDecl != NULL)
12459 SgName templateString =
"template string";
12461 SgTemplateParameterPtrList templateParameters;
12478 printf (
"In buildTemplateClassDeclaration_nfi(): calling new SgTemplateClassDeclaration() name = %s \n",nameWithTemplateSpecializationArguments.str());
12493 if (nonDefiningDecl != NULL)
12501 ROSE_ASSERT(defdecl != NULL);
12503 printf (
"In buildTemplateClassDeclaration_nfi(): Reusing the defining declaration previously build: defdecl = %p = %s \n",defdecl,defdecl->get_name().str());
12509 printf (
"In buildTemplateClassDeclaration_nfi(): No defining declaration found, so we have to build one. \n");
12514 if (defdecl == NULL)
12517 printf (
"Building a defining declaration \n");
12522 ROSE_ASSERT(defdecl != NULL);
12525 printf (
"In buildTemplateClassDeclaration_nfi(): defdecl = %p = %s \n",defdecl,defdecl->
class_name().c_str());
12529 ROSE_ASSERT(templateParameterList != NULL);
12530 defdecl->get_templateParameters() = *templateParameterList;
12533 ROSE_ASSERT(templateSpecializationArgumentList != NULL);
12534 defdecl->get_templateSpecializationArguments() = *templateSpecializationArgumentList;
12540 if (defdecl->get_templateParameters().size() == 0)
12542#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12543 printf (
"WARNING: In buildTemplateClassDeclaration_nfi(): defdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations defdecl = %p \n",defdecl);
12549 defdecl->set_templateName(nameWithoutTemplateArguments);
12552 printf (
"SageBuilder::buildTemplateClassDeclaration_nfi(): scope = %p = %s \n",scope,scope->
class_name().c_str());
12561 ROSE_ASSERT(classDef != NULL);
12568 classDef->set_declaration(defdecl);
12577 if (nondefdecl == NULL) {
12578 ROSE_ASSERT(scope != NULL);
12580 SgClassSymbol* mysymbol = scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList);
12582 printf (
"In buildTemplateClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
12585 if (mysymbol != NULL) {
12586 nondefdecl = isSgTemplateClassDeclaration(mysymbol->get_declaration());
12587 ROSE_ASSERT(nondefdecl != NULL);
12594 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
12601 printf(
" start build non-defn decl for %p\n",defdecl);
12605 ROSE_ASSERT(nondefdecl != NULL);
12610 printf(
" nondefdecl = %p\n",nondefdecl);
12617 nondefdecl->set_nonreal_decl_scope(nonreal_decl_scope);
12623 printf(
"In buildTemplateClassDeclaration_nfi(): nrscope = %p\n", nonreal_decl_scope);
12627 ROSE_ASSERT(templateParameterList != NULL);
12628 nondefdecl->get_templateParameters() = *templateParameterList;
12636 if (nondefdecl->get_templateParameters().size() == 0)
12638#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12639 printf (
"WARNING: In buildTemplateClassDeclaration_nfi(): nondefdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations nondefdecl = %p \n",nondefdecl);
12644 printf(
" next 1\n");
12648 nondefdecl->set_templateName(nameWithoutTemplateArguments);
12651 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
12666 printf(
" next 2\n");
12669 if (nondefdecl->get_type() == NULL)
12673 printf (
"In SageBuilder::buildTemplateClassDeclaration_nfi(): built class type: part 1: nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str());
12677 printf(
" next 3\n");
12681 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
12692 ROSE_ASSERT(templateClassDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateClassDeclaration->get_templateParameters().size()));
12695 scope->
insert_symbol(nameWithTemplateSpecializationArguments, mysymbol);
12697 printf(
" end build non-defn decl\n");
12701 SgClassSymbol* mysymbol = scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList);
12702 if (mysymbol == NULL) {
12703 printf(
"WARNING: In buildTemplateClassDeclaration_nfi(): non-defining declaration was provided but cannot be located in the associated scope.\n");
12708 printf (
"In buildTemplateClassDeclaration_nfi(): Setting the firstNondefiningDeclaration to be nondefdecl = %p \n",nondefdecl);
12724 if (defdecl->get_type() != NULL)
12730 if (defdecl->get_type()->get_declaration() == isSgDeclarationStatement(defdecl) )
12732 delete defdecl->get_type();
12744 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12748 if (isSgClassType(nondefdecl->get_type())->get_declaration() != isSgDeclarationStatement(nondefdecl))
12751 printf (
"In buildTemplateClassDeclaration_nfi(): detected isSgClassType(nondefdecl->get_type())->get_declaration() != isSgDeclarationStatement(nondefdecl) (problem with Boost code in ROSE compiling ROSE) \n");
12756 defdecl->set_type(nondefdecl->get_type());
12759 printf (
"In SageBuilder::buildTemplateClassDeclaration_nfi(): built class type: part 2: defdecl->get_type() = %p = %s \n",defdecl->get_type(),defdecl->get_type()->
class_name().c_str());
12774 printf (
"***** WARNING *****: Commented out call to fixStructDeclaration() \n");
12782 ROSE_ASSERT(defdecl->
get_scope() != NULL);
12786 ROSE_ASSERT(defdecl->get_type() != NULL);
12789 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
12795#if PRINT_DEVELOPER_WARNINGS
12796 printf (
"WARNING: the parent will have been set if the defining declaration was found and reused! defdecl = %p = %s \n",defdecl,defdecl->
class_name().c_str());
12801 ROSE_ASSERT(defdecl->get_templateName().is_null() ==
false);
12804 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
12811 printf (
"Leaving buildTemplateClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
12813 SgSymbol* test_symbol = defdecl->
get_scope()->find_symbol_from_declaration(tmp_classDeclaration);
12816 printf (
"Leaving buildTemplateClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
12846 ASSERT_not_null(scope);
12857 SgEnumSymbol* existing_symbol = scope->lookup_enum_symbol(name);
12858 if (existing_symbol != NULL)
12860 enumType = isSgEnumType(existing_symbol->
get_type());
12861 first_nondefdecl = existing_symbol->get_declaration();
12862 ROSE_ASSERT(first_nondefdecl != NULL);
12871 ROSE_ASSERT(nondefdecl);
12875 if (first_nondefdecl)
12890 ASSERT_not_null(type);
12896 SgEnumSymbol* existing_symbol = scope->lookup_enum_symbol(name);
12898 if (existing_symbol)
12900 mysymbol = existing_symbol;
12901 first_nondefdecl = mysymbol->get_declaration();
12905 first_nondefdecl = nondefdecl;
12908 ASSERT_not_null(mysymbol);
12918 if (first_nondefdecl != nondefdecl)
12928 ASSERT_not_null(nondefdecl->
get_type());
12929 ASSERT_not_null(scope->lookup_enum_symbol(name));
12938 ROSE_ASSERT(scope != NULL);
12941 printf (
"In buildEnumDeclaration_nfi(): name = %s scope = %p = %s \n",name.str(),scope,scope->
class_name().c_str());
12949 SgEnumSymbol* existing_symbol = scope->lookup_enum_symbol(name);
12950 if (existing_symbol != NULL)
12952 enumType = isSgEnumType(existing_symbol->
get_type());
12957 printf (
"In buildEnumDeclaration_nfi(): name = %s building using enumType = %p \n",name.str(),enumType);
12962 ROSE_ASSERT(defdecl);
12965 printf (
"In buildEnumDeclaration_nfi(): built defining declaration = %p name = %s scope = %p = %s \n",defdecl,name.str(),scope,scope->
class_name().c_str());
12970 ROSE_ASSERT(type != NULL);
12977 printf (
"In buildEnumDeclaration_nfi(): name = %s \n",name.str());
12982 ROSE_ASSERT(scope != NULL);
12983 SgEnumSymbol* enumSymbol = scope->lookup_enum_symbol(name);
12986 if (enumSymbol != NULL)
12988 ROSE_ASSERT(enumSymbol->get_declaration() != NULL);
12989 nondefdecl = enumSymbol->get_declaration();
12990 ROSE_ASSERT(nondefdecl != NULL);
12997 printf (
"###### In buildEnumDeclaration_nfi(): built a non-defining declaration to support the symbol table: name = %s nondefdecl = %p \n",name.str(),nondefdecl);
13026 ROSE_ASSERT(mysymbol);
13046 printf (
"In buildEnumDeclaration_nfi(): name = %s defdecl = %p \n",name.str(),defdecl);
13050 ROSE_ASSERT(scope->lookup_enum_symbol(name) != NULL);
13062 ROSE_ASSERT(classDeclaration != NULL);
13063 ROSE_ASSERT(classDefinition != NULL);
13074 ROSE_ASSERT(baseclass != NULL);
13076 if (isVirtual ==
true)
13080 ROSE_ASSERT(baseclass->get_baseClassModifier() != NULL);
13081 baseclass->get_baseClassModifier()->setVirtual();
13093 classDefinition->append_inheritance(baseclass);
13102 ROSE_ASSERT(nrdecl != NULL);
13103 ROSE_ASSERT(classDefinition != NULL);
13106 ROSE_ASSERT(baseclass != NULL);
13108 if (isVirtual ==
true)
13110 baseclass->get_baseClassModifier()->setVirtual();
13115 classDefinition->append_inheritance(baseclass);
13125SageBuilder::buildAccessModifier (
unsigned int access )
13133 printf (
"In SageBuilder::set_access_modifiers(): Mark as public \n");
13140 printf (
"In SageBuilder::set_access_modifiers(): Mark as protected \n");
13147 printf (
"In SageBuilder::set_access_modifiers(): Mark as private \n");
13153 printf (
"Error: default reached in SageBuilder::set_access_modifiers() \n");
13168 ROSE_ASSERT(subtreeRoot != NULL);
13169 ROSE_ASSERT(newFileName !=
"");
13171#define DEBUG_FIXUP 0
13174 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): newFileName = %s \n",newFileName.c_str());
13175 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
13182 Traversal(
const std::string& tmp_newFileName,
int tmp_new_file_id,
int tmp_originalFileId)
13184 newFileName = tmp_newFileName;
13185 new_file_id = tmp_new_file_id;
13186 originalFileId = tmp_originalFileId;
13188 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): newFileName = %s new_file_id = %d originalFileId = %d \n",newFileName.c_str(),new_file_id,originalFileId);
13195 printf (
"In fixupSourcePositionFileSpecification visit(): node = %p = %s \n",node,node->
class_name().c_str());
13199 if (locatedNode != NULL)
13210 printf (
"Found SgLocatedNode marked as isShared() == true: locatedNode = %p = %s \n",locatedNode,locatedNode->
class_name().c_str());
13213 printf (
"Exiting as a test! \n");
13224 printf (
"locatedNode->get_startOfConstruct()->get_filename() = %s locatedNode->get_startOfConstruct()->get_physical_filename() = %s \n",
13226 printf (
"locatedNode->get_startOfConstruct()->get_file_id() = %d locatedNode->get_startOfConstruct()->get_physical_file_id() = %d \n",
13228 printf (
"locatedNode->get_startOfConstruct()->isShared() = %s \n",locatedNode->
get_startOfConstruct()->
isShared() ?
"true" :
"false");
13234 printf (
"NOT MATCHING: originalFileId = %d locatedNode->get_startOfConstruct()->get_file_id() = %d locatedNode->get_startOfConstruct()->get_physical_file_id() = %d \n",
13236 printf (
" ------------ originalFileId = %d locatedNode->get_endOfConstruct()->get_file_id() = %d locatedNode->get_endOfConstruct()->get_physical_file_id() = %d \n",
13244 if (initializedName != NULL)
13262 if (sourceFile != NULL)
13270 printf (
"sourceFile->get_endOfConstruct() == NULL: fixup endOfConstruct \n");
13284 printf (
"sourceFile->get_startOfConstruct()->get_file_id() = %d \n",sourceFile->
get_startOfConstruct()->get_file_id());
13285 printf (
"sourceFile->get_startOfConstruct()->get_physical_file_id() = %d \n",sourceFile->
get_startOfConstruct()->get_physical_file_id());
13294 printf (
"Unhandled: node = %p = %s \n",node,node->
class_name().c_str());
13301 if (expression != NULL)
13303 if (expression->get_operatorPosition()->get_physical_file_id() == originalFileId)
13305 expression->get_operatorPosition()->set_file_id(new_file_id);
13306 expression->get_operatorPosition()->set_physical_file_id(new_file_id);
13313 int originalFileId;
13314 string newFileName;
13318 SgFile* file = isSgFile(subtreeRoot);
13319 int new_file_id = -1;
13320 int originalFileId = -1;
13329 printf (
"originalFileId = %d \n",originalFileId);
13342 int new_file_id_2 = Sg_File_Info::getIDFromFilename(newFileName);
13344 printf (
"new_file_id = %d new_file_id_2 = %d \n",new_file_id,new_file_id_2);
13346 ROSE_ASSERT(new_file_id == new_file_id_2);
13348 string new_filename_2 = Sg_File_Info::getFilenameFromID(new_file_id);
13350 printf (
"newFileName = %s new_filename_2 = %s \n",newFileName.c_str(),new_filename_2.c_str());
13352 ROSE_ASSERT(newFileName == new_filename_2);
13356 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): file != NULL: newFileName = %s new_file_id = %d \n",newFileName.c_str(),new_file_id);
13361 SgLocatedNode* subtreeLocatedNode = isSgLocatedNode(subtreeRoot);
13362 if (subtreeLocatedNode != NULL)
13365 printf (
"subtreeLocatedNode->get_startOfConstruct()->get_file_id() = %d \n",subtreeLocatedNode->
get_startOfConstruct()->get_file_id());
13366 printf (
"subtreeLocatedNode->get_startOfConstruct()->get_physical_file_id() = %d \n",subtreeLocatedNode->
get_startOfConstruct()->get_physical_file_id());
13369 new_file_id = Sg_File_Info::getIDFromFilename(newFileName);
13371 printf (
"originalFileId = %d \n",originalFileId);
13372 printf (
"new_file_id = %d \n",new_file_id);
13375 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): subtreeLocatedNode = %s : originalFileId = %d newFileName = %s new_file_id = %d \n",
13376 subtreeLocatedNode->
class_name().c_str(),originalFileId,newFileName.c_str(),new_file_id);
13381 printf (
"Error: In SageBuilder::fixupSourcePositionFileSpecification(): subtree should be a SgFile or SgLocatedNode: subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
13386 printf (
"Error: In SageBuilder::fixupSourcePositionFileSpecification(): subtree should be a SgFile: subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
13391 ROSE_ASSERT(new_file_id >= 0);
13394 Traversal traversal (newFileName,new_file_id,originalFileId);
13399 traversal.traverse(subtreeRoot, preorder);
13402 printf (
"Exiting as a test in SageBuilder::fixupSourcePositionFileSpecification() \n");
13420 ROSE_ASSERT(subtreeRoot != NULL);
13421 ROSE_ASSERT(new_file_id >= 0);
13424 printf (
"In SageBuilder::fixupSharingSourcePosition(): subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
13425 printf (
"In SageBuilder::fixupSharingSourcePosition(): new_file_id = %d \n",new_file_id);
13432 Traversal(
int tmp_new_file_id)
13434 new_file_id = tmp_new_file_id;
13436 printf (
"In SageBuilder::fixupSharingSourcePosition(): new_file_id = %d \n",new_file_id);
13440 void visit (
SgNode* node)
13443 printf (
"In fixupSharingSourcePosition visit(): node = %p = %s new_file_id = %d \n",node,node->
class_name().c_str(),new_file_id);
13447 if (statement != NULL)
13452 printf (
"new_file_id = %d startOfConstruct->get_physical_file_id() = %d \n",new_file_id,startOfConstruct->get_physical_file_id());
13455 if (startOfConstruct->get_physical_file_id() == new_file_id)
13463 printf (
" --- adding entries for file_id and line number to support sharing: new_file_id = %d line = %d end line = %d \n",
13466 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == startOfConstruct->get_fileLineNumbersToUnparse().size());
13467 ROSE_ASSERT(endOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
13468 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
13471 startOfConstruct->get_fileIDsToUnparse().push_back(new_file_id);
13472 startOfConstruct->get_fileLineNumbersToUnparse().push_back(startOfConstruct->
get_line());
13474 endOfConstruct->get_fileIDsToUnparse().push_back(new_file_id);
13475 endOfConstruct->get_fileLineNumbersToUnparse().push_back(endOfConstruct->
get_line());
13477 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == startOfConstruct->get_fileLineNumbersToUnparse().size());
13478 ROSE_ASSERT(endOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
13479 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
13485 printf (
"Unhandled: node = %p = %s \n",node,node->
class_name().c_str());
13495 SgStatement* statement = isSgStatement(subtreeRoot);
13496 if (statement != NULL)
13499 printf (
"statement->get_startOfConstruct()->get_file_id() = %d \n",statement->
get_startOfConstruct()->get_file_id());
13500 printf (
"statement->get_startOfConstruct()->get_physical_file_id() = %d \n",statement->
get_startOfConstruct()->get_physical_file_id());
13503 printf (
"new_file_id = %d \n",new_file_id);
13506 printf (
"In SageBuilder::fixupSharingSourcePosition(): statement = %s : new_file_id = %d \n",statement->
class_name().c_str(),new_file_id);
13511 printf (
"Error: In SageBuilder::fixupSharingSourcePosition(): subtree should be a SgFile or SgLocatedNode: subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
13515 ROSE_ASSERT(new_file_id >= 0);
13518 Traversal traversal (new_file_id);
13523 traversal.traverse(subtreeRoot, preorder);
13526 printf (
"Exiting as a test in SageBuilder::fixupSharingSourcePosition() \n");
13543#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
13546 printf (
"In SageBuilder::buildFile(inputFileName = %s, outputFileName = %s, project = %p) \n",inputFileName.c_str(),outputFileName.c_str(),project);
13552 ROSE_ASSERT(project != NULL);
13555 if (tmp1_collectionOfModifiedLocatedNodes.size() > 0)
13557 printf (
"In Traversal::evaluateInheritedAttribute(): tmp1_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp1_collectionOfModifiedLocatedNodes.size());
13559 printf (
"Exiting as a test! \n");
13560 ROSE_ASSERT(
false);
13565 ROSE_ASSERT(inputFileName.size() != 0);
13570 string sourceFilename = inputFileName;
13574 printf (
"sourceFilename = %s \n",sourceFilename.c_str());
13580 if (project != NULL)
13582 SgGlobal* globalScopeAcrossFiles = project->get_globalScopeAcrossFiles();
13583 ROSE_ASSERT(globalScopeAcrossFiles != NULL);
13586 ROSE_ASSERT(globalScopeAcrossFiles->
get_symbol_table()->get_table() != NULL);
13589 printf (
"In SageBuilder::buildFile(): globalScopeAcrossFiles = %p \n",globalScopeAcrossFiles);
13590 printf (
" --- globalScopeAcrossFiles->get_declarations().size() = %zu \n",globalScopeAcrossFiles->
get_declarations().size());
13591 printf (
" --- globalScopeAcrossFiles->get_symbol_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->
size());
13592 printf (
" --- globalScopeAcrossFiles->get_symbol_table()->get_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->get_table()->size());
13595 printf (
"Removing all elements from the globalScopeAcrossFiles->get_symbol_table() \n");
13601 if (clear_globalScopeAcrossFiles ==
true)
13603 globalScopeAcrossFiles->
get_symbol_table()->get_table()->delete_elements();
13607 printf (
"After removing all symbols (alias symbols): globalScopeAcrossFiles->get_symbol_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->
size());
13608 printf (
"After removing all symbols (alias symbols): globalScopeAcrossFiles->get_symbol_table()->get_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->get_table()->size());
13615 Rose_STL_Container<std::string> arglist;
13616 int nextErrorCode = 0;
13619 bool set_header_file_unparsing_optimization =
false;
13623 bool isCopyOfExistingFile_testForSharedNodes =
false;
13624 SgFile* fileBeingCopied = NULL;
13626 if (project == NULL)
13631 printf (
"In SageBuilder::buildFile(): build the SgProject \n");
13634 ROSE_ASSERT(project);
13635 project->get_fileList().clear();
13637 arglist.push_back(
"cc");
13638 arglist.push_back(
"-c");
13646 SgFilePtrList & files = project->get_fileList();
13647 for (SgFilePtrList::iterator i = files.begin(); i != files.end(); i++)
13651 printf (
"file = %p = %s name = %s \n",file,file->
class_name().c_str(), file->
getFileName().c_str());
13653 printf (
"file->get_header_file_unparsing_optimization() = %s \n",file->get_header_file_unparsing_optimization() ?
"true" :
"false");
13654 printf (
"file->get_header_file_unparsing_optimization_source_file() = %s \n",file->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
13655 printf (
"file->get_header_file_unparsing_optimization_header_file() = %s \n",file->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
13660 printf (
"This is a copy of an existing file in the project: sourceFilename = %s \n",sourceFilename.c_str());
13663 isCopyOfExistingFile_testForSharedNodes =
true;
13664 fileBeingCopied = file;
13669 if (file->get_header_file_unparsing_optimization() ==
true)
13671 set_header_file_unparsing_optimization =
true;
13678 printf (
"Exiting as a test! \n");
13683 ifstream testfile(inputFileName.c_str());
13684 if (!testfile.is_open())
13690 ofstream outputfile(inputFileName.c_str(),ios::out);
13692 outputfile<<
"// Output file generated so that StringUtility::getAbsolutePathFromRelativePath() will see a vaild file ... unparsed file will have rose_ prefix "<<endl;
13693 outputfile.close();
13713 project->get_sourceFileNameList().push_back(inputFileName);
13715 Rose_STL_Container<string> sourceFilenames = project->get_sourceFileNameList();
13723 if (std::find(arglist.begin(), arglist.end(), sourceFilename) == arglist.end())
13725 arglist.push_back(sourceFilename);
13730 if (outputFileName.empty() ==
false)
13732 arglist.push_back(
"-rose:o");
13734 arglist.push_back(outputFileName);
13751 SgFile* result = determineFileType(arglist, nextErrorCode, project);
13752 ROSE_ASSERT(result != NULL);
13755 printf (
"In SageBuilder::buildFile(): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",project,project->get_fileList_ptr()->get_listOfFiles().size());
13759 if (sourceFile != NULL)
13761 SgGlobal* globalScope = sourceFile->get_globalScope();
13762 ROSE_ASSERT(globalScope != NULL);
13771 printf (
"In SageBuilder::buildFile(): globalScope->get_isModified() == true: reset to false \n");
13775 printf (
"In SageBuilder::buildFile(): Verify false setting: globalScope->get_isModified() = %s \n",globalScope->
get_isModified() ?
"true" :
"false");
13790 ROSE_ASSERT(project != NULL);
13793 if (tmp2_collectionOfModifiedLocatedNodes.size() > 0)
13795 printf (
"In Traversal::evaluateInheritedAttribute(): tmp2_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp2_collectionOfModifiedLocatedNodes.size());
13797 printf (
"Exiting as a test! \n");
13798 ROSE_ASSERT(
false);
13805 ROSE_ASSERT(project != NULL);
13808 if (tmp22_collectionOfModifiedLocatedNodes.size() > 0)
13810 printf (
"In Traversal::evaluateInheritedAttribute(): tmp22_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp22_collectionOfModifiedLocatedNodes.size());
13812 printf (
"Exiting as a test! \n");
13813 ROSE_ASSERT(
false);
13819 printf (
"Calling outputFileIds() \n");
13823 printf (
"DONE: Calling outputFileIds() \n");
13828 printf (
"In SageBuilder::buildFile(): file = %p = %s result->get_header_file_unparsing_optimization() = %s \n",
13829 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization() ?
"true" :
"false");
13833 printf (
"In SageBuilder::buildFile(): file = %p = %s result->get_header_file_unparsing_optimization_source_file() = %s \n",
13834 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
13835 printf (
"In SageBuilder::buildFile(): file = %p = %s result->get_header_file_unparsing_optimization_header_file() = %s \n",
13836 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
13848 if (set_header_file_unparsing_optimization ==
true)
13850 result->set_header_file_unparsing_optimization(
true);
13860 result->set_header_file_unparsing_optimization_header_file(
false);
13863 printf (
"In SageBuilder::buildFile(): set_header_file_unparsing_optimization == true: file = %p = %s result->get_header_file_unparsing_optimization() = %s \n",
13864 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization() ?
"true" :
"false");
13865 printf (
"In SageBuilder::buildFile(): set_header_file_unparsing_optimization == true: file = %p = %s result->get_header_file_unparsing_optimization_source_file() = %s \n",
13866 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
13867 printf (
"In SageBuilder::buildFile(): set_header_file_unparsing_optimization == true: file = %p = %s result->get_header_file_unparsing_optimization_header_file() = %s \n",
13868 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
13884 if (project->get_Java_only() ==
true)
13887 printf (
"WARNING: Java specific action to add new file to SgProject (using set_file()) (more uniform language handling symantics would avoid this problem) \n");
13899 printf (
"In SageBuilder::buildFile(): Outliner::use_dlopen = %s \n",Outliner::use_dlopen ?
"true" :
"false");
13904 ROSE_ASSERT(project != NULL);
13907 if (tmp23_collectionOfModifiedLocatedNodes.size() > 0)
13909 printf (
"In Traversal::evaluateInheritedAttribute(): tmp23_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp23_collectionOfModifiedLocatedNodes.size());
13911 printf (
"Exiting as a test! \n");
13912 ROSE_ASSERT(
false);
13919 ROSE_ASSERT(project != NULL);
13922 if (tmp24_collectionOfModifiedLocatedNodes.size() > 0)
13924 printf (
"In Traversal::evaluateInheritedAttribute(): tmp24_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp24_collectionOfModifiedLocatedNodes.size());
13926 printf (
"Exiting as a test! \n");
13927 ROSE_ASSERT(
false);
13937 if (!Outliner::use_dlopen)
13940 printf (
"In SageBuilder::buildFile(): (after test for (!Outliner::use_dlopen) == true: project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
13941 project,project->get_fileList_ptr()->get_listOfFiles().size());
13946 printf (
"In SageBuilder::buildFile(): (after 2nd project->set_file()): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
13947 project,project->get_fileList_ptr()->get_listOfFiles().size());
13953 printf (
"In SageBuilder::buildFile(): (after test for (!Outliner::use_dlopen) == false: project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
13954 project,project->get_fileList_ptr()->get_listOfFiles().size());
13969 SgFilePtrList& flist = project->get_fileList();
13970 flist.insert(flist.begin(),result);
13972 printf (
"In SageBuilder::buildFile(): (after flist.insert(flist.begin(),result)): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
13973 project,project->get_fileList_ptr()->get_listOfFiles().size());
13980 ROSE_ASSERT(project != NULL);
13983 if (tmp25_collectionOfModifiedLocatedNodes.size() > 0)
13985 printf (
"In Traversal::evaluateInheritedAttribute(): tmp25_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp25_collectionOfModifiedLocatedNodes.size());
13987 printf (
"Exiting as a test! \n");
13988 ROSE_ASSERT(
false);
13996 EDG_ROSE_Translation::suppress_detection_of_transformations =
true;
13999 printf (
"In SageBuilder::buildFile(): EDG_ROSE_Translation::suppress_detection_of_transformations = %s \n",EDG_ROSE_Translation::suppress_detection_of_transformations ?
"true" :
"false");
14003 printf (
"In SageBuilder::buildFile(): (after project->set_file()): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",project,project->get_fileList_ptr()->get_listOfFiles().size());
14026 ROSE_ASSERT(project != NULL);
14029 if (tmp251_collectionOfModifiedLocatedNodes.size() > 0)
14031 printf (
"In Traversal::evaluateInheritedAttribute(): tmp251_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp251_collectionOfModifiedLocatedNodes.size());
14033 printf (
"Exiting as a test! \n");
14034 ROSE_ASSERT(
false);
14042 result->runFrontend(nextErrorCode);
14045 printf (
"In SageBuilder::buildFile(): (after result->runFrontend()): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",project,project->get_fileList_ptr()->get_listOfFiles().size());
14049 printf (
"After result->runFrontend(): calling outputFileIds() \n");
14053 printf (
"DONE: After result->runFrontend(): calling outputFileIds() \n");
14068 ROSE_ASSERT(project != NULL);
14071 if (tmp26_collectionOfModifiedLocatedNodes.size() > 0)
14073 printf (
"In Traversal::evaluateInheritedAttribute(): tmp26_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp26_collectionOfModifiedLocatedNodes.size());
14075 printf (
"Exiting as a test! \n");
14076 ROSE_ASSERT(
false);
14083 printf (
"Generating a dot file... (SgFile only) \n");
14084 generateDOT ( *project );
14089 printf (
"In SageBuilder::buildFile(): Generate the dot output for multiple files (ROSE AST) \n");
14091 generateDOTforMultipleFile ( *project );
14092 printf (
"DONE: Generate the dot output of the SAGE III AST \n");
14098 const int MAX_NUMBER_OF_IR_NODES_TO_GRAPH_FOR_WHOLE_GRAPH = 8000;
14099 generateAstGraph(project,MAX_NUMBER_OF_IR_NODES_TO_GRAPH_FOR_WHOLE_GRAPH);
14104 printf (
"In SageBuilder::buildFile(): calling astPostProcessing() \n");
14107 if (!project->get_skip_post_processing()) AstPostProcessing(result);
14110 printf (
"In SageBuilder::buildFile(): DONE: calling astPostProcessing() \n");
14123 ROSE_ASSERT(project != NULL);
14126 if (tmp265_collectionOfModifiedLocatedNodes.size() > 0)
14128 printf (
"In Traversal::evaluateInheritedAttribute(): tmp265_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp265_collectionOfModifiedLocatedNodes.size());
14130 printf (
"Exiting as a test! \n");
14131 ROSE_ASSERT(
false);
14137 result->display(
"SageBuilder::buildFile()");
14140 ROSE_ASSERT(project != NULL);
14141 project->set_frontendErrorCode(max(project->get_frontendErrorCode(), nextErrorCode));
14156 printf (
"Exiting as a test! \n");
14162 ROSE_ASSERT(project != NULL);
14165 if (tmp27_collectionOfModifiedLocatedNodes.size() > 0)
14167 printf (
"In Traversal::evaluateInheritedAttribute(): tmp27_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp27_collectionOfModifiedLocatedNodes.size());
14169 printf (
"Exiting as a test! \n");
14170 ROSE_ASSERT(
false);
14176 if (isCopyOfExistingFile_testForSharedNodes ==
true)
14182 printf (
"Found isCopyOfExistingFile_testForSharedNodes == true \n");
14183 printf (
"fileBeingCopied = %p = %s \n",fileBeingCopied,fileBeingCopied->
getFileName().c_str());
14186 SgSourceFile* sourceFileBeingCopied = isSgSourceFile(fileBeingCopied);
14187 ROSE_ASSERT(sourceFileBeingCopied != NULL);
14190 ROSE_ASSERT(sourceResult != NULL);
14192 SgGlobal* fileBeingCopied_globalScope = sourceFileBeingCopied->get_globalScope();
14193 SgGlobal* result_globalScope = sourceResult->get_globalScope();
14195 printf (
"fileBeingCopied_globalScope = %p \n",fileBeingCopied_globalScope);
14196 printf (
"result_globalScope = %p \n",result_globalScope);
14198 ROSE_ASSERT(fileBeingCopied_globalScope != NULL);
14199 ROSE_ASSERT(result_globalScope != NULL);
14201 SgDeclarationStatementPtrList fileBeingCopied_declarationList = fileBeingCopied_globalScope->
get_declarations();
14202 SgDeclarationStatementPtrList result_declarationList = result_globalScope->
get_declarations();
14207 vector<SgDeclarationStatement*>::iterator it;
14208 SgDeclarationStatementPtrList v(fileBeingCopied_declarationList.size());
14211 std::sort(fileBeingCopied_declarationList.begin(),fileBeingCopied_declarationList.end());
14212 std::sort(result_declarationList.begin(),result_declarationList.end());
14216 it = std::set_intersection(fileBeingCopied_declarationList.begin(),fileBeingCopied_declarationList.end(),result_declarationList.begin(),result_declarationList.end(),v.begin());
14218 v.resize(it-v.begin());
14220 int fileBeingCopied_file_id = fileBeingCopied->
get_startOfConstruct()->get_physical_file_id();
14223 for (
size_t i = 0; i < v.size(); i++)
14228 printf (
" --- SageBuilder::buildFile() is sharing this node: %p %s \n",intersection_element,intersection_element->
class_name().c_str());
14234 printf (
"Exiting as a test! \n");
14241 ROSE_ASSERT(project != NULL);
14244 if (tmp28_collectionOfModifiedLocatedNodes.size() > 0)
14246 printf (
"In Traversal::evaluateInheritedAttribute(): tmp28_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp28_collectionOfModifiedLocatedNodes.size());
14248 printf (
"Exiting as a test! \n");
14249 ROSE_ASSERT(
false);
14261 std::vector<SgDeclarationStatementPtrList::iterator> removeList;
14262 SgDeclarationStatementPtrList::iterator i = fileBeingCopied_declarationList.begin();
14263 while (i != fileBeingCopied_declarationList.end())
14266 if (emptyDeclaration != NULL)
14268 removeList.push_back(i);
14278 for (std::vector<SgDeclarationStatementPtrList::iterator>::iterator i = removeList.begin(); i != removeList.end(); i++)
14280 fileBeingCopied_declarationList.erase(*i);
14285 if (fileBeingCopied_declarationList.size() != result_declarationList.size())
14287 printf (
"fileBeingCopied_declarationList.size() = %zu \n",fileBeingCopied_declarationList.size());
14288 printf (
"result_declarationList.size() = %zu \n",result_declarationList.size());
14290 ROSE_ASSERT(fileBeingCopied_declarationList.size() == result_declarationList.size());
14295 printf (
"Statements from global scope (size = %zu): \n",fileBeingCopied_declarationList.size());
14297 for (
size_t i = 0; i < fileBeingCopied_declarationList.size(); i++)
14302 printf (
" #%zu global scope entry: fileBeingCopied: %p %s result %p %s \n",i,fileBeingCopied_decl,fileBeingCopied_decl->
class_name().c_str(),result_decl,result_decl->
class_name().c_str());
14304 if (fileBeingCopied_decl == result_decl)
14307 printf (
" --- SageBuilder::buildFile() is sharing this node: %p %s \n",fileBeingCopied_decl,fileBeingCopied_decl->
class_name().c_str());
14313 int fileBeingCopied_file_id = fileBeingCopied->
get_startOfConstruct()->get_physical_file_id();
14316 printf (
"Exiting as a test! \n");
14327 printf (
"exiting as a test! \n");
14337 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
14338 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
14339 printf (
"Leaving SageBuilder::buildFile(): (after result->runFrontend()): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
14340 project,project->get_fileList_ptr()->get_listOfFiles().size());
14341 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
14342 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
14351 ROSE_ASSERT(result->get_preprocessorDirectivesAndCommentsList() != NULL);
14355 ROSE_ASSERT(project != NULL);
14358 if (tmp3_collectionOfModifiedLocatedNodes.size() > 0)
14360 printf (
"In Traversal::evaluateInheritedAttribute(): tmp3_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp3_collectionOfModifiedLocatedNodes.size());
14362 printf (
"Exiting as a test! \n");
14363 ROSE_ASSERT(
false);
14391 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
14392 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
14393 printf (
"In SageBuilder::buildSourceFile(outputFileName = %s, project = %p) \n",outputFileName.c_str(),project);
14394 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
14395 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
14399 string inputFilePrefix =
"temp_dummy_file_";
14402 printf (
"In SageBuilder::buildSourceFile(const std::string& outputFileName, SgProject* project): calling buildFile() \n");
14405 SgFile* file =
buildFile(inputFilePrefix+outputFileName,outputFileName,project,clear_globalScopeAcrossFiles);
14406 ROSE_ASSERT(file != NULL);
14409 printf (
"DONE: In SageBuilder::buildSourceFile(): calling buildFile() \n");
14413 ROSE_ASSERT(sourceFile != NULL);
14415 ROSE_ASSERT(sourceFile->get_globalScope() != NULL);
14418 printf (
"call the unparser on the just built file \n");
14422 printf (
"Exiting as a test! \n");
14433 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
14434 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
14435 printf (
"In SageBuilder::buildSourceFile(const std::string& inputFileName,const std::string& outputFileName, SgProject* project): calling buildFile() \n");
14437 printf (
" --- inputFileName = %s \n",inputFileName.c_str());
14438 printf (
" --- outputFileName = %s \n",outputFileName.c_str());
14439 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
14440 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
14445 ROSE_ASSERT(project != NULL);
14448 if (tmp1_collectionOfModifiedLocatedNodes.size() > 0)
14450 printf (
"In Traversal::evaluateInheritedAttribute(): tmp1_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp1_collectionOfModifiedLocatedNodes.size());
14452 printf (
"Exiting as a test! \n");
14453 ROSE_ASSERT(
false);
14458 SgFile* file =
buildFile(inputFileName, outputFileName,project,clear_globalScopeAcrossFiles);
14459 ROSE_ASSERT(file != NULL);
14462 printf (
"DONE: In SageBuilder::buildSourceFile(): calling buildFile() \n");
14467 ROSE_ASSERT(project != NULL);
14470 if (tmp2_collectionOfModifiedLocatedNodes.size() > 0)
14472 printf (
"In Traversal::evaluateInheritedAttribute(): tmp2_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp2_collectionOfModifiedLocatedNodes.size());
14474 printf (
"Exiting as a test! \n");
14475 ROSE_ASSERT(
false);
14481 ROSE_ASSERT(sourceFile != NULL);
14483 ROSE_ASSERT(sourceFile->get_globalScope() != NULL);
14487 printf (
"Debugging the unparsing header file optimization \n");
14489 printf (
"sourceFile->get_header_file_unparsing_optimization() = %s \n",sourceFile->get_header_file_unparsing_optimization() ?
"true" :
"false");
14490 printf (
"sourceFile->get_header_file_unparsing_optimization_source_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
14491 printf (
"sourceFile->get_header_file_unparsing_optimization_header_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
14498 ROSE_ASSERT(sourceFile->get_header_file_unparsing_optimization() ==
true);
14499 ROSE_ASSERT(sourceFile->get_header_file_unparsing_optimization_source_file() ==
true);
14501 ROSE_ASSERT(sourceFile->get_header_file_unparsing_optimization_header_file() ==
false);
14507 SgFilePtrList & fileList = project->get_fileList();
14510 printf (
"Looking for file = %s \n",inputFileName.c_str());
14513 for (SgFilePtrList::iterator i = fileList.begin(); i != fileList.end(); i++)
14517 printf (
"temp_file = %p = %s name = %s \n",temp_file,temp_file->
class_name().c_str(),temp_file->
getFileName().c_str());
14519 if (temp_file != file)
14534 printf (
"sourceFile = %p = %s \n",sourceFile,sourceFile->
class_name().c_str());
14535 printf (
"sourceFile->get_header_file_unparsing_optimization() = %s \n",sourceFile->get_header_file_unparsing_optimization() ?
"true" :
"false");
14536 printf (
"sourceFile->get_header_file_unparsing_optimization_source_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
14537 printf (
"sourceFile->get_header_file_unparsing_optimization_header_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
14539 printf (
"temp_file = %p = %s \n",temp_file,temp_file->
class_name().c_str());
14540 printf (
"temp_file->get_header_file_unparsing_optimization() = %s \n",temp_file->get_header_file_unparsing_optimization() ?
"true" :
"false");
14541 printf (
"temp_file->get_header_file_unparsing_optimization_source_file() = %s \n",temp_file->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
14542 printf (
"temp_file->get_header_file_unparsing_optimization_header_file() = %s \n",temp_file->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
14561 printf (
"Sg_File_Info::get_nametofileid_map()[sourceFile->get_file_info()->get_filename()] = %d \n",filename_id);
14562 printf (
"Sg_File_Info::get_nametofileid_map()[sourceFile->get_file_info()->get_filename()] = %d \n",filename_physical_id);
14563 sourceFile->
get_file_info()->set_physical_file_id(filename_physical_id);
14565 printf (
"sourceFile->get_file_info()->get_physical_filename() = %s \n",sourceFile->
get_file_info()->get_physical_filename().c_str());
14566 printf (
"sourceFile->get_file_info()->get_physical_file_id() = %d \n",sourceFile->
get_file_info()->get_physical_file_id());
14570 printf (
"Exiting as a test! \n");
14582 if (sourceFile->get_preprocessorDirectivesAndCommentsList() == NULL)
14585 printf (
"Initialize NULL p_preprocessorDirectivesAndCommentsList to empty ROSEAttributesListContainer \n");
14588 sourceFile->set_preprocessorDirectivesAndCommentsList(tmp_preprocessorDirectivesAndCommentsList);
14593 printf (
"NOTE: p_preprocessorDirectivesAndCommentsList is already defined! \n");
14594 printf (
" --- inputFileName = %s \n",inputFileName.c_str());
14595 printf (
" --- outputFileName = %s \n",outputFileName.c_str());
14596 printf (
" --- sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size() = %zu \n",sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size());
14599 ROSE_ASSERT (sourceFile->get_preprocessorDirectivesAndCommentsList() != NULL);
14606 printf (
"NOTE: SageBuilder::buildSourceFile(): If this is processing a previously processed source file then this will cause the source file comments and CPP directives to be collected redundently \n");
14611 ROSE_ASSERT(filePreprocInfo != NULL);
14617 printf (
"In SageBuilder::buildSourceFile(const std::string& inputFileName,const std::string& outputFileName, SgProject* project): calling attachPreprocessingInfo() \n");
14618 printf (
" --- sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size() = %zu \n",sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size());
14623 printf (
"We read the comments in filename inputFileName, and build outputFileName, and this is a problem since the comments are marked with the inputFileName \n");
14624 printf (
" --- inputFileName = %s \n",inputFileName.c_str());
14625 printf (
" --- outputFileName = %s \n",outputFileName.c_str());
14626 printf (
"sourceFile = %p \n",sourceFile);
14627 printf (
"sourceFile->get_token_list.size() = %zu \n",sourceFile->get_token_list().size());
14628 printf (
"sourceFile->get_tokenSubsequenceMap().size() = %zu \n",sourceFile->get_tokenSubsequenceMap().size());
14636 attachPreprocessingInfo (sourceFile,outputFileName);
14643 printf (
"Exiting after test! processed first phase of collecting comments and CPP directives for source file) \n");
14644 ROSE_ASSERT(
false);
14648 printf (
"DONE: In SageBuilder::buildSourceFile(const std::string& inputFileName,const std::string& outputFileName, SgProject* project): calling attachPreprocessingInfo() \n");
14652 printf (
"call the unparser on the just built file \n");
14656 printf (
"In buildSourceFile(): AS A TEST: calling unparseFile(): filename = %s \n",sourceFile->
getFileName().c_str());
14675 printf (
"In SageBuilder::buildSourceFile(): changing the name of the file represented in sourceFile: \n");
14676 printf (
"inputFileName = %s \n",inputFileName.c_str());
14677 printf (
"outputFileName = %s \n",outputFileName.c_str());
14678 printf (
"sourceFile->getFileName() = %s \n",sourceFile->
getFileName().c_str());
14681 SgGlobal* globalScope = sourceFile->get_globalScope();
14684 printf (
"Leaving SageBuilder::buildSourceFile() sourceFile = %p globalScope = %p \n",sourceFile,sourceFile->get_globalScope());
14685 printf (
"sourceFile->get_file_info()->get_file_id() = %d \n",sourceFile->
get_file_info()->get_file_id());
14686 printf (
"sourceFile->get_file_info()->get_physical_file_id() = %d \n",sourceFile->
get_file_info()->get_physical_file_id());
14687 printf (
"sourceFile->get_token_list.size() = %zu \n",sourceFile->get_token_list().size());
14688 printf (
"sourceFile->get_tokenSubsequenceMap().size() = %zu \n",sourceFile->get_tokenSubsequenceMap().size());
14689 printf (
"inputFileName = %s \n",inputFileName.c_str());
14690 printf (
"outputFileName = %s \n",outputFileName.c_str());
14691 printf (
"sourceFile->getFileName() = %s \n",sourceFile->
getFileName().c_str());
14693 printf (
"sourceFile->get_globalScope() = %p \n",globalScope);
14694 printf (
"globalScope->get_isModified() = %s \n",globalScope->
get_isModified() ?
"true" :
"false");
14704 printf (
"globalScope->get_isModified() == true: reset to false \n");
14708 printf (
"Verify false setting: globalScope->get_isModified() = %s \n",globalScope->
get_isModified() ?
"true" :
"false");
14714 ROSE_ASSERT(project != NULL);
14717 if (tmp3_collectionOfModifiedLocatedNodes.size() > 0)
14719 printf (
"In Traversal::evaluateInheritedAttribute(): tmp3_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp3_collectionOfModifiedLocatedNodes.size());
14721 printf (
"Exiting as a test! \n");
14722 ROSE_ASSERT(
false);
14728 printf (
"Exiting as a test! \n");
14744 bool isSystemHeader)
14746 std::string content;
14747 if (isSystemHeader)
14748 content =
"#include <" + header_filename +
"> \n";
14750 content =
"#include \"" + header_filename +
"\" \n";
14752 content,
"Transformation generated",0, 0, 0, position);
14753 ROSE_ASSERT(result);
14762 ROSE_ASSERT(target != NULL);
14764 std::string content2 = content;
14765 boost::algorithm::trim(content2);
14766 string prefix =
"#define";
14767 string::size_type pos = content2.find(prefix, 0);
14768 ROSE_ASSERT (pos == 0);
14772 PreprocessingInfo::DirectiveType mytype = PreprocessingInfo::CpreprocessorDefineDeclaration;
14776 result =
new PreprocessingInfo (mytype,content,
"transformation-generated", 0, 0, 0, position);
14777 ROSE_ASSERT(result);
14778 target->addToAttachedPreprocessingInfo(result);
14784#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
14789 static std::map<SgNode*, AbstractHandle::abstract_handle *> handleMap;
14791 ROSE_ASSERT(n != NULL);
14796 ROSE_ASSERT(anode !=NULL );
14799 ROSE_ASSERT(ahandle != NULL);
14808 ROSE_ASSERT(exp1 != NULL);
14809 ROSE_ASSERT(exp2 != NULL);
14814 ROSE_ASSERT(equivalenceStatement->get_equivalence_set_list() == NULL);
14815 equivalenceStatement->set_equivalence_set_list(setList);
14816 ROSE_ASSERT(equivalenceStatement->get_equivalence_set_list() != NULL);
14819 return equivalenceStatement;
14832 typedef Rose_STL_Container<SgScopeStatement*> SgScopeStatementPtrList;
14833 SgScopeStatementPtrList snippet_scope_list;
14839 printf (
"First scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
14841 if (temp_classDefinition != NULL)
14844 SgName className = temp_classDeclaration->get_name();
14846 printf (
"Input snippet declaration's class name = %s \n",className.str());
14850 if (namespaceDefinitionStatement != NULL)
14855 snippet_scope_list.push_back(snippet_scope);
14856 while (snippet_scope != NULL && isSgGlobal(snippet_scope) == NULL)
14862 snippet_scope = snippet_scope->
get_scope();
14864 printf (
"snippet_scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
14866 snippet_scope_list.push_back(snippet_scope);
14870 printf (
"snippet_scope_list.size() = %" PRIuPTR
" \n",snippet_scope_list.size());
14873 SgGlobal* global_scope_in_target_ast = TransformationSupport::getGlobalScope(targetScope);
14874 SgScopeStatementPtrList::reverse_iterator i = snippet_scope_list.rbegin();
14879 ROSE_ASSERT(isSgGlobal(snippet_AST_scope) != NULL);
14884 while (i != snippet_scope_list.rend())
14888 printf (
"snippet_AST_scope list *i = %p = %s \n",*i,(*i)->class_name().c_str());
14895 if (classDefinition != NULL)
14898 SgName className = classDeclaration->get_name();
14900 printf (
"Found snippet class name = %s \n",className.str());
14902 SgClassSymbol* classSymbol = target_AST_scope->lookup_class_symbol(className);
14903 ROSE_ASSERT(classSymbol != NULL);
14904 ROSE_ASSERT(classSymbol->get_declaration() != NULL);
14906 printf (
"Associated symbol in taget AST: declaration = %p name = %s \n",classSymbol->get_declaration(),classSymbol->get_declaration()->get_name().str());
14909 returnSymbol = classSymbol;
14912 target_AST_scope = classDefinition;
14917 if (functionDefinition != NULL)
14919 printf (
"ERROR: Found an unusual case of SgFunctionDefinition in list of scopes holding a declaration for a type \n");
14924 if (namespaceDefinition != NULL)
14929 printf (
"Found snippet namespace name = %s \n",namespaceName.str());
14931 SgNamespaceSymbol* namespaceSymbol = target_AST_scope->lookup_namespace_symbol(namespaceName);
14932 ROSE_ASSERT(namespaceSymbol != NULL);
14938 returnSymbol = namespaceSymbol;
14941 target_AST_scope = namespaceDefinition;
14949 switch (snippet_declaration->
variantT())
14951 case V_SgClassDeclaration:
14953 SgClassDeclaration* snippet_classDeclaration = isSgClassDeclaration(snippet_declaration);
14954 ROSE_ASSERT(snippet_classDeclaration != NULL);
14956 SgName snippet_className = snippet_classDeclaration->get_name();
14958 printf (
"snippet snippet declaration's class name = %s \n",snippet_className.str());
14960 SgClassSymbol* target_symbol = target_AST_scope->lookup_class_symbol(snippet_className);
14961 ROSE_ASSERT(target_symbol != NULL);
14962 returnSymbol = target_symbol;
14964 SgClassSymbol* classSymbolInTargetAST = isSgClassSymbol(returnSymbol);
14965 ROSE_ASSERT(classSymbolInTargetAST != NULL);
14966 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
14967 ROSE_ASSERT(target_classDeclaration != NULL);
14969 printf (
"snippet: classDeclaration = %p = %s \n",snippet_classDeclaration,snippet_classDeclaration->get_name().str());
14970 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
14972 ROSE_ASSERT(snippet_classDeclaration->get_name() == target_classDeclaration->get_name());
14976 case V_SgTypedefDeclaration:
14978 SgTypedefDeclaration* snippet_typedefDeclaration = isSgTypedefDeclaration(snippet_declaration);
14979 ROSE_ASSERT(snippet_typedefDeclaration != NULL);
14981 SgName snippet_typedefName = snippet_typedefDeclaration->get_name();
14983 printf (
"snippet snippet declaration's typedef name = %s \n",snippet_typedefName.str());
14985 SgTypedefSymbol* target_symbol = target_AST_scope->lookup_typedef_symbol(snippet_typedefName);
14986 ROSE_ASSERT(target_symbol != NULL);
14987 returnSymbol = target_symbol;
14989 SgTypedefSymbol* typedefSymbolInTargetAST = isSgTypedefSymbol(returnSymbol);
14990 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
14991 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
14992 ROSE_ASSERT(target_typedefDeclaration != NULL);
14994 printf (
"snippet: typedefDeclaration = %p = %s \n",snippet_typedefDeclaration,snippet_typedefDeclaration->get_name().str());
14995 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
14997 ROSE_ASSERT(snippet_typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
15001 case V_SgEnumDeclaration:
15003 SgEnumDeclaration* snippet_enumDeclaration = isSgEnumDeclaration(snippet_declaration);
15004 ROSE_ASSERT(snippet_enumDeclaration != NULL);
15008 printf (
"snippet snippet declaration's enum name = %s \n",snippet_enumName.str());
15011 bool isUnNamed = snippet_enumDeclaration->get_isUnNamed();
15012 if (isUnNamed ==
false)
15016 if (target_symbol == NULL)
15020 printf (
"scope = %p = %s \n",scope,scope->
class_name().c_str());
15021 scope->
get_file_info()->display(
"case V_SgEnumDeclaration: target_symbol == NULL: scope: debug");
15023 ROSE_ASSERT(target_symbol != NULL);
15024 returnSymbol = target_symbol;
15026 SgEnumSymbol* enumSymbolInTargetAST = isSgEnumSymbol(returnSymbol);
15027 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
15028 SgEnumDeclaration* target_enumDeclaration = isSgEnumDeclaration(enumSymbolInTargetAST->get_declaration());
15029 ROSE_ASSERT(target_enumDeclaration != NULL);
15031 printf (
"snippet: enumDeclaration = %p = %s \n",snippet_enumDeclaration,snippet_enumDeclaration->
get_name().str());
15032 printf (
"target: enumDeclaration = %p = %s \n",target_enumDeclaration,target_enumDeclaration->
get_name().str());
15034 ROSE_ASSERT(snippet_enumDeclaration->
get_name() == target_enumDeclaration->
get_name());
15039 printf (
"Warning: can't handle unnamed enum declarations \n");
15040 ROSE_ASSERT(returnSymbol == NULL);
15046 case V_SgMemberFunctionDeclaration:
15047 case V_SgFunctionDeclaration:
15050 ROSE_ASSERT(snippet_functionDeclaration != NULL);
15052 printf (
"snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15054 SgName snippet_functionName = snippet_functionDeclaration->get_name();
15056 printf (
"snippet snippet declaration's function name = %s \n",snippet_functionName.str());
15057 printf (
" --- target_AST_scope = %p = %s \n",target_AST_scope,target_AST_scope->
class_name().c_str());
15059 SgFunctionSymbol* target_symbol = target_AST_scope->lookup_function_symbol(snippet_functionName);
15060 ROSE_ASSERT(target_symbol != NULL);
15061 returnSymbol = target_symbol;
15063 SgFunctionSymbol* functionSymbolInTargetAST = isSgFunctionSymbol(returnSymbol);
15064 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
15065 SgFunctionDeclaration* target_functionDeclaration = isSgFunctionDeclaration(functionSymbolInTargetAST->get_declaration());
15066 ROSE_ASSERT(target_functionDeclaration != NULL);
15068 printf (
"snippet: functionDeclaration = %p = %s \n",snippet_functionDeclaration,snippet_functionDeclaration->get_name().str());
15069 printf (
"target: functionDeclaration = %p = %s \n",target_functionDeclaration,target_functionDeclaration->get_name().str());
15071 ROSE_ASSERT(snippet_functionDeclaration->get_name() == target_functionDeclaration->get_name());
15077 printf (
"Error: default reached in switch: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15083 return returnSymbol;
15095#define DEBUG_FIND_ASSOCIATED_DECLARATION 0
15102#if DEBUG_FIND_ASSOCIATED_DECLARATION
15103 printf (
"isDefiningDeclaration = %s \n",isDefiningDeclaration ?
"true" :
"false");
15109 typedef Rose_STL_Container<SgScopeStatement*> SgScopeStatementPtrList;
15110 SgScopeStatementPtrList snippet_scope_list;
15115#if DEBUG_FIND_ASSOCIATED_DECLARATION
15116 printf (
"First scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
15118 if (temp_classDefinition != NULL)
15121 SgName className = temp_classDeclaration->get_name();
15122 printf (
"Input declaration's class name = %s \n",className.str());
15126 if (namespaceDefinitionStatement != NULL)
15130 printf (
"Input declaration's namespace name = %s \n",namespaceName.str());
15134 snippet_scope_list.push_back(snippet_scope);
15135 while (snippet_scope != NULL && isSgGlobal(snippet_scope) == NULL)
15141 snippet_scope = snippet_scope->
get_scope();
15143#if DEBUG_FIND_ASSOCIATED_DECLARATION
15144 printf (
"snippet_scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
15146 snippet_scope_list.push_back(snippet_scope);
15153#if DEBUG_FIND_ASSOCIATED_DECLARATION
15154 printf (
"snippet_scope_list.size() = %" PRIuPTR
" \n",snippet_scope_list.size());
15155 for (SgScopeStatementPtrList::iterator i = snippet_scope_list.begin(); i != snippet_scope_list.end(); i++)
15159 SgGlobal* global_scope_from_declarations_scope = TransformationSupport::getGlobalScope(scope);
15160 printf (
" --- --- global_scope_from_declarations_scope = %p \n",global_scope_from_declarations_scope);
15168 SgGlobal* global_scope_in_target_ast = TransformationSupport::getGlobalScope(targetScope);
15169 SgScopeStatementPtrList::reverse_iterator i = snippet_scope_list.rbegin();
15171#if DEBUG_FIND_ASSOCIATED_DECLARATION
15172 printf (
"global_scope_in_target_ast = %p = %s \n",global_scope_in_target_ast,global_scope_in_target_ast->
class_name().c_str());
15181 ROSE_ASSERT(isSgGlobal(snippet_AST_scope) != NULL);
15185#if DEBUG_FIND_ASSOCIATED_DECLARATION
15186 string otherASTnameFromGlobalScope = global_scope_in_target_ast->
get_file_info()->get_filenameString();
15187 SgSourceFile* otherSourceFile = SageInterface::getEnclosingNode<SgSourceFile>(targetScope,
true);
15188 string otherASTnameFromSourceFile = otherSourceFile->
getFileName();
15189 printf (
"Now traverse the list of scopes in reverse to find the declaration in the other AST: \n");
15190 printf (
"otherASTnameFromGlobalScope = %s \n",otherASTnameFromGlobalScope.c_str());
15191 printf (
"otherASTnameFromSourceFile = %s \n",otherASTnameFromSourceFile.c_str());
15198 while (i != snippet_scope_list.rend())
15204#if DEBUG_FIND_ASSOCIATED_DECLARATION
15205 printf (
"snippet_AST_scope list *i = %p = %s \n",*i,(*i)->class_name().c_str());
15207 printf (
" --- target_AST_scope = %p = %s \n",target_AST_scope,target_AST_scope ->class_name().c_str());
15214#if DEBUG_FIND_ASSOCIATED_DECLARATION
15215 SgSourceFile* otherSourceFile = SageInterface::getEnclosingNode<SgSourceFile>(targetScope,
true);
15216 string otherASTnameFromSourceFile = otherSourceFile->
getFileName();
15217 printf (
" --- otherASTnameFromSourceFile = %s \n",otherASTnameFromSourceFile.c_str());
15222 if (classDefinition != NULL)
15225 SgName className = classDeclaration->get_name();
15226#if DEBUG_FIND_ASSOCIATED_DECLARATION
15227 printf (
" --- Found snippet class name = %s \n",className.str());
15229 SgClassSymbol* classSymbol = target_AST_scope->lookup_class_symbol(className);
15230 ROSE_ASSERT(classSymbol != NULL);
15231 ROSE_ASSERT(classSymbol->get_declaration() != NULL);
15232#if DEBUG_FIND_ASSOCIATED_DECLARATION
15233 printf (
" --- Associated symbol in taget AST: declaration = %p name = %s \n",classSymbol->get_declaration(),classSymbol->get_declaration()->get_name().str());
15236 returnSymbol = classSymbol;
15239 SgClassDeclaration* temp_classDeclaration_in_target_ast = classSymbol->get_declaration();
15240 ROSE_ASSERT(temp_classDeclaration_in_target_ast != NULL);
15242 ROSE_ASSERT(classDeclaration_in_target_ast != NULL);
15243 SgClassDefinition* classDefinition_in_target_ast = classDeclaration_in_target_ast->get_definition();
15244 ROSE_ASSERT(classDefinition_in_target_ast != NULL);
15251 target_AST_scope = classDefinition_in_target_ast;
15259 if (functionDefinition != NULL)
15261 printf (
"ERROR: Found an unusual case of SgFunctionDefinition in list of scopes holding a declaration for a type \n");
15266 if (namespaceDefinition != NULL)
15270#if DEBUG_FIND_ASSOCIATED_DECLARATION
15271 printf (
" --- Found snippet namespace name = %s \n",namespaceName.str());
15273 SgNamespaceSymbol* namespaceSymbol = target_AST_scope->lookup_namespace_symbol(namespaceName);
15274 ROSE_ASSERT(namespaceSymbol != NULL);
15277#if DEBUG_FIND_ASSOCIATED_DECLARATION
15281 returnSymbol = namespaceSymbol;
15288 target_AST_scope = otherASTnamespaceDeclaration->
get_definition();
15297#if DEBUG_FIND_ASSOCIATED_DECLARATION
15298 printf (
" --- At base of loop of the list of scopes in top to bottom: target_AST_scope = %p = %s \n",target_AST_scope,target_AST_scope->
class_name().c_str());
15301 SgSourceFile* otherSourceFile = SageInterface::getEnclosingNode<SgSourceFile>(target_AST_scope,
true);
15302 string otherASTnameFromSourceFile = otherSourceFile->
getFileName();
15303 printf (
" --- At base of loop: otherASTnameFromSourceFile = %s \n",otherASTnameFromSourceFile.c_str());
15310#if DEBUG_FIND_ASSOCIATED_DECLARATION
15311 printf (
"##### Now based on the kind of declaration, search for that same named declaration in the target_AST_scope = %p = %s \n",
15312 target_AST_scope,target_AST_scope->
class_name().c_str());
15318 switch (snippet_declaration->
variantT())
15320 case V_SgClassDeclaration:
15322 SgClassDeclaration* snippet_classDeclaration = isSgClassDeclaration(snippet_declaration);
15323 ROSE_ASSERT(snippet_classDeclaration != NULL);
15325 SgName snippet_className = snippet_classDeclaration->get_name();
15327#if DEBUG_FIND_ASSOCIATED_DECLARATION
15328 printf (
"snippet snippet declaration's class name = %s \n",snippet_className.str());
15330 SgClassSymbol* target_symbol = target_AST_scope->lookup_class_symbol(snippet_className);
15331 ROSE_ASSERT(target_symbol != NULL);
15332 returnSymbol = target_symbol;
15334 SgClassSymbol* classSymbolInTargetAST = isSgClassSymbol(returnSymbol);
15335 ROSE_ASSERT(classSymbolInTargetAST != NULL);
15336 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
15337 ROSE_ASSERT(target_classDeclaration != NULL);
15339#if DEBUG_FIND_ASSOCIATED_DECLARATION
15340 printf (
"snippet: classDeclaration = %p = %s \n",snippet_classDeclaration,snippet_classDeclaration->get_name().str());
15341 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
15343 ROSE_ASSERT(snippet_classDeclaration->get_name() == target_classDeclaration->get_name());
15347 case V_SgTypedefDeclaration:
15349 SgTypedefDeclaration* snippet_typedefDeclaration = isSgTypedefDeclaration(snippet_declaration);
15350 ROSE_ASSERT(snippet_typedefDeclaration != NULL);
15352 SgName snippet_typedefName = snippet_typedefDeclaration->get_name();
15354#if DEBUG_FIND_ASSOCIATED_DECLARATION
15355 printf (
"snippet snippet declaration's typedef name = %s \n",snippet_typedefName.str());
15357 SgTypedefSymbol* target_symbol = target_AST_scope->lookup_typedef_symbol(snippet_typedefName);
15358 ROSE_ASSERT(target_symbol != NULL);
15359 returnSymbol = target_symbol;
15361 SgTypedefSymbol* typedefSymbolInTargetAST = isSgTypedefSymbol(returnSymbol);
15362 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
15363 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
15364 ROSE_ASSERT(target_typedefDeclaration != NULL);
15366#if DEBUG_FIND_ASSOCIATED_DECLARATION
15367 printf (
"snippet: typedefDeclaration = %p = %s \n",snippet_typedefDeclaration,snippet_typedefDeclaration->get_name().str());
15368 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
15370 ROSE_ASSERT(snippet_typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
15374 case V_SgEnumDeclaration:
15376 SgEnumDeclaration* snippet_enumDeclaration = isSgEnumDeclaration(snippet_declaration);
15377 ROSE_ASSERT(snippet_enumDeclaration != NULL);
15381#if DEBUG_FIND_ASSOCIATED_DECLARATION
15382 printf (
"snippet snippet declaration's enum name = %s \n",snippet_enumName.str());
15385 bool isUnNamed = snippet_enumDeclaration->get_isUnNamed();
15386 if (isUnNamed ==
false)
15390 if (target_symbol == NULL)
15394 printf (
"scope = %p = %s \n",scope,scope->
class_name().c_str());
15395 scope->
get_file_info()->display(
"case V_SgEnumDeclaration: target_symbol == NULL: scope: debug");
15397 ROSE_ASSERT(target_symbol != NULL);
15398 returnSymbol = target_symbol;
15400 SgEnumSymbol* enumSymbolInTargetAST = isSgEnumSymbol(returnSymbol);
15401 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
15402 SgEnumDeclaration* target_enumDeclaration = isSgEnumDeclaration(enumSymbolInTargetAST->get_declaration());
15403 ROSE_ASSERT(target_enumDeclaration != NULL);
15405#if DEBUG_FIND_ASSOCIATED_DECLARATION
15406 printf (
"snippet: enumDeclaration = %p = %s \n",snippet_enumDeclaration,snippet_enumDeclaration->
get_name().str());
15407 printf (
"target: enumDeclaration = %p = %s \n",target_enumDeclaration,target_enumDeclaration->
get_name().str());
15409 ROSE_ASSERT(snippet_enumDeclaration->
get_name() == target_enumDeclaration->
get_name());
15414 printf (
"Warning: can't handle unnamed enum declarations \n");
15415 ROSE_ASSERT(returnSymbol == NULL);
15421 case V_SgTemplateMemberFunctionDeclaration:
15423 case V_SgTemplateFunctionDeclaration:
15425 case V_SgMemberFunctionDeclaration:
15426 case V_SgFunctionDeclaration:
15429 ROSE_ASSERT(snippet_functionDeclaration != NULL);
15431#if DEBUG_FIND_ASSOCIATED_DECLARATION
15432 printf (
"snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15434 SgName snippet_functionName = snippet_functionDeclaration->get_name();
15436#if DEBUG_FIND_ASSOCIATED_DECLARATION
15437 printf (
"snippet snippet declaration's function name = %s \n",snippet_functionName.str());
15438 printf (
" --- target_AST_scope = %p = %s \n",target_AST_scope,target_AST_scope->
class_name().c_str());
15440 SgFunctionSymbol* target_symbol = target_AST_scope->lookup_function_symbol(snippet_functionName);
15441 ROSE_ASSERT(target_symbol != NULL);
15442 returnSymbol = target_symbol;
15444 SgFunctionSymbol* functionSymbolInTargetAST = isSgFunctionSymbol(returnSymbol);
15445 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
15446 SgFunctionDeclaration* target_functionDeclaration = isSgFunctionDeclaration(functionSymbolInTargetAST->get_declaration());
15447 ROSE_ASSERT(target_functionDeclaration != NULL);
15449#if DEBUG_FIND_ASSOCIATED_DECLARATION
15450 printf (
"snippet: functionDeclaration = %p = %s \n",snippet_functionDeclaration,snippet_functionDeclaration->get_name().str());
15451 printf (
"target: functionDeclaration = %p = %s \n",target_functionDeclaration,target_functionDeclaration->get_name().str());
15452 printf (
"isDefiningDeclaration = %s \n",isDefiningDeclaration ?
"true" :
"false");
15454 if (isDefiningDeclaration ==
true)
15456#if DEBUG_FIND_ASSOCIATED_DECLARATION
15457 printf (
"get the defining declaration instead of the firstNondefining declaration from the function symbol \n");
15462 ROSE_ASSERT(snippet_functionDeclaration->get_name() == target_functionDeclaration->get_name());
15468 printf (
"Error: default reached in switch: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15473 ROSE_ASSERT(returnDeclaration != NULL);
15480 return returnDeclaration;
15488 SgType* returnType = NULL;
15490 ROSE_ASSERT(snippet_type != NULL);
15491 ROSE_ASSERT(targetScope != NULL);
15499 SgType* type_copy = snippet_type;
15500 printf (
"(before type_copy->getInternalTypes()): type_copy = %p = %s \n",type_copy,type_copy->
class_name().c_str());
15503 SgNamedType* namedType = isSgNamedType(snippet_type);
15504 if (namedType != NULL)
15508 ROSE_ASSERT(snippet_declaration != NULL);
15510 printf (
"Need to find the declaration in the target AST that is associated with the snippet_declaration in the snippet AST \n");
15511 printf (
" --- snippet_declaration = %p = %s = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str(),
SageInterface::get_name(snippet_declaration).c_str());
15516 case V_SgClassType:
15519 if (classDeclaration != NULL)
15522 if (classSymbolInTargetAST == NULL)
15529 printf (
"This is likely a name qualified scope (which can't be seen in a simple traversal of the parent scope (case of C++ or Java) \n");
15530 printf (
" --- Looking for target AST match for class name = %s \n",classDeclaration->get_name().str());
15533 ROSE_ASSERT(symbol != NULL);
15535 classSymbolInTargetAST = isSgClassSymbol(symbol);
15538 ROSE_ASSERT(classSymbolInTargetAST != NULL);
15539 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
15540 ROSE_ASSERT(target_classDeclaration != NULL);
15542 printf (
"snippet: classDeclaration = %p = %s \n",classDeclaration,classDeclaration->get_name().str());
15543 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
15545 ROSE_ASSERT(classDeclaration->get_name() == target_classDeclaration->get_name());
15547 returnType = classSymbolInTargetAST->
get_type();
15552 case V_SgTypedefType:
15555 if (typedefDeclaration != NULL)
15562 if (typedefSymbolInTargetAST == NULL)
15565 printf (
"Error: It is an error to not have a typedef type defined in the target AST (this is an old rule, we have to support more general rules now)! \n");
15566 printf (
" --- The target AST must have a valid typedef type (and associated declaration) to support resetting the SgTypedefType: %p \n",typedefDeclaration->get_type());
15571 ROSE_ASSERT(symbol != NULL);
15573 typedefSymbolInTargetAST = isSgTypedefSymbol(symbol);
15579 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
15580 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
15581 ROSE_ASSERT(target_typedefDeclaration != NULL);
15583 printf (
"snippet: typedefDeclaration = %p = %s \n",typedefDeclaration,typedefDeclaration->get_name().str());
15584 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
15586 ROSE_ASSERT(typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
15588 returnType = typedefSymbolInTargetAST->
get_type();
15596 if (enumDeclaration != NULL)
15598 ROSE_ASSERT(enumDeclaration->
get_name().is_null() ==
false);
15604 if (enumSymbolInTargetAST == NULL)
15606 printf (
"Error: It is an error to not have a enum type defined in the target AST! \n");
15607 printf (
" --- The target AST must have a valid enum type (and associated declaration) to support resetting the SgEnumType: %p \n",enumDeclaration->
get_type());
15610 returnType = snippet_type;
15617 returnType = enumSymbolInTargetAST->
get_type();
15624 case V_SgJavaParameterizedType:
15630 printf (
"In getTargetFileTypeSupport(): case V_SgJavaParameterizedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15634 if (classDeclaration != NULL)
15637 printf (
"Looking for classDeclaration = %s \n",classDeclaration->get_name().str());
15640 ROSE_ASSERT(javaParameterizedType != NULL);
15644 ROSE_ASSERT(templateParameterListNode != NULL);
15645 SgTemplateParameterPtrList* templateParameterList = &templateParameterListNode->get_args();
15653 printf (
"Calling lookupTemplateClassSymbolInParentScopes() name = %s \n",classDeclaration->get_name().str());
15658 printf (
"DONE: Calling lookupTemplateClassSymbolInParentScopes() \n");
15661 printf (
"targetScope->get_symbol_table()->size() = %d \n",targetScope->
get_symbol_table()->
size());
15662 if (templateClassSymbolInTargetAST == NULL)
15668 if (templateClassSymbolInTargetAST == NULL)
15671 printf (
"Calling findAssociatedSymbolInTargetAST \n");
15674 ROSE_ASSERT(symbol != NULL);
15676 templateClassSymbolInTargetAST = isSgClassSymbol(symbol);
15678 ROSE_ASSERT(templateClassSymbolInTargetAST != NULL);
15682 ROSE_ASSERT(templateClassSymbolInTargetAST != NULL);
15684 returnType = templateClassSymbolInTargetAST->
get_type();
15688 if (javaParameterizedType != NULL)
15692 returnType = javaParameterizedType;
15694 SgType* internal_type = javaParameterizedType->get_raw_type();
15695 ROSE_ASSERT(internal_type != NULL);
15699 printf (
"SgJavaParameterizedType not yet tested! \n");
15705 case V_SgJavaQualifiedType:
15716 printf (
"In getTargetFileTypeSupport(): case V_SgJavaQualifiedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15719 if (javaQualifiedType != NULL)
15722 returnType = javaQualifiedType;
15724 SgType* internal_type_1 = javaQualifiedType->get_parent_type();
15725 ROSE_ASSERT(internal_type_1 != NULL);
15726 SgType* internal_type_2 = javaQualifiedType->get_type();
15727 ROSE_ASSERT(internal_type_2 != NULL);
15730 printf (
"Case of SgJavaQualifiedType: not yet handled: commented out assertion! \n");
15735 case V_SgJavaWildcardType:
15744 printf (
"In getTargetFileTypeSupport(): case V_SgJavaWildcardType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15747 if (javaWildcardType != NULL)
15750 returnType = javaWildcardType;
15753 printf (
"SgJavaWildcardType not yet tested! \n");
15759 printf (
"Error: In getTargetFileTypeSupport(): default reached in switch: namedType = %p = %s \n",namedType,namedType->
class_name().c_str());
15764 ROSE_ASSERT(returnType != NULL);
15766 printf (
"Exiting as a test! \n");
15785 SgType* returnType = NULL;
15787 ROSE_ASSERT(snippet_type != NULL);
15788 ROSE_ASSERT(targetScope != NULL);
15792 SgType* type_copy = snippet_type;
15795 printf (
"(before type_copy->getInternalTypes()): type_copy = %p = %s \n",type_copy,type_copy->
class_name().c_str());
15802 for (
size_t i = 0; i < typeList.size(); i++)
15804 printf (
"Input type: typeList[i=%" PRIuPTR
"] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
15812 SgNamedType* namedType = isSgNamedType(snippet_type);
15816 if (namedType != NULL)
15820 ROSE_ASSERT(snippet_declaration != NULL);
15822 printf (
"Need to find the declaration in the target AST that is associated with the snippet_declaration in the snippet AST \n");
15823 printf (
" --- snippet_declaration = %p = %s = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str(),
SageInterface::get_name(snippet_declaration).c_str());
15828 case V_SgClassType:
15831 if (classDeclaration != NULL)
15834 if (classSymbolInTargetAST == NULL)
15841 printf (
"This is likely a name qualified scope (which can't be seen in a simple traversal of the parent scope (case of C++ or Java) \n");
15842 printf (
" --- Looking for target AST match for class name = %s \n",classDeclaration->get_name().str());
15845 ROSE_ASSERT(symbol != NULL);
15847 classSymbolInTargetAST = isSgClassSymbol(symbol);
15850 ROSE_ASSERT(classSymbolInTargetAST != NULL);
15851 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
15852 ROSE_ASSERT(target_classDeclaration != NULL);
15854 printf (
"snippet: classDeclaration = %p = %s \n",classDeclaration,classDeclaration->get_name().str());
15855 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
15857 ROSE_ASSERT(classDeclaration->get_name() == target_classDeclaration->get_name());
15859 returnType = classSymbolInTargetAST->
get_type();
15864 case V_SgTypedefType:
15867 if (typedefDeclaration != NULL)
15874 if (typedefSymbolInTargetAST == NULL)
15877 printf (
"Error: It is an error to not have a typedef type defined in the target AST (this is an old rule, we have to support more general rules now)! \n");
15878 printf (
" --- The target AST must have a valid typedef type (and associated declaration) to support resetting the SgTypedefType: %p \n",typedefDeclaration->get_type());
15883 ROSE_ASSERT(symbol != NULL);
15885 typedefSymbolInTargetAST = isSgTypedefSymbol(symbol);
15891 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
15892 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
15893 ROSE_ASSERT(target_typedefDeclaration != NULL);
15895 printf (
"snippet: typedefDeclaration = %p = %s \n",typedefDeclaration,typedefDeclaration->get_name().str());
15896 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
15898 ROSE_ASSERT(typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
15900 returnType = typedefSymbolInTargetAST->
get_type();
15908 if (enumDeclaration != NULL)
15910 ROSE_ASSERT(enumDeclaration->
get_name().is_null() ==
false);
15916 if (enumSymbolInTargetAST == NULL)
15918 printf (
"Error: It is an error to not have a enum type defined in the target AST! \n");
15919 printf (
" --- The target AST must have a valid enum type (and associated declaration) to support resetting the SgEnumType: %p \n",enumDeclaration->
get_type());
15922 returnType = snippet_type;
15929 returnType = enumSymbolInTargetAST->
get_type();
15936 case V_SgJavaParameterizedType:
15942 printf (
"In getTargetFileType(): case V_SgJavaParameterizedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15945 if (classDeclaration != NULL)
15947 SgTemplateParameterPtrList* templateParameterList = NULL;
15948 SgTemplateArgumentPtrList* templateSpecializationArgumentList = NULL;
15952 ROSE_ASSERT(templateClassSymbolInTargetAST != NULL);
15954 returnType = templateClassSymbolInTargetAST->
get_type();
15958 if (javaParameterizedType != NULL)
15961 returnType = javaParameterizedType;
15963 SgType* internal_type = javaParameterizedType->get_raw_type();
15964 ROSE_ASSERT(internal_type != NULL);
15967 printf (
"SgJavaParameterizedType not yet tested! \n");
15971 case V_SgJavaQualifiedType:
15978 printf (
"In getTargetFileType(): case V_SgJavaQualifiedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15981 if (javaQualifiedType != NULL)
15984 returnType = javaQualifiedType;
15986 SgType* internal_type_1 = javaQualifiedType->get_parent_type();
15987 ROSE_ASSERT(internal_type_1 != NULL);
15988 SgType* internal_type_2 = javaQualifiedType->get_type();
15989 ROSE_ASSERT(internal_type_2 != NULL);
15992 printf (
"SgJavaQualifiedType not yet tested! \n");
15996 case V_SgJavaWildcardType:
16005 printf (
"In getTargetFileType(): case V_SgJavaWildcardType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16008 if (javaWildcardType != NULL)
16011 returnType = javaWildcardType;
16013 SgType* internal_type_1 = javaWildcardType->get_bound_type();
16017 printf (
"SgJavaWildcardType not yet tested! \n");
16023 printf (
"Error: In getTargetFileType(): default reached in switch: namedType = %p = %s \n",namedType,namedType->
class_name().c_str());
16028 ROSE_ASSERT(returnType != NULL);
16030 printf (
"Exiting as a test! \n");
16043 SgType* new_type = returnType;
16047 if (new_type != NULL && typeList.size() > 1)
16049 int size = (int)typeList.size();
16050 for (
int i = size - 2; i >= 0; i--)
16053 printf (
"Rebuild type: typeList[i=%d] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
16056 switch(typeList[i]->variantT())
16058 case V_SgModifierType:
16061 ROSE_ASSERT(modifierType != NULL);
16062 if (modifierType->
get_typeModifier().get_constVolatileModifier().isConst() ==
true)
16064 ROSE_ASSERT(new_type != NULL);
16066 printf (
"Building a SgModifierType: calling buildConstType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
16073 printf (
"Modifier kind not handled (not implemented) check what sort of modifier this is: \n");
16080 case V_SgTypedefType:
16083 ROSE_ASSERT(typedefType != NULL);
16089 ROSE_ASSERT(new_typedefType != NULL);
16090 ROSE_ASSERT(isSgTypedefType(new_typedefType) != NULL);
16092 new_type = new_typedefType;
16094 printf (
"ERROSE: SgTypedefType kind not handled (not implemented) \n");
16100 case V_SgPointerType:
16103 ROSE_ASSERT(pointerType != NULL);
16105 printf (
"Building a SgPointerType: calling buildPointerType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
16107 ROSE_ASSERT(new_type != NULL);
16110 printf (
"ERROSE: SgPointerType kind not handled (not implemented) \n");
16118 printf (
"Error: default reached in evaluation of typelist: typeList[i] = %p = %s \n",typeList[i],typeList[i]->class_name().c_str());
16124 returnType = new_type;
16128 if (typeList.size() > 1)
16130 printf (
"Exiting as a test! \n");
16145 printf (
"In errorCheckingTargetAST(): node_copy = %p = %s node_original = %p = %s \n",node_copy,node_copy->
class_name().c_str(),node_original,node_original->
class_name().c_str());
16149 SgStatement* statement_copy = isSgStatement(node_copy);
16150 SgStatement* statement_original = isSgStatement(node_original);
16151 if (statement_copy != NULL)
16158 ROSE_ASSERT(statement_original != NULL);
16160 ROSE_ASSERT(scope_copy != NULL);
16161 ROSE_ASSERT(scope_original != NULL);
16168 printf (
"Warning: SgStatement: scope = %p = %s \n",scope_original,scope_original->
class_name().c_str());
16173 ROSE_ASSERT(snippetFile != NULL);
16174 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
16176 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
16179 if (failOnWarning ==
true)
16181 printf (
"Exit on warning! \n");
16186 SgNode* insertionPointScope = (insertionPointIsScope ==
true) ? insertionPoint : insertionPoint->get_parent();
16187 printf (
"insertionPointIsScope = %s insertionPointScope = %p = %s \n",insertionPointIsScope ?
"true" :
"false",insertionPointScope,insertionPointScope->
class_name().c_str());
16206 printf (
"SgClassDeclaration: Exiting as a test! \n");
16210 if (TransformationSupport::getFile(scope) != targetFile)
16212 printf (
"Warning: SgStatement: scope = %p = %s \n",scope,scope->
class_name().c_str());
16213 SgFile* snippetFile = TransformationSupport::getFile(scope);
16214 ROSE_ASSERT(snippetFile != NULL);
16215 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
16217 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
16227 if (declarationStatement_copy != NULL)
16237 if (snippetFile != NULL && snippetFile != targetFile)
16242 printf (
"Note: SgDeclarationStatement: firstNondefiningDeclaration_original is not in target file (allowed for merged ASTs) \n");
16245 if (failOnWarning ==
true)
16247 printf (
"Exit on warning! \n");
16254 if (snippetFile == NULL)
16256 printf (
"Note: firstNondefiningDeclaration_original = %p getEnclosingFileNode() returned NULL \n",firstNondefiningDeclaration_original);
16258 if (failOnWarning ==
true)
16260 printf (
"Exit on warning! \n");
16268 if (definingDeclaration_original != NULL)
16275 if (snippetFile != NULL && snippetFile != targetFile)
16278 printf (
"Warning: SgDeclarationStatement: definingDeclaration is not in target file \n");
16281 if (failOnWarning ==
true)
16283 printf (
"Exit on warning! \n");
16287 if (declarationStatement_original == definingDeclaration_original)
16296 if (snippetFile == NULL)
16298 printf (
"Note: definingDeclaration_original = %p getEnclosingFileNode() returned NULL \n",definingDeclaration_original);
16300 if (failOnWarning ==
true)
16302 printf (
"Exit on warning! \n");
16312 if (expression != NULL)
16322 ROSE_ASSERT(type != NULL);
16327 printf (
"Leaving errorCheckingTargetAST() \n");
16341 T* classDeclaration_copy_defining =
dynamic_cast<T*
>(classDeclaration_copy->get_definingDeclaration());
16342 T* classDeclaration_copy_nondefining =
dynamic_cast<T*
>(classDeclaration_copy->get_firstNondefiningDeclaration());
16343 T* classDeclaration_original_defining =
dynamic_cast<T*
>(classDeclaration_original->get_definingDeclaration());
16344 T* classDeclaration_original_nondefining =
dynamic_cast<T*
>(classDeclaration_original->get_firstNondefiningDeclaration());
16347 if (classDeclaration_copy_defining != NULL && classDeclaration_copy_defining->get_scope() == classDeclaration_original_defining->get_scope())
16350 printf (
"reset the scope of classDeclaration_copy_defining \n");
16352 classDeclaration_copy_defining->set_scope(targetScope);
16356 if (classDeclaration_copy_nondefining != NULL && classDeclaration_copy_nondefining->get_scope() == classDeclaration_original_nondefining->get_scope())
16359 printf (
"reset the scope of classDeclaration_copy_nondefining \n");
16361 classDeclaration_copy_nondefining->set_scope(targetScope);
16365 if (classDeclaration_copy_nondefining != NULL && classDeclaration_copy_nondefining->get_parent() == classDeclaration_original_nondefining->get_parent())
16368 printf (
"reset the parent of classDeclaration_copy_nondefining \n");
16370 classDeclaration_copy_nondefining->set_parent(classDeclaration_copy->get_parent());
16395 printf (
"In fixupCopyOfNodeFromSeperateFileInNewTargetAst: node_copy = %p = %s \n",node_copy,node_copy->
class_name().c_str());
16399 printf (
"Disabled fixupCopyOfNodeFromSeperateFileInNewTargetAst() \n");
16407 printf (
" --- targetFile = %p = %s \n",targetFile,targetFile->get_sourceFileNameWithPath().c_str());
16408 printf (
" --- insertionPointIsScope = %s \n",insertionPointIsScope ?
"true" :
"false");
16415 SgNode* insertionPointScope = (insertionPointIsScope ==
true) ? insertionPoint : insertionPoint->
get_parent();
16417 printf (
"insertionPointScope = %p = %s \n",insertionPointScope,insertionPointScope->class_name().c_str());
16420 ROSE_ASSERT(targetScope != NULL);
16432 SgStatement* statement_copy = isSgStatement(node_copy);
16433 SgStatement* statement_original = isSgStatement(node_original);
16434 if (statement_copy != NULL)
16442 ROSE_ASSERT(scope_copy != NULL);
16443 ROSE_ASSERT(scope_original != NULL);
16449 printf (
"Warning: SgStatement: scope = %p = %s \n",scope_original,scope_original->
class_name().c_str());
16453 ROSE_ASSERT(snippetFile != NULL);
16454 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
16456 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
16461 SgNode* insertionPointScope = (insertionPointIsScope ==
true) ? insertionPoint : insertionPoint->
get_parent();
16462 printf (
"insertionPointIsScope = %s insertionPointScope = %p = %s \n",insertionPointIsScope ?
"true" :
"false",insertionPointScope,insertionPointScope->
class_name().c_str());
16481 printf (
"SgClassDeclaration: Exiting as a test! \n");
16485 if (TransformationSupport::getFile(scope) != targetFile)
16487 printf (
"Warning: SgStatement: scope = %p = %s \n",scope,scope->
class_name().c_str());
16488 SgFile* snippetFile = TransformationSupport::getFile(scope);
16489 ROSE_ASSERT(snippetFile != NULL);
16490 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
16492 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
16504 if (declarationStatement_copy != NULL)
16511 if (snippetFile != NULL && snippetFile != targetFile)
16516 printf (
"Note: SgDeclarationStatement: firstNondefiningDeclaration_original is not in target file (allowed for merged ASTs) \n");
16523 if (snippetFile == NULL)
16525 printf (
"Note: firstNondefiningDeclaration_original = %p getEnclosingFileNode() returned NULL \n",firstNondefiningDeclaration_original);
16532 if (definingDeclaration_original != NULL)
16537 if (snippetFile != NULL && snippetFile != targetFile)
16540 printf (
"Warning: SgDeclarationStatement: definingDeclaration is not in target file \n");
16543 if (declarationStatement_original == definingDeclaration_original)
16552 if (snippetFile == NULL)
16554 printf (
"Note: definingDeclaration_original = %p getEnclosingFileNode() returned NULL \n",definingDeclaration_original);
16566 if (expression != NULL)
16576 ROSE_ASSERT(type != NULL);
16581 if (new_type != NULL)
16591 case V_SgInitializedName:
16594 SgInitializedName* initializedName_original = isSgInitializedName(node_original);
16601 SgStatement* enclosingStatement_copy = TransformationSupport::getStatement(initializedName_copy);
16603 printf (
"enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
16609 ROSE_ASSERT(scope_copy != NULL);
16610 ROSE_ASSERT(scope_original != NULL);
16616 ROSE_ASSERT(initializedName_copy != NULL);
16617 printf (
"initializedName_copy = %p = %s \n",initializedName_copy,initializedName_copy->get_name().str());
16618 ROSE_ASSERT(initializedName_original != NULL);
16619 printf (
"initializedName_original = %p = %s \n",initializedName_original,initializedName_original->get_name().str());
16620 SgType* initializedName_original_type = initializedName_original->get_type();
16621 printf (
"initializedName_original_type = %p = %s \n",initializedName_original_type,initializedName_original_type->
class_name().c_str());
16622 SgClassType* classType = isSgClassType(initializedName_original_type);
16624 if (classType != NULL)
16626 SgClassDeclaration* classDeclaration = isSgClassDeclaration(classType->get_declaration());
16627 ROSE_ASSERT(classDeclaration != NULL);
16628 printf (
"classDeclaration = %p = %s \n",classDeclaration,classDeclaration->get_name().str());
16632 printf (
"Warning: case V_SgInitializedName: scope_copy = %p = %s \n",scope_copy,scope_copy->
class_name().c_str());
16633 printf (
"Warning: case V_SgInitializedName: scope_original = %p = %s \n",scope_original,scope_original->
class_name().c_str());
16635 printf (
"Warning: case V_SgInitializedName: initializedName_copy->get_parent() = %p \n",initializedName_copy->
get_parent());
16636 printf (
"Warning: case V_SgInitializedName: initializedName_original->get_parent() = %p \n",initializedName_original->
get_parent());
16641 ROSE_ASSERT(snippetFile != NULL);
16642 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
16644 printf (
"Warning: case V_SgInitializedName: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
16650 SgType* type_copy = initializedName_copy->get_type();
16652 printf (
"(before type_copy->getInternalTypes()): type_copy = %p = %s \n",type_copy,type_copy->
class_name().c_str());
16662 for (
size_t i = 0; i < typeList.size(); i++)
16664 printf (
"Input type: typeList[i=%" PRIuPTR
"] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
16673 if (new_type != NULL && typeList.size() > 1)
16675 int size = (int)typeList.size();
16676 for (
int i = size - 2; i >= 0; i--)
16679 printf (
"Rebuild type: typeList[i=%d] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
16682 switch(typeList[i]->variantT())
16684 case V_SgModifierType:
16687 ROSE_ASSERT(modifierType != NULL);
16688 if (modifierType->
get_typeModifier().get_constVolatileModifier().isConst() ==
true)
16690 ROSE_ASSERT(new_type != NULL);
16692 printf (
"Building a SgModifierType: calling buildConstType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
16699 printf (
"Modifier kind not handled (not implemented) check what sort of modifier this is: \n");
16708 case V_SgTypedefType:
16711 ROSE_ASSERT(typedefType != NULL);
16715 ROSE_ASSERT(new_typedefType != NULL);
16716 ROSE_ASSERT(isSgTypedefType(new_typedefType) != NULL);
16718 new_type = new_typedefType;
16720 printf (
"ERROSE: SgTypedefType kind not handled (not implemented) \n");
16728 case V_SgPointerType:
16731 ROSE_ASSERT(pointerType != NULL);
16733 printf (
"Building a SgPointerType: calling buildPointerType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
16735 ROSE_ASSERT(new_type != NULL);
16738 printf (
"ERROSE: SgPointerType kind not handled (not implemented) \n");
16748 printf (
"Error: default reached in evaluation of typelist: typeList[i] = %p = %s \n",typeList[i],typeList[i]->class_name().c_str());
16755 if (typeList.size() > 1)
16757 printf (
"Exiting as a test! \n");
16771 printf (
"new_type = %p \n",new_type);
16773 if (new_type != NULL)
16777 printf (
"Reset type for initializedName_copy = %p from type = %p to type = %p \n",initializedName_copy,initializedName_copy->get_type(),new_type);
16779 SgType* original_type = initializedName_copy->get_type();
16780 SgNamedType* original_named_type = isSgNamedType(original_type);
16781 SgNamedType* new_named_type = isSgNamedType(new_type);
16782 if (original_named_type != NULL)
16784 ROSE_ASSERT(new_named_type != NULL);
16785 SgClassDeclaration* original_classDeclaration = isSgClassDeclaration(original_named_type->get_declaration());
16786 SgClassDeclaration* new_classDeclaration = isSgClassDeclaration(new_named_type->get_declaration());
16787 if (original_classDeclaration != NULL)
16789 ROSE_ASSERT(new_classDeclaration != NULL);
16791 printf (
"original_classDeclaration = %p = %s \n",original_classDeclaration,original_classDeclaration->get_name().str());
16792 printf (
"new_classDeclaration = %p = %s \n",new_classDeclaration,new_classDeclaration->get_name().str());
16795 ROSE_ASSERT(new_classDeclaration->get_name() == original_classDeclaration->get_name());
16799 SgType* old_type = initializedName_copy->get_type();
16800 printf (
"Reset the type: initializedName_copy->set_type(new_type): old type = %p = %s new_type = %p = %s \n",old_type,old_type->
class_name().c_str(),new_type,new_type->
class_name().c_str());
16802 initializedName_copy->set_type(new_type);
16805 printf (
"enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
16808 if (functionParameterList != NULL)
16815 ROSE_ASSERT(functionDeclaration != NULL);
16817 if (functionDefinition != NULL)
16819 ROSE_ASSERT(initializedName_copy->get_scope() == functionDefinition);
16825 ROSE_ASSERT(globalScope != NULL);
16826 if (initializedName_copy->get_scope() != globalScope)
16829 printf (
"Reset scope for initializedName_copy = %p = %s \n",initializedName_copy,initializedName_copy->get_name().str());
16831 initializedName_copy->set_scope(globalScope);
16833 ROSE_ASSERT(initializedName_copy->get_scope() == globalScope);
16839 printf (
"initializedName_copy->get_scope() = %p = %s \n",initializedName_copy->get_scope(),initializedName_copy->get_scope()->
class_name().c_str());
16841 SgEnumDeclaration* enumDeclaration = isSgEnumDeclaration(enclosingStatement_copy);
16842 if (enumDeclaration != NULL)
16852 SgName name = initializedName_copy->get_name();
16853 SgSymbol* symbol = initializedName_copy->get_scope()->lookup_enum_field_symbol(name);
16854 ROSE_ASSERT(symbol != NULL);
16857 ROSE_ASSERT(enumFieldSymbol != NULL);
16862 ROSE_ASSERT(new_enumFieldSymbol != NULL);
16868 initializedName_copy->set_scope(targetScope);
16870 printf (
"Exiting as a test! \n");
16877 printf (
"enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
16880 if (catchOptionStatement != NULL)
16883 ROSE_ASSERT(variableDeclaration != NULL);
16886 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(initializedName_original);
16887 ROSE_ASSERT(enclosingStatement_original != NULL);
16892 if (symbol == NULL)
16894 printf (
"ERROR: (symbol == NULL): initializedName_copy->get_name() = %s \n",initializedName_copy->get_name().str());
16897 ROSE_ASSERT(symbol != NULL);
16899 initializedName_copy->set_scope(targetScope);
16902 ROSE_ASSERT(new_variableSymbol != NULL);
16905 targetScope->
insert_symbol(initializedName_copy->get_name(),new_variableSymbol);
16911 if (javaForEachStatement != NULL)
16914 ROSE_ASSERT(variableDeclaration != NULL);
16916 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(initializedName_original);
16917 ROSE_ASSERT(enclosingStatement_original != NULL);
16921 if (symbol == NULL)
16923 printf (
"ERROR: (symbol == NULL): initializedName_copy->get_name() = %s \n",initializedName_copy->get_name().str());
16926 ROSE_ASSERT(symbol != NULL);
16928 initializedName_copy->set_scope(targetScope);
16931 ROSE_ASSERT(new_variableSymbol != NULL);
16934 targetScope->
insert_symbol(initializedName_copy->get_name(),new_variableSymbol);
16936 printf (
"Need to handle case of SgJavaForEachStatement \n");
16944 if (symbol == NULL)
16946 printf (
"ERROR: enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
16947 ROSE_ASSERT(enclosingStatement_copy->
get_parent() != NULL);
16948 printf (
"ERROR: enclosingStatement_copy->get_parent() = %p = %s \n",enclosingStatement_copy->
get_parent(),enclosingStatement_copy->
get_parent()->
class_name().c_str());
16949 printf (
"ERROR: (symbol == NULL): initializedName_copy->get_name() = %s \n",initializedName_copy->get_name().str());
16950 initializedName_original->
get_file_info()->display(
"ERROR: (symbol == NULL): debug");
16953 SgScopeStatement* initializedName_copy_scope = isSgScopeStatement(initializedName_copy->get_scope());
16954 ROSE_ASSERT(initializedName_copy_scope != NULL);
16955 SgVariableSymbol* variableSymbol = initializedName_copy_scope->lookup_variable_symbol(initializedName_copy->get_name());
16956 ROSE_ASSERT(variableSymbol != NULL);
16958 symbol = variableSymbol;
16960 ROSE_ASSERT(symbol != NULL);
16963 ROSE_ASSERT(variableSymbol != NULL);
16965 printf (
"Insert symbol = %p for initializedName_copy = %p = %s into targetScope = %p = %s \n",variableSymbol,initializedName_copy,initializedName_copy->get_name().str(),targetScope,targetScope->
class_name().c_str());
16970 ROSE_ASSERT(new_variableSymbol != NULL);
16973 targetScope->
insert_symbol(initializedName_copy->get_name(),new_variableSymbol);
16976 initializedName_copy->set_scope(targetScope);
16979 SgName mangledName = variableSymbol->get_mangled_name();
16980 printf (
"initializedName_copy: mangledName = %s \n",mangledName.str());
16984 if (initializedName_copy->get_scope() != targetScope)
16986 printf (
"WARNING: initializedName_copy->get_scope() != targetScope: initializedName_copy->get_scope() = %p = %s \n",initializedName_copy->get_scope(),initializedName_copy->get_scope()->
class_name().c_str());
16988 printf (
"I think this should be an error! \n");
16999 case V_SgVariableDeclaration:
17004 ROSE_ASSERT(variableDeclaration != NULL);
17009#define DEBUG_FUNCTION_DECLARATION 0
17011 case V_SgFunctionDeclaration:
17023 SgFunctionType* functionType_copy = functionDeclaration_copy->get_type();
17024 SgFunctionType* functionType_original = functionDeclaration_original->get_type();
17025 ROSE_ASSERT(functionType_copy != NULL);
17026 ROSE_ASSERT(functionType_original != NULL);
17027 ROSE_ASSERT(functionType_copy == functionType_original);
17028#if DEBUG_FUNCTION_DECLARATION
17029 printf (
"case SgFunctionDeclaration: part 1: Calling functionDeclaration_copy->search_for_symbol_from_symbol_table() \n");
17033 ROSE_ASSERT(symbol_original != NULL);
17034 SgFunctionSymbol* functionSymbol_original = isSgFunctionSymbol(symbol_original);
17035 ROSE_ASSERT(functionSymbol_original != NULL);
17038 ROSE_ASSERT(snippetFile != NULL);
17039 if (snippetFile != targetFile)
17041#if DEBUG_FUNCTION_DECLARATION
17042 printf (
"Warning: case V_SgFunctionDeclaration: functionSymbol_original not in target file \n");
17046 ROSE_ASSERT(isSgMemberFunctionSymbol(symbol_original) == NULL);
17052 SgName name = functionDeclaration_copy->get_name();
17053 SgType* functionType = functionDeclaration_copy->get_type();
17054 ROSE_ASSERT(functionType != NULL);
17055#if DEBUG_FUNCTION_DECLARATION
17056 printf (
"case V_SgFunctionDeclaration: name = %s \n",name.str());
17057 printf (
"case V_SgFunctionDeclaration: functionType = %p \n",functionType);
17058 printf (
"case V_SgFunctionDeclaration: functionType_original = %p \n",functionType_original);
17059 printf (
"case V_SgFunctionDeclaration: functionType_copy = %p \n",functionType_copy);
17063 ROSE_ASSERT(targetScope != NULL);
17064 functionDeclaration_copy->
set_scope(targetScope);
17071 if (functionSymbolInTargetAST == NULL)
17073#if DEBUG_FUNCTION_DECLARATION
17074 printf (
"functionSymbolInTargetAST not found in targetScope = %p = %s \n",targetScope,targetScope->
class_name().c_str());
17078 ROSE_ASSERT(otherPossibleScope != NULL);
17079#if DEBUG_FUNCTION_DECLARATION
17080 printf (
"case V_SgFunctionDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope,otherPossibleScope->
class_name().c_str());
17084 functionSymbolInTargetAST = otherPossibleScope->lookup_function_symbol(name,functionType);
17086 if (functionSymbolInTargetAST == NULL)
17088 printf (
"function symbol not found in otherPossibleScope = %p = %s \n",otherPossibleScope,otherPossibleScope->
class_name().c_str());
17091 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
17092#if DEBUG_FUNCTION_DECLARATION
17093 printf (
"(building a new SgFunctionSymbol): functionSymbolInTargetAST->get_declaration() = %p \n",functionSymbolInTargetAST->get_declaration());
17101 ROSE_ASSERT(new_symbol != NULL);
17105 functionSymbolInTargetAST = new_symbol;
17115#if DEBUG_FUNCTION_DECLARATION
17116 printf (
"(using existing symbol found in target scope): functionSymbolInTargetAST->get_declaration() = %p \n",functionSymbolInTargetAST->get_declaration());
17118 functionDeclaration_copy_firstNondefining = isSgFunctionDeclaration(functionSymbolInTargetAST->get_declaration());
17121 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
17124 ROSE_ASSERT(functionDeclaration_copy_firstNondefining != NULL);
17133 ROSE_ASSERT(functionDeclaration_original_firstNondefining != NULL);
17134 printf (
"functionSymbolInTargetAST->get_declaration() = %p \n",functionSymbolInTargetAST->get_declaration());
17136 printf (
"functionDeclaration_original = %p = %s \n",functionDeclaration_original,functionDeclaration_original->
class_name().c_str());
17137 printf (
"functionDeclaration_copy = %p = %s \n",functionDeclaration_copy,functionDeclaration_copy->
class_name().c_str());
17138 printf (
"functionDeclaration_original_firstNondefining = %p \n",functionDeclaration_original_firstNondefining);
17139 printf (
"functionDeclaration_copy_firstNondefining = %p \n",functionDeclaration_copy_firstNondefining);
17140 printf (
"functionDeclaration_original_defining = %p \n",functionDeclaration_original_defining);
17141 printf (
"functionDeclaration_copy_defining = %p \n",functionDeclaration_copy_defining);
17143 printf (
"functionDeclaration_original->get_scope() = %p = %s \n",functionDeclaration_original->
get_scope(),functionDeclaration_original->
get_scope()->
class_name().c_str());
17144 printf (
"functionDeclaration_copy->get_scope() = %p = %s \n",functionDeclaration_copy->
get_scope(),functionDeclaration_copy->
get_scope()->
class_name().c_str());
17145 printf (
"functionDeclaration_original_firstNondefining->get_scope() = %p = %s \n",functionDeclaration_original_firstNondefining->
get_scope(),functionDeclaration_original_firstNondefining->
get_scope()->
class_name().c_str());
17146 printf (
"functionDeclaration_copy_firstNondefining->get_scope() = %p = %s \n",functionDeclaration_copy_firstNondefining->
get_scope(),functionDeclaration_copy_firstNondefining->
get_scope()->
class_name().c_str());
17147 printf (
"functionDeclaration_original_defining->get_scope() = %p = %s \n",functionDeclaration_original_defining->
get_scope(),functionDeclaration_original_defining->
get_scope()->
class_name().c_str());
17148 printf (
"functionDeclaration_copy_defining->get_scope() = %p = %s \n",functionDeclaration_copy_defining->
get_scope(),functionDeclaration_copy_defining->
get_scope()->
class_name().c_str());
17149 printf (
"functionSymbolInTargetAST = %p = %s \n",functionSymbolInTargetAST,functionSymbolInTargetAST->
class_name().c_str());
17152 ROSE_ASSERT(targetScope->lookup_function_symbol(name,functionType) != NULL);
17166 bool isDefiningDeclaration (functionDeclaration_original->get_declaration() != NULL);
17167 if (isDefiningDeclaration ==
true)
17172 ROSE_ASSERT(nondefiningDeclarationFile != NULL);
17173 if (nondefiningDeclarationFile == targetFile)
17190 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
17198 resetDeclaration(functionDeclaration_copy,functionDeclaration_original,targetScope);
17200 printf (
"SageBuilder::fixupCopyOfNodeFromSeperateFileInNewTargetAst(): Need to be able to fixup the SgFunctionDeclaration \n");
17206 case V_SgClassDeclaration:
17210 SgClassDeclaration* classDeclaration_original = isSgClassDeclaration(node_original);
17211 SgClassType* classType = classDeclaration_copy->get_type();
17212 ROSE_ASSERT(classType != NULL);
17214 printf (
"Need to handle named types from class declarations \n");
17225 printf (
"Warning: case V_SgClassDeclaration: assume getEnclosingFileNode(classDeclaration_copy) != targetFile \n");
17237 SgName name = classDeclaration_copy->get_name();
17240 printf (
"case V_SgClassDeclaration: targetScope = %p classSymbol_copy->get_name() = %s \n",targetScope,classSymbol_copy->get_name().str());
17245 if (classSymbolInTargetAST == NULL)
17249 ROSE_ASSERT(otherPossibleScope != NULL);
17251 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p \n",otherPossibleScope);
17255 ROSE_ASSERT(classSymbolInTargetAST != NULL);
17259 ROSE_ASSERT(classDeclaration != NULL);
17261 ROSE_ASSERT(scope != NULL);
17262 classDeclaration_copy->
set_scope(scope);
17265 classDeclaration_copy->
set_scope(targetScope);
17269 ROSE_ASSERT(classSymbol != NULL);
17270 classSymbolInTargetAST = classSymbol;
17280 ROSE_ASSERT(classDeclaration != NULL);
17282 ROSE_ASSERT(scope != NULL);
17283 classDeclaration_copy->
set_scope(scope);
17286 ROSE_ASSERT(classSymbolInTargetAST != NULL);
17293 SgClassType* new_class_type = isSgClassType(new_type);
17294 if (new_class_type != NULL)
17297 classDeclaration_copy->set_type(new_class_type);
17299 printf (
"case V_SgClassDeclaration: built class type: part 1: classDeclaration_copy->get_type() = %p = %s \n",
17300 classDeclaration_copy->get_type(),classDeclaration_copy->get_type()->
class_name().c_str());
17304 resetDeclaration(classDeclaration_copy,classDeclaration_original,targetScope);
17306 printf (
"SgClassDeclaration: Exiting as a test! \n");
17312 case V_SgEnumDeclaration:
17316 SgEnumDeclaration* enumDeclaration_original = isSgEnumDeclaration(node_original);
17326 printf (
"case V_SgEnumDeclaration: targetScope = %p enumSymbol_copy->get_name() = %s \n",targetScope,name.str());
17330 if (enumSymbolInTargetAST == NULL)
17334 ROSE_ASSERT(otherPossibleScope != NULL);
17336 printf (
"case V_SgEnumDeclaration: otherPossibleScope = %p \n",otherPossibleScope);
17340 printf (
"Since the symbol has not been inserted yet, what symbol are we looking for? \n");
17344 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
17346 ROSE_ASSERT(enumDeclaration != NULL);
17348 ROSE_ASSERT(enumDeclaration != enumDeclaration_original);
17355 ROSE_ASSERT(enumSymbol != NULL);
17356 enumSymbolInTargetAST = enumSymbol;
17363 ROSE_ASSERT(scope != NULL);
17364 enumDeclaration_copy->
set_scope(scope);
17366 printf (
"case V_SgEnumDeclaration: insert_symbol(): name = %s enumSymbolInTargetAST = %p \n",name.str(),enumSymbolInTargetAST);
17375 printf (
"Found an existing enum declaration: name = %s enumSymbolInTargetAST = %p \n",name.str(),enumSymbolInTargetAST);
17379 ROSE_ASSERT(enumDeclaration != NULL);
17382 ROSE_ASSERT(scope != NULL);
17383 ROSE_ASSERT(scope == targetScope);
17391 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
17394 printf (
"Exiting as a test 1! \n");
17398 ROSE_ASSERT(enumType != NULL);
17401 printf (
"Return type from getTargetFileType(): original enumType = %p new_type = %p \n",enumType,new_type);
17403 SgEnumType* new_enum_type = isSgEnumType(new_type);
17404 if (new_enum_type != NULL)
17408 printf (
"reset the type using the new enum type from the target AST \n");
17410 enumDeclaration_copy->
set_type(new_enum_type);
17413 printf (
"Exiting as a test 2! \n");
17417 resetDeclaration(enumDeclaration_copy,enumDeclaration_original,targetScope);
17422 case V_SgTemplateClassDeclaration:
17426 SgClassType* templateClassType = templateClassDeclaration->get_type();
17427 ROSE_ASSERT(templateClassType != NULL);
17431 SgClassType* new_templateClass_type = isSgClassType(new_type);
17432 if (new_templateClass_type != NULL)
17435 templateClassDeclaration->set_type(new_templateClass_type);
17437 printf (
"case V_SgTemplateClassDeclaration: built class type: part 1: templateClassDeclaration->get_type() = %p = %s \n",
17438 templateClassDeclaration->get_type(),templateClassDeclaration->get_type()->
class_name().c_str());
17445 case V_SgTypedefDeclaration:
17451 SgType* base_type = typedefDeclaration_copy->get_base_type();
17452 ROSE_ASSERT(base_type != NULL);
17454 if (new_base_type != NULL)
17457 typedefDeclaration_copy->set_base_type(new_base_type);
17462 SgName name = typedefDeclaration_copy->get_name();
17465 printf (
"case V_SgTypedefDeclaration: targetScope = %p typedefSymbol_copy->get_name() = %s \n",targetScope,name.str());
17469 if (typedefSymbolInTargetAST == NULL)
17473 ROSE_ASSERT(otherPossibleScope != NULL);
17475 printf (
"case V_SgTypedefDeclaration: otherPossibleScope = %p \n",otherPossibleScope);
17479 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
17481 ROSE_ASSERT(typedefDeclaration != NULL);
17484 ROSE_ASSERT(scope != NULL);
17485 typedefDeclaration_copy->
set_scope(scope);
17489 ROSE_ASSERT(typedefSymbol != NULL);
17490 typedefSymbolInTargetAST = typedefSymbol;
17492 printf (
"case V_SgTypedefDeclaration: insert_symbol(): name = %s typedefSymbolInTargetAST = %p \n",name.str(),typedefSymbolInTargetAST);
17501 printf (
"Found an existing typedef declaration: name = %s typedefSymbolInTargetAST = %p \n",name.str(),typedefSymbolInTargetAST);
17505 ROSE_ASSERT(typedefDeclaration != NULL);
17507 ROSE_ASSERT(scope != NULL);
17508 typedefDeclaration_copy->
set_scope(scope);
17511 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
17514 printf (
"Exiting as a test 1! \n");
17517 SgTypedefType* typedefType = typedefDeclaration_copy->get_type();
17518 ROSE_ASSERT(typedefType != NULL);
17520 SgTypedefType* new_typedef_type = isSgTypedefType(new_type);
17521 if (new_typedef_type != NULL)
17525 printf (
"reset the type using the new typedef type from the target AST \n");
17527 typedefDeclaration_copy->set_type(new_typedef_type);
17529 printf (
"case V_SgTypedefDeclaration: built class type: part 1: typedefDeclaration_copy->get_type() = %p = %s \n",
17530 typedefDeclaration_copy->get_type(),typedefDeclaration_copy->get_type()->
class_name().c_str());
17534 resetDeclaration(typedefDeclaration_copy,typedefDeclaration_original,targetScope);
17536 printf (
"Exiting as a test 2! \n");
17542 case V_SgVarRefExp:
17553 SgVarRefExp* varRefExp_copy = isSgVarRefExp(node_copy);
17554 SgVarRefExp* varRefExp_original = isSgVarRefExp(node_original);
17555 SgVariableSymbol* variableSymbol_copy = isSgVariableSymbol(varRefExp_copy->get_symbol());
17556 ROSE_ASSERT(variableSymbol_copy != NULL);
17561 printf (
"Warning: case V_SgVarRefExp: variableSymbol not in target file: name = %s \n",variableSymbol_copy->
get_name().str());
17564 printf (
"insertionPoint = %p = %s \n",insertionPoint,insertionPoint->
class_name().c_str());
17577 if (variableSymbolInTargetAST == NULL)
17583 printf (
"Error: The associated variable = %s should have been found in a parent scope of the target AST \n",variableSymbol_copy->
get_name().str());
17588 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(varRefExp_original);
17589 ROSE_ASSERT(enclosingStatement_original != NULL);
17591 printf (
"case V_SgVarRefExp: enclosingStatement_original = %p = %s \n",enclosingStatement_original,enclosingStatement_original->
class_name().c_str());
17594 ROSE_ASSERT(otherPossibleScope_original != NULL);
17597 ROSE_ASSERT(file != NULL);
17599 printf (
"enclosingStatement_original: associated file name = %s \n",file->get_sourceFileNameWithPath().c_str());
17602 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope_original,otherPossibleScope_original->
class_name().c_str());
17603 printf (
"case V_SgClassDeclaration: variableSymbol_copy->get_name() = %s \n",variableSymbol_copy->
get_name().str());
17606 if (variableSymbolInTargetAST == NULL)
17610 otherPossibleScope_original->
get_symbol_table()->
print(
"otherPossibleScope_original: symbol table");
17615 SgBinaryOp* parentBinaryOp = isSgBinaryOp(parentExpression);
17616 SgDotExp* parentDotExp = isSgDotExp(parentExpression);
17617 SgArrowExp* parentArrowExp = isSgArrowExp(parentExpression);
17618 if (parentDotExp != NULL || parentArrowExp != NULL)
17622 ROSE_ASSERT(lhs != NULL);
17626 ROSE_ASSERT(type != NULL);
17628 printf (
"type = %p = %s \n",type,type->
class_name().c_str());
17631 ROSE_ASSERT(namedType != NULL);
17633 ROSE_ASSERT(declaration != NULL);
17635 ROSE_ASSERT(classDeclaration != NULL);
17637 ROSE_ASSERT(definingClassDeclaration != NULL);
17638 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
17639 ROSE_ASSERT(classDefinition != NULL);
17641 printf (
"case V_SgClassDeclaration: classDefinition = %p = %s \n",classDefinition,classDefinition->
class_name().c_str());
17644 otherPossibleScope_original = classDefinition;
17650 ROSE_ASSERT(variableSymbolInTargetAST != NULL);
17651 SgInitializedName* initializedName = variableSymbolInTargetAST->get_declaration();
17652 ROSE_ASSERT(initializedName != NULL);
17654 ROSE_ASSERT(scope != NULL);
17657 initializedName->set_scope(scope);
17662 ROSE_ASSERT(variableSymbolInTargetAST != NULL);
17665 varRefExp_copy->set_symbol(variableSymbolInTargetAST);
17674 case V_SgFunctionRefExp:
17679 SgFunctionSymbol* functionSymbol_copy = isSgFunctionSymbol(functionRefExp_copy->get_symbol());
17680 ROSE_ASSERT(functionSymbol_copy != NULL);
17685 printf (
"Warning: case V_SgFunctionRefExp: functionSymbol_copy not in target file (find function = %s) \n",functionSymbol_copy->
get_name().str());
17689 printf (
"insertionPointIsScope = %s insertionPointScope = %p = %s \n",insertionPointIsScope ?
"true" :
"false",insertionPointScope,insertionPointScope->class_name().c_str());
17701 if (functionSymbolInTargetAST == NULL)
17712 fprintf (stderr,
"Error: The associated function = \"%s\" should have been found in a parent scope"
17713 " of the target AST\n", name.str());
17715 fprintf (stderr,
" targetScope = %p = %s \n",targetScope,targetScope->
class_name().c_str());
17716 SgGlobal* globalScope = TransformationSupport::getGlobalScope(targetScope);
17717 ROSE_ASSERT(globalScope != NULL);
17718 fprintf (stderr,
" globalScope = %p = %s \n",globalScope,globalScope->
class_name().c_str());
17720 targetScope->
get_file_info()->display(
"case V_SgFunctionRefExp: targetScope: debug");
17721 node_original->
get_file_info()->display(
"case V_SgFunctionRefExp: node_original: debug");
17727 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(functionRefExp_original);
17728 ROSE_ASSERT(enclosingStatement_original != NULL);
17730 printf (
"case V_SgFunctionRefExp: enclosingStatement_original = %p = %s \n",enclosingStatement_original,enclosingStatement_original->
class_name().c_str());
17733 ROSE_ASSERT(otherPossibleScope_original != NULL);
17736 ROSE_ASSERT(file != NULL);
17738 printf (
"enclosingStatement_original: associated file name = %s \n",file->get_sourceFileNameWithPath().c_str());
17741 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope_original,otherPossibleScope_original->
class_name().c_str());
17742 printf (
"case V_SgClassDeclaration: functionSymbol_copy->get_name() = %s \n",functionSymbol_copy->
get_name().str());
17746 if (functionSymbolInTargetAST == NULL)
17750 SgBinaryOp* parentBinaryOp = isSgBinaryOp(parentExpression);
17751 SgDotExp* parentDotExp = isSgDotExp(parentExpression);
17752 SgArrowExp* parentArrowExp = isSgArrowExp(parentExpression);
17753 if (parentDotExp != NULL || parentArrowExp != NULL)
17757 ROSE_ASSERT(lhs != NULL);
17758 ROSE_ASSERT(parentBinaryOp->
get_rhs_operand() == functionRefExp_copy);
17761 ROSE_ASSERT(type != NULL);
17763 printf (
"type = %p = %s \n",type,type->
class_name().c_str());
17766 ROSE_ASSERT(namedType != NULL);
17768 ROSE_ASSERT(declaration != NULL);
17770 ROSE_ASSERT(classDeclaration != NULL);
17772 ROSE_ASSERT(definingClassDeclaration != NULL);
17773 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
17774 ROSE_ASSERT(classDefinition != NULL);
17776 printf (
"case V_SgClassDeclaration: classDefinition = %p = %s \n",classDefinition,classDefinition->
class_name().c_str());
17779 otherPossibleScope_original = classDefinition;
17786 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
17788 ROSE_ASSERT(functionDeclaration != NULL);
17790 ROSE_ASSERT(scope != NULL);
17795 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
17800 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
17803 functionRefExp_copy->set_symbol(functionSymbolInTargetAST);
17805 printf (
"Exiting as a test! \n");
17813#define DEBUG_MEMBER_FUNCTION_REF_EXP 0
17815 case V_SgMemberFunctionRefExp:
17820 SgMemberFunctionSymbol* memberFunctionSymbol_copy = isSgMemberFunctionSymbol(memberFunctionRefExp_copy->get_symbol());
17821 ROSE_ASSERT(memberFunctionSymbol_copy != NULL);
17826#if DEBUG_MEMBER_FUNCTION_REF_EXP
17827 printf (
"Warning: case V_SgMemberFunctionRefExp: memberFunctionSymbol_copy not in target file (find member function = %s) \n",memberFunctionSymbol_copy->
get_name().str());
17831 if (memberFunctionSymbolInTargetAST == NULL)
17836#if DEBUG_MEMBER_FUNCTION_REF_EXP
17837 printf (
"Error: The associated memberFunction_copy = %s should have been found in a parent scope of the target AST \n",memberFunctionSymbol_copy->
get_name().str());
17842 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(memberFunctionRefExp_original);
17843 ROSE_ASSERT(enclosingStatement_original != NULL);
17844#if DEBUG_MEMBER_FUNCTION_REF_EXP
17845 printf (
"case V_SgMemberFunctionRefExp: enclosingStatement_original = %p = %s \n",enclosingStatement_original,enclosingStatement_original->
class_name().c_str());
17848 ROSE_ASSERT(otherPossibleScope_original != NULL);
17851 ROSE_ASSERT(file != NULL);
17852#if DEBUG_MEMBER_FUNCTION_REF_EXP
17853 printf (
"enclosingStatement_original: associated file name = %s \n",file->get_sourceFileNameWithPath().c_str());
17856 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope_original,otherPossibleScope_original->
class_name().c_str());
17857 printf (
"case V_SgClassDeclaration: memberFunctionSymbol_copy->get_name() = %s \n",memberFunctionSymbol_copy->
get_name().str());
17860 if (memberFunctionSymbolInTargetAST == NULL)
17862#if DEBUG_MEMBER_FUNCTION_REF_EXP
17863 printf (
"Backup and look for the associated class and then look for the member function in the class (assume non-friend function or Java member function) \n");
17868 ROSE_ASSERT(parentExpression != NULL);
17869#if DEBUG_MEMBER_FUNCTION_REF_EXP
17870 printf (
"parentExpression = %p = %s \n",parentExpression,parentExpression->
class_name().c_str());
17872 bool handle_as_java =
false;
17874 if (functionCallExp != NULL)
17878 handle_as_java =
true;
17882 ROSE_ASSERT(parentOfFunctionCallExpression != NULL);
17883#if DEBUG_MEMBER_FUNCTION_REF_EXP
17884 printf (
"parentOfFunctionCallExpression = %p = %s \n",parentOfFunctionCallExpression,parentOfFunctionCallExpression->
class_name().c_str());
17886 parentExpression = parentOfFunctionCallExpression;
17889 SgBinaryOp* parentBinaryOp = isSgBinaryOp(parentExpression);
17890 SgDotExp* parentDotExp = isSgDotExp(parentExpression);
17891 SgArrowExp* parentArrowExp = isSgArrowExp(parentExpression);
17892#if DEBUG_MEMBER_FUNCTION_REF_EXP
17893 printf (
"parentBinaryOp = %p \n",parentBinaryOp);
17894 printf (
"parentDotExp = %p \n",parentDotExp);
17895 printf (
"parentArrowExp = %p \n",parentArrowExp);
17897 if (parentDotExp != NULL || parentArrowExp != NULL)
17901 ROSE_ASSERT(lhs != NULL);
17904 if (handle_as_java ==
true)
17912 ROSE_ASSERT(parentBinaryOp->
get_rhs_operand() == memberFunctionRefExp_copy);
17914#if DEBUG_MEMBER_FUNCTION_REF_EXP
17915 printf (
"lhs = %p = %s \n",lhs,lhs->
class_name().c_str());
17921 if (varRefExp != NULL)
17923 SgVariableSymbol* variableSymbol = isSgVariableSymbol(varRefExp->get_symbol());
17924 ROSE_ASSERT(variableSymbol != NULL);
17926 ROSE_ASSERT(initializedName != NULL);
17928 SgType* initializedName_type = initializedName->get_type();
17929#if DEBUG_MEMBER_FUNCTION_REF_EXP
17930 printf (
"initializedName = %p = %s \n",initializedName,initializedName->get_name().str());
17931 printf (
"initializedName_type = %p \n",initializedName_type);
17933 SgClassType* classType = isSgClassType(initializedName_type);
17934 if (classType != NULL)
17936 SgClassDeclaration* classDeclaration = isSgClassDeclaration(classType->get_declaration());
17937 ROSE_ASSERT(classDeclaration != NULL);
17939 ROSE_ASSERT(definingClassDeclaration != NULL);
17940 printf (
"definingClassDeclaration->get_name() = %s \n",definingClassDeclaration->get_name().str());
17942 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
17943 ROSE_ASSERT(classDefinition != NULL);
17944 SgType* memberFunctionType = memberFunctionSymbol_copy->
get_type();
17945 SgName memberFunctionName = memberFunctionSymbol_copy->
get_name();
17946 ROSE_ASSERT(memberFunctionType != NULL);
17947 SgFunctionSymbol *functionSymbol = classDefinition->lookup_function_symbol(memberFunctionName,memberFunctionType);
17948 if (functionSymbol == NULL)
17950 printf (
"Symbol not found: output symbol table (size = %d): \n",classDefinition->
get_symbol_table()->
size());
17951#if DEBUG_MEMBER_FUNCTION_REF_EXP
17952 classDefinition->
get_symbol_table()->
print(
"Symbol not found: output symbol table: SgClassDefinition");
17957 printf (
"\n*************************************************************** \n");
17958 printf (
"ERROR: target has not be properly setup to receive the snippet. \n");
17959 printf (
"*************************************************************** \n");
17961 ROSE_ASSERT(functionSymbol != NULL);
17963 ROSE_ASSERT(memberFunctionSymbol != NULL);
17965 memberFunctionSymbolInTargetAST = memberFunctionSymbol;
17967 printf (
"Exiting as a test! \n");
17977 if (valueExp != NULL)
17979 memberFunctionSymbolInTargetAST = memberFunctionSymbol_copy;
17980 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
17983 if (memberFunctionSymbolInTargetAST == NULL)
17987 ROSE_ASSERT(type != NULL);
17988#if DEBUG_MEMBER_FUNCTION_REF_EXP
17989 printf (
"type = %p = %s \n",type,type->
class_name().c_str());
17992 ROSE_ASSERT(namedType != NULL);
17994 ROSE_ASSERT(declaration != NULL);
17996 ROSE_ASSERT(classDeclaration != NULL);
17998 ROSE_ASSERT(definingClassDeclaration != NULL);
17999 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
18000 ROSE_ASSERT(classDefinition != NULL);
18001#if DEBUG_MEMBER_FUNCTION_REF_EXP
18002 printf (
"case V_SgClassDeclaration: classDefinition = %p = %s \n",classDefinition,classDefinition->
class_name().c_str());
18005 otherPossibleScope_original = classDefinition;
18006#if DEBUG_MEMBER_FUNCTION_REF_EXP
18009#if DEBUG_MEMBER_FUNCTION_REF_EXP
18012 printf (
"associated_classDeclaration = %p name = %s \n",associated_classDeclaration,associated_classDeclaration->get_name().str());
18013 printf (
"functionSymbol = %p \n",functionSymbol);
18016 if (memberFunctionSymbolInTargetAST == NULL)
18019 printf (
"Error: (memberFunctionSymbolInTargetAST == NULL): memberFunctionSymbol_copy->get_name() = %s \n",memberFunctionSymbol_copy->
get_name().str());
18022 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18024 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18028 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18030 ROSE_ASSERT(functionDeclaration != NULL);
18032 ROSE_ASSERT(scope != NULL);
18037 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18040 memberFunctionRefExp_copy->set_symbol(memberFunctionSymbolInTargetAST);
18050 printf (
"Exiting as a test! (SgTryStmt) \n");
18057 case V_SgCatchStatementSeq:
18062 printf (
"Exiting as a test! (SgCatchStatementSeq) \n");
18069 case V_SgCatchOptionStmt:
18074 ROSE_ASSERT(catchOptionStatement_copy);
18076 printf (
"Need to check the symbol table of the SgCatchOptionStmt (which is a SgScopeStatement) \n");
18079 printf (
"Exiting as a test! (SgCatchOptionStmt) \n");
18086 case V_SgJavaPackageStatement:
18089 printf (
"Exiting as a test! (SgJavaPackageStatement) \n");
18099 printf (
"enum values contain a reference to the associated SgEnumDeclaration \n");
18101 SgEnumVal* enumVal_copy = isSgEnumVal(node_copy);
18102 SgEnumVal* enumVal_original = isSgEnumVal(node_original);
18104 printf (
" --- enumVal_original = %p = %d name = %s \n",enumVal_original,enumVal_original->get_value(),enumVal_original->get_name().str());
18106 SgEnumDeclaration* associatedEnumDeclaration_copy = isSgEnumDeclaration(enumVal_copy->get_declaration());
18107 SgEnumDeclaration* associatedEnumDeclaration_original = isSgEnumDeclaration(enumVal_original->get_declaration());
18110 bool isUnNamed = associatedEnumDeclaration_original->get_isUnNamed();
18111 if (isUnNamed ==
false)
18113 if (associatedEnumDeclaration_copy == associatedEnumDeclaration_original)
18116 printf (
" --- The stored reference to the enum declaration in the SgEnumVal must be reset \n");
18120 if (symbol == NULL)
18123 enumVal_original->
get_file_info()->display(
"case V_SgEnumVal: symbol == NULL: debug");
18125 ROSE_ASSERT(symbol != NULL);
18127 ROSE_ASSERT(enumSymbol != NULL);
18128 SgEnumDeclaration* new_associatedEnumDeclaration_copy = enumSymbol->get_declaration();
18129 ROSE_ASSERT(new_associatedEnumDeclaration_copy != NULL);
18132 ROSE_ASSERT(new_associatedEnumDeclaration_copy != associatedEnumDeclaration_original);
18134 ROSE_ASSERT(new_associatedEnumDeclaration_copy != associatedEnumDeclaration_original->
get_definingDeclaration());
18136 enumVal_copy->set_declaration(new_associatedEnumDeclaration_copy);
18138 printf (
"Exiting as a test! \n");
18147 printf (
"Warning: can't handle enum values from unnamed enum declarations \n");
18148 printf (
" --- enumVal_original = %p = %lld name = %s \n",enumVal_original,enumVal_original->get_value(),enumVal_original->get_name().str());
18182 ROSE_ASSERT(insertionPoint != NULL);
18183 ROSE_ASSERT(toInsert != NULL);
18184 ROSE_ASSERT(original_before_copy != NULL);
18188 SgSymbolTable::set_force_search_of_base_classes(
true);
18195 ROSE_ASSERT(targetFile != NULL);
18204 ROSE_ASSERT(snippetFile_of_copy == targetFile);
18209 ROSE_ASSERT(snippetFile_of_original != targetFile);
18212 printf (
" --- targetFile = %p = %s \n",targetFile,targetFile->get_sourceFileNameWithPath().c_str());
18213 printf (
" --- snippetFile_of_copy = %p = %s \n",snippetFile_of_copy,snippetFile_of_copy->get_sourceFileNameWithPath().c_str());
18214 printf (
" --- snippetFile_of_original = %p = %s \n",snippetFile_of_original,snippetFile_of_original->get_sourceFileNameWithPath().c_str());
18226 if (isStructurallyEquivalent ==
false)
18228 printf (
"WARNING: The copy of the snippet is a different size than the original snippet (don't do transformations on the copy before inserting into the target AST). \n");
18231 ROSE_ASSERT(isStructurallyEquivalent ==
true);
18241 RoseAst ast_of_copy(toInsert);
18242 RoseAst ast_of_original(original_before_copy);
18251 while (i_copy != ast_of_copy.
end())
18255 if ((*i_copy)->variantT() != (*i_original)->variantT())
18257 printf (
"ERROR: return from fixupCopyOfAstFromSeparateFileInNewTargetAst(): "
18258 "(*i_copy)->variantT() != (*i_original)->variantT() \n");
18260 printf (
"Making this an error! \n");
18273 ROSE_ASSERT(i_original != ast_of_original.
end());
18278 ROSE_ASSERT(i_copy == ast_of_copy.
end() && i_original == ast_of_original.
end());
18284 if (functionDeclaration != NULL)
18286 printf (
"functionDeclaration = %s \n",functionDeclaration->get_name().str());
18288 printf (
"Exiting as a test! \n");
18295 SgSymbolTable::set_force_search_of_base_classes(
false);
18305 ROSE_ASSERT (scope != NULL);
18315 ROSE_ASSERT(result != NULL);
18319 cerr<<
"Error. buildStatementFromString() cannot parse the input string:"<<s
18320 <<
"\n\t within the given scope:"<<scope->
class_name() <<endl;
18344 template <
class SgAstNode>
18347 static const bool explicitlySpecified =
true;
18365 res = createTemplateArg_(*isSgType(&n));
18366 else if (isSgExpression(&n))
18367 res = createTemplateArg_(*isSgExpression(&n));
18370 ROSE_ASSERT(isSgTemplateDeclaration(&n));
18371 res = createTemplateArg_(*isSgTemplateDeclaration(&n));
18378 SgName genTemplateName(
SgName base, Rose_STL_Container<SgNode*>& targs)
18380 Rose_STL_Container<SgNode*>::iterator aa = targs.begin();
18381 Rose_STL_Container<SgNode*>::iterator zz = targs.begin();
18382 std::string name(base.getString());
18385 for ( ; aa != zz; ++aa) name.append((*aa)->unparseToString());
18391 SgTemplateArgumentPtrList genTemplateArgumentList(Rose_STL_Container<SgNode*>& targs)
18393 Rose_STL_Container<SgNode*>::iterator aa = targs.begin();
18394 Rose_STL_Container<SgNode*>::iterator zz = targs.begin();
18395 SgTemplateArgumentPtrList lst;
18397 for ( ; aa != zz; ++aa)
18399 lst.push_back(createTemplateArg(**aa));
18407 ROSE_ASSERT(main_decl);
18413 ROSE_ASSERT(tdecl);
18419 ROSE_ASSERT(tclassdecl);
18440 ROSE_ASSERT(tdecl);
18445 struct TemplateArgumentParentSetter
18463Rose_STL_Container<SgNode *>& template_args)
18470Rose_STL_Container<SgNode *>& template_args)
18472 ROSE_ASSERT(template_decl);
18475 SgName name = template_decl->get_name();
18477 SgTemplateArgumentPtrList targs = genTemplateArgumentList(template_args);
18480 ROSE_ASSERT(tinst);
18484 ROSE_ASSERT(tclass);
18487 tinst->set_type(tclass);
18491 std::for_each(targs.begin(), targs.end(), TemplateArgumentParentSetter(tinst));
18497#ifdef ROSE_BUILD_JAVA_LANGUAGE_SUPPORT
18504 ROSE_ASSERT(Rose::Frontend::Java::lengthSymbol);
18516 if (parent_scope != NULL) {
18517 scope -> set_parent(parent_scope);
18547 pair -> set_value(value);
18548 value -> set_parent(pair);
18575 for (std::list<SgJavaMemberValuePair *>::iterator i = pair_list.begin(); i != pair_list.end(); i++) {
18577 member_value_pair -> set_parent(annotation);
18578 annotation -> append_value_pair(member_value_pair);
18601 return initialized_name;
18610 package_statement -> set_firstNondefiningDeclaration(package_statement);
18611 package_statement -> set_definingDeclaration(package_statement);
18612 return package_statement;
18621 import_statement -> set_firstNondefiningDeclaration(import_statement);
18622 import_statement -> set_definingDeclaration(import_statement);
18623 return import_statement;
18630 ROSE_ASSERT(scope);
18631 SgName class_name = name;
18632 ROSE_ASSERT(scope -> lookup_class_symbol(class_name) == NULL);
18635 bool buildTemplateInstantiation =
false;
18636 SgTemplateArgumentPtrList* templateArgumentsList = NULL;
18638 ROSE_ASSERT(class_declaration);
18639 class_declaration -> set_parent(scope);
18640 class_declaration -> set_scope(scope);
18643 ROSE_ASSERT(class_definition);
18647 class_definition -> setAttribute(
"extension_type_names",
new AstRegExAttribute());
18650 type_space -> set_parent(class_definition);
18652 class_declaration -> setAttribute(
"type_space",
new AstSgNodeAttribute(type_space));
18654 return class_declaration;
18663 string filename = directory_name +
"/" + type_name +
".java";
18664 ROSE_ASSERT((*project)[filename] == NULL);
18666 string command = string(
"touch ") + filename;
18667 int status = system(command.c_str());
18668 ROSE_ASSERT(status == 0);
18669 project -> get_sourceFileNameList().push_back(filename);
18670 Rose_STL_Container<std::string> arg_list = project -> get_originalCommandLineArgumentList();
18671 arg_list.push_back(filename);
18675 int error_code = 0;
18676 SgFile *file = determineFileType(arg_list, error_code, project);
18678 ROSE_ASSERT(sourcefile);
18679 sourcefile -> set_parent(project);
18680 project -> get_fileList_ptr() -> get_listOfFiles().push_back(sourcefile);
18681 ROSE_ASSERT(sourcefile == isSgSourceFile((*project)[filename]));
18687 ROSE_ASSERT(pkgDefDecl != NULL);
18689 package_statement->
set_parent(package_definition);
18690 sourcefile->set_package(package_statement);
18696 import_statement_list -> set_parent(sourcefile);
18697 sourcefile -> set_import_list(import_statement_list);
18703 class_declaration_list -> set_parent(package_definition);
18704 sourcefile -> set_class_list(class_declaration_list);
18714 ROSE_ASSERT(num_dimensions > 0);
18715 if (num_dimensions > 1) {
18719 ROSE_ASSERT(base_type != NULL);
18721 if (attribute == NULL) {
18723 array_type -> set_rank(num_dimensions);
18725 base_type -> setAttribute(
"array", attribute);
18728 return isSgArrayType(attribute -> getNode());
18739 generic_type -> setAttribute(
"parameterized types", attribute);
18741 ROSE_ASSERT(attribute);
18743 return attribute -> findOrInsertParameterizedType(new_args);
18754 type -> setAttribute(
"qualified types", attribute);
18756 ROSE_ASSERT(attribute);
18758 for (
int i = 0; i < attribute -> size(); i++) {
18760 ROSE_ASSERT(qualified_type);
18761 if (qualified_type -> get_parent_type() == parent_type && qualified_type -> get_type() == type) {
18762 return qualified_type;
18767 qualified_type -> set_parent_type(parent_type);
18768 qualified_type -> set_type(type);
18770 attribute -> addNode(qualified_type);
18772 return qualified_type;
18783 SgClassDeclaration *class_declaration = isSgClassDeclaration(Rose::Frontend::Java::ObjectClassType -> get_declaration());
18786 Rose::Frontend::Java::ObjectClassType -> setAttribute(
"unbound", attribute);
18789 return isSgJavaWildcardType(attribute -> getNode());
18802 ROSE_ASSERT(array_type || named_type);
18803 SgClassDeclaration *class_declaration = isSgClassDeclaration((array_type ? (
SgNamedType *) Rose::Frontend::Java::ObjectClassType : named_type) -> get_declaration());
18806 wildcard -> set_has_extends(
true);
18809 type -> setAttribute(
"extends", attribute);
18812 return isSgJavaWildcardType(attribute -> getNode());
18825 ROSE_ASSERT(array_type || named_type);
18826 SgClassDeclaration *class_declaration = isSgClassDeclaration((array_type ? (
SgNamedType *) Rose::Frontend::Java::ObjectClassType : named_type) -> get_declaration());
18829 wildcard -> set_has_super(
true);
18832 type -> setAttribute(
"super", attribute);
18835 return isSgJavaWildcardType(attribute -> getNode());
18845 namespace Builder {
18846 namespace Templates {
18849 if (t ==
nullptr)
return nullptr;
18855 if (e ==
nullptr)
return nullptr;
18875std::string strTemplateArgument(
int v) {
18876 std::ostringstream oss;
18881std::string strTemplateArgument(
bool v) {
18882 std::ostringstream oss;
18883 if (v) oss <<
"true";
18884 else oss <<
"false";
18888std::string strTemplateArgument(
SgNamedType * nt) {
18889 std::ostringstream oss;
18894std::string strTemplateArgument(
SgType * t) {
18895 std::ostringstream oss;
18901 std::ostringstream oss;
18906#define DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps 0
18910 std::vector<std::vector<SgTemplateParameter *>> & tpl_params,
18911 std::vector<std::vector<SgTemplateArgument *>> & tpl_args
18913#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
18914 std::cout <<
"Rose::Builder::Templates::instantiateNonrealRefExps" << std::endl;
18915 std::cout <<
" expr = " << std::hex << expr <<
" : " << ( expr ? expr->
class_name() :
"" ) << std::endl;
18916 std::cout <<
" = " << ( expr ? expr->
unparseToString() :
"" ) << std::endl;
18920 }
else if (isSgNonrealRefExp(expr)) {
18921#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
18922 std::cerr <<
"Error: In instantiateNonrealRefExps: case of a SgNonrealRefExp!!!" << std::endl;
18925 }
else if (isSgVarRefExp(expr)) {
18928 ROSE_ASSERT(iname);
18929#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
18930 std::cout <<
" iname = " << std::hex << iname <<
" : " << ( iname ? iname->
class_name() :
"" ) << std::endl;
18931 std::cout <<
" iname->get_name() = " << iname->get_name() << std::endl;
18932 std::cout <<
" iname->get_initializer() = " << std::hex << iname->get_initializer() <<
" : " << ( iname->get_initializer() ? iname->get_initializer()->
class_name() :
"" ) << std::endl;
18936 unsigned depth = 0;
18938 for (
auto tpl_params_: tpl_params) {
18940 for (
auto tpl_param: tpl_params_) {
18941 if (tpl_param->get_initializedName()) {
18942#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
18943 std::cout <<
" tpl_param->get_initializedName() = " << std::hex << tpl_param->get_initializedName() << std::endl;
18944 std::cout <<
" tpl_param->get_initializedName()->get_name() = " << tpl_param->get_initializedName()->get_name() << std::endl;
18946 if (tpl_param->get_initializedName()->get_name() == iname->get_name()) {
18947 iname = tpl_param->get_initializedName();
18956 if (depth < tpl_args.size() && pos < tpl_args[depth].size()) {
18957 SgExpression * res = tpl_args[depth][pos]->get_expression();
18960 }
else if (depth < tpl_params.size() && pos < tpl_params[depth].size()) {
18961 SgExpression * dft = tpl_params[depth][pos]->get_defaultExpressionParameter();
18963 dft = instantiateNonrealRefExps(dft, tpl_params, tpl_args);
18967#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
18968 std::cerr <<
"Error: In instantiateNonrealRefExps: this should not be reached!!!" << std::endl;
18971 }
else if (isSgValueExp(expr)) {
18973 }
else if (isSgConditionalExp(expr)) {
18979 }
else if (isSgSizeOfOp(expr)) {
18981#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
18982 std::cout <<
" szo->get_operand_expr() = " << std::hex << szo->get_operand_expr() <<
" : " << ( szo->get_operand_expr() ? szo->get_operand_expr()->
class_name() :
"" ) << std::endl;
18983 std::cout <<
" szo->get_operand_type() = " << std::hex << szo->get_operand_type() <<
" : " << ( szo->get_operand_type() ? szo->get_operand_type()->
class_name() :
"" ) << std::endl;
18985 SgExpression * eres = instantiateNonrealRefExps(szo->get_operand_expr(), tpl_params, tpl_args);
18986 ROSE_ASSERT(szo->get_operand_expr() ==
nullptr || eres !=
nullptr);
18987 szo->set_operand_expr(eres);
18989 SgType * tres = instantiateNonrealTypes(szo->get_operand_type(), tpl_params, tpl_args);
18990 ROSE_ASSERT(szo->get_operand_type() ==
nullptr || tres !=
nullptr);
18991 szo->set_operand_type(tres);
18993#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
18994 std::cout <<
" szo->get_operand_expr() = " << std::hex << szo->get_operand_expr() <<
" : " << ( szo->get_operand_expr() ? szo->get_operand_expr()->
class_name() :
"" ) << std::endl;
18995 std::cout <<
" szo->get_operand_type() = " << std::hex << szo->get_operand_type() <<
" : " << ( szo->get_operand_type() ? szo->get_operand_type()->
class_name() :
"" ) << std::endl;
18998 }
else if (isSgCastExp(expr)) {
19000 auto operand = instantiateNonrealRefExps(cast->
get_operand_i(), tpl_params, tpl_args);
19001 if (operand ==
nullptr)
return nullptr;
19002 auto type = instantiateNonrealTypes(cast->
get_type(), tpl_params, tpl_args);
19003 if (type ==
nullptr)
return operand;
19005 cast->set_type(type);
19007 }
else if (isSgUnaryOp(expr)) {
19011 }
else if (isSgBinaryOp(expr)) {
19017 std::cerr <<
"!!! expr = " << std::hex << expr <<
" : " << ( expr ? expr->
class_name() :
"" ) << std::endl;
19024 std::vector<SgTemplateParameter *> & tpl_params,
19025 std::vector<SgTemplateArgument *> & tpl_args
19027 std::vector<std::vector<SgTemplateParameter *>> tpl_params_{tpl_params};
19028 std::vector<std::vector<SgTemplateArgument *>> tpl_args_{tpl_args};
19029 return instantiateNonrealRefExps(expr, tpl_params_, tpl_args_);
19032#define DEBUG_Rose_Builder_Templates_instantiateNonrealTypes 0
19034SgType * instantiateNonrealTypes(
19036 std::vector<std::vector<SgTemplateParameter *>> & tpl_params,
19037 std::vector<std::vector<SgTemplateArgument *>> & tpl_args
19039#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19040 std::cout <<
"Rose::Builder::Templates::instantiateNonrealTypes" << std::endl;
19041 std::cout <<
" type = " << std::hex << type <<
" : " << ( type ? type->
class_name() :
"" ) << std::endl;
19042 std::cout <<
" = " << ( type ? type->
unparseToString() :
"" ) << std::endl;
19046 }
else if (isSgNonrealType(type)) {
19048 SgNonrealDecl * nrdecl = isSgNonrealDecl(nrtype->get_declaration());
19049 ROSE_ASSERT(nrdecl !=
nullptr);
19050#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19051 std::cout <<
" nrdecl = " << std::hex << nrdecl <<
" : " << nrdecl->
class_name() << std::endl;
19052 std::cout <<
" ->get_qualified_name() = " << nrdecl->get_qualified_name().getString() << std::endl;
19054 std::cout <<
" ->get_tpl_args() = " << std::dec << nrdecl->get_tpl_args().size() << std::endl;
19055 std::cout <<
" ->get_tpl_params() = " << std::dec << nrdecl->get_tpl_params().size() << std::endl;
19056 std::cout <<
" ->get_is_class_member() = " << ( nrdecl->get_is_class_member() ?
"true" :
"false" ) << std::endl;
19057 std::cout <<
" ->get_is_template_param() = " << ( nrdecl->get_is_template_param() ?
"true" :
"false" ) << std::endl;
19058 std::cout <<
" ->get_is_template_template_param() = " << ( nrdecl->get_is_template_template_param() ?
"true" :
"false" ) << std::endl;
19059 std::cout <<
" ->get_is_nonreal_template() = " << ( nrdecl->get_is_nonreal_template() ?
"true" :
"false" ) << std::endl;
19060 std::cout <<
" ->get_is_nonreal_function() = " << ( nrdecl->get_is_nonreal_function() ?
"true" :
"false" ) << std::endl;
19063 if (tpldecl !=
nullptr) {
19064#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19065 std::cout <<
" tpldecl = " << std::hex << tpldecl <<
" : " << tpldecl->
class_name() << std::endl;
19069 if (xtpldecl !=
nullptr) {
19070#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19071 std::cout <<
" xtpldecl->get_name() = " << xtpldecl->get_name() << std::endl;
19073 std::vector<SgTemplateArgument *> inst_tpl_args;
19075#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19076 std::cout <<
" tplarg = " << std::hex << tplarg <<
" : " << ( tplarg ? tplarg->class_name() :
"" ) << std::endl;
19077 std::cout <<
" ->get_argumentType() = " << tplarg->get_argumentType() << std::endl;
19079 switch (tplarg->get_argumentType()) {
19081#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19082 std::cout <<
" tplarg->get_type() = " << std::hex << tplarg->get_type() <<
" : " << ( tplarg->get_type() ? tplarg->get_type()->class_name() :
"" ) << std::endl;
19084 auto inst_tplarg = instantiateNonrealTypes(tplarg->get_type(), tpl_params, tpl_args);
19086 inst_tpl_args.push_back(buildTemplateArgument(inst_tplarg));
19090#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19091 std::cout <<
" tplarg->get_expression() = " << std::hex << tplarg->get_expression() <<
" : " << ( tplarg->get_expression() ? tplarg->get_expression()->class_name() :
"" ) << std::endl;
19092 std::cout <<
" ->unparseToString() = " << tplarg->get_expression()->unparseToString() << std::endl;
19095#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19096 std::cout <<
" inst_tplarg = " << std::hex << inst_tplarg <<
" : " << ( inst_tplarg ? inst_tplarg->class_name() :
"" ) << std::endl;
19097 std::cout <<
" inst_tplarg->unparseToString() = " << ( inst_tplarg ? inst_tplarg->unparseToString() :
"" ) << std::endl;
19100 inst_tpl_args.push_back(buildTemplateArgument(inst_tplarg));
19104#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19105 std::cout <<
" tplarg->get_templateDeclaration() = " << std::hex << tplarg->get_templateDeclaration() <<
" : " << ( tplarg->get_templateDeclaration() ? tplarg->get_templateDeclaration()->class_name() :
"" ) << std::endl;
19110#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19111 std::cout <<
" start_of_pack_expansion_argument" << std::endl;
19115 default: ROSE_ABORT();
19121 ROSE_ASSERT(inst_decl);
19122#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19123 std::cout <<
" inst_decl = " << std::hex << inst_decl <<
" : " << inst_decl->
class_name() << std::endl;
19125 std::cout <<
" inst_decl->get_definingDeclaration() = " << std::hex << inst_decl->
get_definingDeclaration() << std::endl;
19132 for (
auto inst_tpl_arg: inst_tpl_args) {
19133 inst_tpl_arg->set_parent(inst_decl);
19137 return inst_decl->get_type();
19141 }
else if (nrdecl->get_is_template_param()) {
19142 auto depth = nrdecl->get_template_parameter_depth();
19143 auto position = nrdecl->get_template_parameter_position();
19144#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19145 std::cout <<
" ->get_template_parameter_position() = " << std::dec <<
position << std::endl;
19146 std::cout <<
" ->get_template_parameter_depth() = " << std::dec << depth << std::endl;
19148 ROSE_ASSERT(depth > 0);
19149 ROSE_ASSERT(position > 0);
19150 if (std::size_t(depth) <= tpl_args.size() && std::size_t(position) <= tpl_args[depth-1].size()) {
19152#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19153 std::cout <<
" tpl_args[" << std::dec << depth-1 <<
"][" << std::dec <<
position-1 <<
"]->get_type() = " << std::dec << res << std::endl;
19156 }
else if (std::size_t(depth) <= tpl_params.size() && std::size_t(position) <= tpl_params[depth-1].size()) {
19157 SgType * dft_tpl_arg = tpl_params[depth-1][
position-1]->get_defaultTypeParameter();
19158#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19159 std::cout <<
" tpl_params[" << std::dec << depth-1 <<
"][" << std::dec <<
position-1 <<
"]->get_type() = " << std::dec << dft_tpl_arg << std::endl;
19161 dft_tpl_arg = instantiateNonrealTypes(dft_tpl_arg, tpl_params, tpl_args);
19162#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19163 std::cout <<
" dft_tpl_arg = " << std::dec << dft_tpl_arg << std::endl;
19165 return dft_tpl_arg;
19169 }
else if (nrdecl->get_is_class_member()) {
19170#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19171 std::cout <<
" Case of a non-real class member will return INT." << std::endl;
19183 }
else if (isSgTypeVoid(type) || isSgTypeUnsignedLong(type) || isSgTypeInt(type) || isSgTypeLong(type) || isSgTypeUnsignedInt(type) || isSgTypedefType(type) || isSgClassType(type)) {
19185 }
else if (isSgModifierType(type)) {
19187 SgType * btype = mtype->get_base_type();
19188 ROSE_ASSERT(btype !=
nullptr);
19190 ROSE_ASSERT(rtype !=
nullptr);
19194 std::cerr <<
"!!! type = " << std::hex << type <<
" : " << ( type ? type->
class_name() :
"" ) << std::endl;
19200SgType * instantiateNonrealTypes(
19202 std::vector<SgTemplateParameter *> & tpl_params,
19203 std::vector<SgTemplateArgument *> & tpl_args
19205 std::vector<std::vector<SgTemplateParameter *>> tpl_params_{tpl_params};
19206 std::vector<std::vector<SgTemplateArgument *>> tpl_args_{tpl_args};
19207 return instantiateNonrealTypes(type, tpl_params_, tpl_args_);
to specify a construct using a specifier Can be used alone or with parent handles when relative speci...
Users should provide a concrete node implementation especially a constructor/builder to avoid duplica...
Attribute containing a regex expression as a string.
Attribute storing an SgNode.
Class for traversing the AST.
virtual void visit(SgNode *astNode)=0
this method is called at every traversed node.
For preprocessing information including source comments, include , if, define, etc.
RelativePositionType
MK: Enum type to store if the directive goes before or after the corresponding line of source code.
Interface for iterating over an AST.
iterator begin()
Iterator positioned at root of subtree.
iterator end()
Iterator positioned at the end of the traversal.
std::string comment() const
Property: Comment associated with facility.
This class represents the concept of a C Assembler statement.
This class represents the rhs of a variable declaration which includes an optional assignment (e....
This class represents the concept of a block (not a basic block from control flow analysis).
This class represents the notion of a binary operator. It is derived from a SgExpression because oper...
void set_rhs_operand_i(SgExpression *rhs_operand_i)
This function allows the p_rhs_operand_i pointer to be set (used internally).
SgExpression * get_lhs_operand() const
returns SgExpression pointer to the lhs operand associated with this binary operator.
SgExpression * get_rhs_operand_i() const
returns SgExpression pointer to the operand associated with this binary operator.
SgExpression * get_lhs_operand_i() const
returns SgExpression pointer to the operand associated with this binary operator.
void set_lhs_operand_i(SgExpression *lhs_operand_i)
This function allows the p_lhs_operand_i pointer to be set (used internally).
SgExpression * get_rhs_operand() const
returns SgExpression pointer to the rhs operand associated with this binary operator.
This class represents a boolean value (expression value).
This class represents the notion of a break statement (typically used in a switch statment).
This class represents the concept of a C and C++ case option (used within a switch statement).
This class represents a cast of one type to another.
cast_type_enum
Classification of Casts.
SgType * get_type() const override
unparsing support for pragmas
This class represents the concept of a catch within a try-catch construct used in C++ exception handl...
This class represents the concept of a C++ sequence of catch statements.
This class represents the concept of a class declaration statement. It includes the concept of an ins...
void set_scope(SgScopeStatement *scope) override
Support for setting scopes (only meaningful on IR statements that store the scope explicitly).
virtual std::string class_name() const override
returns a string representing the class name
virtual SgSymbol * get_symbol_from_symbol_table() const override
FOR INTERNAL USE Get the associated symbol from the symbol table in the stored scope....
SgScopeStatement * get_scope() const override
Returns scope of current statement.
virtual VariantT variantT() const override
returns new style SageIII enum values
This class represents the concept of a class definition in C++.
SgClassDeclaration * get_declaration() const
returns the class declaration associated with this class decinition.
virtual std::string class_name() const override
returns a string representing the class name
This class represents the concept of a C++ expression built from a class name.
This class represents the concept of a class name within the compiler.
virtual std::string class_name() const override
returns a string representing the class name
SgType * get_type() const override
This function returns the type associated with the named entity.
virtual std::string class_name() const override
returns a string representing the class name
virtual SgName get_mangled(void) const override
Mangled name support for unparser support.
SgName get_name() const override
Support for some classes which have pure virtual function in base classes.
static SgClassType * createType(SgDeclarationStatement *decl=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgClassType (types whose constructors take par...
This class represents the concept of a C trinary conditional expression (e.g. "test ?...
SgExpression * get_true_exp() const
Access function for p_true_exp.
void set_false_exp(SgExpression *false_exp)
Access function for p_false_exp.
SgExpression * get_conditional_exp() const
Access function for p_conditional_exp.
SgExpression * get_false_exp() const
Access function for p_false_exp.
void set_true_exp(SgExpression *true_exp)
Access function for p_true_exp.
void set_conditional_exp(SgExpression *conditional_exp)
Access function for p_conditional_exp.
cv_modifier_enum
Const Volatile Modifier.
This class represents the call of a class constructor to initialize a variable. For example "Foo foo;...
This class represents the concept of a C or C++ continue statement.
This class represents the concept of a contructor initializer list (used in constructor (member funct...
static SgDeclType * createType(SgExpression *expr=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgDeclType (types whose constructors take para...
virtual std::string class_name() const override
returns a string representing the class name
This class represents the concept of a declaration statement.
SgSymbol * search_for_symbol_from_symbol_table() const
User interface for retrieving the associated symbol from the declaration.
void set_definingDeclaration(SgDeclarationStatement *definingDeclaration)
This is an access function for the SgDeclarationStatement::p_definingDeclaration data member (see tha...
void set_firstNondefiningDeclaration(SgDeclarationStatement *firstNondefiningDeclaration)
This is an access function for the SgDeclarationStatement::p_firstNondefiningDeclaration data member ...
SgDeclarationStatement * get_definingDeclaration() const
This is an access function for the SgDeclarationStatement::p_definingDeclaration data member (see tha...
virtual VariantT variantT() const override
returns new style SageIII enum values
virtual std::string class_name() const override
returns a string representing the class name
SgDeclarationStatement * get_firstNondefiningDeclaration() const
This is an access function for the SgDeclarationStatement::p_firstNondefiningDeclaration data member ...
virtual SgSymbol * get_symbol_from_symbol_table() const override
FOR INTERNAL USE Get the associated symbol from the symbol table in the stored scope....
void setForward()
Marks a declaration as a forward declaration.
This class represents the concept of a C or C++ default case within a switch statement.
This class represents the concept of a C++ call to the delete operator.
This class represents the concept of a do-while statement.
SgStatement * get_condition() const
Access function for p_condition.
SgStatement * get_body() const
Access function for p_body.
void set_condition(SgStatement *condition)
Access function for p_condition.
void set_body(SgStatement *body)
Access function for p_body.
This class represents the notion of an value (expression value).
This class represents the concept of an enum declaration.
void set_type(SgEnumType *type)
Access function for p_type.
SgScopeStatement * get_scope() const override
Access function for p_scope.
SgName get_name() const
Access function for p_name.
void set_scope(SgScopeStatement *scope) override
Access function for p_scope.
SgEnumType * get_type() const
Access function for p_type.
SgType * get_type() const override
This function returns the type associated with the named entity.
This class represents the concept of the dynamic execution of a string, file, or code object....
This class represents the concept of a C and C++ expression list.
This class represents the concept of a C or C++ statement which contains a expression.
This class represents the notion of an expression. Expressions are derived from SgLocatedNodes,...
virtual std::string class_name() const override
returns a string representing the class name
void set_need_paren(bool need_paren)
This function allows the p_need_paren flag to be set (used internally).
virtual SgType * get_type() const
unparsing support for pragmas
bool hasExplicitType()
Some expressions store internal SgType pointers explicitly while others compute them from other expre...
virtual Sg_File_Info * get_file_info(void) const override
Interface function to implement original SAGE interface to SgFile_Info objects.
void set_lvalue(bool lvalue)
This function allows the p_lvalue flag to be set (used internally).
void set_explicitly_stored_type(SgType *type)
Some expressions store internal SgType pointers explicitly, this allows these IR nodes to be reset wi...
This class represents a source file for a project (which may contian many source files and or directo...
Sg_File_Info * get_startOfConstruct() const override
New function interface for Sg_File_Info data stores starting location of contruct (typically the open...
void secondaryPassOverSourceFile()
Fixups to be run when the whole project has been created (this attaches preprocessing information).
std::string getFileName() const
associated filename
virtual std::string class_name() const override
returns a string representing the class name
Sg_File_Info * get_file_info() const override
Access function calling get_startOfConstruct(), provided to support older interface.
This class represents the notion of an value (expression value).
This class represents the variable declaration or variable initialization withn a for loop.
const SgStatementPtrList & get_init_stmt() const
Returns const reference to a SgStatementPtrList (typedef to a STL list).
This class represents the concept of a for loop.
SgForInitStatement * get_for_init_stmt() const
Access function for p_for_init_stmt.
void set_loop_body(SgStatement *loop_body)
Access function for p_loop_body.
SgStatement * get_loop_body() const
Access function for p_loop_body.
void set_for_init_stmt(SgForInitStatement *for_init_stmt)
Access function for p_for_init_stmt.
This class represents the concept of a C++ function call (which is an expression).
This class represents the concept of a function declaration statement.
SgScopeStatement * get_scope() const override
Returns scope of current statement.
virtual SgSymbol * get_symbol_from_symbol_table() const override
FOR INTERNAL USE Get the associated symbol from the symbol table in the stored scope....
void set_scope(SgScopeStatement *scope) override
Support for setting scopes (only meaningful on IR statements that store the scope explicitly).
virtual std::string class_name() const override
returns a string representing the class name
This class represents the concept of a scope in C++ (e.g. global scope, fuction scope,...
void set_body(SgBasicBlock *body)
Access function for p_body.
This class represents the concept of a declaration list.
const SgInitializedNamePtrList & get_args() const
Access function for p_args.
const SgTypePtrList & get_arguments() const
Get a const list of input types (types of the parameters list) to this function type (from a cost fun...
This class represents the function being called and must be assembled in the SgFunctionCall with the ...
SgType * get_type() const override
Get the type associated with this expression.
virtual std::string class_name() const override
returns a string representing the class name
SgName get_name() const override
Access function for getting name from declarations or types internally.
This class represents the function type table (stores all function types so that they can be shared i...
This class represents a type for all functions.
virtual std::string class_name() const override
returns a string representing the class name
virtual SgName get_mangled(void) const override
Mangled name support for unparser support.
This class represents the concept of a namespace definition.
virtual std::string class_name() const override
returns a string representing the class name
const SgDeclarationStatementPtrList & get_declarations() const
Returns a const list to the global scope declarations.
This class represents the concept of a C or C++ goto statement.
This class represents the concept of an "if" construct.
void set_use_then_keyword(bool use_then_keyword)
Fortran specific function to indicate if the Fortran "if" statement uses the "then" construct (C/C++ ...
void set_has_end_statement(bool has_end_statement)
Fortran specific function to indicate if the Fortran "if" statement has an "end" construct (C/C++ use...
This class represents the notion of a declared variable.
SgName get_qualified_name() const
Returns the name with appropriate qualified names representing nested scopes.
SgSymbol * get_symbol_from_symbol_table() const
Get the associated SgSymbol from the symbol table located in the scope, without considering possible ...
virtual std::string class_name() const override
returns a string representing the class name
SgSymbol * search_for_symbol_from_symbol_table() const
User interface for retrieving the associated symbol. It searches through the possible chain of prev_d...
This class represents the notion of an initializer for a variable declaration or expression in a func...
virtual std::string class_name() const override
returns a string representing the class name
static SgJavaParameterType * createType(SgClassDeclaration *decl=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgJavaParameterType (types whose constructors ...
static SgJovialBitType * createType(SgExpression *size=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgJovialBitType (types whose constructors take...
static SgJovialTableType * createType(SgClassDeclaration *decl=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgJovialTableType (types whose constructors ta...
This class represents the concept of a C or C++ label statement.
This class represents a lambda expression.
This class represents a list display.
This class represents the notion of an expression or statement which has a position within the source...
virtual std::string class_name() const override
returns a string representing the class name
Sg_File_Info * get_endOfConstruct() const override
New function interface for Sg_File_Info data stores ending location of contruct (typically the closin...
void set_endOfConstruct(Sg_File_Info *endOfConstruct)
This function sets the current source location position of the end of the current construct.
Sg_File_Info * get_startOfConstruct() const override
New function interface for Sg_File_Info data stores starting location of contruct (typically the open...
virtual Sg_File_Info * get_file_info() const override
Interface function to implement original SAGE interface to SgFile_Info objects.
This class represents the notion of an value (expression value).
This class represents the concept of a member function declaration statement.
SgCtorInitializerList * get_CtorInitializerList() const
Access function for p_CtorInitializerList.
void set_associatedClassDeclaration(SgDeclarationStatement *associatedClassDeclaration)
This is an access function for the p_associatedClassDeclaration data member.
virtual SgSymbol * get_symbol_from_symbol_table() const override
FOR INTERNAL USE Get the associated symbol from the symbol table in the stored scope....
This class represents the member function being called and must be assembled in the SgFunctionCall wi...
SgType * get_type() const override
Get the type associated with this expression.
SgName get_name() const override
Access function for getting name from declarations or types internally.
SgType * get_type() const override
This function returns the type associated with the named entity.
virtual std::string class_name() const override
returns a string representing the class name
virtual SgName get_mangled(void) const override
Mangled name support for unparser support.
static SgMemberFunctionType * createType(SgPartialFunctionType *type=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgMemberFunctionType (types whose constructors...
This class represents the numeric negation of a value. Not to be confused with SgSubtractOp.
SgTypeModifier & get_typeModifier()
Access function for modifier.
virtual std::string class_name() const override
returns a string representing the class name
This class represents strings within the IR nodes.
virtual std::string class_name() const override
returns a string representing the class name
SgName get_qualified_name() const
Used for the SgNamedType object (base class for the SgClassType, SgTypedefType and the SgEnumType obj...
virtual VariantT variantT() const override
returns new style SageIII enum values
This class represents the concept of a C++ namespace alias declaration statement.
This class represents the concept of a C++ namespace declaration.
SgName get_name() const
Access function for p_name.
SgNamespaceDefinitionStatement * get_definition() const
Returns pointer to SgNamespaceDefinitionStatement.
This class represents the concept of a namespace definition.
This class represents the concept of a namespace name within the compiler.
SgNamespaceDeclarationStatement * get_declaration() const
Access function for getting the declaration of the original namespace.
This class represents the notion of an n-ary boolean operation. This node is intended for use with Py...
This class represents the notion of an n-ary comparison operation. This node is intended for use with...
This class represents the concept of a C++ call to the new operator.
This class represents the base class for all IR nodes within Sage III.
static void clearGlobalMangledNameMap()
Support to clear the performance optimizing global mangled name map.
virtual Sg_File_Info * get_endOfConstruct(void) const
New function interface for Sg_File_Info data stores ending location of contruct (typically the closin...
SgNode * get_parent() const
Access function for parent node.
void set_isModified(bool isModified)
All nodes in the AST contain a isModified flag used to track changes to the AST.
virtual VariantT variantT() const
returns new style SageIII enum values
void set_parent(SgNode *parent)
All nodes in the AST contain a reference to a parent node.
virtual std::string unparseToString(SgUnparse_Info *info) const
This function unparses the AST node (excluding comments and unnecessary white space)
virtual std::string class_name() const
returns a string representing the class name
static std::map< SgNode *, std::string > & get_globalMangledNameMap()
Access function for performance optimizing global mangled name map.
static SgFunctionTypeTable * get_globalFunctionTypeTable()
Access function for symbol table specific to function types.
virtual Sg_File_Info * get_file_info(void) const
File information containing filename, line number, column number, and if the SgNode is a part of a ne...
bool get_isModified() const
Acess function for isModified flag.
virtual std::string class_name() const override
returns a string representing the class name
virtual std::string class_name() const override
returns a string representing the class name
virtual std::string class_name() const override
returns a string representing the class name
static SgPointerType * createType(SgType *type=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgPointerType (types whose constructors take p...
This class represents the concept of a C Assembler statement (untested).
This class represents a source project, with a list of SgFile objects and global information about th...
void set_originalCommandLineArgumentList(SgStringList originalCommandLineArgumentList)
Sets the list of strings representing the original command-line.
SgStringList get_originalCommandLineArgumentList() const
Returns a list of strings representing the original command-line.
void set_file(SgFile &)
Access function for putting a new SgFile object into the list stored internally This function is depr...
This class represents the concept of a 'global' stmt in Python.
virtual void append_name(SgInitializedName *element)
Append a name to the list of identifiers imported into the inner scope.
static SgReferenceType * createType(SgType *type=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgReferenceType (types whose constructors take...
This class represents the concept of a C Assembler statement (untested).
static SgRvalueReferenceType * createType(SgType *type=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgRvalueReferenceType (types whose constructor...
This class represents the concept of a scope in C++ (e.g. global scope, fuction scope,...
bool isNamedScope()
Some scopes have associated names for purposed of name qualification. This returns true if the scope ...
SgSymbolTable * get_symbol_table() const
Returns a pointer to the locally strored SgSymbolTable.
void append_statement(SgStatement *stmt)
Higher level function to handle statements and declarations is scopes.
virtual std::string class_name() const override
returns a string representing the class name
bool containsOnlyDeclarations() const
This function is used to indicate if either the getDeclarationList() or getStatementList() can be cal...
void insert_symbol(const SgName &n, SgSymbol *s)
Puts a SgSymbol object into the local symbol table.
This class represents the "sizeof()" operator (applied to any type).
virtual std::string class_name() const override
returns a string representing the class name
This class represents the GNU extension "statement expression" (thus is non-standard C and C++).
This class represents the notion of a statement.
virtual std::string class_name() const override
returns a string representing the class name
virtual void set_scope(SgScopeStatement *newScope)
Support for setting scopes (only meaningful on IR statements that store the scope explicitly).
virtual bool hasExplicitScope() const
Support for where the scope is explicitly required.
virtual SgScopeStatement * get_scope(void) const
Returns scope of current statement.
This class is intended to be a wrapper around SgStatements, allowing them to exist in scopes that onl...
void setExtern()
Set storage.
bool isExtern() const
Storage modifier is extern (not the same as extern "C").
storage_modifier_enum
Storage Modifiers (only one value can be specified)
This class represents the conversion of an arbitrary expression to a string. This node is intended fo...
This class represents the concept of a switch.
void print(std::string label, VariantT nodeType=V_SgSymbol)
Outputs symbol table information (useful for debugging)
int size() const
Computes the number of symbols in the symbol table (forced to count them, I think,...
This class represents the concept of a name within the compiler.
This class represents template argument within the use of a template to build an instantiation.
SgExpression * get_expression() const
This function returns argumentExpression.
SgType * get_type() const
This function returns argumentType.
SgTemplateArgument::template_argument_enum get_argumentType() const
This function returns argumentType.
@ template_template_argument
@ start_of_pack_expansion_argument
virtual std::string class_name() const override
returns a string representing the class name
SgType * get_type() const override
This function returns the type associated with the named entity.
This class represents the concept of a template declaration.
This class represents the concept of an instantiated class template.
virtual std::string class_name() const override
returns a string representing the class name
void set_templateDeclaration(SgTemplateClassDeclaration *templateDeclaration)
Access function for p_templateDeclaration.
SgName get_templateName() const
Returns name of class template, the name excludes template arguments.
void set_templateName(SgName templateName)
sets name of instantiated class template, name excludes template arguments.
const SgTemplateArgumentPtrList & get_templateArguments() const
Returns pointer to STL list of pointers to SgTemplateArgument objects.
SgTemplateClassDeclaration * get_templateDeclaration() const
Returns pointer to SgTemplateDeclaration from which instantiation is generated.
This class represents the concept of a class definition in C++.
This class represents the concept of an instantiation of function template.
const SgTemplateArgumentPtrList & get_templateArguments() const
Returns pointer to STL list of pointers to SgTemplateArgument objects.
SgName get_templateName() const
Returns name of instantiated function template, name includes template arguments.
void set_templateName(SgName templateName)
sets name of instantiated function template, name includes template arguments.
This class represents the concept of an instantiation of member function template or a member functio...
void set_templateName(SgName templateName)
sets name of instantiated function template, name includes template arguments.
virtual std::string class_name() const override
returns a string representing the class name
const SgTemplateArgumentPtrList & get_templateArguments() const
Returns pointer to STL list of pointers to SgTemplateArgument objects.
SgName get_templateName() const
Returns name of instantiated function template, name includes template arguments.
virtual std::string class_name() const override
returns a string representing the class name
virtual std::string class_name() const override
returns a string representing the class name
virtual std::string class_name() const override
returns a string representing the class name
This class represents the "this" operator (can be applied to any member data).
This class represents the C++ throw expression (handled as a unary operator).
e_throw_kind
Throw IR node can be used in three different ways.
This class represents the concept of try statement within the try-catch support for exception handlin...
SgCatchStatementSeq * get_catch_statement_seq_root() const
Returns pointer to SgCatchStatementSeq.
This class represents a tuple display.
static SgTypeBFloat16 * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeBool * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeChar16 * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeChar32 * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeChar * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
This class represents a C99 complex type.
static SgTypeDouble * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeFixed * createType(SgExpression *scale=NULL, SgExpression *fraction=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgTypeFixed (types whose constructors take par...
static SgTypeFloat128 * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeFloat16 * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeFloat32 * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeFloat32x * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeFloat64 * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeFloat64x * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeFloat80 * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeFloat * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeFp16 * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
This class represents a C99 complex type.
static SgTypeInt * createType(int sz=0, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgTypeInt (types whose constructors take param...
static SgTypeLongDouble * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeLongLong * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeLong * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeNullptr * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeOfType * createType(SgExpression *expr=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgTypeOfType (types whose constructors take pa...
static SgTypeShort * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeSigned128bitInteger * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeSignedChar * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeSignedInt * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeSignedLongLong * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeSignedLong * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeSignedShort * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
This class represents a string type used for SgStringVal IR node.
static SgTypeUnknown * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeUnsigned128bitInteger * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeUnsignedChar * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeUnsignedInt * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeUnsignedLongLong * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeUnsignedLong * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeUnsignedShort * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeVoid * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
static SgTypeWchar * createType(SgExpression *optional_fortran_type_kind=nullptr)
example of type used where construction is particularly simple
This class represents the base class for all types.
std::vector< SgType * > getInternalTypes() const
Generate a container of types hidden in the input type.
SgType * stripType(unsigned char bit_array=STRIP_MODIFIER_TYPE|STRIP_REFERENCE_TYPE|STRIP_RVALUE_REFERENCE_TYPE|STRIP_POINTER_TYPE|STRIP_ARRAY_TYPE|STRIP_TYPEDEF_TYPE|STRIP_POINTER_MEMBER_TYPE) const
Returns hidden type beneath layers of typedefs, pointers, references, modifiers, array representation...
virtual std::string class_name() const override
returns a string representing the class name
This class represents the notion of a typedef declaration.
SgScopeStatement * get_scope() const override
Returns scope of current statement.
void set_scope(SgScopeStatement *scope) override
Support for setting scopes (only meaningful on IR statements that store the scope explicitly).
SgType * get_type() const override
This function returns the type associated with the named entity.
virtual std::string class_name() const override
returns a string representing the class name
SgType * get_base_type() const
This is used in the SgTypedefType object (is not associated with a base_type data field)
static SgTypedefType * createType(SgTypedefDeclaration *decl=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgTypedefType (types whose constructors take p...
This class represents the notion of a unary operator. It is derived from a SgExpression because opera...
void set_mode(SgUnaryOp::Sgop_mode mode)
Set the mode (prefix/postfix) associated with this operator.
SgExpression * get_operand_i() const
returns SgExpression pointer to the operand associated with this unary operator.
Sgop_mode
Enum value defines operators as prefix or postfix, as appropriate, e.g. operator++().
void set_operand_i(SgExpression *operand_i)
This function allows the p_operand_i pointer to be set (used internally).
This class represents the concept of a C++ using directive.
This class represents the notion of an value (expression value).
This class represents the variable refernece in expressions.
This class represents the concept of a C or C++ variable declaration.
const SgInitializedNamePtrList & get_variables() const
Access function for p_variables.
This class represents the definition (initialization) of a variable.
void set_vardefn(SgInitializedName *vardefn)
Access function for SgInitializedName in p_vardefn.
This class represents the concept of a variable name within the compiler (a shared container for the ...
SgName get_name() const override
Access function for getting name from declarations or types internally.
This class represents the concept of a do-while statement.
This class represents the location of the code associated with the IR node in the original source cod...
static std::map< std::string, int > & get_nametofileid_map()
Access function for static datamember nametofileid_map.
void setTransformation()
Marks an IR node to be a transformation if it is not one already.
const char * get_filename() const
Returns filename of source code associated with IR node.
bool isOutputInCodeGeneration() const
Returns true only if required to be unparsed in generated code.
void unsetOutputInCodeGeneration()
Mark as to be output by the unparser (code generator)
int get_line() const
Returns the line number of the associated code for this IR node.
void setShared()
Marks IR node as shared.
void setCompilerGenerated()
Marks IR node as compiler generated.
bool isShared() const
Returns true only if shared internally (either by the front-end or by ROSE).
ROSE_DLL_API roseNode * buildroseNode(SgNode *snode)
A builder function to avoid duplicated building.
ROSE_DLL_API const char * c_char
A namespace scope char* to avoid passing and returning a target c string for every and each function ...
ROSE_DLL_API SgNode * c_sgnode
current anchor SgNode associated with parsing. It will serve as a start point to find enclosing scope...
ROSE_DLL_API SgNode * c_parsed_node
Store the AST substree (expression, statement) generated from a helper function.
ROSE_DLL_API bool afs_match_statement()
match any statement, not complete yet. Don't use it yet . : labeled_statement | compound_statement | ...
ROSE_DLL_API std::vector< std::string > generateSourceFilenames(std::vector< std::string > argList, bool binaryMode)
Build the list of isolated file names from the command line.
ROSE_UTIL_API void removeAllFileNamesExcept(std::vector< std::string > &argv, std::vector< std::string > filenameList, std::string exceptFilename)
Remove file names specified in filenameList from argv, except for 'exceptFilename'.
Unsigned position(size_t i)
Generate a single-bit mask.
Controls diagnostic messages from ROSE.
ROSE_DLL_API void initAndRegister(Facility *mlog, const std::string &name)
Initialize and register a logging facility.
ROSE_DLL_API Sawyer::Message::Facility mlog
Diagnostic facility for the ROSE library as a whole.
ROSE_UTIL_API std::string intToHex(uint64_t)
Convert an integer to a hexadecimal string.
Functions that build an AST.
ROSE_DLL_API SgTypeFloat16 * buildFloat16Type()
Built in simple types.
ROSE_DLL_API SgTemplateInstantiationTypedefDeclaration * buildTemplateInstantiationTypedefDeclaration_nfi(SgName &name, SgType *base_type, SgScopeStatement *scope, bool has_defining_base, SgTemplateTypedefDeclaration *templateTypedefDeclaration, SgTemplateArgumentPtrList &templateArgumentsList)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgJavaMemberValuePair * buildJavaMemberValuePair(const SgName &, SgExpression *)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgCastExp * buildCastExp_nfi(SgExpression *operand_i, SgType *expression_type, SgCastExp::cast_type_enum cast_type)
ROSE_DLL_API SgUpcBarrierStatement * buildUpcBarrierStatement_nfi(SgExpression *exp)
Build a UPC barrier statement.
ROSE_DLL_API SgAtomicStmt * buildAtomicStmt(SgBasicBlock *body)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgAtStmt * buildAtStmt(SgExpression *expression, SgBasicBlock *body)
MH (6/11/2014): Added at support.
ROSE_DLL_API SgJovialBitType * buildJovialBitType(SgExpression *size)
Build a Jovial bit type of a given size.
ROSE_DLL_API SgColonShapeExp * buildColonShapeExp()
Build a Fortran colon-shape expression, set file info as the default one.
ROSE_DLL_API SgJovialTableType * buildJovialTableType(const SgName &name, SgType *base_type, SgExprListExp *dim_info, SgScopeStatement *scope=NULL)
Build a Jovial table type with required class definition and defining and nondefining declarations.
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)
Build a prototype for a function, handle function type, symbol etc transparently.
ROSE_DLL_API SgFloat32Val * buildFloat32Val(float v=0)
Build a float32.
ROSE_DLL_API SgTemplateArgumentPtrList * getTemplateArgumentList(SgDeclarationStatement *decl)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgSwitchStatement * buildSwitchStatement_nfi(SgStatement *item_selector, SgStatement *body)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgBaseClass * buildBaseClass(SgClassDeclaration *classDeclaration, SgClassDefinition *classDefinition, bool isVirtual, bool isDirect)
DQ (5/6/2013): Added build functions to support SgBaseClass construction.
SourcePositionClassification
intended to be a private member, don't access it directly. could be changed any time
@ e_sourcePosition_last
Specify as source position to be filled in as part of AST construction in the front-end.
@ e_sourcePositionNullPointers
Classify as compiler generated code (e.g. template instantiation).
@ e_sourcePositionCompilerGenerated
Classify as a transformation.
@ e_sourcePositionFrontendConstruction
Set pointers to Sg_File_Info objects to NULL.
@ e_sourcePositionDefault
Error value for enum.
@ e_sourcePositionTransformation
Default source position.
ROSE_DLL_API SgFunctionParameterRefExp * buildFunctionParameterRefExp_nfi(int parameter_number, int parameter_level)
ROSE_DLL_API SgThrowOp * buildThrowOp(SgExpression *, SgThrowOp::e_throw_kind)
Build a ThrowOp expression.
ROSE_DLL_API SgPointerMemberType * buildPointerMemberType(SgType *base_type, SgType *classType)
Pei-Hung (06/30/2023): support for SgPointerMemberType.
ROSE_DLL_API SgPragma * buildPragma(const std::string &name)
Build SgPragma.
ROSE_DLL_API void testTemplateParameterParents(SgDeclarationStatement *decl)
DQ (9/16/2012): Added function to support setting the template parameters and setting their parents (...
ROSE_DLL_API SgStringConversion * buildStringConversion(SgExpression *exp)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgChooseExpression * buildChooseExpression_nfi()
ROSE_DLL_API SgJavaWildcardType * getUniqueJavaWildcardExtends(SgType *)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgUpcForAllStatement * buildUpcForAllStatement_nfi(SgStatement *initialize_stmt, SgStatement *test, SgExpression *increment, SgExpression *affinity, SgStatement *loop_body)
Build a UPC forall statement.
ROSE_DLL_API SgBFloat16Val * buildBFloat16Val_nfi(float v, const std::string &str)
ROSE_DLL_API SgUnsignedLongVal * buildUnsignedLongValHex(unsigned long v=0)
ROSE_DLL_API SgClassType * buildClassTemplateType(SgTemplateClassDeclaration *template_decl, std::vector< SgNode * > &template_args)
Some support for building class template instantiation declarations.
ROSE_DLL_API SgNullptrValExp * buildNullptrValExp_nfi()
ROSE_DLL_API SgDerivedTypeStatement * buildDerivedTypeStatement(const SgName &name, SgScopeStatement *scope=NULL)
Build an SgDerivedTypeStatement Fortran derived type declaration with a class declaration and definit...
ROSE_DLL_API SgExprStatement * buildFunctionCallStmt(const SgName &name, SgType *return_type, SgExprListExp *parameters=NULL, SgScopeStatement *scope=NULL)
Build a regular function call statement.
ROSE_DLL_API SgExecStatement * buildExecStatement(SgExpression *executable, SgExpression *globals=NULL, SgExpression *locals=NULL)
Build an exec statement.
ROSE_DLL_API SgShortVal * buildShortValHex(short value=0)
ROSE_DLL_API SgClassDeclaration * buildClassDeclaration_nfi(const SgName &name, SgClassDeclaration::class_types kind, SgScopeStatement *scope, SgClassDeclaration *nonDefiningDecl, bool buildTemplateInstantiation, SgTemplateArgumentPtrList *templateArgumentsList)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgTypeSignedLongLong * buildSignedLongLongType()
Built in simple types.
ROSE_DLL_API SgNewExp * buildNewExp(SgType *type, SgExprListExp *exprListExp, SgConstructorInitializer *constInit, SgExpression *expr, short int val, SgFunctionDeclaration *funcDecl)
SgPythonGlobalStmt * buildPythonGlobalStmt_nfi(SgInitializedNamePtrList &names)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SourcePositionClassification getSourcePositionClassificationMode()
Get the current source position classification (defines how IR nodes built by the SageBuilder interfa...
SgNullStatement * buildNullStatement_nfi()
Build a NULL statement.
ROSE_DLL_API SgForStatement * buildForStatement_nfi(SgStatement *initialize_stmt, SgStatement *test, SgExpression *increment, SgStatement *loop_body, SgStatement *else_body=NULL)
Based on the contribution from Pradeep Srinivasa@ LANL.
ROSE_DLL_API SgTypeUnsignedLongLong * buildUnsignedLongLongType()
Built in simple types.
ROSE_DLL_API SgCompoundInitializer * buildCompoundInitializer(SgExprListExp *initializers=NULL, SgType *type=NULL)
Build a compound initializer, for vector type initialization.
ROSE_DLL_API SgTypeString * buildStringType()
DQ (8/21/2010): We want to move to the new buildStringType( SgExpression*,size_t) function over the o...
ROSE_DLL_API SgUpcThreads * buildUpcThreads_nfi()
Build UPC THREADS (integer expression)
ROSE_DLL_API SgModifierType * buildModifierType(SgType *base_type=nullptr)
Build a modifier type.
ROSE_DLL_API SgCaseOptionStmt * buildCaseOptionStmt(SgExpression *key=NULL, SgStatement *body=NULL)
Build a case option statement.
ROSE_DLL_API SgTemplateFunctionDeclaration * buildDefiningTemplateFunctionDeclaration(const SgName &name, SgType *return_type, SgFunctionParameterList *parlist, SgScopeStatement *scope, SgExprListExp *decoratorList, SgTemplateFunctionDeclaration *first_nondefining_declaration)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgCatchOptionStmt * buildCatchOptionStmt(SgVariableDeclaration *condition=NULL, SgStatement *body=NULL)
Build a catch statement.
ROSE_DLL_API SgLongLongIntVal * buildLongLongIntVal_nfi(long long value, const std::string &str)
ROSE_DLL_API SgClassType * buildTemplateClassType(SgTemplateClassDeclaration *template_decl, std::vector< SgNode * > &template_args)
Same as buildClassTemplateType(), just better name.
SgFortranContinueStmt * buildFortranContinueStmt_nfi()
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgTemplateMemberFunctionDeclaration * buildNondefiningTemplateMemberFunctionDeclaration(const SgName &name, SgType *return_type, SgFunctionParameterList *parlist, SgScopeStatement *scope, SgExprListExp *decoratorList, unsigned int functionConstVolatileFlags, SgTemplateParameterPtrList *templateParameterList)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgLabelStatement * buildLabelStatement(const SgName &name, SgStatement *stmt=NULL, SgScopeStatement *scope=NULL)
Build a label statement, name is the label's name. Handling label symbol and scope internally.
ROSE_DLL_API SgFortranDo * buildFortranDo_nfi(SgExpression *initialization, SgExpression *bound, SgExpression *increment, SgBasicBlock *)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgUpcThreads * buildUpcThreads()
Build UPC THREADS (integer expression)
ROSE_DLL_API SgModifierType * buildRestrictType(SgType *base_type)
Build a restrict type.
ROSE_DLL_API SgIntVal * buildIntVal_nfi(int value=0)
ROSE_DLL_API SgLongDoubleVal * buildLongDoubleVal(long double value=0.0)
SgFunctionParameterList * buildFunctionParameterList_nfi()
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API AbstractHandle::abstract_handle * buildAbstractHandle(SgNode *n)
Build an abstract handle from a SgNode.
ROSE_DLL_API SgClassDeclaration * buildClassDeclaration(SgName name, SgScopeStatement *scope)
Build C++ class (builds both the non-defining and defining declarations; in that order).
ROSE_DLL_API SgMinusOp * buildMinusOp_nfi(SgExpression *op)
ROSE_DLL_API SgTemplateFunctionDeclaration * buildNondefiningTemplateFunctionDeclaration(const SgName &name, SgType *return_type, SgFunctionParameterList *parlist, SgScopeStatement *scope=NULL, SgExprListExp *decoratorList=NULL, SgTemplateParameterPtrList *templateParameterList=NULL)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgAsmStmt * buildMultibyteNopStatement(int n)
DQ (4/30/2010): Added support for building nop statement using asm statement Building nop statement u...
ROSE_DLL_API SgKeyDatumPair * buildKeyDatumPair(SgExpression *key, SgExpression *datum)
Build a key-datum pair.
ROSE_DLL_API SgComprehension * buildComprehension(SgExpression *target, SgExpression *iter, SgExprListExp *ifs)
ROSE_DLL_API SgJavaParameterizedType * getUniqueJavaParameterizedType(SgNamedType *, SgTemplateParameterPtrList *)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgComplexVal * buildImaginaryVal_nfi(SgValueExp *imaginary_value, const std::string &str)
ROSE_DLL_API SgFunctionCallExp * buildFunctionCallExp(SgFunctionSymbol *sym, SgExprListExp *parameters=NULL)
Build a function call expression.
ROSE_DLL_API SgType * getTargetFileType(SgType *snippet_type, SgScopeStatement *targetScope)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgTemplateParameter * buildTemplateParameter(SgTemplateParameter::template_parameter_enum parameterType, SgType *)
Build a template parameter, passing enum kind and SgTemplateType template_parameter_enum { parameter_...
ROSE_DLL_API SgNoexceptOp * buildNoexceptOp(SgExpression *exp=NULL)
Build noexcept operator expression with an expression parameter.
ROSE_DLL_API SgSignedCharVal * buildSignedCharVal_nfi(signed char v, const std::string &str)
ROSE_DLL_API SgClassDeclaration * buildNondefiningClassDeclaration(SgName name, SgScopeStatement *scope)
DQ (11/7/2009): Added functions to build C++ class.
SgMemberFunctionRefExp * buildMemberFunctionRefExp_nfi(SgMemberFunctionSymbol *sym, bool virtual_call, bool need_qualifier)
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)
Build a function declaration with a function body.
ROSE_DLL_API SgModifierType * buildUpcSharedType(SgType *base_type=nullptr, long layout=-1)
Build a UPC shared type.
ROSE_DLL_API SgGotoStatement * buildGotoStatement(SgLabelStatement *label=NULL)
Build a goto statement.
ROSE_DLL_API std::string display(SourcePositionClassification &scp)
display function for debugging
ROSE_DLL_API SgUnsignedLongVal * buildUnsignedLongVal_nfi(unsigned long v, const std::string &str)
ROSE_DLL_API SgLabelRefExp * buildLabelRefExp(SgLabelSymbol *s)
Build a Fortran numeric label ref exp.
ROSE_DLL_API SgCompoundInitializer * buildCompoundInitializer_nfi(SgExprListExp *initializers, SgType *type=NULL)
Build a compound initializer, for vector type initialization.
ROSE_DLL_API SgSourceFile * buildJavaSourceFile(SgProject *, std::string, SgClassDefinition *, std::string)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgCatchStatementSeq * buildCatchStatementSeq(SgCatchOptionStmt *=NULL)
Build an initial sequence of Catch blocks containing 0 or 1 element.
ROSE_DLL_API SgInitializedName * buildInitializedName(const SgName &name, SgType *type, SgInitializer *init=NULL)
Initialized names are tricky, their scope vary depending on context, so scope and symbol information ...
ROSE_DLL_API SgTryStmt * buildTryStmt(SgStatement *body, SgCatchOptionStmt *catch0=NULL, SgCatchOptionStmt *catch1=NULL, SgCatchOptionStmt *catch2=NULL, SgCatchOptionStmt *catch3=NULL, SgCatchOptionStmt *catch4=NULL)
Build a try statement.
ROSE_DLL_API SgJavaImportStatement * buildJavaImportStatement(std::string, bool)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgThisExp * buildThisExp_nfi(SgSymbol *sym)
ROSE_DLL_API SgEnumDeclaration * buildEnumDeclaration_nfi(const SgName &name, SgScopeStatement *scope=NULL)
Build an enum, It is also a declaration statement in SAGE III.
ROSE_DLL_API SgNonrealDecl * buildNonrealDecl(const SgName &name, SgDeclarationScope *scope, SgDeclarationScope *child_scope=NULL)
Build a declaration of a non-real class or class-member representing template parameters and their me...
SgAssertStmt * buildAssertStmt_nfi(SgExpression *test)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgThisExp * buildThisExp(SgSymbol *sym)
Build this pointer.
ROSE_DLL_API SgSymbol * findAssociatedSymbolInTargetAST(SgDeclarationStatement *snippet_declaration, SgScopeStatement *targetScope)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgListComprehension * buildListComprehension(SgExpression *elt, SgExprListExp *generators)
ROSE_DLL_API SgMinusMinusOp * buildMinusMinusOp_nfi(SgExpression *op)
ROSE_DLL_API SgModifierType * buildUpcBlockStarType(SgType *base_type=nullptr)
Build a UPC shared[*] type.
ROSE_DLL_API SgStringConversion * buildStringConversion_nfi(SgExpression *exp)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgFloat16Val * buildFloat16Val_nfi(float v, const std::string &str)
SgTupleExp * buildTupleExp_nfi()
ROSE_DLL_API SgIntVal * buildIntValHex(int value=0)
ROSE_DLL_API SgTemplateClassDeclaration * buildNondefiningTemplateClassDeclaration_nfi(const SgName &name, SgClassDeclaration::class_types kind, SgScopeStatement *scope, SgTemplateParameterPtrList *templateParameterList, SgTemplateArgumentPtrList *templateSpecializationArgumentList)
DQ (11/29/2011): Adding template declaration support to the AST.
ROSE_DLL_API void setTemplateParametersInDeclaration(SgDeclarationStatement *decl, SgTemplateParameterPtrList *templateParametersList_input)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgDeclType * buildDeclType(SgExpression *base_expression, SgType *base_type)
Build a decltype reference type.
ROSE_DLL_API SgUnsignedShortVal * buildUnsignedShortVal_nfi(unsigned short v, const std::string &str)
ROSE_DLL_API SgJavaWildcardType * getUniqueJavaWildcardUnbound()
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgIfStmt * buildIfStmt_nfi(SgStatement *conditional, SgStatement *true_body, SgStatement *false_body)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgDictionaryComprehension * buildDictionaryComprehension(SgKeyDatumPair *kd_pair, SgExprListExp *generators)
ROSE_DLL_API SgShortVal * buildShortVal_nfi(short value, const std::string &str)
ROSE_DLL_API void clearScopeStack()
intended to be a private member, don't access it directly. could be changed any time
ROSE_DLL_API SgLongIntVal * buildLongIntVal(long value=0)
Build a long integer value expression.
ROSE_DLL_API SgJavaTypeExpression * buildJavaTypeExpression(SgType *)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgChar16Val * buildChar16Val(unsigned short value=0)
ROSE_DLL_API SgAwaitExpression * buildAwaitExpression()
SgDeleteExp * buildDeleteExp_nfi(SgExpression *target, bool is_array=false, bool need_global_specifier=false, SgFunctionDeclaration *deleteOperatorDeclaration=NULL)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgFoldExpression * buildFoldExpression_nfi(SgExpression *operands, std::string operator_token_string, bool is_left_associative)
ROSE_DLL_API SgBracedInitializer * buildBracedInitializer_nfi(SgExprListExp *initializers=NULL, SgType *expression_type=NULL)
ROSE_DLL_API SgMemberFunctionType * buildMemberFunctionType(SgType *return_type, SgFunctionParameterTypeList *typeList, SgScopeStatement *struct_name, unsigned int mfunc_specifier)
Built in simple types.
ROSE_DLL_API SgVariableDefinition * buildVariableDefinition_nfi(SgVariableDeclaration *decl, SgInitializedName *init_name, SgInitializer *init)
Build variable definition.
ROSE_DLL_API SgBasicBlock * buildBasicBlock_nfi()
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgUpcMythread * buildUpcMythread_nfi()
Build UPC MYTHREAD (integer expression)
ROSE_DLL_API SgWhileStmt * buildWhileStmt(SgStatement *condition, SgStatement *body, SgStatement *else_body=NULL)
Build while statement.
ROSE_DLL_API SgTypeFloat32 * buildFloat32Type()
Built in simple types.
ROSE_DLL_API SgTemplateClassDeclaration * buildNondefiningTemplateClassDeclaration(const SgName &name, SgClassDeclaration::class_types kind, SgScopeStatement *scope, SgTemplateParameterPtrList *templateParameterList, SgTemplateArgumentPtrList *templateSpecializationArgumentList)
buildNondefiningTemplateClassDeclaration()
ROSE_DLL_API void setSourcePositionClassificationMode(SourcePositionClassification X)
Set the current source position classification (defines how IR nodes built by the SageBuilder interfa...
ROSE_DLL_API SgClassDeclaration * buildStructDeclaration(const SgName &name, SgScopeStatement *scope=NULL)
Build a structure, It is also a declaration statement in SAGE III.
SgCtorInitializerList * buildCtorInitializerList_nfi()
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgNamespaceAliasDeclarationStatement * buildNamespaceAliasDeclarationStatement(const SgName &name, SgNamespaceDeclarationStatement *namespaceDeclaration)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgClassDefinition * buildClassDefinition(SgClassDeclaration *d=NULL, bool buildTemplateInstantiation=false)
Build a class definition scope statement.
ROSE_DLL_API SgJovialBitVal * buildJovialBitVal_nfi(const std::string &str)
Build a Jovial bit value expression.
ROSE_DLL_API SgCharVal * buildCharVal_nfi(char value, const std::string &str)
ROSE_DLL_API SgJavaThrowStatement * buildJavaThrowStatement(SgThrowOp *)
Build a Java Throw statement.
ROSE_DLL_API SgJavaSynchronizedStatement * buildJavaSynchronizedStatement(SgExpression *, SgBasicBlock *)
Build a Java Synchronized statement.
ROSE_DLL_API PreprocessingInfo * buildComment(SgLocatedNode *target, const std::string &content, PreprocessingInfo::RelativePositionType position=PreprocessingInfo::before, PreprocessingInfo::DirectiveType dtype=PreprocessingInfo::CpreprocessorUnknownDeclaration)
Build and attach a comment, comment style is inferred from the language type of the target node if no...
SgConditionalExp * buildConditionalExp_nfi(SgExpression *test, SgExpression *a, SgExpression *b, SgType *t)
ROSE_DLL_API SgNamespaceDefinitionStatement * buildNamespaceDefinition(SgNamespaceDeclarationStatement *d=NULL)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgDefaultOptionStmt * buildDefaultOptionStmt(SgStatement *body=NULL)
Build a default option statement.
SgCudaKernelExecConfig * buildCudaKernelExecConfig_nfi(SgExpression *grid=NULL, SgExpression *blocks=NULL, SgExpression *shared=NULL, SgExpression *stream=NULL)
Build a CUDA kernel execution configuration (<<<grid, blocks, shared, stream>>>)
ROSE_DLL_API SgJavaSingleMemberAnnotation * buildJavaSingleMemberAnnotation(SgType *, SgExpression *)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgForStatement * buildForStatement(SgStatement *initialize_stmt, SgStatement *test, SgExpression *increment, SgStatement *loop_body, SgStatement *else_body=NULL)
Build a for statement, assume none of the arguments is NULL.
ROSE_DLL_API SgTypeMatrix * buildMatrixType()
Build a Matlab Matrix Type.
ROSE_DLL_API SgModuleStatement * buildModuleStatement(const SgName &name, SgScopeStatement *scope)
Build a Fortran module declaration.
ROSE_DLL_API SgContinueStmt * buildContinueStmt()
Build a continue statement.
ROSE_DLL_API SgEmptyDeclaration * buildEmptyDeclaration()
Build an empty declaration (useful for adding precission to comments and CPP handling under token-bas...
ROSE_DLL_API SgUnsignedIntVal * buildUnsignedIntValHex(unsigned int v=0)
ROSE_DLL_API SgTemplateType * buildTemplateType(SgName name="")
Build a template type, used for template parameter and later argument.
ROSE_DLL_API SgLambdaRefExp * buildLambdaRefExp(SgType *return_type, SgFunctionParameterList *params, SgScopeStatement *scope)
Build lambda expression.
ROSE_DLL_API SgFloatVal * buildFloatVal_nfi(float value=0.0)
ROSE_DLL_API SgConditionalExp * buildConditionalExp(SgExpression *test=NULL, SgExpression *a=NULL, SgExpression *b=NULL)
Build a conditional expression ?:
ROSE_DLL_API SgUnsignedLongVal * buildUnsignedLongVal(unsigned long v=0)
Build a unsigned long integer.
ROSE_DLL_API SgTypeInt * buildIntType()
Built in simple types.
SgDictionaryComprehension * buildDictionaryComprehension_nfi(SgKeyDatumPair *kd_pair, SgExprListExp *generators)
ROSE_DLL_API SgTemplateClassDeclaration * buildTemplateClassDeclaration_nfi(const SgName &name, SgClassDeclaration::class_types kind, SgScopeStatement *scope, SgTemplateClassDeclaration *nonDefiningDecl, SgTemplateParameterPtrList *templateParameterList, SgTemplateArgumentPtrList *templateSpecializationArgumentList)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgTypeUnsignedInt * buildUnsignedIntType()
Built in simple types.
ROSE_DLL_API SgFloat80Val * buildFloat80Val(long double value=0.0)
SgSubscriptExpression * buildSubscriptExpression_nfi(SgExpression *lower_bound, SgExpression *upper_bound, SgExpression *stride)
Build a SgSubscriptExpression, used for array shape expressions. The lower bound and stride may be nu...
ROSE_DLL_API SgDotDotExp * buildDotDotExp()
Build a variable declaration, handle symbol table transparently.
SourcePositionClassification SourcePositionClassificationMode
C++ SageBuilder namespace specific state for storage of the source code position state (used to contr...
ROSE_DLL_API SgTypeBFloat16 * buildBFloat16Type()
Built in simple types.
ROSE_DLL_API SgMinusOp * buildMinusOp(SgExpression *op=NULL)
std::list< SgScopeStatement * > ScopeStack
intended to be a private member, don't access it directly. could be changed any time
ROSE_DLL_API SgModifierType * buildUpcBlockIndefiniteType(SgType *base_type=nullptr)
Build a UPC shared[] type.
SgSetComprehension * buildSetComprehension_nfi(SgExpression *elt, SgExprListExp *generators)
ROSE_DLL_API SgTypeFp16 * buildFp16Type()
Built in simple types.
SgName unparseTemplateArgumentToString(SgTemplateArgument *templateArgument)
DQ (3/9/2018): Added to support debugging.
ROSE_DLL_API SgSuperExp * buildSuperExp(SgClassSymbol *sym)
Build super pointer.
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)
Build a SgExprListExp, used for function call parameter list etc.
ROSE_DLL_API void resetDeclaration(T *classDeclaration_copy, T *classDeclaration_original, SgScopeStatement *targetScope)
Function to reset scopes in SgDeclarationStatement IR nodes.
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)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgJavaPackageStatement * buildJavaPackageStatement(std::string)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgJavaLabelStatement * buildJavaLabelStatement(const SgName &, SgStatement *=NULL)
Build a Java Label statement.
ROSE_DLL_API SgEquivalenceStatement * buildEquivalenceStatement(SgExpression *lhs, SgExpression *rhs)
Build a SgFile node and attach it to SgProject.
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)
Build a SgListExp.
ROSE_DLL_API SgUnsignedCharVal * buildUnsignedCharValHex(unsigned char v=0)
ROSE_DLL_API SgModifierType * buildNotNullType(SgType *base_type)
Build a not null type for Ada.
ROSE_DLL_API SgLambdaExp * buildLambdaExp_nfi(SgLambdaCaptureList *lambda_capture_list, SgClassDeclaration *lambda_closure_class, SgFunctionDeclaration *lambda_function)
ROSE_DLL_API SgTemplateClassDeclaration * buildTemplateClassDeclaration(const SgName &name, SgClassDeclaration::class_types kind, SgScopeStatement *scope, SgTemplateClassDeclaration *nonDefiningDecl, SgTemplateParameterPtrList *templateParameterList, SgTemplateArgumentPtrList *templateSpecializationArgumentList)
Build tempplate class declaration.
ROSE_DLL_API SgSourceFile * buildSourceFile(const std::string &outputFileName, SgProject *project=NULL, bool clear_globalScopeAcrossFiles=false)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API void setTemplateSpecializationArgumentsInDeclaration(SgDeclarationStatement *decl, SgTemplateArgumentPtrList *templateSpecializationArgumentsList_input)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgArrayType * buildArrayType(SgType *base_type=nullptr, SgExpression *index=nullptr)
Build ArrayType.
ROSE_DLL_API SgTypeFloat32x * buildFloat32xType()
Built in simple types.
ROSE_DLL_API SgEnumDeclaration * buildNondefiningEnumDeclaration_nfi(const SgName &name, SgScopeStatement *scope)
Build an enum first nondefining declaration, without file info.
ROSE_DLL_API SgComplexVal * buildImaginaryVal(long double imaginary_value)
ROSE_DLL_API SgLambdaCapture * buildLambdaCapture_nfi(SgExpression *capture_variable, SgExpression *source_closure_variable, SgExpression *closure_variable)
ROSE_DLL_API SgNullptrValExp * buildNullptrValExp()
DQ (7/31/2014): Adding support for C++11 nullptr const value expressions.
ROSE_DLL_API void fixupCopyOfAstFromSeparateFileInNewTargetAst(SgStatement *insertionPoint, bool insertionPointIsScope, SgStatement *toInsert, SgStatement *original_before_copy)
Fixup any AST moved from one file two another (references to symbols, types, etc.).
SgExprStatement * buildExprStatement_nfi(SgExpression *exp)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgTypeExpression * buildTypeExpression(SgType *type)
DQ (7/24/2014): Adding support for c11 generic operands.
ROSE_DLL_API SgTypeFixed * buildFixedType(SgExpression *fraction, SgExpression *scale)
Build a Jovial fixed type with a fraction specifier and a scale specifier.
SgPythonPrintStmt * buildPythonPrintStmt_nfi(SgExpression *dest=NULL, SgExprListExp *values=NULL)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgTemplateVariableDeclaration * buildTemplateVariableDeclaration_nfi(const SgName &name, SgType *type, SgInitializer *varInit, SgScopeStatement *scope)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgNaryComparisonOp * buildNaryComparisonOp_nfi(SgExpression *lhs)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgReturnStmt * buildReturnStmt(SgExpression *expression=NULL)
Build a return statement.
SgCaseOptionStmt * buildCaseOptionStmt_nfi(SgExpression *key, SgStatement *body)
Build a variable declaration, handle symbol table transparently.
SgWithStatement * buildWithStatement_nfi(SgExpression *expr, SgStatement *body)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgUpcFenceStatement * buildUpcFenceStatement_nfi()
Build a UPC fence statement.
ROSE_DLL_API SgComplexVal * buildComplexVal_nfi(SgValueExp *real_value, SgValueExp *imaginary_value, const std::string &str)
SgCudaKernelCallExp * buildCudaKernelCallExp_nfi(SgExpression *kernel, SgExprListExp *parameters=NULL, SgCudaKernelExecConfig *config=NULL)
Build a CUDA kernel call expression (kernel<<<config>>>(parameters))
ROSE_DLL_API SgTypeFloat64x * buildFloat64xType()
Built in simple types.
SgCompoundLiteralExp * buildCompoundLiteralExp_nfi(SgVariableSymbol *varSymbol)
Build function for compound literals (uses a SgVariableSymbol and is similar to buildVarRefExp_nfi())...
actualFunction * buildDefiningFunctionDeclaration_T(const SgName &name, SgType *return_type, SgFunctionParameterList *parlist, bool isMemberFunction, SgScopeStatement *scope, SgExprListExp *decoratorList, unsigned int functionConstVolatileFlags, actualFunction *first_nondefinng_declaration, SgTemplateArgumentPtrList *templateArgumentsList)
A template function for function declaration builders.
ROSE_DLL_API SgChar16Val * buildChar16Val_nfi(unsigned short value, const std::string &str)
ROSE_DLL_API SgTypeLongLong * buildLongLongType()
Built in simple types.
ROSE_DLL_API SgTypeFloat128 * buildFloat128Type()
Built in simple types.
ROSE_DLL_API SgProcedureHeaderStatement * buildNondefiningProcedureHeaderStatement(const SgName &name, SgType *return_type, SgFunctionParameterList *param_list, SgProcedureHeaderStatement::subprogram_kind_enum, SgScopeStatement *scope=NULL)
Build a nondefining SgProcedureHeaderStatement, handle function type, symbol etc transparently.
ROSE_DLL_API SgFloat32Val * buildFloat32Val_nfi(float v, const std::string &str)
ROSE_DLL_API SgVarRefExp * buildVarRefExp(const SgName &name, SgScopeStatement *scope=NULL)
Build SgVarRefExp based on a variable's Sage name. It will lookup the name in the symbol table intern...
SgComprehension * buildComprehension_nfi(SgExpression *target, SgExpression *iter, SgExprListExp *ifs)
ROSE_DLL_API SgJovialTableStatement * buildJovialTableStatement(const SgName &name, SgClassDeclaration::class_types kind, SgScopeStatement *scope=NULL)
Build a Jovial table declaration statement.
ROSE_DLL_API SgLongLongIntVal * buildLongLongIntVal(long long value=0)
Build a long long integer value expression.
ROSE_DLL_API SgUnsignedLongLongIntVal * buildUnsignedLongLongIntVal(unsigned long long v=0)
Build an unsigned long long integer.
ROSE_DLL_API SgVarRefExp * buildJavaArrayLengthVarRefExp()
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgSuperExp * buildSuperExp_nfi(SgClassSymbol *sym)
SgKeyDatumPair * buildKeyDatumPair_nfi(SgExpression *key, SgExpression *datum)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgNamespaceDeclarationStatement * buildNamespaceDeclaration(const SgName &name, SgScopeStatement *scope=NULL)
tps (09/02/2009) : Added support for building namespaces
ROSE_DLL_API SgAggregateInitializer * buildAggregateInitializer_nfi(SgExprListExp *initializers, SgType *type=NULL)
Build an aggregate initializer.
ROSE_DLL_API SgTypeUnsignedShort * buildUnsignedShortType()
Built in simple types.
ROSE_DLL_API SgTypedefDeclaration * buildTypedefDeclaration_nfi(const std::string &name, SgType *base_type, SgScopeStatement *scope=NULL, bool has_defining_base=false)
Build a typedef declaration, such as: typedef int myint;.
ROSE_DLL_API SgTemplateVariableDeclaration * buildTemplateVariableDeclaration(const SgName &name, SgType *type, SgInitializer *varInit, SgScopeStatement *scope)
Build template variable declarations.
ROSE_DLL_API SgMinusMinusOp * buildMinusMinusOp(SgExpression *op=NULL)
ROSE_DLL_API void buildDoWhileStatement_nfi(SgDoWhileStmt *result, SgStatement *body, SgStatement *condition)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgTypeSigned128bitInteger * buildSigned128bitIntegerType()
Built in simple types.
ROSE_DLL_API SgUnsignedCharVal * buildUnsignedCharVal_nfi(unsigned char v, const std::string &str)
bool symbol_table_case_insensitive_semantics
Support for construction of case sensitive/insensitive symbol table handling in scopes.
SgListExp * buildListExp_nfi()
ROSE_DLL_API SgPythonPrintStmt * buildPythonPrintStmt(SgExpression *dest=NULL, SgExprListExp *values=NULL)
Build a python print statement.
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 SgDoWhileStmt * buildDoWhileStmt(SgStatement *body, SgStatement *condition)
Build do-while statement.
ROSE_DLL_API void errorCheckingTargetAST(SgNode *node_copy, SgNode *node_original, SgFile *targetFile, bool failOnWarning)
Error checking the inserted snippet AST.
ROSE_DLL_API SgDotExp * buildDotExp(SgExpression *lhs=NULL, SgExpression *rhs=NULL)
ROSE_DLL_API SgFortranDo * buildFortranDo(SgExpression *initialization, SgExpression *bound, SgExpression *increment, SgBasicBlock *)
Build a Fortran do construct.
ROSE_DLL_API SgPythonGlobalStmt * buildPythonGlobalStmt(SgInitializedNamePtrList &names)
Build a python global statement.
ROSE_DLL_API SgUnsignedLongLongIntVal * buildUnsignedLongLongIntValHex(unsigned long long v=0)
ROSE_DLL_API SgBoolValExp * buildBoolValExp_nfi(int value)
ROSE_DLL_API SgReturnStmt * buildReturnStmt_nfi(SgExpression *expression)
Build a return statement.
ROSE_DLL_API SgClassExp * buildClassExp(SgClassSymbol *sym)
Build class pointer.
ROSE_DLL_API SgTypeChar16 * buildChar16Type()
Built in simple types.
ROSE_DLL_API SgLambdaExp * buildLambdaExp(SgLambdaCaptureList *lambda_capture_list, SgClassDeclaration *lambda_closure_class, SgFunctionDeclaration *lambda_function)
DQ (9/3/2014): Adding support for C++11 Lambda expressions.
ROSE_DLL_API SgWhenStmt * buildWhenStmt(SgExpression *expression, SgBasicBlock *body)
Build a variable declaration, handle symbol table transparently.
SgAsmStmt * buildAsmStatement_nfi(std::string s)
Build an asm statement.
SgListComprehension * buildListComprehension_nfi(SgExpression *elt, SgExprListExp *generators)
ROSE_DLL_API SgClassDeclaration * buildJavaDefiningClassDeclaration(SgScopeStatement *, std::string, SgClassDeclaration::class_types kind=SgClassDeclaration::e_class)
Build a SgFile node and attach it to SgProject.
SgContinueStmt * buildContinueStmt_nfi()
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgAssignInitializer * buildAssignInitializer(SgExpression *operand_i=NULL, SgType *expression_type=NULL)
Build the rhs of a variable declaration which includes an assignment.
ROSE_DLL_API SgArrayType * getUniqueJavaArrayType(SgType *, int)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgLambdaCapture * buildLambdaCapture(SgExpression *capture_variable, SgExpression *source_closure_variable, SgExpression *closure_variable)
ROSE_DLL_API SgRangeExp * buildRangeExp(SgExpression *start)
Build a Matlab range expression like start:end or start:stride:end.
ROSE_DLL_API SgEnumDeclaration * buildEnumDeclaration(const SgName &name, SgScopeStatement *scope=NULL)
Build an enum, It is also a declaration statement in SAGE III.
ROSE_DLL_API SgModifierType * buildConstVolatileType(SgType *base_type=nullptr)
Build a const volatile type.
ROSE_DLL_API SgEnumVal * buildEnumVal(long long int value, SgEnumDeclaration *decl, SgName name)
ROSE_DLL_API SgEnumVal * buildEnumVal_nfi(long long int value, SgEnumDeclaration *decl, SgName name)
ROSE_DLL_API void setTemplateNameInTemplateInstantiations(SgFunctionDeclaration *func, const SgName &name)
DQ (2/11/2012): Added support to set the template name in function template instantiations (member an...
ROSE_DLL_API SgVariableDeclaration * buildVariableDeclaration(const SgName &name, SgType *type, SgInitializer *varInit=NULL, SgScopeStatement *scope=NULL)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgFloat128Val * buildFloat128Val(long double value=0.0)
ROSE_DLL_API SgJovialDefineDeclaration * buildJovialDefineDeclaration_nfi(const SgName &name, const std::string ¶ms, const std::string &def_string, SgScopeStatement *scope=NULL)
Build a Jovial define directive declaration statement.
ROSE_DLL_API SgTypeFloat80 * buildFloat80Type()
Built in simple types.
SgBreakStmt * buildBreakStmt_nfi()
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgWcharVal * buildWcharVal_nfi(wchar_t value, const std::string &str)
ROSE_DLL_API SgFloatVal * buildFloatVal(float value=0.0)
ROSE_DLL_API SgFinishStmt * buildFinishStmt(SgBasicBlock *body)
MH (6/11/2014): Added finish support.
ROSE_DLL_API SgScopeStatement * topScopeStack()
intended to be a private member, don't access it directly. could be changed any time
ROSE_DLL_API SgModifierType * buildUpcRelaxedType(SgType *base_type=nullptr)
Build a UPC relaxed type.
SgScopeStatement * getGlobalScopeFromScopeStack()
Support to retrive the SgGlobal from the internal scope stack (error if not present in a non-empty li...
ROSE_DLL_API SgChooseExpression * buildChooseExpression()
SgClassDefinition * buildClassDefinition_nfi(SgClassDeclaration *d=NULL, bool buildTemplateInstantiation=false)
Build a class definition scope statement.
ROSE_DLL_API SgClassNameRefExp * buildClassNameRefExp(SgClassSymbol *sym)
ROSE_DLL_API SgWithStatement * buildWithStatement(SgExpression *expr, SgStatement *body)
Build a with statement.
SgTemplateClassDefinition * buildTemplateClassDefinition(SgTemplateClassDeclaration *d=NULL)
Build a template class definition statement.
ROSE_DLL_API SgNullExpression * buildNullExpression()
Build a null expression, set file info as the default one.
ROSE_DLL_API SgNaryBooleanOp * buildNaryBooleanOp_nfi(SgExpression *lhs)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgModifierType * buildAliasedType(SgType *base_type)
Build an aliased type for Ada.
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)
Build a SgTupleExp.
ROSE_DLL_API SgTypeImaginary * buildImaginaryType(SgType *base_type=nullptr)
Build an imaginary type.
ROSE_DLL_API SgStringVal * buildStringVal_nfi(std::string value)
ROSE_DLL_API SgStatementExpression * buildStatementExpression_nfi(SgStatement *exp)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API void setTemplateArgumentParents(SgDeclarationStatement *decl)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgStmtDeclarationStatement * buildStmtDeclarationStatement(SgStatement *stmt)
Build a StmtDeclarationStmt.
ROSE_DLL_API SgAwaitExpression * buildAwaitExpression_nfi()
ROSE_DLL_API SgTemplateParameterVal * buildTemplateParameterVal_nfi(int template_parameter_position, const std::string &str)
ROSE_DLL_API SgJavaQualifiedType * getUniqueJavaQualifiedType(SgClassDeclaration *, SgNamedType *, SgNamedType *)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgFinishExp * buildFinishExp(SgExpression *expression, SgBasicBlock *body)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgYieldExpression * buildYieldExpression(SgExpression *value)
Build a yield statement.
ROSE_DLL_API SgJavaInstanceOfOp * buildJavaInstanceOfOp(SgExpression *exp=NULL, SgType *type=NULL)
This is part of Java specific operator support.
ROSE_DLL_API SgLambdaCaptureList * buildLambdaCaptureList_nfi()
ROSE_DLL_API SgShortVal * buildShortVal(short value=0)
ROSE_DLL_API SgAsmStmt * buildAsmStatement(std::string s)
Build a NULL statement.
ROSE_DLL_API SgModifierType * buildConstType(SgType *base_type=nullptr)
Build a const type.
ROSE_DLL_API void setTemplateArgumentsInDeclaration(SgDeclarationStatement *decl, SgTemplateArgumentPtrList *templateArgumentsList_input)
DQ (9/16/2012): Added function to support setting the template arguments and setting their parents (a...
ROSE_DLL_API SgJavaNormalAnnotation * buildJavaNormalAnnotation(SgType *)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgDoubleVal * buildDoubleVal_nfi(double value, const std::string &str)
ROSE_DLL_API SgUnsignedShortVal * buildUnsignedShortVal(unsigned short v=0)
Build an unsigned short integer.
ROSE_DLL_API SgInitializedName * buildInitializedName_nfi(const SgName &name, SgType *type, SgInitializer *init, SgVariableDeclaration *declptr=NULL)
Initialized names are tricky, their scope vary depending on context, so scope and symbol information ...
ROSE_DLL_API PreprocessingInfo * buildCpreprocessorDefineDeclaration(SgLocatedNode *target, const std::string &content, PreprocessingInfo::RelativePositionType position=PreprocessingInfo::before)
Build and attach #define XX directives, pass "#define xxx xxx" as content.
ROSE_DLL_API SgTypeDouble * buildDoubleType()
Built in simple types.
ROSE_DLL_API SgReferenceType * buildReferenceType(SgType *base_type=nullptr)
Build a reference type.
SgExecStatement * buildExecStatement_nfi(SgExpression *executable, SgExpression *globals=NULL, SgExpression *locals=NULL)
Build an exec stmt.
ROSE_DLL_API SgTypeLongDouble * buildLongDoubleType()
Built in simple types.
ROSE_DLL_API SgTypeLong * buildLongType()
Built in simple types.
ROSE_DLL_API SgExprStatement * buildExprStatement(SgExpression *exp=NULL)
Build a SgExprStatement, set File_Info automatically.
ROSE_DLL_API SgLongIntVal * buildLongIntVal_nfi(long value, const std::string &str)
ROSE_DLL_API SgFunctionParameterRefExp * buildFunctionParameterRefExp(int parameter_number, int parameter_level)
ROSE_DLL_API SgTemplateTypedefDeclaration * buildTemplateTypedefDeclaration_nfi(const SgName &name, SgType *base_type, SgScopeStatement *scope=NULL, bool has_defining_base=false)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API void fixupSourcePositionFileSpecification(SgNode *subtreeRoot, const std::string &newFileName)
Change the source file associated with the source position information in the AST.
ROSE_DLL_API SgAssertStmt * buildAssertStmt(SgExpression *test)
Build a Assert statement.
ROSE_DLL_API SgAtExp * buildAtExp(SgExpression *expression, SgBasicBlock *body)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgChar32Val * buildChar32Val(unsigned int value=0)
ROSE_DLL_API SgSizeOfOp * buildSizeOfOp_nfi(SgExpression *exp)
Build sizeof() expression with an expression parameter.
ROSE_DLL_API SgIfStmt * buildIfStmt(SgStatement *conditional, SgStatement *true_body, SgStatement *false_body)
Build if statement.
ROSE_DLL_API SgAsyncStmt * buildAsyncStmt(SgBasicBlock *body)
MH (6/10/2014): Added async support.
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)
Build an empty SgFunctionParameterList, possibly with some initialized names filled in.
ROSE_DLL_API SgModifierType * buildFortranKindType(SgType *base_type, SgExpression *kindExpression)
Build a type based on the Fortran kind mechanism.
ROSE_DLL_API SgPragmaDeclaration * buildPragmaDeclaration(const std::string &name, SgScopeStatement *scope=NULL)
Build pragma declaration, handle SgPragma and defining/nondefining pointers internally.
ROSE_DLL_API SgUnsignedCharVal * buildUnsignedCharVal(unsigned char v=0)
Build an unsigned char.
SgLabelStatement * buildLabelStatement_nfi(const SgName &name, SgStatement *stmt, SgScopeStatement *scope)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgAlignOfOp * buildAlignOfOp(SgExpression *exp=NULL)
Build alignof() expression with an expression parameter.
ROSE_DLL_API SgMatlabForStatement * buildMatlabForStatement(SgExpression *loop_index, SgExpression *loop_range, SgBasicBlock *loop_body)
Build a For-loop statement for matlab.
bool inSwitchScope()
intended to be a private member, don't access it directly. could be changed any time
ROSE_DLL_API SgFloat64Val * buildFloat64Val_nfi(double v, const std::string &str)
ROSE_DLL_API SgUpcMythread * buildUpcMythread()
Build UPC MYTHREAD (integer expression)
ROSE_DLL_API SgTypeUnsignedLong * buildUnsignedLongType()
Built in simple types.
ROSE_DLL_API SgPlusPlusOp * buildPlusPlusOp_nfi(SgExpression *op)
ROSE_DLL_API SgSignedCharVal * buildSignedCharValHex(signed char v=0)
ROSE_DLL_API SgTypeShort * buildShortType()
Built in simple types.
ROSE_DLL_API SgNonrealRefExp * buildNonrealRefExp_nfi(SgNonrealSymbol *sym)
Build a reference to the non-real declaration of a member of a non-real class.
SgFunctionCallExp * buildFunctionCallExp_nfi(SgExpression *f, SgExprListExp *parameters=NULL)
ROSE_DLL_API SgTypeVoid * buildVoidType()
Built in simple types.
ROSE_DLL_API void fixupSharingSourcePosition(SgNode *subtreeRoot, int new_file_id)
Sharing IR nodes requires that the file id be added to the fileIDsToUnparse held in the Sg_File_Info ...
ROSE_DLL_API SgAssignInitializer * buildAssignInitializer_nfi(SgExpression *operand_i=NULL, SgType *expression_type=NULL)
ROSE_DLL_API SgTypeBool * buildBoolType()
Built in simple types.
ROSE_DLL_API SgMicrosoftAttributeDeclaration * buildMicrosoftAttributeDeclaration(const SgName &name)
DQ (8/17/2014): Adding support for Microsoft MSVC specific attributes.
ROSE_DLL_API SgStatement * buildStatementFromString(const std::string &stmt_str, SgScopeStatement *scope)
Liao (9/18/2015): experimental support of building a statement from a string.
ROSE_DLL_API SgFile * buildFile(const std::string &inputFileName, const std::string &outputFileName, SgProject *project=NULL, bool clear_globalScopeAcrossFiles=false)
Build a SgFile node and attach it to SgProject.
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)
Build a defining ( non-prototype) member function declaration.
ROSE_DLL_API SgVarRefExp * buildVarRefExp_nfi(SgVariableSymbol *varSymbol)
ROSE_DLL_API SgPointerType * buildPointerType(SgType *base_type=nullptr)
Build a pointer type.
ROSE_DLL_API SgLongDoubleVal * buildLongDoubleVal_nfi(long double value, const std::string &str)
ROSE_DLL_API SgMagicColonExp * buildMagicColonExp()
Build a Matlab colon expression :
ROSE_DLL_API SgTypedefDeclaration * buildTypedefDeclaration(const std::string &name, SgType *base_type, SgScopeStatement *scope=NULL, bool has_defining_base=false)
Build a typedef declaration, such as: typedef int myint; typedef struct A {..} s_A;.
ROSE_DLL_API SgTemplateParameterVal * buildTemplateParameterVal(int template_parameter_position=-1)
Build an template parameter value expression.
ROSE_DLL_API SgFortranContinueStmt * buildFortranContinueStmt()
Build a Fortran continue statement.
ROSE_DLL_API SgFloat128Val * buildFloat128Val_nfi(long double value, const std::string &str)
ROSE_DLL_API SgBoolValExp * buildBoolValExp(int value=0)
Build a bool value expression, the name convention of SgBoolValExp is little different from others fo...
ROSE_DLL_API SgSwitchStatement * buildSwitchStatement(SgStatement *item_selector=NULL, SgStatement *body=NULL)
Build a switch statement.
ROSE_DLL_API SgType * buildOpaqueType(std::string const type_name, SgScopeStatement *scope)
Build an opaque type with a name, useful when a type's details are unknown during transformation,...
ROSE_DLL_API SgTypeChar32 * buildChar32Type()
Built in simple types.
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 SgMatrixExp * buildMatrixExp(SgExprListExp *firstRow)
Build a Matlab Matrix.
ROSE_DLL_API SgPassStatement * buildPassStatement()
Build a pass statement.
ROSE_DLL_API SgTypeComplex * buildComplexType(SgType *base_type=nullptr)
Build a complex type.
ROSE_DLL_API SgProcedureHeaderStatement * buildProcedureHeaderStatement(const SgName &name, SgType *return_type, SgFunctionParameterList *parameter_list, SgProcedureHeaderStatement::subprogram_kind_enum, SgScopeStatement *scope=NULL)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgDeclarationStatement * findAssociatedDeclarationInTargetAST(SgDeclarationStatement *snippet_declaration, SgScopeStatement *targetScope)
Build a SgFile node and attach it to SgProject.
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)
Build a tuple of types. Useful for a function returning multiple variables of different types.
ROSE_DLL_API SgNaryComparisonOp * buildNaryComparisonOp(SgExpression *lhs)
driscoll6 (7/20/11) : Support n-ary operators for python
ROSE_DLL_API SgNonrealType * buildNonrealType(const SgName &name, SgDeclarationScope *scope)
Build a non real type used for template parameter. Internally a SgNorealDecl is also built.
ROSE_DLL_API SgDeclarationScope * buildDeclarationScope()
Build a scope statement. Used to build SgNonrealDecl and SgNonrealType.
ROSE_DLL_API SgName appendTemplateArgumentsToName(const SgName &name, const SgTemplateArgumentPtrList &templateArgumentsList)
DQ (7/27/2012): changed semantics from removing the template arguments in names to adding the templat...
ROSE_DLL_API SgStaticAssertionDeclaration * buildStaticAssertionDeclaration(SgExpression *condition, const SgName &string_literal)
DQ (7/25/2014): Adding support for C11 static assertions.
ROSE_DLL_API SgNullExpression * buildNullExpression_nfi()
No file info version of buildNullExpression(). File info is to be set later on.
ROSE_DLL_API SgFunctionParameterTypeList * buildFunctionParameterTypeList(SgFunctionParameterList *paralist)
Build SgFunctionParameterTypeList from SgFunctionParameterList.
ROSE_DLL_API SgFunctionCallExp * buildMemberFunctionCall(std::string className, SgExpression *objectExpression, std::string functionName, SgExprListExp *params, SgScopeStatement *scope)
Build member function calls.
SgDefaultOptionStmt * buildDefaultOptionStmt_nfi(SgStatement *body)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgFloat64Val * buildFloat64Val(double v=0)
Build a float64.
ROSE_DLL_API SgActualArgumentExpression * buildActualArgumentExpression(SgName arg_name, SgExpression *arg)
Build an Actual Argument Expression.
ROSE_DLL_API PreprocessingInfo * buildHeader(const std::string &header_filename, PreprocessingInfo::RelativePositionType position=PreprocessingInfo::before, bool isSystemHeader=false)
Build a dangling #include "x.h" header, insertHeader() is needed to actually insert it.
SgPassStatement * buildPassStatement_nfi()
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgStringVal * buildStringVal(std::string value="")
ROSE_DLL_API SgTypeSignedLong * buildSignedLongType()
Built in simple types.
ROSE_DLL_API SgClassDeclaration * buildDefiningClassDeclaration(SgName name, SgScopeStatement *scope)
Build a variable declaration, handle symbol table transparently.
SgGotoStatement * buildGotoStatement_nfi(SgLabelStatement *label)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgTypeChar * buildCharType()
Built in simple types.
ROSE_DLL_API SgTemplateParameterPtrList * getTemplateParameterList(SgDeclarationStatement *decl)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgClassExp * buildClassExp_nfi(SgClassSymbol *sym)
ROSE_DLL_API SgBreakStmt * buildBreakStmt()
Build a break statement.
ROSE_DLL_API SgForInitStatement * buildForInitStatement_nfi(SgStatementPtrList &statements)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API void setTemplateParameterParents(SgDeclarationStatement *decl)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API void pushScopeStack(SgScopeStatement *stmt)
Public interfaces of the scope stack, should be stable.
ROSE_DLL_API SgTypeSignedShort * buildSignedShortType()
Built in simple types.
ROSE_DLL_API SgUsingDirectiveStatement * buildUsingDirectiveStatement(SgNamespaceDeclarationStatement *ns_decl)
Build a using directive statement.
SgDictionaryExp * buildDictionaryExp_nfi(std::vector< SgKeyDatumPair * > pairs)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgCastExp * buildCastExp(SgExpression *operand_i=NULL, SgType *expression_type=NULL, SgCastExp::cast_type_enum cast_type=SgCastExp::e_C_style_cast)
Build a type casting expression.
SgTemplateMemberFunctionRefExp * buildTemplateMemberFunctionRefExp_nfi(SgTemplateMemberFunctionSymbol *sym, bool virtual_call, bool need_qualifier)
DQ (12/29/2011): Adding template declaration support to the AST.
ROSE_DLL_API SgRvalueReferenceType * buildRvalueReferenceType(SgType *base_type)
Build a rvalue reference type.
ROSE_DLL_API SgClassDeclaration * buildNondefiningClassDeclaration_nfi(const SgName &name, SgClassDeclaration::class_types kind, SgScopeStatement *scope, bool buildTemplateInstantiation, SgTemplateArgumentPtrList *templateArgumentsList)
Build a structure first nondefining declaration, without file info.
ROSE_DLL_API SgStmtDeclarationStatement * buildStmtDeclarationStatement_nfi(SgStatement *stmt)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgForInitStatement * buildForInitStatement()
Build a for init statement.
SgDoWhileStmt * buildDoWhileStmt_nfi(SgStatement *body, SgStatement *condition)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API void popScopeStack()
intended to be a private member, don't access it directly. could be changed any time
ROSE_DLL_API SgSignedCharVal * buildSignedCharVal(signed char v=0)
Build a signed char.
ROSE_DLL_API SgAlignOfOp * buildAlignOfOp_nfi(SgExpression *exp)
Build alignof() expression with an expression parameter.
ROSE_DLL_API SgVarArgOp * buildVarArgOp_nfi(SgExpression *operand_i, SgType *expression_type)
Build vararg op expression.
ROSE_DLL_API void testTemplateArgumentParents(SgDeclarationStatement *decl)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgTypeNullptr * buildNullptrType()
Built in simple types.
ROSE_DLL_API SgModifierType * buildUpcStrictType(SgType *base_type=nullptr)
Build a UPC strict type.
ROSE_DLL_API SgExprStatement * buildAssignStatement_ast_translate(SgExpression *lhs, SgExpression *rhs)
This version does not recursively reset the file info as a transformation.
ROSE_DLL_API SgTypeFloat * buildFloatType()
Built in simple types.
ROSE_DLL_API SgDeleteExp * buildDeleteExp(SgExpression *variable, short is_array, short need_global_specifier, SgFunctionDeclaration *deleteOperatorDeclaration)
ROSE_DLL_API SgTypeOfType * buildTypeOfType(SgExpression *base_expression, SgType *base_type)
Build a GNU typeof operator.
ROSE_DLL_API SgVoidVal * buildVoidVal()
DQ (2/14/2019): Adding support for C++14 void value expressions.
SgWhileStmt * buildWhileStmt_nfi(SgStatement *condition, SgStatement *body, SgStatement *else_body=NULL)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API bool emptyScopeStack()
intended to be a private member, don't access it directly. could be changed any time
SgClassNameRefExp * buildClassNameRefExp_nfi(SgClassSymbol *sym)
ROSE_DLL_API SgFloat80Val * buildFloat80Val_nfi(long double value, const std::string &str)
ROSE_DLL_API SgSetComprehension * buildSetComprehension(SgExpression *elt, SgExprListExp *generators)
ROSE_DLL_API SgTypeFloat64 * buildFloat64Type()
Built in simple types.
ROSE_DLL_API SgColonShapeExp * buildColonShapeExp_nfi()
No file info version of buildColonShapeExp(). File info is to be set later on.
ROSE_DLL_API SgVoidVal * buildVoidVal_nfi()
ROSE_DLL_API SgModifierType * buildVolatileType(SgType *base_type=nullptr)
Build a volatile type.
ROSE_DLL_API SgFunctionRefExp * buildFunctionRefExp(const SgName &name, const SgType *func_type, SgScopeStatement *scope=NULL)
Build SgFunctionRefExp based on a C++ function's name and function type. It will lookup symbol table ...
ROSE_DLL_API SgTemplateVariableInstantiation * buildTemplateVariableInstantiation(const SgName &name, SgType *type, SgInitializer *varInit, SgScopeStatement *scope, SgTemplateVariableDeclaration *tpl_decl, SgTemplateArgumentPtrList &tpl_args)
Build template variable declarations.
ROSE_DLL_API SgTypeWchar * buildWcharType()
Built in simple types.
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)
Build a SgBasicBlock, setting file info internally.
ROSE_DLL_API SgAggregateInitializer * buildAggregateInitializer(SgExprListExp *initializers=NULL, SgType *type=NULL)
Build an aggregate initializer.
ROSE_DLL_API SgNoexceptOp * buildNoexceptOp_nfi(SgExpression *exp)
Build noexcept operator expression with an expression parameter.
ROSE_DLL_API SgTypeUnknown * buildUnknownType()
Built in simple types.
ROSE_DLL_API SgFoldExpression * buildFoldExpression(SgExpression *operands, std::string operator_token_string, bool is_left_associative)
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)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgTypeIdOp * buildTypeIdOp(SgExpression *operand_expr, SgType *operand_type)
DQ (1/25/2013): Added support for typeId operators.
ROSE_DLL_API SgExprStatement * buildAssignStatement(SgExpression *lhs, SgExpression *rhs)
Build an assignment statement from lefthand operand and right hand operand.
ROSE_DLL_API SgTypeUnsigned128bitInteger * buildUnsigned128bitIntegerType()
Built in simple types.
ROSE_DLL_API SgUnsignedIntVal * buildUnsignedIntVal(unsigned int v=0)
Build an unsigned integer.
SgFunctionRefExp * buildFunctionRefExp_nfi(SgFunctionSymbol *sym)
ROSE_DLL_API SgCharVal * buildCharVal(char value=0)
SgActualArgumentExpression * buildActualArgumentExpression_nfi(SgName arg_name, SgExpression *arg)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgSizeOfOp * buildSizeOfOp(SgExpression *exp=NULL)
Build sizeof() expression with an expression parameter.
ROSE_DLL_API SgMemberFunctionDeclaration * buildNondefiningMemberFunctionDeclaration(const SgName &name, SgType *return_type, SgFunctionParameterList *parlist, SgScopeStatement *scope, SgExprListExp *decoratorList, unsigned int functionConstVolatileFlags, bool buildTemplateInstantiation, SgTemplateArgumentPtrList *templateArgumentsList)
Build a prototype member function declaration.
ROSE_DLL_API SgJavaWildcardType * getUniqueJavaWildcardSuper(SgType *)
Build a SgFile node and attach it to SgProject.
SgTypeTraitBuiltinOperator * buildTypeTraitBuiltinOperator(SgName functionName, SgNodePtrList parameters)
SgCompoundLiteralExp * buildCompoundLiteralExp(SgVariableSymbol *varSymbol)
Build function for compound literals (uses a SgVariableSymbol and is similar to buildVarRefExp()).
ROSE_DLL_API SgTemplateVariableInstantiation * buildTemplateVariableInstantiation_nfi(const SgName &name, SgType *type, SgInitializer *varInit, SgScopeStatement *scope, SgTemplateVariableDeclaration *tpl_decl, SgTemplateArgumentPtrList &tpl_args)
Build a variable declaration, handle symbol table transparently.
SgExprListExp * buildExprListExp_nfi()
ROSE_DLL_API SgType * getTargetFileTypeSupport(SgType *snippet_type, SgScopeStatement *targetScope)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgVariantExpression * buildVariantExpression()
ROSE_DLL_API SgNonrealBaseClass * buildNonrealBaseClass(SgNonrealDecl *classDeclaration, SgClassDefinition *classDefinition, bool isVirtual, bool isDirect)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgTypeSignedInt * buildSignedIntType()
Built in simple types.
ROSE_DLL_API SgBFloat16Val * buildBFloat16Val(float v=0)
Build a bfloat16.
ROSE_DLL_API void fixupCopyOfNodeFromSeparateFileInNewTargetAst(SgStatement *insertionPoint, bool insertionPointIsScope, SgNode *node_copy, SgNode *node_original)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgWcharVal * buildWcharVal(wchar_t value=0)
ROSE_DLL_API SgUnsignedShortVal * buildUnsignedShortValHex(unsigned short v=0)
ROSE_DLL_API SgTemplateMemberFunctionDeclaration * buildDefiningTemplateMemberFunctionDeclaration(const SgName &name, SgType *return_type, SgFunctionParameterList *parlist, SgScopeStatement *scope, SgExprListExp *decoratorList, unsigned int functionConstVolatileFlags, SgTemplateMemberFunctionDeclaration *first_nondefing_declaration)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgVarRefExp * buildOpaqueVarRefExp(const std::string &varName, SgScopeStatement *scope=NULL)
Build a variable reference expression at scope to an opaque variable which has unknown information ex...
ROSE_DLL_API SgTypeUnsignedChar * buildUnsignedCharType()
Built in simple types.
ROSE_DLL_API SgJavaMarkerAnnotation * buildJavaMarkerAnnotation(SgType *)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgUnsignedIntVal * buildUnsignedIntVal_nfi(unsigned int v, const std::string &str)
ROSE_DLL_API SgNaryBooleanOp * buildNaryBooleanOp(SgExpression *lhs)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgModifierType * buildUpcBlockNumberType(SgType *base_type, long block_factor)
Build a UPC shared[n] type.
ROSE_DLL_API SgStatementExpression * buildStatementExpression(SgStatement *exp)
Build a GNU statement expression.
ROSE_DLL_API SgTypeSignedChar * buildSignedCharType()
Built in simple types.
ROSE_DLL_API SgUpcWaitStatement * buildUpcWaitStatement_nfi(SgExpression *exp)
Build a UPC wait statement.
ROSE_DLL_API SgDoubleVal * buildDoubleVal(double value=0.0)
Build a double value expression.
ROSE_DLL_API SgMemberFunctionDeclaration * buildDefaultConstructor(SgClassType *classType)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgUnsignedLongLongIntVal * buildUnsignedLongLongIntVal_nfi(unsigned long long v, const std::string &str)
ROSE_DLL_API SgAutoType * buildAutoType()
Built in simple types.
ROSE_DLL_API SgMemberFunctionRefExp * buildMemberFunctionRefExp(SgMemberFunctionSymbol *sym, bool virtual_call, bool need_qualifier)
ROSE_DLL_API SgFloat16Val * buildFloat16Val(float v=0)
Build a float16.
ROSE_DLL_API SgHereExp * buildHereExpression()
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgPlusPlusOp * buildPlusPlusOp(SgExpression *op=NULL)
ROSE_DLL_API SgComplexVal * buildComplexVal(SgValueExp *real_value, SgValueExp *imaginary_value)
ROSE_DLL_API SgNamespaceDeclarationStatement * buildNamespaceDeclaration_nfi(const SgName &name, bool unnamednamespace, SgScopeStatement *scope)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgIntVal * buildIntVal(int value=0)
Build an integer value expression.
SgYieldExpression * buildYieldExpression_nfi(SgExpression *value)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgChar32Val * buildChar32Val_nfi(unsigned int value, const std::string &str)
ROSE_DLL_API DeclClass * buildClassDeclarationStatement_nfi(const SgName &name, SgClassDeclaration::class_types kind, SgScopeStatement *scope=NULL, SgClassDeclaration *nonDefiningDecl=NULL)
Build a generic class declaration statement (SgClassDeclaration or subclass) with a class declaration...
SgTemplateFunctionRefExp * buildTemplateFunctionRefExp_nfi(SgTemplateFunctionSymbol *sym)
DQ (12/15/2011): Adding template declaration support to the AST.
ROSE_DLL_API SgNullStatement * buildNullStatement()
Build a NULL statement.
ROSE_DLL_API SgUpcNotifyStatement * buildUpcNotifyStatement_nfi(SgExpression *exp)
Build a UPC notify statement.
ROSE_DLL_API SgConstVolatileModifier * buildConstVolatileModifier(SgConstVolatileModifier::cv_modifier_enum mtype=SgConstVolatileModifier::e_unknown)
Build a const/volatile type qualifier.
ROSE_DLL_API SgJavaForEachStatement * buildJavaForEachStatement(SgVariableDeclaration *=NULL, SgExpression *=NULL, SgStatement *=NULL)
Build a Java Foreach statement.
ROSE_DLL_API SgBracedInitializer * buildBracedInitializer(SgExprListExp *initializers=NULL, SgType *expression_type=NULL)
Build an braced initializer.
ROSE_DLL_API SgFunctionType * buildFunctionType(SgType *return_type, SgFunctionParameterTypeList *typeList=nullptr)
Build function type from return type and parameter type list.
ROSE_DLL_API SgScopeStatement * buildScopeStatement(SgClassDefinition *=NULL)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgDictionaryExp * buildDictionaryExp(std::vector< SgKeyDatumPair * > pairs)
Build a list of key-datum pairs.
ROSE_DLL_API SgLambdaCaptureList * buildLambdaCaptureList()
ROSE_DLL_API SgJovialForThenStatement * buildJovialForThenStatement_nfi()
Build a Jovial loop statement.
ROSE_DLL_API SgInitializedName * buildJavaFormalParameter(SgType *, const SgName &, bool is_var_args=false, bool is_final=false)
Build a SgFile node and attach it to SgProject.
SgDeclarationStatement * associatedDeclaration(const SgSymbol &n)
returns the associated declaration for symbol n or nullptr if there is none.
Functions that are useful when operating on the AST.
void initializeIfStmt(SgIfStmt *ifstmt, SgStatement *conditional, SgStatement *true_body, SgStatement *false_body)
Support function used for variable declarations in conditionals.
ROSE_DLL_API void fixNamespaceDeclaration(SgNamespaceDeclarationStatement *structDecl, SgScopeStatement *scope)
Fix symbols, parent and scope pointers. Used internally within appendStatment(), insertStatement() et...
ROSE_DLL_API bool is_Jovial_language()
ROSE_DLL_API bool hasSameGlobalScope(SgStatement *statement_1, SgStatement *statement_2)
This is supporting the recognition of functions in header files from two different ASTs.
ROSE_DLL_API bool language_may_contain_nondeclarations_in_scope()
ROSE_DLL_API void fixStructDeclaration(SgClassDeclaration *structDecl, SgScopeStatement *scope)
Fix symbols, parent and scope pointers. Used internally within appendStatment(), insertStatement() et...
ROSE_DLL_API void appendExpressionList(SgExprListExp *, const std::vector< SgExpression * > &)
Append an expression list to a SgExprListExp, set the parent pointers also.
ROSE_DLL_API int set_name(SgInitializedName *initializedNameNode, SgName new_name)
set_name of symbol in symbol table.
ROSE_DLL_API SgVariableSymbol * getFirstVarSym(SgVariableDeclaration *decl)
Get the variable symbol for the first initialized name of a declaration stmt.
void initializeSwitchStatement(SgSwitchStatement *switchStatement, SgStatement *item_selector, SgStatement *body)
Support function used for variable declarations in conditionals.
ROSE_DLL_API void setOneSourcePositionForTransformation(SgNode *root)
Set current node's source position as transformation generated.
PreprocessingInfo * attachComment(SgSourceFile *source_file, const std::string &content, PreprocessingInfo::DirectiveType directive_type=PreprocessingInfo::C_StyleComment, PreprocessingInfo::RelativePositionType position=PreprocessingInfo::before)
Build and attach comment onto the global scope of a source file.
ROSE_DLL_API SgInitializedName * getFirstInitializedName(SgVariableDeclaration *decl)
Get the first initialized name of a declaration statement.
ROSE_DLL_API void reportModifiedStatements(const std::string &label, SgNode *node)
Connect variable reference to the right variable symbols when feasible, return the number of referenc...
ROSE_DLL_API void setSourcePositionForTransformation(SgNode *root)
Recursively set source position info(Sg_File_Info) as transformation generated.
ROSE_DLL_API SgGlobal * getGlobalScope(const SgNode *astNode)
Traverse back through a node's parents to find the enclosing global scope.
ROSE_DLL_API bool templateArgumentListEquivalence(const SgTemplateArgumentPtrList &list1, const SgTemplateArgumentPtrList &list2)
Verify that 2 SgTemplateArgumentPtrList are equivalent.
ROSE_DLL_API void reportModifiedLocatedNodes(const std::string &label, SgNode *node)
Connect variable reference to the right variable symbols when feasible, return the number of referenc...
void initializeWhileStatement(SgWhileStmt *whileStatement, SgStatement *condition, SgStatement *body, SgStatement *else_body)
Support function used for variable declarations in conditionals.
ROSE_DLL_API void setSourcePosition(SgNode *node)
Set the source code positon for the current (input) node.
bool isStructurallyEquivalentAST(SgNode *tree1, SgNode *tree2)
Collect all read and write references within stmt, which can be a function, a scope statement,...
ROSE_DLL_API bool is_language_case_insensitive()
ROSE_DLL_API SgFunctionSymbol * lookupFunctionSymbolInParentScopes(const SgName &functionName, SgScopeStatement *currentScope=NULL)
look up the first matched function symbol in parent scopes given only a function name,...
ROSE_DLL_API SgFile * getEnclosingFileNode(SgNode *astNode)
get the SgFile node from current node
bool ROSE_DLL_API isAncestor(SgNode *node1, SgNode *node2)
check if node1 is a strict ancestor of node 2. (a node is not considered its own ancestor)
ROSE_DLL_API void resetModifiedLocatedNodes(const std::set< SgLocatedNode * > &modifiedNodeSet)
Use the set of IR nodes and set the isModified flag in each IR node to true.
ROSE_DLL_API SgEnumSymbol * lookupEnumSymbolInParentScopes(const SgName &name, SgScopeStatement *currentScope=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
ROSE_DLL_API SgTypedefSymbol * lookupTypedefSymbolInParentScopes(const SgName &name, SgScopeStatement *currentScope=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
ROSE_DLL_API bool is_Fortran_language()
ROSE_DLL_API SgVariableSymbol * lookupVariableSymbolInParentScopes(const SgName &name, SgScopeStatement *currentScope=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
ROSE_DLL_API void outputFileIds(SgNode *node)
Connect variable reference to the right variable symbols when feasible, return the number of referenc...
ROSE_DLL_API SgTemplateClassSymbol * lookupTemplateClassSymbolInParentScopes(const SgName &name, SgTemplateParameterPtrList *templateParameterList, SgTemplateArgumentPtrList *templateArgumentList, SgScopeStatement *cscope=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
void collectVarRefs(SgLocatedNode *root, std::vector< SgVarRefExp * > &result)
Collect all variable references in a subtree.
ROSE_DLL_API SgVariableSymbol * appendArg(SgFunctionParameterList *, SgInitializedName *)
Append an argument to SgFunctionParameterList, transparently set parent,scope, and symbols for argume...
ROSE_DLL_API int fixVariableReferences(SgNode *root, bool cleanUnusedSymbol=true)
Connect variable reference to the right variable symbols when feasible, return the number of referenc...
ROSE_DLL_API void appendStatement(SgStatement *stmt, SgScopeStatement *scope=NULL)
Append a statement to the end of the current scope, handle side effect of appending statements,...
ROSE_DLL_API void setOneSourcePositionNull(SgNode *node)
Set current node's source position as NULL.
ROSE_DLL_API void fixVariableDeclaration(SgVariableDeclaration *varDecl, SgScopeStatement *scope)
Patch up symbol, scope, and parent information when a SgVariableDeclaration's scope is known.
ROSE_DLL_API SgFunctionDefinition * getEnclosingProcedure(SgNode *n, const bool includingSelf=false)
Find the function definition.
std::string get_name(const SgNode *node)
Generate a useful name to describe the SgNode.
ROSE_DLL_API bool is_Ada_language()
ROSE_DLL_API std::set< SgLocatedNode * > collectModifiedLocatedNodes(SgNode *node)
This collects the SgLocatedNodes that are marked as modified (a flag automatically set by all set_* g...
ROSE_DLL_API void fixLabelStatement(SgLabelStatement *label_stmt, SgScopeStatement *scope)
Fix symbol table for SgLabelStatement. Used Internally when the label is built without knowing its ta...
ROSE_DLL_API void appendStatementList(const std::vector< SgStatement * > &stmt, SgScopeStatement *scope=NULL)
Append a list of statements to the end of the current scope, handle side effect of appending statemen...
bool hasTemplateSyntax(const SgName &name)
Collect all read and write references within stmt, which can be a function, a scope statement,...
ROSE_DLL_API SgClassSymbol * lookupClassSymbolInParentScopes(const SgName &name, SgScopeStatement *currentScope=NULL, SgTemplateArgumentPtrList *templateArgumentList=NULL)
Find a symbol in current and ancestor scopes for a given variable name, starting from top of ScopeSta...
ROSE_DLL_API void appendExpression(SgExprListExp *, SgExpression *)
Append an expression to a SgExprListExp, set the parent pointer also.
ROSE_DLL_API void prependStatement(SgStatement *stmt, SgScopeStatement *scope=NULL)
Prepend a statement to the beginning of the current scope, handling side effects as appropriate.
ROSE_DLL_API void setSourcePositionAtRootAndAllChildren(SgNode *root)
Set the source code positon for the subtree (including the root).
ROSE_DLL_API SgExpression * copyExpression(SgExpression *e)
Deep copy an expression.
void setParameterList(actualFunction *func, SgFunctionParameterList *paralist)
Set parameter list for a function declaration, considering existing parameter list etc.
ROSE_DLL_API SgFunctionType * findFunctionType(SgType *return_type, SgFunctionParameterTypeList *typeList)
Find the function type matching a function signature plus a given return type.