2#include <rose_config.h>
4#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
5 #include "roseAdapter.h"
6 #include "markLhsValues.h"
11 #include "transformationSupport.h"
14#include <boost/algorithm/string/trim.hpp>
15#include "AstConsistencyTests.h"
24#define BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS 0
25#define BUILDER_MAKE_REDUNDANT_CALLS_TO_SYMBOL_TABLE_LOOKUP 0
32namespace EDG_ROSE_Translation
37#if defined(ROSE_BUILD_CXX_LANGUAGE_SUPPORT) && !defined(ROSE_USE_CLANG_FRONTEND)
39 extern bool suppress_detection_of_transformations;
42 bool suppress_detection_of_transformations;
54 static bool initialized =
false;
64template <
class actualFunction>
70template <
class actualFunction>
105 ASSERT_not_null(classType);
107 SgClassDeclaration* classDeclaration = isSgClassDeclaration(classType->get_declaration());
108 ASSERT_not_null(classDeclaration);
110 SgName className = classDeclaration->get_name();
113 ASSERT_not_null(definingClassDeclaration);
115 ASSERT_not_null(classDefinition);
118 ASSERT_not_null(functionParameterList);
122 ASSERT_not_null(return_type);
125 bool buildTemplateInstantiation =
false;
128 unsigned int functionConstVolatileFlags = 0;
130 SgTemplateArgumentPtrList templateArgumentsList;
133 classDefinition, decoratorList, functionConstVolatileFlags, buildTemplateInstantiation, &templateArgumentsList);
134 ASSERT_not_null(first_nondefining_declaration);
136 first_nondefining_declaration->get_specialFunctionModifier().setConstructor();
137 ROSE_ASSERT(first_nondefining_declaration->get_specialFunctionModifier().isConstructor() ==
true);
147 classDefinition, decoratorList, buildTemplateInstantiation, functionConstVolatileFlags, first_nondefining_declaration, &templateArgumentsList);
148 ASSERT_not_null(memberFunctionDeclaration);
150 memberFunctionDeclaration->get_specialFunctionModifier().setConstructor();
151 ROSE_ASSERT(memberFunctionDeclaration->get_specialFunctionModifier().isConstructor() ==
true);
157 memberFunctionDeclaration->get_declarationModifier().get_accessModifier().setPublic();
159 ROSE_ASSERT (memberFunctionDeclaration->get_declarationModifier().get_accessModifier().isPublic() ==
true);
161 return memberFunctionDeclaration;
186 case e_sourcePositionError: s =
"e_sourcePositionError";
break;
196 printf (
"Error: default reached in SageBuilder::display(SourcePositionClassification & scp): scp = %d \n",scp);
210SgScopeStatement::find_symbol_by_type_of_function (
const SgName & name,
const SgType* func_type, SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateArgumentsList)
237 switch((VariantT)T::static_variant)
239 case V_SgFunctionDeclaration:
240 case V_SgProcedureHeaderStatement:
241 case V_SgTemplateInstantiationFunctionDecl:
244 if ((VariantT)T::static_variant == V_SgTemplateInstantiationFunctionDecl)
246 ROSE_ASSERT(templateArgumentsList != NULL);
250 ROSE_ASSERT(templateArgumentsList == NULL);
254 func_symbol = lookup_nontemplate_function_symbol(name,func_type,templateArgumentsList);
256 ROSE_ASSERT(isSgTemplateFunctionSymbol(func_symbol) == NULL);
260 case V_SgMemberFunctionDeclaration:
261 case V_SgTemplateInstantiationMemberFunctionDecl:
265 if ((VariantT)T::static_variant == V_SgTemplateInstantiationMemberFunctionDecl)
267 ROSE_ASSERT(templateArgumentsList != NULL);
271 ROSE_ASSERT(templateArgumentsList == NULL);
273 func_symbol = lookup_nontemplate_member_function_symbol(name,func_type,templateArgumentsList);
277 case V_SgTemplateFunctionDeclaration:
281 ROSE_ASSERT(templateArgumentsList == NULL);
284 ROSE_ASSERT(templateParameterList != NULL);
294 func_symbol = lookup_template_function_symbol(name,func_type,templateParameterList);
299 case V_SgTemplateMemberFunctionDeclaration:
303 ROSE_ASSERT(templateArgumentsList == NULL);
306 ROSE_ASSERT(templateParameterList != NULL);
311 func_symbol = lookup_template_member_function_symbol(name,func_type,templateParameterList);
317 printf (
"In SgScopeStatement::find_symbol_by_type_of_function(): default reached --- variantT(T::static_variant) = %d \n",T::static_variant);
327template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgTemplateFunctionDeclaration>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
328template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgTemplateInstantiationMemberFunctionDecl>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
329template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgTemplateInstantiationFunctionDecl>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
330template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgMemberFunctionDeclaration>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
331template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgTemplateMemberFunctionDeclaration>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
332template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgFunctionDeclaration>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
337 ASSERT_not_null(stmt);
375 ASSERT_not_null(isSgGlobal(tempScope));
393 bool returnVar =
false;
394 std::list<SgScopeStatement*>::iterator i;
397 if (isSgSwitchStatement(*i) !=
nullptr)
422#define DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST 0
424#if DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST
425 printf (
"In SageBuilder::appendTemplateArgumentsToName(): CRITICAL FUNCTION TO BE REFACTORED (name = %s) \n",name.str());
430 ASSERT_not_null(info);
433 info->set_requiresGlobalNameQualification();
436 info->set_SkipClassDefinition();
437 info->set_SkipEnumDefinition();
438 info->set_use_generated_name_for_template_arguments(
true);
440 bool emptyArgumentList = templateArgumentsList.empty();
445 if (emptyArgumentList ==
false)
448 SgTemplateArgumentPtrList::const_iterator i = templateArgumentsList.begin();
449 bool need_separator =
false;
451 bool exit_after_name_is_generated =
false;
453 while (i != templateArgumentsList.end())
466#if DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST
467 printf (
"In SageBuilder::appendTemplateArgumentsToName(): (top of loop) templateArgumentsList element *i = %p = %s returnName = %s \n",*i,(*i)->class_name().c_str(),returnName.str());
477 bool used_fully_qualified_name =
false;
479#define DEBUG_TEMPLATE_ARGUMENT_NAMES 0
484 ASSERT_not_null(templateArgument);
491 ASSERT_not_null(type);
493#if DEBUG_TEMPLATE_ARGUMENT_NAMES
494 printf (
"In SageBuilder::appendTemplateArgumentsToName(): case SgTemplateArgument::type_argument: BEFORE stripType: type = %p = %s \n",type,type->
class_name().c_str());
497#if DEBUG_TEMPLATE_ARGUMENT_NAMES
498 printf (
"In SageBuilder::appendTemplateArgumentsToName(): case SgTemplateArgument::type_argument: AFTER stripType: type = %p = %s \n",type,type->
class_name().c_str());
501 if (isSgPointerType(templateArgument->
get_type()) !=
nullptr)
504#if DEBUG_TEMPLATE_ARGUMENT_NAMES
505 printf (
"Found a templateArgument->get_type() that is SgPointerType: name = %s \n",name.str());
510 if (namedType !=
nullptr)
514 ASSERT_not_null(declaration);
518 case V_SgTemplateInstantiationDecl:
519 case V_SgTemplateClassDeclaration:
520 case V_SgClassDeclaration:
523 string fully_qualified_name = classDeclaration->get_qualified_name();
524#if DEBUG_TEMPLATE_ARGUMENT_NAMES
525 printf (
"fully_qualified_name = %s \n",fully_qualified_name.c_str());
527 returnName += fully_qualified_name;
528 used_fully_qualified_name =
true;
532 case V_SgTemplateInstantiationTypedefDeclaration:
533 case V_SgTemplateTypedefDeclaration:
534 case V_SgTypedefDeclaration:
537 string fully_qualified_name = typedefDeclaration->get_qualified_name();
538#if DEBUG_TEMPLATE_ARGUMENT_NAMES
539 printf (
"fully_qualified_name = %s \n",fully_qualified_name.c_str());
541 returnName += fully_qualified_name;
542 used_fully_qualified_name =
true;
546 case V_SgEnumDeclaration:
549 string fully_qualified_name = enumDeclaration->get_qualified_name();
550#if DEBUG_TEMPLATE_ARGUMENT_NAMES
551 printf (
"fully_qualified_name = %s \n",fully_qualified_name.c_str());
553 returnName += fully_qualified_name;
554 used_fully_qualified_name =
true;
559 case V_SgNonrealDecl:
561 SgNonrealDecl* nonrealDeclaration = isSgNonrealDecl(declaration);
562 string fully_qualified_name = nonrealDeclaration->get_qualified_name();
563#if DEBUG_TEMPLATE_ARGUMENT_NAMES
564 printf (
"fully_qualified_name = %s \n",fully_qualified_name.c_str());
566 returnName += fully_qualified_name;
567 used_fully_qualified_name =
true;
574 printf (
"In SageBuilder::appendTemplateArgumentsToName(): default reached: get_type() != NULL: declaration = %s \n",declaration->
class_name().c_str());
581#if DEBUG_TEMPLATE_ARGUMENT_NAMES
582 printf (
"In SageBuilder::appendTemplateArgumentsToName(): not a SgNamedType: get_type() != NULL: type = %s \n",type->
class_name().c_str());
592 ROSE_ASSERT (templateArgument->
get_expression() != NULL || templateArgument->get_initializedName() != NULL);
593 ROSE_ASSERT (templateArgument->
get_expression() == NULL || templateArgument->get_initializedName() == NULL);
597 ASSERT_not_null(expression);
601 SgVarRefExp* varRefExp = isSgVarRefExp(expression);
602 if (varRefExp !=
nullptr)
606 ROSE_ASSERT(variableSymbol != NULL);
608 ROSE_ASSERT(initializedName != NULL);
610#if DEBUG_TEMPLATE_ARGUMENT_NAMES
611 printf (
"fully_qualified_name = %s \n",fully_qualified_name.c_str());
613 returnName += fully_qualified_name;
614 used_fully_qualified_name =
true;
619#if DEBUG_TEMPLATE_ARGUMENT_NAMES
620 printf (
"In SageBuilder::appendTemplateArgumentsToName(): Case of template argument varRefExp == NULL: expression = %p = %s \n",
628 ROSE_ASSERT(initializedName != NULL);
629 printf (
"initializedName = %p = %s \n",initializedName,initializedName->get_name().str());
631 printf (
"In SageBuilder::appendTemplateArgumentsToName(): Case of template argument initializedName != NULL: Unclear what do do in this case \n");
641 ASSERT_not_null(decl);
642#if DEBUG_TEMPLATE_ARGUMENT_NAMES
643 printf (
"In SageBuilder::appendTemplateArgumentsToName(): case SgTemplateArgument::template_template_argument: decl = %p = %s \n",decl,decl->
class_name().c_str());
645 exit_after_name_is_generated =
true;
647 ROSE_ASSERT(tpl_decl == NULL);
654#if DEBUG_TEMPLATE_ARGUMENT_NAMES
655 printf(
"WARNING: start_of_pack_expansion_argument in evaluateNameQualificationForTemplateArgumentList (can happen from some debug output)\n");
663 printf(
"Error argument_undefined in evaluateNameQualificationForTemplateArgumentList \n");
671 printf(
"Error default reached in evaluateNameQualificationForTemplateArgumentList \n");
680 if (used_fully_qualified_name ==
false)
685#if DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST
686 printf (
"In SageBuilder::appendTemplateArgumentsToName(): (after appending template name) *i = %p returnName = %s \n",*i,returnName.str());
688 need_separator =
true;
691#if DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST
692 printf (
"In SageBuilder::appendTemplateArgumentsToName(): (bottom of loop) returnName = %s \n",returnName.str());
696 if (emptyArgumentList ==
false)
699#if DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST || DEBUG_TEMPLATE_ARGUMENT_NAMES
700 printf (
"Leaving SageBuilder::appendTemplateArgumentsToName(): returnName = %s \n",returnName.str());
706 if (exit_after_name_is_generated ==
true)
708 printf (
"Exiting as a test! \n");
723 ROSE_ASSERT(templateArgument != NULL);
726 ROSE_ASSERT(info != NULL);
731 info->set_SkipClassDefinition();
732 info->set_SkipEnumDefinition();
733 info->set_use_generated_name_for_template_arguments(
true);
744SgTemplateArgumentPtrList*
750 ROSE_ASSERT(decl != NULL);
752 SgTemplateArgumentPtrList* templateArgumentsList =
nullptr;
756 case V_SgNamespaceAliasDeclarationStatement:
757 case V_SgNamespaceDeclarationStatement:
758 case V_SgEnumDeclaration:
759 case V_SgVariableDeclaration:
760 case V_SgTypedefDeclaration:
761 case V_SgProcedureHeaderStatement:
762 case V_SgJovialTableStatement:
763 case V_SgJavaPackageDeclaration:
764 case V_SgFunctionDeclaration:
765 case V_SgMemberFunctionDeclaration:
766 case V_SgClassDeclaration:
768 templateArgumentsList =
nullptr;
772 case V_SgTemplateInstantiationDecl:
778 case V_SgTemplateClassDeclaration:
780 templateArgumentsList = &(isSgTemplateClassDeclaration(decl)->get_templateSpecializationArguments());
784 case V_SgTemplateInstantiationFunctionDecl:
790 case V_SgTemplateFunctionDeclaration:
792 templateArgumentsList = &(isSgTemplateFunctionDeclaration(decl)->get_templateSpecializationArguments());
796 case V_SgTemplateInstantiationMemberFunctionDecl:
798 templateArgumentsList = &(isSgTemplateInstantiationMemberFunctionDecl(decl)->
get_templateArguments());
802 case V_SgTemplateMemberFunctionDeclaration:
804 templateArgumentsList = &(isSgTemplateMemberFunctionDeclaration(decl)->get_templateSpecializationArguments());
808 case V_SgTemplateVariableDeclaration:
810 templateArgumentsList = &(isSgTemplateVariableDeclaration(decl)->get_templateSpecializationArguments());
814 case V_SgTemplateVariableInstantiation:
816 templateArgumentsList = &(isSgTemplateVariableInstantiation(decl)->get_templateArguments());
820 case V_SgTemplateTypedefDeclaration:
822 templateArgumentsList = &(isSgTemplateTypedefDeclaration(decl)->get_templateSpecializationArguments());
826 case V_SgTemplateInstantiationTypedefDeclaration:
828 templateArgumentsList = &(isSgTemplateInstantiationTypedefDeclaration(decl)->get_templateArguments());
832 case V_SgTemplateDeclaration:
834 templateArgumentsList =
nullptr;
838 case V_SgNonrealDecl:
840 templateArgumentsList = &(isSgNonrealDecl(decl)->get_tpl_args());
846 printf (
"getTemplateArgumentList(): Default reached in switch: decl = %p = %s \n",decl,decl->
class_name().c_str());
851 return templateArgumentsList;
856SgTemplateParameterPtrList*
862 ROSE_ASSERT(decl != NULL);
864 SgTemplateParameterPtrList* templateParameterList =
nullptr;
868 case V_SgNamespaceAliasDeclarationStatement:
869 case V_SgNamespaceDeclarationStatement:
870 case V_SgEnumDeclaration:
871 case V_SgVariableDeclaration:
872 case V_SgTypedefDeclaration:
873 case V_SgProcedureHeaderStatement:
874 case V_SgJovialTableStatement:
875 case V_SgJavaPackageDeclaration:
876 case V_SgFunctionDeclaration:
877 case V_SgMemberFunctionDeclaration:
878 case V_SgClassDeclaration:
879 case V_SgTemplateInstantiationTypedefDeclaration:
880 case V_SgTemplateInstantiationFunctionDecl:
881 case V_SgTemplateInstantiationMemberFunctionDecl:
882 case V_SgTemplateVariableInstantiation:
883 case V_SgTemplateInstantiationDecl:
885 templateParameterList =
nullptr;
889 case V_SgTemplateClassDeclaration:
891 templateParameterList = &(isSgTemplateClassDeclaration(decl)->get_templateParameters());
895 case V_SgTemplateFunctionDeclaration:
897 templateParameterList = &(isSgTemplateFunctionDeclaration(decl)->get_templateParameters());
901 case V_SgTemplateMemberFunctionDeclaration:
903 templateParameterList = &(isSgTemplateMemberFunctionDeclaration(decl)->get_templateParameters());
907 case V_SgTemplateVariableDeclaration:
909 templateParameterList = &(isSgTemplateVariableDeclaration(decl)->get_templateParameters());
913 case V_SgTemplateTypedefDeclaration:
915 templateParameterList = &(isSgTemplateTypedefDeclaration(decl)->get_templateParameters());
919 case V_SgNonrealDecl:
921 templateParameterList = &(isSgNonrealDecl(decl)->get_tpl_params());
925 case V_SgTemplateDeclaration:
927 templateParameterList = &(isSgTemplateDeclaration(decl)->get_templateParameters());
933 printf (
"getTemplateParameterList(): Default reached in switch: decl = %p = %s \n",decl,decl->
class_name().c_str());
938 return templateParameterList;
948 ROSE_ASSERT(decl != NULL);
952 if (templateArgumentsList !=
nullptr)
955 ROSE_ASSERT(first_decl != NULL);
957 SgTemplateArgumentPtrList::iterator i = templateArgumentsList->begin();
958 while (i != templateArgumentsList->end())
961 if (parent ==
nullptr)
968 if (scope !=
nullptr)
972 (*i)->set_parent(first_decl);
977 if (declaration !=
nullptr)
979#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
980 printf (
"In setTemplateArgumentParents(): Template argument already set to declaration = %p = %s \n",declaration,declaration->
class_name().c_str());
985#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
986 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());
1004 ROSE_ASSERT(decl != NULL);
1008 if (templateParameterList !=
nullptr)
1011 ROSE_ASSERT(first_decl != NULL);
1013 SgTemplateParameterPtrList::iterator i = templateParameterList->begin();
1014 while (i != templateParameterList->end())
1017 if (parent ==
nullptr)
1024 if (scope !=
nullptr)
1028 (*i)->set_parent(first_decl);
1045 ROSE_ASSERT(decl != NULL);
1049 if (templateArgumentsList !=
nullptr)
1051 SgTemplateArgumentPtrList::iterator i = templateArgumentsList->begin();
1052 while (i != templateArgumentsList->end())
1055 if (parent ==
nullptr)
1057 printf (
"Error: In testTemplateArgumentParents(): decl = %p = %s has template argument = %p with null parent \n",decl,decl->
class_name().c_str(),*i);
1059 ROSE_ASSERT(parent != NULL);
1078 ROSE_ASSERT(decl != NULL);
1082 if (templateParameterList !=
nullptr)
1084 SgTemplateParameterPtrList::iterator i = templateParameterList->begin();
1085 while (i != templateParameterList->end())
1088 if (parent ==
nullptr)
1090 printf (
"Error: In testTemplateParameterParents(): decl = %p = %s has template argument = %p with null parent \n",decl,decl->
class_name().c_str(),*i);
1092 ROSE_ASSERT(parent != NULL);
1111 ROSE_ASSERT(templateArgumentsList_input != NULL);
1113 ROSE_ASSERT(decl->
variantT() == V_SgTemplateInstantiationDecl ||
1114 decl->
variantT() == V_SgTemplateInstantiationFunctionDecl ||
1115 decl->
variantT() == V_SgTemplateInstantiationMemberFunctionDecl ||
1116 decl->
variantT() == V_SgTemplateInstantiationTypedefDeclaration);
1120 if (templateArgumentsList_from_declaration !=
nullptr)
1122 *templateArgumentsList_from_declaration = *templateArgumentsList_input;
1137 ROSE_ASSERT(templateSpecializationArgumentsList_input != NULL);
1139 ROSE_ASSERT(decl->
variantT() == V_SgTemplateClassDeclaration || decl->
variantT() == V_SgTemplateFunctionDeclaration ||
1140 decl->
variantT() == V_SgTemplateMemberFunctionDeclaration || decl->
variantT() == V_SgTemplateVariableDeclaration );
1142 SgTemplateArgumentPtrList* templateSpecializationArgumentsList_from_declaration =
getTemplateArgumentList(decl);
1144 if (templateSpecializationArgumentsList_from_declaration !=
nullptr)
1146 *templateSpecializationArgumentsList_from_declaration = *templateSpecializationArgumentsList_input;
1160 ROSE_ASSERT(templateParameterList_input != NULL);
1162 ROSE_ASSERT(decl->
variantT() == V_SgTemplateClassDeclaration || decl->
variantT() == V_SgTemplateFunctionDeclaration ||
1163 decl->
variantT() == V_SgTemplateMemberFunctionDeclaration || decl->
variantT() == V_SgTemplateVariableDeclaration );
1167 if (templateParameterList_from_declaration !=
nullptr)
1169 *templateParameterList_from_declaration = *templateParameterList_input;
1178#define DEBUG__buildInitializedName 0
1184#if DEBUG__buildInitializedName
1185 std::cout <<
"SageBuilder::buildInitializedName" << std::endl;
1186 std::cout <<
" name = " << name << std::endl;
1188 ASSERT_not_null(type);
1191 ROSE_ASSERT(initializedName);
1194 return initializedName;
1203 string var_name(name);
1208#if DEBUG__buildInitializedName
1209 std::cout <<
"SageBuilder::buildInitializedName_nfi" << std::endl;
1210 std::cout <<
" name = " << name << std::endl;
1212 ROSE_ASSERT(type != NULL);
1215 ROSE_ASSERT(initializedName != NULL);
1220 initializedName->set_declptr(declptr);
1225 return initializedName;
1235 if (scope ==
nullptr)
1237 ROSE_ASSERT(name.is_null() ==
false);
1238 ROSE_ASSERT(type != NULL);
1241 ROSE_ASSERT(varDecl);
1248 if (scope !=
nullptr)
1254 bool isFortranParameter =
false;
1258 if (f_def !=
nullptr)
1262 if (v_symbol !=
nullptr)
1266 ROSE_ASSERT (default_initName != NULL);
1268 ROSE_ASSERT (new_initName != NULL);
1269 ROSE_ASSERT (default_initName != new_initName);
1272 std::replace (n_list.begin(), n_list.end(),default_initName, new_initName );
1273 ROSE_ASSERT (varDecl->get_decl_item (name)==new_initName);
1277 ROSE_ASSERT (old_parent != NULL);
1278 ROSE_ASSERT (isSgFunctionParameterList(old_parent) != NULL);
1286 ROSE_ASSERT (var_def != NULL);
1289 new_initName->set_declptr(var_def);
1291 delete (default_initName);
1297 isFortranParameter =
true;
1301 if (! isFortranParameter)
1307 ROSE_ASSERT(initName != NULL);
1308 ROSE_ASSERT((initName->get_declptr())!=NULL);
1319 unsetNodesMarkedAsModified(varDecl);
1332#define DEBUG_BUILD_VARIABLE_DECLARATION 0
1334#if DEBUG_BUILD_VARIABLE_DECLARATION
1335 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): name = %s scope = %p varInit = %p \n",name.str(),scope,varInit);
1336 if (scope !=
nullptr)
1338 printf (
" --- scope = %p = %s \n",scope,scope->
class_name().c_str());
1342 if (scope ==
nullptr)
1344#if DEBUG_BUILD_VARIABLE_DECLARATION
1345 printf (
"Scope determined from the SageBuilder::topScopeStack() \n");
1350 ROSE_ASSERT (scope != NULL);
1351 ROSE_ASSERT(type != NULL);
1356#if DEBUG_BUILD_VARIABLE_DECLARATION
1357 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): variableSymbol = %p \n",variableSymbol);
1362 if (variableSymbol ==
nullptr)
1365#if DEBUG_BUILD_VARIABLE_DECLARATION
1367 ROSE_ASSERT(tmp_initializedName != NULL);
1368 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): variableSymbol == NULL: varDecl = %p: initializedName = %p = %s \n",varDecl,tmp_initializedName,tmp_initializedName->get_name().str());
1369 printf (
" --- tmp_initializedName->get_initptr() = %p \n",tmp_initializedName->get_initptr());
1372 if (builtFromUseOnly ==
true)
1374#if DEBUG_BUILD_VARIABLE_DECLARATION
1375 printf (
"In buildVariableDeclaration_nfi(): this is the first reference to this variable: building a new SgVariableDeclaration: varDecl = %p name = %s \n",varDecl,name.str());
1377 varDecl->set_builtFromUseOnly(
true);
1383 ROSE_ASSERT(initializedName != NULL);
1387#if DEBUG_BUILD_VARIABLE_DECLARATION
1388 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): initializedName->get_parent() = %p \n",initializedName->
get_parent());
1389 if (initializedName->
get_parent() !=
nullptr)
1391 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): initializedName->get_parent() = %p = %s \n",initializedName->
get_parent(),initializedName->
get_parent()->
class_name().c_str());
1393 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): associatedVariableDeclaration = %p \n",associatedVariableDeclaration);
1395#if DEBUG_BUILD_VARIABLE_DECLARATION
1398 if (associatedVariableDeclaration !=
nullptr && associatedVariableDeclaration->
get_parent() !=
nullptr)
1400 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): associatedVariableDeclaration->get_parent() = %p = %s \n",
1405#if DEBUG_BUILD_VARIABLE_DECLARATION
1406 printf (
"associatedVariableDeclaration = %p \n",associatedVariableDeclaration);
1407 if (associatedVariableDeclaration !=
nullptr)
1409 printf (
"associatedVariableDeclaration->get_builtFromUseOnly() = %s \n",associatedVariableDeclaration->get_builtFromUseOnly() ?
"true" :
"false");
1414 bool reuseTheAssociatedVariableDeclaration = ((associatedVariableDeclaration !=
nullptr) && (associatedVariableDeclaration->get_builtFromUseOnly() ==
true));
1415 if (reuseTheAssociatedVariableDeclaration ==
true)
1421 ROSE_ASSERT(associatedVariableDeclaration != NULL);
1424 varDecl = associatedVariableDeclaration;
1427 varDecl->set_builtFromUseOnly(
false);
1436#if DEBUG_BUILD_VARIABLE_DECLARATION
1437 if (
variable->get_initptr() !=
nullptr)
1439 printf (
"Found initializer associated with variable declaration being reused: variable = %p name = %s \n",
variable,
variable->get_name().str());
1447 ROSE_ASSERT(reuseTheAssociatedVariableDeclaration ==
false);
1453 if (associatedVariableDeclaration ==
nullptr)
1455 ROSE_ASSERT(initializedName->
get_parent() != NULL);
1457 if (scopeStatement !=
nullptr)
1459#if DEBUG_BUILD_VARIABLE_DECLARATION
1460 printf (
"scopeStatement = %p = %s \n",scopeStatement,scopeStatement->
class_name().c_str());
1465#if DEBUG_BUILD_VARIABLE_DECLARATION
1477#if DEBUG_BUILD_VARIABLE_DECLARATION
1478 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): initializedName->get_scope() = %p = %s \n",initializedName->get_scope(),initializedName->get_scope()->
class_name().c_str());
1481 if (scopeStatement !=
nullptr)
1483 additional_variable = initializedName;
1484 if (additional_variable->get_initptr() !=
nullptr)
1486#if DEBUG_BUILD_VARIABLE_DECLARATION
1487 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): borrowed SgInitializedName is alread initialized \n");
1488 printf (
" --- additional_variable->get_initptr() = %p \n",additional_variable->get_initptr());
1489 printf (
" --- varInit = %p \n",varInit);
1496 additional_variable->set_initptr(varInit);
1499#if DEBUG_BUILD_VARIABLE_DECLARATION || 0
1500 printf (
" --- additional_variable->get_scope() = %p = %s \n",additional_variable->get_scope(),additional_variable->get_scope()->
class_name().c_str());
1501 printf (
" --- Reusing the SgInitializedName (not associated with a previous SgVariableDeclaration where the parent is a SgScopeStatement) \n");
1506#if DEBUG_BUILD_VARIABLE_DECLARATION
1507 printf (
" --- Building a new SgInitializedName \n");
1512#if DEBUG_BUILD_VARIABLE_DECLARATION
1513 ROSE_ASSERT(initializedName->get_scope() != NULL);
1517 if (additional_variable != initializedName)
1519 additional_variable->set_prev_decl_item(initializedName);
1524#if DEBUG_BUILD_VARIABLE_DECLARATION
1525 ROSE_ASSERT(initializedName->
get_parent() != NULL);
1527 ROSE_ASSERT(additional_variable->
get_parent() != NULL);
1528 printf (
"additional_variable->get_parent() = %p = %s \n",additional_variable->
get_parent(),additional_variable->
get_parent()->
class_name().c_str());
1533 ASSERT_not_null(initializedName->get_scope());
1536 if (additional_variable != initializedName)
1538 additional_variable->set_scope(initializedName->get_scope());
1542#if DEBUG_BUILD_VARIABLE_DECLARATION
1543 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): After sharing the exisitng SgInitializedName: initializedName = %p = %s \n",initializedName,initializedName->get_name().str());
1544 printf (
" --- initializedName->get_initptr() = %p \n",initializedName->get_initptr());
1545 printf (
" --- additional_variable->get_initptr() = %p \n",additional_variable->get_initptr());
1555 ASSERT_not_null(varDecl);
1557 varDecl->get_declarationModifier().get_storageModifier().set_modifier(sm);
1578 ASSERT_not_null(initName);
1579 ASSERT_not_null(initName->get_declptr());
1581 if (initName->get_scope())
1584#if DEBUG_BUILD_VARIABLE_DECLARATION
1585 printf (
"WARNING: Note in buildVariableDeclaration_nfi(): initName->get_scope() == NULL \n");
1593 SgVariableDefinition* variableDefinition_original = isSgVariableDefinition(initName->get_declptr());
1594 ASSERT_not_null(variableDefinition_original);
1609 unsetNodesMarkedAsModified(varDecl);
1611 ASSERT_not_null(varDecl);
1613#if DEBUG_BUILD_VARIABLE_DECLARATION
1614 printf (
"Leaving buildVariableDeclaration_nfi(): varDecl = %p varDecl->get_parent() = %p \n",varDecl,varDecl->
get_parent());
1626 ASSERT_not_null(decl);
1627 ASSERT_not_null(init_name);
1631 if (!isSgFunctionType(init_name->get_type()))
1637 ROSE_ASSERT (copyOfFileInfo != NULL);
1641 ROSE_ASSERT (defn_stmt != NULL);
1659 ROSE_ASSERT(defn_stmt != NULL);
1662 defn_stmt =
nullptr;
1678 ROSE_ASSERT (scope != NULL);
1679 ROSE_ASSERT(type != NULL);
1682 ROSE_ASSERT(varDecl);
1698 ROSE_ASSERT(initName);
1699 ROSE_ASSERT((initName->get_declptr())!=NULL);
1704 SgVariableDefinition* variableDefinition_original = isSgVariableDefinition(initName->get_declptr());
1705 ROSE_ASSERT(variableDefinition_original != NULL);
1717 SgTemplateArgumentPtrList & tpl_args
1724#define DEBUG__SageBuilder__buildTemplateVariableInstantiation_nfi 0
1730#if DEBUG__SageBuilder__buildTemplateVariableInstantiation_nfi
1731 std::cout <<
"SageBuilder::buildTemplateVariableInstantiation_nfi" << std::endl;
1732 std::cout <<
" name = " << name.getString() << std::endl;
1733 std::cout <<
" type = " << std::hex << type <<
" : " << ( type ? type->
class_name() :
"" ) << std::endl;
1734 std::cout <<
" scope = " << std::hex << scope <<
" : " << ( scope ? scope->
class_name() :
"" ) << std::endl;
1736 ASSERT_not_null(type);
1738 SgName nameWithoutTemplateArguments = name;
1740#if DEBUG__SageBuilder__buildTemplateVariableInstantiation_nfi
1741 std::cout <<
" nameWithoutTemplateArguments = " << nameWithoutTemplateArguments.getString() << std::endl;
1742 std::cout <<
" nameWithTemplateArguments = " << nameWithTemplateArguments.getString() << std::endl;
1745 ASSERT_not_null(scope);
1746 ASSERT_not_null(type);
1749 ROSE_ASSERT(varDecl);
1750#if DEBUG__SageBuilder__buildTemplateVariableInstantiation_nfi
1751 std::cout <<
" varDecl = " << std::hex << varDecl <<
" : " << ( varDecl ? varDecl->
class_name() :
"" ) << std::endl;
1755 varDecl->get_templateArguments() = tpl_args;
1766 ASSERT_not_null(initName);
1767 ASSERT_not_null((initName->get_declptr()));
1768#if DEBUG__SageBuilder__buildTemplateVariableInstantiation_nfi
1769 std::cout <<
" initName = " << std::hex << initName <<
" : " << ( initName ? initName->
class_name() :
"" ) << std::endl;
1772 SgVariableDefinition* variableDefinition_original = isSgVariableDefinition(initName->get_declptr());
1773 ASSERT_not_null(variableDefinition_original);
1809 ROSE_ASSERT (base_type != NULL);
1817 ASSERT_not_null(scope);
1823 ASSERT_not_null(stripedBaseType);
1825 SgNamedType* namedType = isSgNamedType(stripedBaseType);
1834 base_decl = namedType->get_declaration();
1837 ROSE_ASSERT(base_decl != NULL);
1844#ifndef ROSE_USE_CLANG_FRONTEND
1857 if (declaration && !isSgAdaDiscriminatedTypeDecl(declaration))
1859 mprintf (
"Found a valid declaration = %p = %s \n",declaration,declaration->
class_name().c_str());
1865 ROSE_ASSERT(parent_scope != NULL);
1872 ROSE_ASSERT(type_decl != NULL);
1892 SgClassDeclaration* def_class = isSgClassDeclaration(base_class->get_definingDeclaration());
1893 SgClassDeclaration* nondef_class = isSgClassDeclaration(base_class->get_firstNondefiningDeclaration());
1895 if (has_defining_base)
1897 if (def_class != NULL)
1903 if (nondef_class != NULL)
1912 ROSE_ASSERT(typedef_symbol);
1923 ASSERT_not_null(base_type);
1925 if (scope ==
nullptr) {
1930 ASSERT_not_null(scope);
1943 if (declaration != NULL)
1948 ROSE_ASSERT(parent_scope != NULL);
1951 SgNamedType* namedType = isSgNamedType(base_type);
1955 if (namedType != NULL)
1960 ROSE_ASSERT(declarationStatement != NULL);
1961 if (declarationStatement != NULL)
1964 if (templateInstantiationDecl != NULL)
1966 SgName name = templateInstantiationDecl->get_name();
1968 if (scope->lookup_template_typedef_symbol(name) != NULL)
1970 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());
1972 ROSE_ASSERT(scope->lookup_template_typedef_symbol(name) == NULL);
1980 ROSE_ASSERT(type_decl != NULL);
1987 ROSE_ASSERT(type_decl->get_type() == NULL);
1990 ROSE_ASSERT(typedefType != NULL);
1993 type_decl->set_type(typedefType);
1996 ROSE_ASSERT(type_decl->get_type() != NULL);
2006 SgNamedType* namedType = isSgNamedType(base_type);
2010 if (namedType != NULL)
2015 ROSE_ASSERT(declarationStatement != NULL);
2016 if (declarationStatement != NULL)
2019 if (templateInstantiationDecl != NULL)
2021 SgName name = templateInstantiationDecl->get_name();
2023 if (scope->lookup_template_typedef_symbol(name) != NULL)
2025 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());
2027 ROSE_ASSERT(scope->lookup_template_typedef_symbol(name) == NULL);
2033 ROSE_ASSERT(typedef_symbol);
2038 ROSE_ASSERT(scope->lookup_template_typedef_symbol(name) != NULL);
2043#define DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi 0
2049 SgTemplateArgumentPtrList & templateArgumentsList
2051#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2052 std::cout <<
"SageBuilder::buildTemplateInstantiationTypedefDeclaration_nfi" << std::endl;
2053 std::cout <<
" name = " << name.getString() << std::endl;
2054 std::cout <<
" base_type = " << std::hex << base_type <<
" : " << ( base_type ? base_type->
class_name() :
"" ) << std::endl;
2056 ASSERT_not_null(base_type);
2058 SgName nameWithoutTemplateArguments = name;
2060#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2061 std::cout <<
" nameWithoutTemplateArguments = " << nameWithoutTemplateArguments.getString() << std::endl;
2062 std::cout <<
" nameWithTemplateArguments = " << nameWithTemplateArguments.getString() << std::endl;
2066 ASSERT_not_null(scope);
2073 if (scope !=
nullptr)
2077 if (declaration !=
nullptr)
2081 ASSERT_not_null(parent_scope);
2084 ASSERT_not_null(templateTypedefDeclaration);
2086 SgTemplateTypedefSymbol* prexisting_template_typedef_symbol = scope->lookup_template_typedef_symbol(nameWithTemplateArguments);
2087 if (prexisting_template_typedef_symbol !=
nullptr)
2090 ASSERT_not_null(declarationStatement);
2091#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2092 std::cout <<
" declarationStatement = " << declarationStatement <<
" : " << declarationStatement->
class_name() << std::endl;
2095 ASSERT_not_null(return_declaration);
2096 return return_declaration;
2098 ASSERT_require(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) ==
nullptr);
2103 ASSERT_not_null(type_decl);
2104 ASSERT_require(type_decl->get_base_type() == base_type);
2106#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2107 std::cout <<
" type_decl = " << std::hex << type_decl <<
" : " << ( type_decl ? type_decl->
class_name() :
"" ) << std::endl;
2108 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;
2112 ASSERT_require(type_decl->get_type() ==
nullptr);
2115 type_decl->set_templateName(nameWithoutTemplateArguments);
2117 ASSERT_not_null(scope);
2122 ASSERT_require(type_decl->get_name() == nameWithTemplateArguments);
2124 if (scope->lookup_template_typedef_symbol(nameWithTemplateArguments) !=
nullptr)
2126 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());
2128 ASSERT_require(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) ==
nullptr);
2129 ASSERT_require(type_decl->get_type() ==
nullptr);
2132 ASSERT_not_null(new_typedefType);
2134 type_decl->set_type(new_typedefType);
2135 ASSERT_not_null(type_decl->get_type());
2136 ASSERT_not_null(type_decl->
get_scope());
2148 ASSERT_not_null(type_decl->get_type());
2149 ASSERT_not_null(scope);
2151#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2152 std::cout <<
" type_decl = " << std::hex << type_decl <<
" : " << ( type_decl ? type_decl->
class_name() :
"" ) << std::endl;
2153 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;
2156 if (scope !=
nullptr)
2158 if (scope->lookup_template_typedef_symbol(nameWithTemplateArguments) !=
nullptr)
2160 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());
2162 ASSERT_require(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) ==
nullptr);
2165 ASSERT_not_null(typedef_symbol);
2167 scope->
insert_symbol(nameWithTemplateArguments,typedef_symbol);
2170 ASSERT_not_null(scope->lookup_template_typedef_symbol(nameWithTemplateArguments));
2173#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2174 std::cout <<
" type_decl = " << std::hex << type_decl <<
" : " << ( type_decl ? type_decl->
class_name() :
"" ) << std::endl;
2175 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;
2187 ROSE_ASSERT (parameterList);
2203 if (in10)
appendArg(parameterList, in10);
2205 return parameterList;
2211 ROSE_ASSERT (parameterList);
2217 return parameterList;
2224 ROSE_ASSERT (ctorInitList);
2230 return ctorInitList;
2239 if (paralist == NULL)
2241 printf (
"WARNING: In buildFunctionParameterTypeList(): Accepting NULL input and returning NULL pointer. \n");
2251 ROSE_ASSERT(typePtrList != NULL);
2253 SgInitializedNamePtrList args = paralist->
get_args();
2254 SgInitializedNamePtrList::const_iterator i;
2255 for(i = args.begin(); i != args.end(); i++)
2256 (typePtrList->
get_arguments()).push_back( (*i)->get_type() );
2267 if (expList ==NULL)
return NULL;
2268 SgExpressionPtrList expPtrList = expList->get_expressions();
2271 ROSE_ASSERT(typePtrList);
2273 SgExpressionPtrList::const_iterator i;
2274 for (i=expPtrList.begin();i!=expPtrList.end();i++)
2289 ROSE_ASSERT(typePtrList);
2293 if (type0 != NULL) types.push_back(type0);
2294 if (type1 != NULL) types.push_back(type1);
2295 if (type2 != NULL) types.push_back(type2);
2296 if (type3 != NULL) types.push_back(type3);
2297 if (type4 != NULL) types.push_back(type4);
2298 if (type5 != NULL) types.push_back(type5);
2299 if (type6 != NULL) types.push_back(type6);
2300 if (type7 != NULL) types.push_back(type7);
2312 ROSE_ASSERT(return_type != NULL);
2315 ROSE_ASSERT(typeList != NULL);
2318 ROSE_ASSERT(fTable);
2324 SgFunctionType* funcType = isSgFunctionType(fTable->lookup_function_type(typeName));
2326 if (funcType == NULL)
2330 ROSE_ASSERT(funcType);
2332 if (typeList != NULL)
2335 if (funcType->get_argument_list() != NULL)
2337 delete funcType->get_argument_list();
2338 funcType->set_argument_list(NULL);
2340 ROSE_ASSERT(funcType->get_argument_list() == NULL);
2342 funcType->set_argument_list(typeList);
2346 fTable->insert_function_type(typeName,funcType);
2364 ROSE_ASSERT(fTable != NULL);
2365 ROSE_ASSERT(typeList != NULL);
2368 SgType* typeInTable = fTable->lookup_function_type(typeName);
2371 if (typeInTable == NULL)
2373 bool has_ellipses =
false;
2376 ROSE_ASSERT(partialFunctionType != NULL);
2379 if (partialFunctionType->get_argument_list() != NULL)
2381 delete partialFunctionType->get_argument_list();
2382 partialFunctionType->set_argument_list(NULL);
2384 ROSE_ASSERT(partialFunctionType->get_argument_list() == NULL);
2391 partialFunctionType->set_argument_list(typeList);
2393 ROSE_ASSERT(partialFunctionType->get_argument_list() != NULL);
2402 partialFunctionType->set_argument_list(NULL);
2405 delete partialFunctionType;
2406 partialFunctionType = NULL;
2411 ROSE_ASSERT(funcType->get_argument_list() != NULL);
2414 if (typeInTable ==
nullptr)
2416 ASSERT_not_null(funcType);
2417 fTable->insert_function_type(typeName,funcType);
2423 ASSERT_require(typeInTable != funcType);
2427 funcType = isSgMemberFunctionType(typeInTable);
2428 ASSERT_not_null(funcType);
2448 ROSE_ASSERT(return_type != NULL);
2449 ROSE_ASSERT(struct_name != NULL);
2450 ROSE_ASSERT(struct_name->
get_parent() != NULL);
2455 if (classDefinition == NULL && decl_scope == NULL)
2457 printf (
"Error: (classDefinition == NULL && decl_scope == NULL): struct_name = %p = %s name = %s \n",
2460 ROSE_ASSERT(classDefinition != NULL || decl_scope != NULL);
2463 if (classDefinition != NULL)
2467 else if (decl_scope != NULL)
2469 declaration = isSgDeclarationStatement(decl_scope->
get_parent());
2476 ROSE_ASSERT(declaration != NULL);
2478 if (typeList ==
nullptr) {
2479 printf (
"WARNING: typeList == NULL \n");
2485 ROSE_ASSERT(classDeclaration != NULL || nrdecl != NULL);
2487 SgType* classType = NULL;
2488 if (classDeclaration != NULL)
2490 classType = classDeclaration->get_type();
2492 else if (decl_scope != NULL)
2494 classType = nrdecl->get_type();
2500 ROSE_ASSERT(classType != NULL);
2508 ROSE_ASSERT(base_type != NULL);
2510 ROSE_ASSERT(classType != NULL);
2512 return pointerToMemberType;
2520 ASSERT_not_null(scope);
2529 if (type_symbol == NULL)
2532 ASSERT_not_null(type_decl);
2540 ROSE_ASSERT(type_symbol);
2556 type_decl = type_symbol->get_declaration();
2557 result = type_decl->get_type();
2559 ASSERT_not_null(result);
2569 ASSERT_not_null(argList);
2574 if (func_type->get_argument_list() != typeList)
2591 if (isSgMemberFunctionDeclaration(func) != NULL)
2593#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
2594 printf (
"WARNING: setting parent of function to match scope by default \n");
2598 ROSE_ASSERT(scope != NULL);
2600 if (isSgTemplateInstantiationMemberFunctionDecl(func) != NULL)
2608#if !ENFORCE_NO_FUNCTION_TEMPLATE_DECLARATIONS_IN_TEMPLATE_CLASS_INSTANTIATIONS
2615 if (isSgTemplateFunctionDeclaration(func) != NULL)
2617 if (isSgTemplateInstantiationMemberFunctionDecl(func) != NULL)
2619 ROSE_ASSERT(isSgTemplateClassDefinition(scope) != NULL);
2631template <
class actualFunction>
2633SageBuilder::buildNondefiningFunctionDeclaration_T (
2636 SgTemplateArgumentPtrList* templateArgumentsList, SgTemplateParameterPtrList* templateParameterList,
2647 if (scope ==
nullptr)
2651 ASSERT_not_null(scope);
2653 if (XXX_name.is_null() ==
true)
2656 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");
2659 SgName nameWithoutTemplateArguments = XXX_name;
2660 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
2662 bool buildTemplateInstantiation = ((VariantT)actualFunction::static_variant == V_SgTemplateInstantiationFunctionDecl || (VariantT)actualFunction::static_variant == V_SgTemplateInstantiationMemberFunctionDecl);
2665 bool buildTemplateDeclaration = ((VariantT)actualFunction::static_variant == V_SgTemplateFunctionDeclaration || (VariantT)actualFunction::static_variant == V_SgTemplateMemberFunctionDeclaration);
2669 if (buildTemplateInstantiation ==
true)
2671 ASSERT_not_null(templateArgumentsList);
2676 if (nameWithTemplateArguments.is_null() ==
true)
2680 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");
2683 if (nameWithoutTemplateArguments.is_null() ==
true)
2687 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");
2690 ASSERT_not_null(return_type);
2691 ASSERT_not_null(paralist);
2697#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
2698 printf (
"Warning: In buildNondefiningFunctionDeclaration_T(): nameWithoutTemplateArguments = %s nameWithTemplateArguments = %s \n",nameWithoutTemplateArguments.str(),nameWithTemplateArguments.str());
2708 if (isMemberFunction ==
true)
2718 ASSERT_not_null(func_type);
2721 actualFunction* func =
nullptr;
2739 func_symbol = scope->find_symbol_by_type_of_function<actualFunction>(nameWithTemplateArguments,func_type,templateParameterList,templateArgumentsList);
2742 if (func_symbol == NULL)
2745 ROSE_ASSERT(func_type != NULL);
2749 if (func_symbol != NULL)
2751 switch((VariantT)actualFunction::static_variant)
2753 case V_SgFunctionDeclaration:
2754 case V_SgProcedureHeaderStatement:
2755 case V_SgTemplateInstantiationFunctionDecl:
2757 ROSE_ASSERT(isSgFunctionSymbol(func_symbol) != NULL);
2760 case V_SgMemberFunctionDeclaration:
2761 case V_SgTemplateInstantiationMemberFunctionDecl:
2763 ROSE_ASSERT(isSgMemberFunctionSymbol(func_symbol) != NULL);
2766 case V_SgTemplateFunctionDeclaration:
2768 ROSE_ASSERT(isSgTemplateFunctionSymbol(func_symbol) != NULL);
2771 case V_SgTemplateMemberFunctionDeclaration:
2773 ROSE_ASSERT(isSgTemplateMemberFunctionSymbol(func_symbol) != NULL);
2779 printf (
"default reach in buildNondefiningFunctionDeclaration_T(): variantT(actualFunction::static_variant) = %d \n",actualFunction::static_variant);
2786 ROSE_ASSERT(scope != NULL);
2787 if ( isSgGlobal(scope) != NULL
2788 && scope != func_symbol->get_scope()
2790 && !scope->symbol_exists(nameWithTemplateArguments, func_symbol) )
2792 scope->
insert_symbol(nameWithTemplateArguments, func_symbol);
2796 if (func_symbol == NULL)
2798 func =
new actualFunction (nameWithTemplateArguments,func_type,NULL);
2799 ROSE_ASSERT(func != NULL);
2802 func->get_declarationModifier().get_storageModifier().set_modifier(sm);
2805 ROSE_ASSERT(func->get_file_info() == NULL);
2808 func->set_scope(scope);
2811 checkThatNoTemplateInstantiationIsDeclaredInTemplateDefinitionScope(func,scope);
2814 ROSE_ASSERT(func->get_parameterList() != NULL);
2822 if (isSgMemberFunctionDeclaration(func))
2827 if (isSgTemplateMemberFunctionDeclaration(func) != NULL)
2832 ROSE_ASSERT(memberFunctionDeclaration != NULL);
2836 ROSE_ASSERT(func_symbol != NULL);
2837 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
2842 if (isSgTemplateFunctionDeclaration(func))
2848 ROSE_ASSERT(templatedeclaration != NULL);
2850 ROSE_ASSERT(template_symbol != NULL);
2851 ROSE_ASSERT(template_symbol->get_symbol_basis() != NULL);
2852 func_symbol = template_symbol;
2857 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
2861 ROSE_ASSERT(func_symbol != NULL);
2862 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
2863 scope->
insert_symbol(nameWithTemplateArguments, func_symbol);
2865 ROSE_ASSERT(func->get_symbol_from_symbol_table() != NULL);
2867 if (isSgFunctionDeclaration(func) == NULL)
2873 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
2881 ROSE_ASSERT(buildTemplateDeclaration ==
false || templateParameterList != NULL);
2887 ROSE_ASSERT(scope->lookup_function_symbol(nameWithTemplateArguments) != NULL ||
2888 scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL ||
2889 scope->lookup_template_member_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
2891#if BUILDER_MAKE_REDUNDANT_CALLS_TO_SYMBOL_TABLE_LOOKUP
2895 if (scope->lookup_function_symbol(nameWithTemplateArguments,templateArgumentList) == NULL || scope->lookup_template_symbol(nameWithTemplateArguments,templateParameterList,NULL) != NULL)
2898 printf (
"Need to make sure this is a template function declaration... \n");
2904 ROSE_ASSERT(func->get_scope() != NULL);
2906 if (isSgFunctionDeclaration(func) == NULL)
2912 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
2914 func->set_firstNondefiningDeclaration(func);
2915 func->set_definingDeclaration(NULL);
2918 ROSE_ASSERT(func->get_firstNondefiningDeclaration() == func);
2920 ROSE_ASSERT(func->get_definingDeclaration() == NULL);
2924 if (testMemberDecl != NULL)
2926 ROSE_ASSERT(testMemberDecl->
get_scope() != NULL);
2927 ROSE_ASSERT(testMemberDecl->get_class_scope() != NULL);
2928 ROSE_ASSERT(testMemberDecl->get_associatedClassDeclaration() != NULL);
2933 ROSE_ASSERT(func_symbol != NULL);
2935 ROSE_ASSERT(scope != NULL);
2943 SgNode* associatedSymbolBasis = func_symbol->get_symbol_basis();
2944 ROSE_ASSERT(associatedSymbolBasis != NULL);
2947 ROSE_ASSERT(associatedDeclaration != NULL);
2951 if (functionDeclaration != NULL)
2953 func_type = functionDeclaration->get_type();
2957 if (templateFunctionDeclaration != NULL)
2962 printf (
"This code should not be reachable! \n");
2965 func_type = templateFunctionDeclaration->get_type();
2973 ROSE_ASSERT(func_type != NULL);
2975 func =
new actualFunction(nameWithTemplateArguments,func_type,NULL);
2976 ROSE_ASSERT(func != NULL);
2978#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
2985 func->set_scope(scope);
2987 ROSE_ASSERT(func->get_symbol_from_symbol_table() == NULL);
2990 checkThatNoTemplateInstantiationIsDeclaredInTemplateDefinitionScope(func,scope);
2996 if (functionDeclaration != NULL)
2998 prevDecl = functionDeclaration;
3002 ROSE_ASSERT(templateFunctionDeclaration != NULL);
3003 prevDecl = templateFunctionDeclaration;
3006 ROSE_ASSERT(prevDecl != NULL);
3013 printf (
"WARNING: Switching declaration in functionSymbol to point to the non-defining declaration \n");
3014 function_symbol->set_declaration(isSgFunctionDeclaration(func));
3015 ROSE_ASSERT(function_symbol->get_declaration() != NULL);
3020 if (nondefiningDeclaration == NULL)
3022 nondefiningDeclaration = func;
3025 ROSE_ASSERT(nondefiningDeclaration != NULL);
3026 ROSE_ASSERT(func != NULL);
3027 ROSE_ASSERT(prevDecl != NULL);
3029 func->set_firstNondefiningDeclaration(nondefiningDeclaration);
3033 ROSE_ASSERT(func->get_firstNondefiningDeclaration()->get_symbol_from_symbol_table() != NULL);
3037 if (func->get_symbol_from_symbol_table() == NULL)
3039 ROSE_ASSERT(nondefiningDeclaration != NULL);
3040 ROSE_ASSERT(func->get_firstNondefiningDeclaration() == nondefiningDeclaration);
3044 ROSE_ASSERT(scope != NULL);
3045 ROSE_ASSERT(func->get_scope() != NULL);
3046 ROSE_ASSERT(func->get_scope() == scope);
3050 if (testMemberDecl != NULL)
3052 ROSE_ASSERT(testMemberDecl->
get_scope() != NULL);
3053 ROSE_ASSERT(testMemberDecl->get_associatedClassDeclaration() != NULL);
3057 if (isSgFunctionDeclaration(func) == NULL)
3068 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3072 ROSE_ASSERT(func != NULL);
3074 ROSE_ASSERT(func->get_file_info() == NULL);
3076 ROSE_ASSERT(func->get_firstNondefiningDeclaration() != NULL);
3077 ROSE_ASSERT(func_symbol != NULL);
3078 ROSE_ASSERT(func_symbol->get_symbol_basis() == func->get_firstNondefiningDeclaration());
3079 ROSE_ASSERT(func->get_symbol_from_symbol_table() != NULL || func->get_firstNondefiningDeclaration()->get_symbol_from_symbol_table() != NULL);
3082 ROSE_ASSERT(func->get_parameterList() != NULL);
3083 delete func->get_parameterList();
3084 func->set_parameterList(NULL);
3087 if (buildTemplateInstantiation ==
true)
3093 if (buildTemplateDeclaration ==
true)
3099 ROSE_ASSERT(templateFunctionDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateFunctionDeclaration->get_templateParameters().size()));
3102 ROSE_ASSERT(templateMemberFunctionDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateMemberFunctionDeclaration->get_templateParameters().size()));
3111 i_name->set_scope(scope);
3117#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3119 if (SourcePositionClassificationMode != e_sourcePositionTransformation)
3121 detectTransformations_local(paralist);
3125 ASSERT_not_null(scope);
3126 ASSERT_not_null(func->get_scope());
3127 ASSERT_require(func->get_scope() == scope);
3134#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
3135 printf (
"Warning: SageBuilder::buildNondefiningFunctionDeclaration_T(): scope parameter may not be the same as the topScopeStack() (e.g. for member functions) \n");
3140 func->set_parent(scope);
3141 ASSERT_not_null(func->get_firstNondefiningDeclaration());
3146 ROSE_ASSERT(func->get_file_info() == NULL);
3151 ROSE_ASSERT(func->get_file_info() != NULL);
3153#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3155 if (SourcePositionClassificationMode != e_sourcePositionTransformation)
3157 detectTransformations_local(func);
3167 ROSE_ASSERT (f_func != NULL);
3181 ROSE_ASSERT(func->get_firstNondefiningDeclaration() != NULL);
3182 SgSymbol* symbol_from_first_nondefining_function = func->get_firstNondefiningDeclaration()->get_symbol_from_symbol_table();
3183 ROSE_ASSERT(symbol_from_first_nondefining_function != NULL);
3186 if (func != func->get_firstNondefiningDeclaration())
3188 SgSymbol* symbol_from_nondefining_function = func->get_symbol_from_symbol_table();
3189 ROSE_ASSERT(symbol_from_nondefining_function == NULL);
3193 if (isSgFunctionDeclaration(func) == NULL)
3199 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3205#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3207 if (SourcePositionClassificationMode !=e_sourcePositionTransformation)
3209 detectTransformations_local(func);
3214 if (functionConstVolatileFlags & SgMemberFunctionType::e_restrict)
3216 func->get_declarationModifier().get_typeModifier().setRestrict();
3219 unsetNodesMarkedAsModified(func);
3230 ROSE_ASSERT(funcdecl!=NULL);
3231 SgName name=funcdecl->get_name();
3233 SgType* return_type = funcType->get_return_type();
3238 ROSE_ASSERT(funcType== ref_funcType);
3243 returnFunction->set_linkage(funcdecl->get_linkage());
3244 if (funcdecl->get_declarationModifier().get_storageModifier().
isExtern() ==
true)
3246 returnFunction->get_declarationModifier().get_storageModifier().
setExtern();
3249 ROSE_ASSERT (returnFunction->get_linkage() == funcdecl->get_linkage());
3250 ROSE_ASSERT (returnFunction->get_declarationModifier().get_storageModifier().
isExtern() ==
3251 funcdecl->get_declarationModifier().get_storageModifier().
isExtern());
3260 return returnFunction;
3269 result = buildNondefiningFunctionDeclaration_T <SgProcedureHeaderStatement> (name,return_type,paralist,
false, scope, decoratorList,
false, NULL, NULL, sm);
3274 if (buildTemplateInstantiation ==
true)
3276 result = buildNondefiningFunctionDeclaration_T <SgTemplateInstantiationFunctionDecl> (name,return_type,paralist,
false, scope, decoratorList,
false, templateArgumentsList, NULL, sm);
3280 result = buildNondefiningFunctionDeclaration_T <SgFunctionDeclaration> (name,return_type,paralist,
false, scope, decoratorList,
false, NULL, NULL, sm);
3293 unsigned int memberFunctionModifiers = 0;
3307 unsigned int memberFunctionModifiers = 0;
3314 if (member_func_symbol != NULL)
3316 nondefining_decl = member_func_symbol->get_declaration();
3340 ROSE_ASSERT(result != NULL);
3356 ROSE_ASSERT(first_nondefining_declaration != NULL);
3360 SgTemplateFunctionDeclaration* result = buildDefiningFunctionDeclaration_T <SgTemplateFunctionDeclaration> (name,return_type,paralist,
false, scope, decoratorList, 0, first_nondefining_declaration, NULL);
3372 SgTemplateMemberFunctionDeclaration* result = buildDefiningFunctionDeclaration_T <SgTemplateMemberFunctionDeclaration> (name,return_type,paralist,
true, scope, decoratorList, functionConstVolatileFlags, first_nondefining_declaration, NULL);
3373 ROSE_ASSERT(result != NULL);
3375 ROSE_ASSERT(result->get_definition() != NULL);
3382 SgExprListExp* decoratorList,
unsigned int functionConstVolatileFlags,
bool buildTemplateInstantiation, SgTemplateArgumentPtrList* templateArgumentsList)
3389 if (buildTemplateInstantiation ==
true)
3392 result = buildNondefiningFunctionDeclaration_T <SgTemplateInstantiationMemberFunctionDecl> (name,return_type,paralist,
true,scope,decoratorList,functionConstVolatileFlags,templateArgumentsList,NULL,
SgStorageModifier::e_default);
3397 result = buildNondefiningFunctionDeclaration_T <SgMemberFunctionDeclaration> (name,return_type,paralist,
true,scope,decoratorList,functionConstVolatileFlags,NULL,NULL,
SgStorageModifier::e_default);
3399 ROSE_ASSERT(result != NULL);
3403 ROSE_ASSERT(ctor != NULL);
3410 ROSE_ASSERT(result->get_associatedClassDeclaration() != NULL);
3412 if (result->get_associatedClassDeclaration() == NULL)
3414 printf (
"Warning, must set the SgMemberFunctionDeclaration::associatedClassDeclaration \n");
3416 ROSE_ASSERT(scope != NULL);
3418 ROSE_ASSERT(classDefinition != NULL);
3420 ROSE_ASSERT(associatedDeclaration != NULL);
3421 SgClassDeclaration* associatedClassDeclaration = isSgClassDeclaration(associatedDeclaration);
3442 ROSE_ASSERT(result != NULL);
3444#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3448 detectTransformations_local(result);
3455 SgSymbol* associatedSymbol = scope->lookup_template_member_function_symbol(name,result->get_type(),templateParameterList);
3456 if (associatedSymbol == NULL)
3458 printf (
"ERROR: associatedSymbol == NULL \n");
3459 printf (
" --- result = %p = %s \n",result,result->
class_name().c_str());
3460 printf (
" --- scope = %p = %s \n",scope,scope->
class_name().c_str());
3461 printf (
" --- name = %s \n",name.str());
3462 printf (
" --- result->get_type() = %p = %s \n",result->get_type(),result->get_type()->
class_name().c_str());
3463 printf (
" --- result->get_type()->get_mangled() = %s \n",result->get_type()->get_mangled().str());
3465 ROSE_ASSERT(associatedSymbol != NULL);
3468 ROSE_ASSERT(ctor != NULL);
3476 ROSE_ASSERT(symbol_from_first_nondefining_function != NULL);
3482 ROSE_ASSERT(symbol_from_nondefining_function == NULL);
3485#if BUILDER_MAKE_REDUNDANT_CALLS_TO_SYMBOL_TABLE_LOOKUP
3488 if (scope->lookup_template_member_function_symbol(name,result->get_type(),templateParameterList) == NULL)
3490 printf (
"Error: scope->lookup_template_member_function_symbol(name,result->get_type()) == NULL (investigate this) \n");
3491 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());
3492 scope->
get_symbol_table()->
print(
"Error: scope->lookup_template_member_function_symbol(name,result->get_type()) == NULL (investigate this)");
3495 ROSE_ASSERT(scope->lookup_template_member_function_symbol(name,result->get_type(),templateParameterList) != NULL);
3497#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3501 detectTransformations_local(result);
3513 if (buildTemplateInstantiation ==
true)
3516 ROSE_ASSERT(templateInstantiationMemberFunctionDecl != NULL);
3520 ROSE_ASSERT(templateArgumentsList != NULL);
3521 string nameWithoutTemplateArguments = name;
3523 SgMemberFunctionType* func_type = isSgMemberFunctionType(first_nondefining_declaration->get_type());
3524 ROSE_ASSERT(func_type != NULL);
3528 if (func_symbol == NULL)
3530 printf (
"ERROR caught in SageBuilder::buildDefiningMemberFunctionDeclaration(): nameWithTemplateArguments = %s buildTemplateInstantiation = %s \n",nameWithTemplateArguments.c_str(),buildTemplateInstantiation ?
"true:" :
"false");
3531 printf (
"ERROR caught in SageBuilder::buildDefiningMemberFunctionDeclaration(): func_symbol == NULL for first_nondefining_declaration = %p = %s and func_type = %p = %s \n",
3532 templateInstantiationMemberFunctionDecl,templateInstantiationMemberFunctionDecl->
class_name().c_str(),func_type,func_type->
class_name().c_str());
3536 result = buildDefiningFunctionDeclaration_T <SgTemplateInstantiationMemberFunctionDecl> (name, return_type, paralist,
true, scope, decoratorList, functionConstVolatileFlags, templateInstantiationMemberFunctionDecl, templateArgumentsList);
3537 ROSE_ASSERT(isSgTemplateInstantiationMemberFunctionDecl(result) != NULL);
3538 ROSE_ASSERT(isSgTemplateInstantiationMemberFunctionDecl(result)->get_templateName().is_null() ==
false);
3542 ROSE_ASSERT(first_nondefining_declaration != NULL);
3548 result = buildDefiningFunctionDeclaration_T <SgMemberFunctionDeclaration> (name,return_type,paralist,
true,scope,decoratorList,functionConstVolatileFlags,first_nondefining_declaration, NULL);
3551 ROSE_ASSERT(result != NULL);
3555 ROSE_ASSERT(ctor != NULL);
3562 ROSE_ASSERT(result->get_associatedClassDeclaration() != NULL);
3572template <
class actualFunction>
3581#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
3582 printf (
"WARNING: This function for building defining function declarations has different semantics from that of the function to build defining class declarations. \n");
3585 ASSERT_not_null(first_nondefining_declaration);
3586 ASSERT_require(first_nondefining_declaration->get_firstNondefiningDeclaration() == first_nondefining_declaration);
3588 if (scope ==
nullptr)
3593 ASSERT_require(XXX_name.is_null() ==
false);
3594 ASSERT_not_null(scope);
3595 ASSERT_not_null(return_type);
3597 SgName nameWithoutTemplateArguments = XXX_name;
3598 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
3600 bool buildTemplateInstantiation = ((VariantT)actualFunction::static_variant == V_SgTemplateInstantiationFunctionDecl || (VariantT)actualFunction::static_variant == V_SgTemplateInstantiationMemberFunctionDecl);
3603 bool buildTemplateDeclaration = ((VariantT)actualFunction::static_variant == V_SgTemplateFunctionDeclaration || (VariantT)actualFunction::static_variant == V_SgTemplateMemberFunctionDeclaration);
3606 if (buildTemplateInstantiation ==
true)
3608 ASSERT_not_null(templateArgumentsList);
3610 SgTemplateArgumentPtrList & templateArgumentsList_from_first_nondefining_declaration = (isMemberFunction ==
false) ?
3612 isSgTemplateInstantiationMemberFunctionDecl(first_nondefining_declaration)->
get_templateArguments();
3614 ASSERT_not_null(templateArgumentsList);
3616 ASSERT_require(templateArgumentListsAreEquivalent ==
true);
3619 SgTemplateParameterPtrList* templateParameterList =
nullptr;
3620 if (buildTemplateDeclaration ==
true)
3623 templateParameterList = (isMemberFunction ==
false) ?
3624 &(isSgTemplateFunctionDeclaration(first_nondefining_declaration)->get_templateParameters()) :
3625 &(isSgTemplateMemberFunctionDeclaration(first_nondefining_declaration)->get_templateParameters());
3627 ASSERT_require(templateArgumentsList ==
nullptr);
3628 ASSERT_not_null(templateParameterList);
3631 if (buildTemplateInstantiation ==
true)
3633 ASSERT_not_null(templateArgumentsList);
3636 if (nameWithTemplateArguments ==
"insert < __normal_iterator< SgInitializedName ** , __type > > ")
3638 printf (
"In buildDefiningFunctionDeclaration_T(): Found function nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
3642 ASSERT_require(nameWithoutTemplateArguments.is_null() ==
false);
3643 ASSERT_require(nameWithTemplateArguments.is_null() ==
false);
3644 ASSERT_not_null(paralist);
3652 actualFunction* defining_func =
nullptr;
3658 ASSERT_not_null(first_nondefining_declaration);
3675 func_type = first_nondefining_declaration->get_type();
3676 ASSERT_not_null(func_type);
3679 ASSERT_require(func_type == first_nondefining_declaration->get_type());
3684 SgSymbol* func_symbol = scope->find_symbol_by_type_of_function<actualFunction>(nameWithTemplateArguments,func_type,templateParameterList,templateArgumentsList);
3687 ASSERT_not_null(func_symbol);
3689 if (func_symbol ==
nullptr)
3694 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");
3708 if (temp_function_sym !=
nullptr)
3710 func_type = temp_function_sym->get_declaration()->get_type();
3716 ASSERT_not_null(temp_template_sym);
3719 ASSERT_not_null(firstNondefiningFunctionDeclaration);
3722 defining_func =
new actualFunction(nameWithTemplateArguments,func_type,
nullptr);
3723 ASSERT_not_null(defining_func);
3725 ASSERT_not_null(firstNondefiningFunctionDeclaration);
3726 defining_func->set_firstNondefiningDeclaration(firstNondefiningFunctionDeclaration);
3732 if (decoratorList !=
nullptr)
3734 defining_func->set_decoratorList(decoratorList);
3739 defining_func->set_definingDeclaration(defining_func);
3743 ASSERT_not_null(func_body);
3749 if (templateFunctionDeclaration ==
nullptr)
3752 ASSERT_not_null(functionDeclaration);
3757 ASSERT_not_null(templateFunctionDeclaration);
3760 ASSERT_not_null(func_def);
3764 func_def->setCaseInsensitive(
true);
3765 func_body->setCaseInsensitive(
true);
3778 i_name->set_scope(func_def);
3781 ASSERT_not_null(variableSymbol);
3782 func_def->
insert_symbol(i_name->get_name(), variableSymbol);
3785 SgArrayType* arrayType = isSgArrayType(i_name->get_type());
3786 if (arrayType !=
nullptr)
3790 SgExpression* indexExpression = arrayType->get_index();
3792 if (indexExpression !=
nullptr)
3796 vector<SgVarRefExp* > varRefList;
3799 for (
size_t i = 0; i < varRefList.size(); i++)
3803 ASSERT_not_null(dimension_variableSymbol);
3804 ASSERT_require(dimension_variableSymbol != variableSymbol);
3807 SgSymbol* symbolFromLookup = func_def->lookup_symbol(dimension_variableSymbol->
get_name());
3808 if (symbolFromLookup !=
nullptr)
3810 SgVariableSymbol* variableSymbolFromLookup = isSgVariableSymbol(symbolFromLookup);
3811 ASSERT_not_null(variableSymbolFromLookup);
3813 varRefList[i]->set_symbol(variableSymbolFromLookup);
3814 ASSERT_require(dimension_variableSymbol != variableSymbol);
3825 defining_func->set_parent(scope);
3826 defining_func->set_scope(scope);
3828 ASSERT_not_null(defining_func->get_scope());
3830 checkThatNoTemplateInstantiationIsDeclaredInTemplateDefinitionScope(defining_func,scope);
3836 if (isMemberFunction ==
true)
3838 ASSERT_not_null(isSgMemberFunctionDeclaration(defining_func));
3845 if (buildTemplateInstantiation ==
true)
3851 if (buildTemplateDeclaration ==
true)
3857 ROSE_ASSERT(templateFunctionDeclaration ==
nullptr || (templateParameterList !=
nullptr && templateParameterList->size() == templateFunctionDeclaration->get_templateParameters().size()));
3859 ROSE_ASSERT(templateMemberFunctionDeclaration ==
nullptr || (templateParameterList !=
nullptr && templateParameterList->size() == templateMemberFunctionDeclaration->get_templateParameters().size()));
3863 if (functionConstVolatileFlags & SgMemberFunctionType::e_restrict)
3865 defining_func->get_declarationModifier().get_typeModifier().setRestrict();
3872 unsetNodesMarkedAsModified(defining_func);
3874 return defining_func;
3884 bool isTemplateInstantition = (templateInstantiationFunctionDecl != NULL) || (templateInstantiationMemberFunctionDecl != NULL);
3885 if (isTemplateInstantition ==
true)
3889 SgName templateNameWithoutArguments = name;
3895 bool isMemberFunction = (templateInstantiationMemberFunctionDecl != NULL);
3896 if (isMemberFunction ==
true)
3898 ROSE_ASSERT(templateInstantiationMemberFunctionDecl != NULL);
3899 ROSE_ASSERT(templateInstantiationFunctionDecl == NULL);
3901 if (templateInstantiationMemberFunctionDecl->
get_templateName().is_null() ==
true)
3905 templateInstantiationMemberFunctionDecl->
set_templateName(templateNameWithoutArguments);
3909 ROSE_ASSERT(templateInstantiationMemberFunctionDecl->
get_templateName().is_null() ==
false);
3913 ROSE_ASSERT(templateInstantiationFunctionDecl != NULL);
3914 ROSE_ASSERT(templateInstantiationMemberFunctionDecl == NULL);
3916 if (templateInstantiationFunctionDecl->
get_templateName().is_null() ==
true)
3920 templateInstantiationFunctionDecl->
set_templateName(templateNameWithoutArguments);
3925 ROSE_ASSERT(templateInstantiationFunctionDecl->
get_templateName().is_null() ==
false);
3935 if (buildTemplateInstantiation ==
true)
3939 ROSE_ASSERT(first_nondefining_declaration != NULL);
3941 func = buildDefiningFunctionDeclaration_T<SgTemplateInstantiationFunctionDecl>(name,return_type,paralist,
false,scope,decoratorList,0,templateInstantiationFunctionDecl, templateArgumentsList);
3943 ROSE_ASSERT(isSgTemplateInstantiationFunctionDecl(func) != NULL);
3944 ROSE_ASSERT(isSgTemplateInstantiationFunctionDecl(func)->get_templateName().is_null() ==
false);
3948 ROSE_ASSERT(first_nondefining_declaration != NULL);
3950 func = buildDefiningFunctionDeclaration_T<SgFunctionDeclaration>(name,return_type,paralist,
false,scope,decoratorList,0,first_nondefining_declaration, NULL);
3952 ROSE_ASSERT(isSgFunctionDeclaration(func) != NULL);
3965 ROSE_ASSERT(return_type != NULL);
3966 ROSE_ASSERT(parameter_list != NULL);
3977 if (func_symbol != NULL)
3979 nondefiningDeclaration = func_symbol->get_declaration();
3986 ROSE_ASSERT(nondefiningDeclaration != NULL);
3998 ASSERT_not_null(return_type);
3999 ASSERT_not_null(param_list);
4003 if (scope ==
nullptr) {
4009 nondef_decl = buildNondefiningFunctionDeclaration_T <SgProcedureHeaderStatement>
4010 ( name, return_type, param_list,
false, scope,
nullptr,
4013 ASSERT_not_null(isSgProcedureHeaderStatement(nondef_decl));
4016 nondef_decl->set_subprogram_kind(kind);
4025 ASSERT_not_null(return_type);
4026 ASSERT_not_null(parameter_list);
4030 if (scope ==
nullptr) {
4036 if (func_symbol ==
nullptr)
4038 nondef_decl = buildNondefiningFunctionDeclaration_T <SgProcedureHeaderStatement>
4039 ( name, return_type, parameter_list,
false, scope,
4044 nondef_decl = func_symbol->get_declaration();
4048 ASSERT_not_null(proc_header_stmt);
4061 ASSERT_not_null(firstNondefDecl);
4069 mlog[ERROR] <<
"unhandled subprogram kind for Fortran (or Jovial) function declaration:"
4074 func = buildDefiningFunctionDeclaration_T<SgProcedureHeaderStatement>(
SgName(name), returnType, params,
false,
4075 scope,
nullptr, 0U, firstNondefDecl,
nullptr);
4076 ASSERT_not_null(func);
4077 func->set_subprogram_kind(kind);
4088 ROSE_ASSERT(boolValue);
4099 ROSE_ASSERT(boolValue);
4107 ROSE_ASSERT(nullptrValue);
4109 return nullptrValue;
4115 ROSE_ASSERT(nullptrValue);
4117 return nullptrValue;
4123 ROSE_ASSERT(voidValue);
4131 ROSE_ASSERT(voidValue);
4139 ROSE_ASSERT(result);
4147 ROSE_ASSERT(result);
4155 ROSE_ASSERT(result);
4163 ROSE_ASSERT(result);
4172 ROSE_ASSERT(result);
4180 ROSE_ASSERT(result);
4189 ROSE_ASSERT(result);
4197 ROSE_ASSERT(result);
4206 ROSE_ASSERT(result);
4209 if (real_value != NULL)
4212 if (imaginary_value != NULL)
4215 ROSE_ASSERT(real_value == NULL || real_value->
get_parent() != NULL);
4216 ROSE_ASSERT(imaginary_value == NULL || imaginary_value->
get_parent() != NULL);
4224 ROSE_ASSERT(imaginary_value != NULL);
4226 ROSE_ASSERT(result != NULL);
4229 if (real_value != NULL)
4232 if (imaginary_value != NULL)
4235 ROSE_ASSERT(real_value == NULL || real_value->
get_parent() != NULL);
4236 ROSE_ASSERT(imaginary_value == NULL || imaginary_value->
get_parent() != NULL);
4245 ROSE_ASSERT(result);
4248 result->get_imaginary_value()->
set_parent(result);
4249 ROSE_ASSERT(result->get_imaginary_value()->
get_parent() != NULL);
4257 ROSE_ASSERT(imaginary_value != NULL);
4260 ROSE_ASSERT(result);
4264 ROSE_ASSERT(imaginary_value->
get_parent() != NULL);
4272 ROSE_ASSERT(imaginary_value != NULL);
4276 ROSE_ASSERT(result);
4279 ROSE_ASSERT(imaginary_value->
get_parent() != NULL);
4304 ROSE_ASSERT(result);
4312 ROSE_ASSERT(result);
4320 ROSE_ASSERT(result);
4335 ASSERT_not_null(intValue);
4343 ASSERT_not_null(intValue);
4351 ASSERT_not_null(intValue);
4359 ASSERT_not_null(intValue);
4372 ASSERT_not_null(intValue);
4380 ASSERT_not_null(intValue);
4388 ASSERT_not_null(intValue);
4396 ASSERT_not_null(intValue);
4404 ASSERT_not_null(enumVal);
4413 ASSERT_not_null(enumVal);
4420 ROSE_ASSERT(init_name != NULL);
4422 ROSE_ASSERT(assign_init != NULL);
4423 SgEnumVal * enum_val = isSgEnumVal(assign_init->get_operand_i());
4424 ROSE_ASSERT(enum_val != NULL);
4432 ASSERT_not_null(result);
4440 ASSERT_not_null(result);
4448 ASSERT_not_null(result);
4456 ASSERT_not_null(result);
4464 ASSERT_not_null(result);
4472 ASSERT_not_null(result);
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);
4727 SgJovialBitVal* result =
new SgJovialBitVal(str);
4728 ASSERT_not_null(result);
4736 ASSERT_not_null (result);
4745 ROSE_ASSERT (result);
4753 ROSE_ASSERT(templateParameterValue);
4757 ROSE_ASSERT(templateParameterValue->
get_parent() == NULL);
4759 return templateParameterValue;
4765 ROSE_ASSERT(templateParameterValue);
4769 ROSE_ASSERT(templateParameterValue->
get_parent() == NULL);
4771 return templateParameterValue;
4774#define DEBUG_BUILD_NONREAL_DECL 0
4777 ROSE_ASSERT(scope != NULL);
4778#if DEBUG_BUILD_NONREAL_DECL
4779 printf(
"ENTER SageBuilder::buildNonrealDecl\n");
4780 printf(
" --- name = %s\n", name.str());
4781 printf(
" --- scope = %p (%s)\n", scope, scope->
class_name().c_str());
4789#if DEBUG_BUILD_NONREAL_DECL
4790 printf(
" --- nrdecl = %p (%s)\n", nrdecl, nrdecl->
class_name().c_str());
4795#if DEBUG_BUILD_NONREAL_DECL
4796 printf(
" --- symbol = %p (%s)\n", symbol, symbol->
class_name().c_str());
4800 type->set_declaration(nrdecl);
4802 nrdecl->set_type(type);
4804#if DEBUG_BUILD_NONREAL_DECL
4805 printf(
" --- type = %p (%s)\n", type, type->
class_name().c_str());
4808 if (child_scope == NULL) {
4810#if DEBUG_BUILD_NONREAL_DECL
4811 printf(
" --- child_scope = %p (new)\n", name.str(), child_scope);
4817#if DEBUG_BUILD_NONREAL_DECL
4818 printf(
" --- child_scope = %p (provided)\n", name.str(), child_scope);
4823 nrdecl->set_nonreal_decl_scope(child_scope);
4825#if DEBUG_BUILD_NONREAL_DECL
4826 printf(
"LEAVE SageBuilder::buildNonrealDecl\n");
4836 ROSE_ASSERT(result);
4845 ROSE_ASSERT(result);
4854 ROSE_ASSERT(result);
4863 ROSE_ASSERT(result);
4871 ROSE_ASSERT(result);
4879 ROSE_ASSERT(result);
4887 ROSE_ASSERT(result);
4895 ROSE_ASSERT(result);
4903 ROSE_ASSERT(result);
4911 ROSE_ASSERT(result);
5007#define BUILD_UNARY_DEF(suffix) \
5008 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix##_nfi(SgExpression* op) \
5010 return SageBuilder::buildUnaryExpression_nfi<Sg##suffix>(op); \
5012 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix(SgExpression* op) \
5014 return SageBuilder::buildUnaryExpression<Sg##suffix>(op); \
5017BUILD_UNARY_DEF(AddressOfOp)
5018BUILD_UNARY_DEF(BitComplementOp)
5019BUILD_UNARY_DEF(MinusOp)
5020BUILD_UNARY_DEF(NotOp)
5021BUILD_UNARY_DEF(PointerDerefExp)
5022BUILD_UNARY_DEF(UnaryAddOp)
5023BUILD_UNARY_DEF(AbsOp)
5024BUILD_UNARY_DEF(MinusMinusOp)
5025BUILD_UNARY_DEF(PlusPlusOp)
5026BUILD_UNARY_DEF(RealPartOp)
5027BUILD_UNARY_DEF(ImagPartOp)
5028BUILD_UNARY_DEF(ConjugateOp)
5029BUILD_UNARY_DEF(VarArgStartOneOperandOp)
5030BUILD_UNARY_DEF(VarArgEndOp)
5032BUILD_UNARY_DEF(MatrixTransposeOp)
5034#undef BUILD_UNARY_DEF
5037 SgType * expression_type,
5041 ROSE_ASSERT(result);
5042 if (operand_i) {operand_i->
set_parent(result); markLhsValues(result);}
5053 short int need_global_specifier,
5057 SgNewExp* result =
new SgNewExp(specified_type, placement_args, constructor_args, builtin_args, need_global_specifier, newOperatorDeclaration);
5058 ROSE_ASSERT(result);
5066 short need_global_specifier,
5070 need_global_specifier, deleteOperatorDeclaration);
5071 ROSE_ASSERT(result);
5081 ROSE_ASSERT(result != NULL);
5089 ROSE_ASSERT(result);
5090 if (operand_i) {operand_i->
set_parent(result); markLhsValues(result);}
5097 ROSE_ASSERT(result);
5098 if (operand_i) {operand_i->
set_parent(result); markLhsValues(result);}
5105 SgMinusMinusOp* result = buildUnaryExpression<SgMinusMinusOp>(operand_i);
5106 ROSE_ASSERT(result);
5113 SgMinusMinusOp* result = buildUnaryExpression_nfi<SgMinusMinusOp>(operand_i);
5114 ROSE_ASSERT(result);
5121 SgMinusOp* result = buildUnaryExpression<SgMinusOp>(operand_i);
5122 ROSE_ASSERT(result);
5129 SgMinusOp* result = buildUnaryExpression_nfi<SgMinusOp>(operand_i);
5130 ROSE_ASSERT(result);
5137 SgPlusPlusOp* result = buildUnaryExpression<SgPlusPlusOp>(operand_i);
5138 ROSE_ASSERT(result);
5146 SgPlusPlusOp* result = buildUnaryExpression_nfi<SgPlusPlusOp>(operand_i);
5147 ROSE_ASSERT(result);
5161 markLhsValues(result);
5167 operand_i -> set_parent(result);
5169 ROSE_ASSERT(result);
5176#define BUILD_BINARY_DEF(suffix) \
5177 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix##_nfi(SgExpression* lhs, SgExpression* rhs) \
5179 return buildBinaryExpression_nfi<Sg##suffix>(lhs, rhs); \
5181 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix(SgExpression* lhs, SgExpression* rhs) \
5183 return buildBinaryExpression<Sg##suffix>(lhs, rhs); \
5186BUILD_BINARY_DEF(AddOp)
5187BUILD_BINARY_DEF(AndAssignOp)
5188BUILD_BINARY_DEF(AndOp)
5189BUILD_BINARY_DEF(ArrowExp)
5190BUILD_BINARY_DEF(ArrowStarOp)
5191BUILD_BINARY_DEF(AssignOp)
5192BUILD_BINARY_DEF(AtOp)
5193BUILD_BINARY_DEF(BitAndOp)
5194BUILD_BINARY_DEF(BitOrOp)
5195BUILD_BINARY_DEF(BitXorOp)
5197BUILD_BINARY_DEF(CommaOpExp)
5198BUILD_BINARY_DEF(ConcatenationOp)
5199BUILD_BINARY_DEF(DivAssignOp)
5200BUILD_BINARY_DEF(DivideOp)
5201BUILD_BINARY_DEF(DotExp)
5202BUILD_BINARY_DEF(DotStarOp)
5203BUILD_BINARY_DEF(EqualityOp)
5205BUILD_BINARY_DEF(ExponentiationOp)
5206BUILD_BINARY_DEF(ExponentiationAssignOp)
5207BUILD_BINARY_DEF(GreaterOrEqualOp)
5208BUILD_BINARY_DEF(GreaterThanOp)
5209BUILD_BINARY_DEF(IntegerDivideOp)
5210BUILD_BINARY_DEF(IntegerDivideAssignOp)
5211BUILD_BINARY_DEF(IorAssignOp)
5212BUILD_BINARY_DEF(IsOp)
5213BUILD_BINARY_DEF(IsNotOp)
5215BUILD_BINARY_DEF(LessOrEqualOp)
5216BUILD_BINARY_DEF(LessThanOp)
5217BUILD_BINARY_DEF(LshiftAssignOp)
5218BUILD_BINARY_DEF(LshiftOp)
5220BUILD_BINARY_DEF(MembershipOp)
5221BUILD_BINARY_DEF(MinusAssignOp)
5222BUILD_BINARY_DEF(ModAssignOp)
5223BUILD_BINARY_DEF(ModOp)
5224BUILD_BINARY_DEF(MultAssignOp)
5225BUILD_BINARY_DEF(MultiplyOp)
5227BUILD_BINARY_DEF(NotEqualOp)
5228BUILD_BINARY_DEF(NonMembershipOp)
5229BUILD_BINARY_DEF(OrOp)
5230BUILD_BINARY_DEF(PlusAssignOp)
5231BUILD_BINARY_DEF(PntrArrRefExp)
5232BUILD_BINARY_DEF(RemOp)
5233BUILD_BINARY_DEF(RshiftAssignOp)
5234BUILD_BINARY_DEF(JavaUnsignedRshiftAssignOp)
5236BUILD_BINARY_DEF(RshiftOp)
5237BUILD_BINARY_DEF(JavaUnsignedRshiftOp)
5238BUILD_BINARY_DEF(ScopeOp)
5239BUILD_BINARY_DEF(SubtractOp)
5240BUILD_BINARY_DEF(XorAssignOp)
5242BUILD_BINARY_DEF(VarArgCopyOp)
5243BUILD_BINARY_DEF(VarArgStartOp)
5246BUILD_BINARY_DEF(ReplicationOp);
5249BUILD_BINARY_DEF(PowerOp);
5250BUILD_BINARY_DEF(ElementwisePowerOp);
5251BUILD_BINARY_DEF(ElementwiseMultiplyOp);
5252BUILD_BINARY_DEF(ElementwiseDivideOp);
5253BUILD_BINARY_DEF(LeftDivideOp);
5254BUILD_BINARY_DEF(ElementwiseLeftDivideOp);
5255BUILD_BINARY_DEF(ElementwiseAddOp);
5256BUILD_BINARY_DEF(ElementwiseSubtractOp);
5259BUILD_BINARY_DEF(SpaceshipOp)
5261#undef BUILD_BINARY_DEF
5269 ROSE_ASSERT(base_type != NULL);
5273 if (dim_info == NULL)
5284 ROSE_ASSERT(array_type);
5285 ROSE_ASSERT(array_type->get_dim_info() == NULL);
5290 array_type->set_dim_info(dim_info);
5291 array_type->set_rank(dim_info->get_expressions().size());
5299 ASSERT_not_null(result);
5301 if (index !=
nullptr) {
5322 if (a) {a->
set_parent(result); markLhsValues(a);}
5323 if (b) {b->
set_parent(result); markLhsValues(b);}
5331 ROSE_ASSERT(result);
5351 ASSERT_not_null(expr);
5365 ROSE_ASSERT(result);
5366 if (operand_i!=NULL)
5370 markLhsValues(result);
5379 ASSERT_not_null(result);
5384 markLhsValues(result);
5397 ROSE_ASSERT(result);
5398 if (initializers!=NULL)
5402 result->set_need_explicit_braces(
true);
5411 ROSE_ASSERT(result);
5412 if (initializers!=NULL)
5416 result->set_need_explicit_braces(
true);
5425 ROSE_ASSERT(result);
5426 if (initializers!=NULL)
5438 ROSE_ASSERT(result);
5439 if (initializers!=NULL)
5454 bool need_qualifier ,
5455 bool need_parenthesis_after_name ,
5456 bool associated_class_unknown )
5463 ROSE_ASSERT(declaration == NULL || declaration->get_associatedClassDeclaration() != NULL);
5466 need_qualifier, need_parenthesis_after_name, associated_class_unknown );
5467 ROSE_ASSERT(result != NULL);
5486 bool need_qualifier ,
5487 bool need_parenthesis_after_name ,
5488 bool associated_class_unknown )
5494 ROSE_ASSERT(declaration == NULL || declaration->get_associatedClassDeclaration() != NULL);
5497 ROSE_ASSERT(result != NULL);
5522 ROSE_ASSERT(result);
5523 if (initializers!=NULL)
5534 ROSE_ASSERT(result);
5535 if (initializers!=NULL)
5552 ROSE_ASSERT(result);
5556 markLhsValues(result);
5570 ROSE_ASSERT(result);
5574 markLhsValues(result);
5585 ROSE_ASSERT(result);
5595 ROSE_ASSERT(result);
5607 ROSE_ASSERT(result);
5611 markLhsValues(result);
5624 ROSE_ASSERT(result);
5628 markLhsValues(result);
5641 ROSE_ASSERT(result);
5645 markLhsValues(result);
5659 ROSE_ASSERT(result);
5663 markLhsValues(result);
5674 ROSE_ASSERT(result);
5683 ROSE_ASSERT(result);
5692 ROSE_ASSERT(expList);
5714 ROSE_ASSERT(expList);
5717 for (
size_t i = 0; i < exprs.size(); ++i) {
5726 ROSE_ASSERT(expList);
5735 ROSE_ASSERT(expList != NULL);
5738 for (
size_t i = 0; i < exprs.size(); ++i)
5744 testAstForUniqueNodes(expList);
5752 if (lower_bound == NULL)
5761 ROSE_ASSERT(lower_bound);
5762 ROSE_ASSERT(upper_bound);
5763 ROSE_ASSERT(stride);
5766 ROSE_ASSERT(subscript);
5780 ROSE_ASSERT(initname);
5787 if (initname->get_scope()!=NULL)
5792 varRef =
new SgVarRefExp(isSgVariableSymbol(symbol));
5794 ROSE_ASSERT(varRef);
5839 varSymbol = isSgVariableSymbol(symbol);
5847 name1->set_scope(scope);
5853 if (varSymbol == NULL)
5855 printf (
"Error: varSymbol == NULL for name = %s \n",name.str());
5857 ROSE_ASSERT(varSymbol != NULL);
5861 ROSE_ASSERT(varRef != NULL);
5863 ROSE_ASSERT (isSgVariableSymbol(varRef->get_symbol())->get_declaration()!=NULL);
5873 ROSE_ASSERT(symbol);
5883 ROSE_ASSERT(varRef);
5894 ROSE_ASSERT(varRef);
5905 ROSE_ASSERT(refexp != NULL);
5920 ROSE_ASSERT(scope != NULL);
5931 ROSE_ASSERT(isSgVariableSymbol(symbol));
5957 ROSE_ASSERT(compoundLiteral != NULL);
5961 return compoundLiteral;
5970 ROSE_ASSERT(compoundLiteral != NULL);
5974 return compoundLiteral;
5982 ROSE_ASSERT (s!= NULL);
5984 ROSE_ASSERT (result != NULL);
5993 if (paraTypeList==NULL)
return paraList;
5996 SgTypePtrList::iterator i;
5997 for (i=typeList.begin();i!=typeList.end();i++)
6010 ROSE_ASSERT (paraList);
6012 SgTypePtrList::iterator i;
6013 for (i=typeList.begin();i!=typeList.end();i++)
6025 ASSERT_not_null(funcType);
6027 ASSERT_not_null(func_type);
6029 bool isMemberFunc = isSgMemberFunctionType(func_type);
6031 if (scope ==
nullptr) {
6034 ASSERT_not_null(scope);
6036 if (symbol ==
nullptr)
6039 SgType* return_type = func_type->get_return_type();
6045 ASSERT_require(isMemberFunc ==
false);
6051 funcDecl = buildNondefiningFunctionDeclaration_T
6056 funcDecl = buildNondefiningFunctionDeclaration_T
6060 funcDecl->get_declarationModifier().get_storageModifier().
setExtern();
6063 ASSERT_not_null(symbol);
6068 ASSERT_not_null(func_ref);
6083 ROSE_ASSERT(func_decl != NULL);
6087 if (nondef_func != NULL)
6089 ROSE_ASSERT(nondef_func!= NULL);
6091 ROSE_ASSERT( symbol != NULL);
6094 else if (def_func != NULL)
6100 std::cerr<<
"Fatal error: SageBuilder::buildFunctionRefExp():defining and nondefining declarations for a function cannot be both NULL"<<std::endl;
6103 ROSE_ASSERT( symbol != NULL);
6114 ROSE_ASSERT(func_ref);
6124 ROSE_ASSERT(func_ref);
6132 ROSE_ASSERT(sym != NULL);
6135 ROSE_ASSERT(func_ref != NULL);
6138 ROSE_ASSERT(func_ref->get_symbol() != NULL);
6149 ROSE_ASSERT(func_ref);
6159 ROSE_ASSERT(func_ref);
6169 ROSE_ASSERT(func_ref);
6179 ROSE_ASSERT(class_ref);
6188 ROSE_ASSERT(class_ref);
6198 ROSE_ASSERT(scope != NULL);
6212 printf (
"Error: buildFunctionRefExp(): This function should not be used! \n");
6223 funcDecl->get_declarationModifier().get_storageModifier().
setExtern();
6226 ROSE_ASSERT(symbol);
6232 ROSE_ASSERT(func_ref);
6248 ROSE_ASSERT(expStmt);
6258 ROSE_ASSERT(expStmt);
6269 ROSE_ASSERT(expStmt);
6281 ROSE_ASSERT(expStmt);
6291 if (scope ==
nullptr) {
6294 ASSERT_not_null(scope);
6296 if (parameters ==
nullptr) {
6307 ASSERT_not_null(func_call_expr);
6309 return func_call_expr;
6317 ROSE_ASSERT (sym != NULL);
6318 if (parameters == NULL)
6320 ROSE_ASSERT (parameters != NULL);
6327 if (memberFunctionSymbol != NULL)
6330 bool virtual_call =
false;
6333 bool need_qualifier =
false;
6351 ROSE_ASSERT(func_call_expr);
6352 return func_call_expr;
6358 ROSE_ASSERT(f != NULL);
6360 ROSE_ASSERT(func_call_expr != NULL);
6365 if (parameters != NULL) {
6370 return func_call_expr;
6376 ROSE_ASSERT(f != NULL);
6378 ROSE_ASSERT(func_call_expr != NULL);
6381 if (parameters) parameters->
set_parent(func_call_expr);
6384 return func_call_expr;
6395 ROSE_ASSERT(scope != NULL);
6421 std::string functionName,
6427 ROSE_ASSERT(classSymbol);
6431 ROSE_ASSERT(classDeclaration != NULL);
6434 ROSE_ASSERT(classDefinition);
6438 ROSE_ASSERT(functionSymbol);
6461 ROSE_ASSERT(builtin_func_call_expr != NULL);
6463 SgNodePtrList & args = builtin_func_call_expr->get_args();
6464 for (SgNodePtrList::iterator it = parameters.begin(); it != parameters.end(); ++it) {
6465 args.push_back(*it);
6466 (*it)->set_parent(builtin_func_call_expr);
6469 return builtin_func_call_expr;
6476 ROSE_ASSERT(kernel);
6477 ROSE_ASSERT(parameters);
6478 ROSE_ASSERT(config);
6483 if (func_ref_exp == NULL && template_func_ref_exp == NULL)
6485 std::cerr <<
"SgCudaKernelCallExp accept only direct reference to a function. Got, " <<
typeid(*kernel).name()
6492 else if ( (func_ref_exp != NULL && func_ref_exp->get_symbol_i()->get_declaration()->get_functionModifier().isCudaKernel() ==
false) &&
6493 (template_func_ref_exp != NULL && template_func_ref_exp->get_symbol_i()->get_declaration()->get_functionModifier().isCudaKernel() ==
false) )
6495 std::cerr <<
"To build a SgCudaKernelCallExp the callee needs to be a kernel (having \"__global__\" attribute)." << std::endl;
6507 ROSE_ASSERT(kernel_call_expr);
6509 return kernel_call_expr;
6514 if (!grid || !blocks) {
6515 std::cerr <<
"SgCudaKernelExecConfig need fields 'grid' and 'blocks' to be set." << std::endl;
6532 ROSE_ASSERT(config);
6541 ROSE_ASSERT(lhs != NULL);
6542 ROSE_ASSERT(rhs != NULL);
6547 ROSE_ASSERT(assignOp);
6568 ROSE_ASSERT(lhs != NULL);
6569 ROSE_ASSERT(rhs != NULL);
6574 ROSE_ASSERT(assignOp);
6601 ROSE_ASSERT(labelstmt);
6621 ASSERT_not_null(labelStmt);
6624 if (stmt !=
nullptr) {
6638 ROSE_ASSERT(conditional);
6639 ROSE_ASSERT(true_body);
6641 ROSE_ASSERT(ifstmt);
6646 ifstmt->setCaseInsensitive(
true);
6651 if (false_body != NULL) false_body->
set_parent(ifstmt);
6661 if (isSgBasicBlock(true_body)|| isSgFortranDo(true_body)|| isSgIfStmt(true_body))
6674 ROSE_ASSERT(ifstmt);
6689 ASSERT_not_null(result);
6692 result->setCaseInsensitive(
true);
6699 increment->set_parent(result);
6713 ASSERT_not_null(result);
6716 result->setCaseInsensitive(
true);
6723 increment->set_parent(result);
6746 ROSE_ASSERT(forInit != NULL);
6748 ROSE_ASSERT(statement != NULL);
6749 forInit->append_init_stmt(statement);
6763 (*it)->set_parent(result);
6778 (*it)->set_parent(result);
6792 ROSE_ASSERT(result);
6795 result->setCaseInsensitive(
true);
6803 increment->set_parent(result);
6807 result->set_else_body(else_body);
6822 for_init_stmt->set_parent(result);
6827 ROSE_ASSERT(init_stmt);
6841 if (initialize_stmt)
6843 init_stmt->append_init_stmt(initialize_stmt);
6846 if (isSgVariableDeclaration(initialize_stmt))
6864 ROSE_ASSERT(result);
6869 result->setCaseInsensitive(
true);
6873 if (loop_body) loop_body->
set_parent(result);
6874 if (increment) increment->set_parent(result);
6875 if (else_body) else_body->
set_parent(result);
6877 result->set_else_body(else_body);
6879 if (initialize_stmt != NULL)
6882 ROSE_ASSERT(init_stmt);
6884 init_stmt->append_init_stmt(initialize_stmt);
6896 ROSE_ASSERT(result != NULL);
6912 ROSE_ASSERT(result != NULL);
6921 if (result->get_test() != NULL && test != result->get_test())
6923 delete result->get_test();
6924 result->set_test(NULL);
6927 if (result->get_increment() != NULL && increment != result->get_increment())
6929 delete result->get_increment();
6930 result->set_increment(NULL);
6939 if (result->get_else_body() != NULL && else_body != result->get_else_body())
6941 delete result->get_else_body();
6942 result->set_else_body(NULL);
6946 result->set_test(test);
6947 result->set_increment(increment);
6951 result->setCaseInsensitive(
true);
6955 if (loop_body) loop_body->
set_parent(result);
6956 if (increment) increment->set_parent(result);
6957 if (init_stmt) init_stmt->
set_parent(result);
6958 if (else_body) else_body->
set_parent(result);
6960 result->set_else_body(else_body);
6963 ROSE_ASSERT(result->get_test() != NULL);
6964 ROSE_ASSERT(result->get_increment() != NULL);
6988 ROSE_ASSERT(result != NULL);
6992 if (initializer != NULL) initializer->
set_parent(result);
6993 if (range != NULL) range->
set_parent(result);
6995 if (begin_declaration != NULL) begin_declaration->
set_parent(result);
6996 if (end_declaration != NULL) end_declaration->
set_parent(result);
6998 if (not_equal_expression != NULL) not_equal_expression->
set_parent(result);
6999 if (increment_expression != NULL) increment_expression->
set_parent(result);
7015 ASSERT_not_null(result);
7016 ASSERT_not_null(body);
7017 ASSERT_not_null(condition);
7019 ASSERT_require(result->
get_body() ==
nullptr);
7030 ASSERT_not_null(result->
get_body());
7044 ROSE_ASSERT(result);
7047 if (loop_body) loop_body->
set_parent(result);
7048 if (increment) increment->set_parent(result);
7051 if (initialize_stmt != NULL) {
7053 ROSE_ASSERT(init_stmt);
7055 init_stmt->append_init_stmt(initialize_stmt);
7066 ROSE_ASSERT(result);
7071 result->setCaseInsensitive(
true);
7075 if (loop_body) loop_body->
set_parent(result);
7076 if (increment) increment->set_parent(result);
7078 if (init_stmt) init_stmt->
set_parent(result);
7141 ROSE_ASSERT(condition);
7144 ROSE_ASSERT(result);
7149 result->setCaseInsensitive(
true);
7156 if (else_body != NULL) {
7157 result->set_else_body(else_body);
7168 ROSE_ASSERT(result);
7177 ROSE_ASSERT(expr != NULL && body != NULL);
7188 ROSE_ASSERT(expr != NULL && body != NULL);
7199 ROSE_ASSERT(condition);
7202 ROSE_ASSERT(result);
7212 ROSE_ASSERT(result);
7214 if (condition) condition->
set_parent(result);
7224 ROSE_ASSERT(result != NULL);
7235 ROSE_ASSERT(result);
7243 ROSE_ASSERT(result);
7251 ASSERT_not_null(result);
7259 ASSERT_not_null(result);
7267 ASSERT_not_null(result);
7275 ASSERT_not_null(result);
7283 ROSE_ASSERT(result);
7291 ROSE_ASSERT(result);
7298 SgDeleteExp *result =
new SgDeleteExp(target, is_array, need_global_specifier, deleteOperatorDeclaration);
7299 target->set_parent(result);
7306 SgDeleteExp *result =
new SgDeleteExp(target, is_array, need_global_specifier, deleteOperatorDeclaration);
7307 target->set_parent(result);
7315 ROSE_ASSERT(test != NULL);
7328 ROSE_ASSERT(result);
7332 markLhsValues(result);
7342 ROSE_ASSERT(test != NULL);
7344 if (exceptionArgument != NULL) {
7345 result -> set_exception_argument(exceptionArgument);
7355 ROSE_ASSERT(test != NULL);
7363 ROSE_ASSERT(value != NULL);
7372 ROSE_ASSERT(value != NULL);
7381 ROSE_ASSERT(key != NULL && datum != NULL);
7391 ROSE_ASSERT(key != NULL && datum != NULL);
7402 ROSE_ASSERT(result);
7403 for (
size_t i = 0; i < pairs.size(); ++i)
7404 result->append_pair(pairs[i]);
7412 ROSE_ASSERT(result);
7413 for (
size_t i = 0; i < pairs.size(); ++i)
7414 result->append_pair(pairs[i]);
7422 ROSE_ASSERT(target != NULL);
7423 ROSE_ASSERT(iter != NULL);
7425 ROSE_ASSERT(result);
7427 target->set_parent(result);
7438 ROSE_ASSERT(target != NULL);
7439 ROSE_ASSERT(iter != NULL);
7441 ROSE_ASSERT(result);
7442 target->set_parent(result);
7452 ROSE_ASSERT(elt != NULL);
7453 ROSE_ASSERT(generators != NULL);
7464 ROSE_ASSERT(elt != NULL);
7465 ROSE_ASSERT(generators != NULL);
7476 ROSE_ASSERT(elt != NULL);
7477 ROSE_ASSERT(generators != NULL);
7488 ROSE_ASSERT(elt != NULL);
7489 ROSE_ASSERT(generators != NULL);
7500 ROSE_ASSERT(kd_pair != NULL);
7501 ROSE_ASSERT(generators != NULL);
7512 ROSE_ASSERT(kd_pair != NULL);
7513 ROSE_ASSERT(generators != NULL);
7523 ROSE_ASSERT(arg != NULL);
7532 ROSE_ASSERT(arg != NULL);
7546 ROSE_ASSERT(pragma);
7551 ROSE_ASSERT(result);
7573 ROSE_ASSERT(result);
7583 ROSE_ASSERT(emptyDeclaration != NULL);
7596 ROSE_ASSERT(emptyDeclaration->
get_parent() != NULL);
7599 return emptyDeclaration;
7606 ROSE_ASSERT(result);
7611 result->setCaseInsensitive(
true);
7631 ROSE_ASSERT(result);
7635 result->setCaseInsensitive(
true);
7663 ROSE_ASSERT(result);
7672 ROSE_ASSERT (symbol != NULL);
7678 result->set_label_expression(l_exp);
7683 ROSE_ASSERT (l_stmt != NULL);
7686 ROSE_ASSERT(result);
7694 ROSE_ASSERT(result);
7705 result->set_selector_expression(label_expression);
7706 ROSE_ASSERT(result);
7718 if (expression == NULL)
7723 ROSE_ASSERT(result);
7724 if (expression != NULL) expression->
set_parent(result);
7733 ROSE_ASSERT(result);
7734 if (expression != NULL) expression->
set_parent(result);
7742 ROSE_ASSERT(result);
7752 ROSE_ASSERT(result);
7762 ROSE_ASSERT(result);
7771 ROSE_ASSERT(result);
7780 ROSE_ASSERT(result);
7783 result->setCaseInsensitive(
true);
7786 if (item_selector) item_selector->
set_parent(result);
7795 ROSE_ASSERT(result);
7807 ROSE_ASSERT(result);
7817 ROSE_ASSERT(result);
7826 if (locals != NULL && globals == NULL)
7827 ROSE_ASSERT(!
"buildExecStatement with non-NULL locals requires non-NULL globals");
7828 ROSE_ASSERT(executable != NULL);
7832 if (globals != NULL) globals->
set_parent(result);
7833 if (locals != NULL) locals->
set_parent(result);
7843 if (locals != NULL && globals == NULL)
7844 ROSE_ASSERT(!
"buildExecStatement with non-NULL locals requires non-NULL globals");
7845 ROSE_ASSERT(executable != NULL);
7849 if (globals != NULL) globals->
set_parent(result);
7850 if (locals != NULL) locals->
set_parent(result);
7859 ROSE_ASSERT(body != NULL);
7861 ROSE_ASSERT(async_stmt);
7871 ROSE_ASSERT(body != NULL);
7873 ROSE_ASSERT(finish_stmt);
7883 ROSE_ASSERT(expression);
7896 ROSE_ASSERT(body != NULL);
7898 ROSE_ASSERT(atomic_stmt);
7908 ROSE_ASSERT(expression);
7921 ROSE_ASSERT(expression);
7934 ROSE_ASSERT(expression);
7966 ROSE_ASSERT(body != NULL);
7985 if (catch0 != NULL) try_stmt->append_catch_statement(catch0);
7986 if (catch1 != NULL) try_stmt->append_catch_statement(catch1);
7987 if (catch2 != NULL) try_stmt->append_catch_statement(catch2);
7988 if (catch3 != NULL) try_stmt->append_catch_statement(catch3);
7989 if (catch4 != NULL) try_stmt->append_catch_statement(catch4);
8006 ROSE_ASSERT(try_body != NULL);
8008 try_body -> set_parent(try_stmt);
8014 try_stmt -> set_finally_body(finally_body);
8015 finally_body -> set_parent(try_stmt);
8029 if (catch_option_stmt) {
8030 catch_statement_sequence -> append_catch_statement(catch_option_stmt);
8031 catch_option_stmt -> set_parent(catch_statement_sequence);
8034 return catch_statement_sequence;
8041 if (condition) condition->
set_parent(result);
8049 ROSE_ASSERT(expression);
8064 ROSE_ASSERT(throw_stmt);
8074 ROSE_ASSERT(foreach_stmt);
8076 if (collection) collection -> set_parent(foreach_stmt);
8077 if (body) body -> set_parent(foreach_stmt);
8079 return foreach_stmt;
8085 ROSE_ASSERT(label_stmt);
8089 stmt -> set_parent(label_stmt);
8095 ROSE_ASSERT(lsymbol);
8096 label_stmt -> insert_symbol(lsymbol ->
get_name(), lsymbol);
8146 ROSE_ASSERT(result);
8147 result->set_assemblyCode(s);
8158 ROSE_ASSERT(result);
8159 result->set_assemblyCode(s);
8169#define NOP_1_BYTE_STRING "nop"
8170#define NOP_2_BYTE_STRING ".byte 0x66,0x90"
8171#define NOP_3_BYTE_STRING "nopl (%eax)"
8172#define NOP_4_BYTE_STRING "nopl 0x01(%eax)"
8173#define NOP_5_BYTE_STRING ".byte 0x0f,0x1f,0x44,0x00,0x00"
8174#define NOP_6_BYTE_STRING ".byte 0x66,0x0f,0x1f,0x44,0x00,0x00"
8175#define NOP_7_BYTE_STRING ".byte 0x0f,0x1f,0x80,0x00,0x00,0x00,0x00"
8176#define NOP_8_BYTE_STRING ".byte 0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00"
8177#define NOP_9_BYTE_STRING ".byte 0x66,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00"
8197 printf (
"Only supporting values of multi-byte nop's up to 9 bytes long. \n");
8202 return nopStatement;
8209 ROSE_ASSERT(condition != NULL);
8212 ROSE_ASSERT(result != NULL);
8229 ROSE_ASSERT(result != NULL);
8243 if (isSgReferenceType (base_type))
8245 cerr<<
"Error in SageBuilder::buildPointerType(): trying to build a pointer to a reference type! This is not allowed in C++."<<endl;
8250 ROSE_ASSERT(result != NULL);
8258 ROSE_ASSERT(result != NULL);
8264 ROSE_ASSERT(base_type != NULL);
8266 ROSE_ASSERT(result != NULL);
8273 ROSE_ASSERT(base_expression != NULL);
8277 if (isSgFunctionParameterRefExp(base_expression) != NULL)
8280 result->set_base_type(base_type);
8287 ROSE_ASSERT(result != NULL);
8300#define DEBUG_TYPEOF_TYPE 0
8302#if DEBUG_TYPEOF_TYPE
8303 printf (
"In SageBuilder::buildTypeOfType(): base_expression = %p = %s \n",base_expression,base_expression != NULL ? base_expression->
class_name().c_str() :
"NULL");
8304 printf (
" ------------------------------- base_type = %p = %s \n",base_type,base_type != NULL ? base_type->
class_name().c_str() :
"NULL");
8308 if (isSgFunctionParameterRefExp(base_expression) != NULL)
8310#if DEBUG_TYPEOF_TYPE
8311 printf (
"In SageBuilder::buildTypeOfType(): isSgFunctionParameterRefExp(base_expression) != NULL: calling new SgTypeOfType(base_expression,NULL) \n");
8316 ROSE_ASSERT(result != NULL);
8317#if DEBUG_TYPEOF_TYPE
8318 printf (
"In buildTypeOfType(): test 1: result = %p = %s \n",result,result->class_name().c_str());
8320 result->set_base_type(base_type);
8324 if (base_expression != NULL)
8326#if DEBUG_TYPEOF_TYPE
8327 printf (
"In SageBuilder::buildTypeOfType(): isSgFunctionParameterRefExp(base_expression) == NULL: base_expression != NULL: calling SgTypeOfType::createType(base_expression,NULL) \n");
8332 ROSE_ASSERT(result != NULL);
8333#if DEBUG_TYPEOF_TYPE
8334 printf (
"In buildTypeOfType(): test 2: result = %p = %s \n",result,result->class_name().c_str());
8339 ROSE_ASSERT(base_type != NULL);
8341#if DEBUG_TYPEOF_TYPE
8342 printf (
"In SageBuilder::buildTypeOfType(): isSgFunctionParameterRefExp(base_expression) == NULL: base_expression == NULL: calling SgTypeOfType::createType(base_type,NULL) \n");
8347 ROSE_ASSERT(result != NULL);
8349#if DEBUG_TYPEOF_TYPE
8350 printf (
"In buildTypeOfType(): test 3: result = %p = %s \n",result,result->class_name().c_str());
8353 if (result->get_base_type() != base_type)
8355 ROSE_ASSERT(result->get_base_type() != NULL);
8356#if DEBUG_TYPEOF_TYPE
8357 printf (
"result->get_base_type() = %p = %s \n",result->get_base_type(),result->get_base_type()->class_name().c_str());
8359 ROSE_ASSERT(base_type != NULL);
8360#if DEBUG_TYPEOF_TYPE
8361 printf (
"base_type = %p = %s \n",base_type,base_type->
class_name().c_str());
8367 ROSE_ASSERT(result != NULL);
8369 if (base_expression != NULL)
8375 ROSE_ASSERT(result != NULL);
8377#if DEBUG_TYPEOF_TYPE
8378 printf (
"In buildTypeOfType(): test 4: result = %p = %s \n",result,result->class_name().c_str());
8387 ROSE_ASSERT(result);
8388 if (kind_expr != NULL) kind_expr->
set_parent(result);
8398 ROSE_ASSERT(result);
8405 ROSE_ASSERT(result);
8412 ROSE_ASSERT(result);
8419 ROSE_ASSERT(result);
8426 ROSE_ASSERT(result);
8433 ROSE_ASSERT(result);
8441 ROSE_ASSERT(result);
8442 if (kind_expr != NULL) kind_expr->
set_parent(result);
8453 ROSE_ASSERT(result);
8459 ROSE_ASSERT(result);
8465 ROSE_ASSERT(result);
8471 ROSE_ASSERT(result);
8477 ROSE_ASSERT(result);
8483 ROSE_ASSERT(result);
8489 ROSE_ASSERT(result);
8495 ROSE_ASSERT(result);
8501 ROSE_ASSERT(result);
8507 ROSE_ASSERT(result);
8514 ROSE_ASSERT(result);
8521 ROSE_ASSERT(result);
8528 ROSE_ASSERT(result);
8535 ROSE_ASSERT(result);
8542 ROSE_ASSERT(result);
8549 ROSE_ASSERT(result);
8556 ROSE_ASSERT(result);
8563 ROSE_ASSERT(result);
8570 ROSE_ASSERT(result);
8577 ROSE_ASSERT(result);
8584 ROSE_ASSERT(result);
8591 ROSE_ASSERT(result);
8598 ROSE_ASSERT(result);
8605 ROSE_ASSERT(result);
8612 ROSE_ASSERT(result);
8619 ROSE_ASSERT(result);
8631 ROSE_ASSERT(result != NULL);
8646 SgTypeString* result = SgTypeString::createType(stringLengthExpression);
8647 ASSERT_not_null(result);
8655 if (kind_expr != NULL)
8664 ASSERT_not_null(result);
8675 ROSE_ASSERT(result);
8683 if (kind_expr != NULL)
8692 ASSERT_not_null(result);
8698 ASSERT_not_null(result);
8706 ROSE_ASSERT(result);
8728 ROSE_ASSERT(base_type != NULL);
8732 ROSE_ASSERT(result != NULL);
8735 ROSE_ASSERT(result != base_type);
8740 SgModifierType* result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8742 if (result != result2)
8745 printf (
"WARNING: In SageBuilder::buildModifierType(): using previously build SgModifierType from global type table: result2 = %p = %s \n",result2,result2->
class_name().c_str());
8750 ROSE_ASSERT(result2 != base_type);
8758 ROSE_ASSERT(base_type != NULL);
8762 ROSE_ASSERT(result!=NULL);
8768 SgModifierType *result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8770 if (result != result2)
8776 ROSE_ASSERT(result2 != base_type);
8785 ROSE_ASSERT(base_type != NULL);
8788 ROSE_ASSERT(result != NULL);
8790 result->set_type_kind(kindExpression);
8792 SgModifierType *result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8793 if (result != result2)
8805 ROSE_ASSERT(base_type != NULL);
8807 ROSE_ASSERT(result!=NULL);
8814 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8815 if (result != result2)
8827 ROSE_ASSERT(base_type != NULL);
8830 ROSE_ASSERT(result!=NULL);
8835 printf (
"In SageBuilder::buildConstVolatileType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
8840 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8841 if (result != result2) {
8849generate_type_list (
SgType* type)
8852 string returnString;
8854 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);
8856 SgType* currentType = type;
8865 while (currentType != NULL)
8868 if ( (bit_array & SgType::STRIP_MODIFIER_TYPE) && (modType = isSgModifierType(currentType)) )
8870 currentType = modType->get_base_type();
8872 else if ( (bit_array & SgType::STRIP_REFERENCE_TYPE) && (refType = isSgReferenceType(currentType)) )
8874 currentType = refType->get_base_type();
8876 else if ( (bit_array & SgType::STRIP_RVALUE_REFERENCE_TYPE) && (rRefType = isSgRvalueReferenceType(currentType)) )
8878 currentType = rRefType->get_base_type();
8880 else if ( (bit_array & SgType::STRIP_POINTER_TYPE) && (pointType = isSgPointerType(currentType)) )
8882 currentType = pointType->get_base_type();
8884 else if ( (bit_array & SgType::STRIP_ARRAY_TYPE) && (arrayType = isSgArrayType(currentType)) )
8886 currentType = arrayType->get_base_type();
8888 else if ( (bit_array & SgType::STRIP_TYPEDEF_TYPE) && (typedefType = isSgTypedefType(currentType)) )
8898 returnString +=
" , ";
8901 return returnString;
8908 ROSE_ASSERT(base_type != NULL);
8915 if (!isSgPointerType(base_type) && !isSgReferenceType(base_type) && !isSgArrayType(base_type) && !isSgTypedefType(base_type) && !isSgModifierType(base_type))
8917 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());
8918 printf (
" --- generate_type_list() = %s \n",generate_type_list(base_type).c_str());
8923 ASSERT_not_null(result);
8929 SgModifierType* result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8930 if (result != result2) {
8942 ASSERT_not_null(base_type);
8945 setModifiers(result);
8947 SgModifierType* result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8948 if (result != result2)
delete result;
8958 return _buildModifierType(base_type, op);
8965 return _buildModifierType(base_type, op);
8973 ROSE_ASSERT(base_type != NULL);
8976 ROSE_ASSERT(result!=NULL);
8982 SgModifierType *result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8983 if (result != result2) {
8993 ROSE_ASSERT(base_type != NULL);
8996 ROSE_ASSERT(result!=NULL);
9002 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9003 if (result != result2) {
9013 ROSE_ASSERT(base_type != NULL);
9016 ROSE_ASSERT(result!=NULL);
9024 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9025 if (result != result2) {
9035 ROSE_ASSERT(base_type != NULL);
9038 ROSE_ASSERT(result != NULL);
9044 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
9052 ROSE_ASSERT(base_type != NULL);
9055 ROSE_ASSERT(result!=NULL);
9061 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
9069 ROSE_ASSERT(base_type != NULL);
9072 ROSE_ASSERT(result!=NULL);
9078 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
9085 ROSE_ASSERT(base_type != NULL);
9087 ROSE_ASSERT(result!=NULL);
9094 ROSE_ASSERT(base_type != NULL);
9096 ROSE_ASSERT(result!=NULL);
9104 ROSE_ASSERT(result != NULL);
9112 ROSE_ASSERT(result != NULL);
9114 if(t1) result->append_type(t1);
9115 if(t2) result->append_type(t2);
9116 if(t3) result->append_type(t3);
9117 if(t4) result->append_type(t4);
9118 if(t5) result->append_type(t5);
9119 if(t6) result->append_type(t6);
9120 if(t7) result->append_type(t7);
9121 if(t8) result->append_type(t8);
9122 if(t9) result->append_type(t9);
9123 if(t10) result->append_type(t10);
9134 nrdecl->set_is_template_param (
true);
9135 return nrdecl->get_type();
9142 ROSE_ASSERT(result != NULL);
9144 result->append(start);
9152 ROSE_ASSERT(result != NULL);
9154 result->set_start(start);
9157 result->set_end(end);
9160 result->set_stride(stride);
9171 result->append_expression(firstRow);
9172 ROSE_ASSERT(result != NULL);
9182 ROSE_ASSERT(result != NULL);
9192 ROSE_ASSERT (result != NULL);
9193 result->set_modifier (mtype);
9226 ROSE_ASSERT(expr != NULL);
9238 ROSE_ASSERT(expr != NULL);
9249 ROSE_ASSERT(expr != NULL);
9252 if (lambda_capture_list != NULL)
9257 if (lambda_closure_class != NULL)
9262 if (lambda_function != NULL)
9267 if (lambda_closure_class != NULL)
9269 lambda_function->
set_parent(lambda_closure_class);
9273 printf (
"Warning: In SageBuilder::buildLambdaExp(): lambda_closure_class == NULL: lambda_function parent not set! \n");
9286 ROSE_ASSERT(expr != NULL);
9289 if (lambda_capture_list != NULL)
9294 if (lambda_closure_class != NULL)
9299 if (lambda_function != NULL)
9315 ROSE_ASSERT(lambdaCapture != NULL);
9318 return lambdaCapture;
9325 ROSE_ASSERT(lambdaCapture != NULL);
9328 return lambdaCapture;
9335 ROSE_ASSERT(lambdaCaptureList != NULL);
9338 return lambdaCaptureList;
9345 ROSE_ASSERT(lambdaCaptureList != NULL);
9348 return lambdaCaptureList;
9356 ROSE_ASSERT(result != NULL);
9366 ROSE_ASSERT(result != NULL);
9377 ROSE_ASSERT(result != NULL);
9386 ROSE_ASSERT(result != NULL);
9397 ROSE_ASSERT(result != NULL);
9407 ROSE_ASSERT(result != NULL);
9429 ROSE_ASSERT(result);
9442 return nonreal_decl_scope;
9453 ROSE_ASSERT(buildTemplateInstantiation ==
false || isSgTemplateInstantiationDecl(d) != NULL);
9462 ROSE_ASSERT(result);
9468 result->setCaseInsensitive(
true);
9486 ROSE_ASSERT(buildTemplateInstantiation ==
false || isSgTemplateInstantiationDecl(d) != NULL);
9495 ROSE_ASSERT(result);
9500 result->setCaseInsensitive(
true);
9510 SgName nameWithoutTemplateArguments = XXX_name;
9512 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
9517#define DEBUG_NONDEFINING_CLASS_DECLARATION 0
9520#if DEBUG_NONDEFINING_CLASS_DECLARATION
9521 printf (
"Building a SgClassDeclaration: buildNondefiningClassDeclaration_nfi() nameWithoutTemplateArguments = %s buildTemplateInstantiation = %s \n",nameWithoutTemplateArguments.str(),buildTemplateInstantiation ?
"true:" :
"false");
9522 printf (
" --- scope = %p = %s \n",scope,(scope != NULL) ? scope->
class_name().c_str() :
"null");
9529 if (buildTemplateInstantiation ==
true)
9531 ROSE_ASSERT(templateArgumentsList != NULL);
9534#if DEBUG_NONDEFINING_CLASS_DECLARATION
9535 printf (
"Building a SgClassDeclaration: buildNondefiningClassDeclaration_nfi() nameWithTemplateArguments = %s buildTemplateInstantiation = %s \n",nameWithTemplateArguments.str(),buildTemplateInstantiation ?
"true:" :
"false");
9539 SgTemplateArgumentPtrList emptyList;
9542#if DEBUG_NONDEFINING_CLASS_DECLARATION
9543 printf (
"In buildNondefiningClassDeclaration_nfi(): built new SgTemplateInstantiationDecl: nondefdecl = %p \n",nondefdecl);
9545 ROSE_ASSERT(nondefdecl->get_type() == NULL);
9546 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl) != NULL);
9547#if DEBUG_NONDEFINING_CLASS_DECLARATION
9548 printf (
"In buildNondefiningClassDeclaration_nfi(): nondefdecl->get_name() = %s nondefdecl->get_templateName() = %s \n",
9549 nondefdecl->get_name().str(),isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().str());
9552 ROSE_ASSERT(templateArgumentsList != NULL);
9554#if DEBUG_NONDEFINING_CLASS_DECLARATION
9555 printf (
"nondefdecl->get_name() = %s \n",nondefdecl->get_name().str());
9556 printf (
"nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
9557 printf (
"Output templateArgumentsList: \n");
9558 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
9560 printf (
" --- --- templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
9565 ROSE_ASSERT(nondefdecl->get_name() == nameWithTemplateArguments);
9566 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().is_null() ==
true);
9567 isSgTemplateInstantiationDecl(nondefdecl)->
set_templateName(nameWithoutTemplateArguments);
9572#if DEBUG_NONDEFINING_CLASS_DECLARATION
9573 printf (
"In buildNondefiningClassDeclaration_nfi(): built new SgClassDeclaration: nondefdecl = %p \n",nondefdecl);
9578 ROSE_ASSERT(nameWithoutTemplateArguments == nameWithTemplateArguments);
9581 ROSE_ASSERT(nondefdecl != NULL);
9582 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
9583 ROSE_ASSERT(nondefdecl->get_type() == NULL);
9607 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
9615 SgClassSymbol* mysymbol = scope->lookup_nontemplate_class_symbol(nameWithTemplateArguments,templateArgumentsList);
9617#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
9618 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): mysymbol = %p = %s \n",mysymbol,(mysymbol != NULL) ? mysymbol->
class_name().c_str() :
"null");
9620 if (mysymbol != NULL)
9622 firstNondefdecl = isSgClassDeclaration(mysymbol->get_declaration());
9623 ROSE_ASSERT(firstNondefdecl != NULL);
9625 ROSE_ASSERT(firstNondefdecl->get_type() != NULL);
9628 ROSE_ASSERT(nondefdecl->get_type() == NULL);
9630 if (nondefdecl->get_type() == NULL)
9632#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
9633 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);
9636#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
9637 printf (
"NOTE: Call nondefdecl->set_type(firstNondefdecl->get_type()); instead of nondefdecl->set_type(SgClassType::createType(firstNondefdecl)); \n");
9640 ROSE_ASSERT(nondefdecl->get_type() != NULL);
9642#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
9643 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str());
9645 ROSE_ASSERT(nondefdecl->get_type() == firstNondefdecl->get_type());
9648#if (REUSE_CLASS_DECLARATION_FROM_SYMBOL == 0)
9649 ROSE_ASSERT(nondefdecl != NULL);
9650 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
9656 printf (
"ERROR: In SgDeclarationStatement::set_firstNondefiningDeclaration(): nondefdecl = %p = %s IS NOT THE SAME AS firstNondefiningDeclaration = %p = %s \n",
9657 nondefdecl,nondefdecl->
class_name().c_str(),firstNondefdecl,firstNondefdecl->
class_name().c_str());
9659 nondefdecl->
get_file_info()->display(
"ERROR: In SgDeclarationStatement::set_firstNondefiningDeclaration(): nondefdecl: debug");
9661 firstNondefdecl->
get_file_info()->display(
"ERROR: In SgDeclarationStatement::set_firstNondefiningDeclaration(): firstNondefdecl: debug");
9673 ROSE_ASSERT(firstNondefdecl != NULL);
9674 ROSE_ASSERT(firstNondefdecl->get_type() != NULL);
9680 if (buildTemplateInstantiation ==
true)
9686 ROSE_ASSERT (nondefdecl->get_type() == firstNondefdecl->get_type());
9689 if (nondefdecl->get_type() != firstNondefdecl->get_type())
9692 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());
9693 printf (
"Skipping delete of %p so we can maintain unique type pointers \n",nondefdecl->get_type());
9695 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());
9696 nondefdecl->set_type(firstNondefdecl->get_type());
9699 printf (
"Unclear if this code is executed \n");
9706 ROSE_ASSERT(nondefdecl == NULL);
9713#if REUSE_CLASS_DECLARATION_FROM_SYMBOL
9722 ROSE_ASSERT(nondefdecl != NULL);
9723 if (nondefdecl->get_type() == NULL)
9726 printf (
"SageBuilder::buildNondefiningClassDeclaration_nfi(): nondefdecl = %p \n",nondefdecl);
9737 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
9740 firstNondefdecl = nondefdecl;
9743 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
9744 ROSE_ASSERT(mysymbol->get_declaration()->get_definition() == NULL);
9751 if (buildTemplateInstantiation ==
true)
9755#if DEBUG_NONDEFINING_CLASS_DECLARATION
9756 printf (
"BEFORE scope->insert_symbol(): scope = %p = %s nameWithTemplateArguments = %s mysymbol = %p = %s \n",
9757 scope,scope->
class_name().c_str(),nameWithTemplateArguments.str(),mysymbol,mysymbol->
class_name().c_str());
9764 ROSE_ASSERT(nondefdecl->get_type() == NULL);
9765 if (nondefdecl->get_type() == NULL)
9770#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
9771 printf (
"NOTE: In buildNondefiningClassDeclaration_nfi(): 2nd time this is a performance issue (maybe) to call the lookup_nontemplate_class_symbol() again \n");
9781 SgClassSymbol* temp_classSymbol = nondefdecl->
get_scope()->lookup_nontemplate_class_symbol(nameWithTemplateArguments,templateArgumentsList);
9782#if DEBUG_NONDEFINING_CLASS_DECLARATION
9784 printf (
"In buildNondefiningClassDeclaration_nfi(): temp_classSymbol = %p \n",temp_classSymbol);
9785 printf (
"In buildNondefiningClassDeclaration_nfi(): nondefdecl->get_scope() = %p = %s scope = %p \n",nondefdecl->
get_scope(),nondefdecl->
get_scope()->
class_name().c_str(),scope);
9787 printf (
"In buildNondefiningClassDeclaration_nfi(): nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
9788 if (templateArgumentsList != NULL)
9790 printf (
" --- templateArgumentsList elements: \n");
9791 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
9793 printf (
" --- --- templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
9794 printf (
" --- --- templateArgumentsList->[%zu] = %s \n",i,templateArgumentsList->operator[](i)->class_name().c_str());
9795 templateArgumentsList->operator[](i)->
display(
"In SageBuilder::buildNondefiningClassDeclaration_nfi()");
9800 ROSE_ASSERT(nondefdecl->
get_scope()->lookup_class_symbol(nameWithTemplateArguments,templateArgumentsList) != NULL);
9801 ROSE_ASSERT(nondefdecl->
get_scope() == scope);
9805 ROSE_ASSERT(temp_classSymbol == NULL || temp_classSymbol->get_declaration()->get_definition() == NULL);
9808 ROSE_ASSERT(mysymbol != NULL);
9809 ROSE_ASSERT(firstNondefdecl != NULL);
9822 ROSE_ASSERT(nondefdecl->get_type() != NULL);
9824 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
9826#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
9827 printf (
"NOTE: In buildNondefiningClassDeclaration_nfi(): 3rd time this is a performance issue (maybe) to call the lookup_nontemplate_class_symbol() again \n");
9837 SgClassSymbol* temp_classSymbol = nondefdecl->
get_scope()->lookup_nontemplate_class_symbol(nameWithTemplateArguments,templateArgumentsList);
9839 ROSE_ASSERT(temp_classSymbol == NULL || temp_classSymbol->get_declaration()->get_definition() == NULL);
9841 ROSE_ASSERT(nondefdecl != NULL);
9842 ROSE_ASSERT(nondefdecl->get_name() == nameWithTemplateArguments);
9845 if (isSgTemplateInstantiationDecl(nondefdecl) != NULL)
9849 ROSE_ASSERT(finalName == nameWithTemplateArguments);
9850 ROSE_ASSERT(finalName == nondefdecl->get_name());
9853#if DEBUG_NONDEFINING_CLASS_DECLARATION
9854 printf (
"Leaving buildNondefiningClassDeclaration_nfi(): nondefdecl = %p nondefdecl->unparseNameToString() = %s \n",nondefdecl,nondefdecl->unparseNameToString().c_str());
9855 printf (
" --- nondefdecl = %p = %s \n",nondefdecl,nondefdecl->
class_name().c_str());
9858#if DEBUG_NONDEFINING_CLASS_DECLARATION
9860 printf (
"Leaving buildNondefiningClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
9861 SgSymbol* test_symbol = nondefdecl->
get_scope()->find_symbol_from_declaration(nondefdecl);
9863 printf (
"test_symbol = %p \n",test_symbol);
9866 printf (
"Leaving buildNondefiningClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
9875 ROSE_ASSERT(stmt != NULL);
9887 ROSE_ASSERT(stmt != NULL);
9901 std::string directive_string(name);
9907 if (params.length() > 0)
9908 directive_string +=
" " + params;
9910 directive_string +=
" " + def_string;
9913 ROSE_ASSERT(define_decl);
9933 ASSERT_not_null(forStmt);
9939 forStmt->setCaseInsensitive(
true);
9948 bool buildTemplateInstantiation =
false;
9962 SgDerivedTypeStatement* type_decl = buildClassDeclarationStatement_nfi <SgDerivedTypeStatement> (name, kind, scope);
9975 SgModuleStatement* module_stmt = buildClassDeclarationStatement_nfi <SgModuleStatement> (name, kind, scope);
9989 SgJovialTableStatement* table_decl = buildClassDeclarationStatement_nfi <SgJovialTableStatement> (name, kind, scope);
10001 std::string type_name(name);
10004 type_name =
"_table_of_" + type_name;
10006 if (dim_info->get_expressions().size() > 0) {
10007 std::ostringstream address;
10008 address << (
void const *)dim_info;
10009 type_name +=
"_" + address.str();
10014 SgJovialTableStatement* table_decl = buildClassDeclarationStatement_nfi <SgJovialTableStatement> (type_name, kind, scope);
10022 ROSE_ASSERT(nondef_decl != NULL);
10026 ROSE_ASSERT(table_type != NULL);
10028 table_type->set_base_type(base_type);
10029 table_type->set_dim_info(dim_info);
10030 table_type->set_rank(dim_info->get_expressions().size());
10033 nondef_decl->set_type(table_type);
10039template <
class DeclClass> DeclClass *
10068 mysymbol = scope->lookup_class_symbol(name);
10070 if (mysymbol == NULL)
10073 if (nonDefiningDecl != NULL)
10077 ROSE_ASSERT(temp_mysymbol != NULL);
10079 mysymbol = isSgClassSymbol(temp_mysymbol);
10080 ROSE_ASSERT(mysymbol != NULL);
10083 ROSE_ASSERT(scope == nonDefiningDecl->
get_scope());
10088 if (mysymbol != NULL)
10090 nondefdecl = (mysymbol->get_declaration() == NULL)
10091 ? NULL : dynamic_cast<DeclClass*>(mysymbol->get_declaration());
10092 ROSE_ASSERT(nondefdecl != NULL);
10097 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
10102 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10103 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10108 DeclClass* nondefining_classDeclaration = (nondefdecl == NULL) ? NULL : dynamic_cast<DeclClass*>(nondefdecl);
10109 ROSE_ASSERT(nondefining_classDeclaration != NULL);
10111 ? NULL : dynamic_cast<DeclClass*>(nondefdecl->get_definingDeclaration());
10112 ROSE_ASSERT(defining_classDeclaration != NULL);
10114 return defining_classDeclaration;
10119 ROSE_ASSERT(nondefdecl == NULL);
10122 nondefdecl =
new DeclClass(name, kind, NULL, NULL);
10123 ROSE_ASSERT(nondefdecl != NULL);
10135 ROSE_ASSERT(scope != NULL);
10142 ROSE_ASSERT(nondefdecl->
get_scope() != NULL);
10143 ROSE_ASSERT(nondefdecl->get_type() == NULL);
10145 if (nondefdecl->get_type() == NULL)
10161 ROSE_ASSERT(class_type != NULL);
10163 nondefdecl->set_type(class_type);
10165 SgClassDeclaration* tmp_classDeclarationFromType = isSgClassDeclaration(class_type->get_declaration());
10166 ROSE_ASSERT(tmp_classDeclarationFromType != NULL);
10169 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10170 if (nondefdecl->get_type()->get_declaration() != nondefdecl)
10172 printf (
"ERROR: nondefdecl = %p = %s \n",nondefdecl,nondefdecl->
class_name().c_str());
10173 printf (
"ERROR: nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str());
10174 printf (
"ERROR: nondefdecl->get_type()->get_declaration() = %p = %s \n",nondefdecl->get_type()->get_declaration(),nondefdecl->get_type()->get_declaration()->
class_name().c_str());
10176 SgClassDeclaration* classDeclarationFromType = isSgClassDeclaration(nondefdecl->get_type()->get_declaration());
10177 ROSE_ASSERT(classDeclarationFromType != NULL);
10179 printf (
"nondefdecl->get_name() = %s \n",nondefdecl->get_name().str());
10180 printf (
"nondefdecl->get_type()->get_name() = %s \n",nondefdecl->get_type()->
get_name().str());
10181 printf (
"nondefdecl->get_type()->get_declaration()->get_name() = %s \n",classDeclarationFromType->get_name().str());
10183 printf (
"nondefdecl->get_mangled_name() = %s \n",nondefdecl->get_mangled_name().getString().c_str());
10184 printf (
"nondefdecl->get_type()->get_mangled() = %s \n",nondefdecl->get_type()->
get_mangled().getString().c_str());
10185 printf (
"nondefdecl->get_type()->get_declaration()->get_mangled_name() = %s \n",classDeclarationFromType->get_mangled_name().getString().c_str());
10188 printf (
"nondefdecl->get_type()->get_declaration()->get_firstNondefiningDeclaration() = %s \n",classDeclarationFromType->
get_firstNondefiningDeclaration() ?
"true" :
"false");
10198 ROSE_ASSERT(nondefdecl->get_type()->get_declaration() == nondefdecl);
10208#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
10210 if (SourcePositionClassificationMode != e_sourcePositionTransformation)
10212 detectTransformations(nondefdecl);
10223 ROSE_ASSERT(nondefdecl->
get_scope() == scope);
10236 DeclClass* defdecl =
new DeclClass(name,kind,NULL,classDef);
10237 ROSE_ASSERT(defdecl != NULL);
10238 ROSE_ASSERT(defdecl->get_type() == NULL);
10241 ROSE_ASSERT(defdecl->get_definition() != NULL);
10242 ROSE_ASSERT(defdecl != NULL);
10252 classDef->set_declaration(defdecl);
10253 defdecl->set_definingDeclaration(defdecl);
10255 defdecl->set_firstNondefiningDeclaration(nondefdecl);
10258 ROSE_ASSERT(defdecl->get_type() == NULL);
10265 if (defdecl->get_type() != NULL)
10272 ROSE_ASSERT (nondefdecl->get_type() != NULL);
10273 defdecl->set_type(nondefdecl->get_type());
10278 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10281 ROSE_ASSERT (nondefdecl->get_type() != NULL);
10282 ROSE_ASSERT (defdecl->get_type() != NULL);
10283 ROSE_ASSERT (defdecl->get_type()->get_declaration() != NULL);
10284 ROSE_ASSERT (defdecl->get_type()->get_declaration() != isSgDeclarationStatement(defdecl));
10288 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10297 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10302 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10306 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10316 ROSE_ASSERT(defdecl->get_parent() == NULL);
10321 ROSE_ASSERT(defdecl->get_definingDeclaration() == defdecl);
10322 ROSE_ASSERT(defdecl->get_firstNondefiningDeclaration() != defdecl->get_definingDeclaration());
10325 SgClassDeclaration* temp_firstNondefiningDeclaration = isSgClassDeclaration(defdecl->get_firstNondefiningDeclaration());
10326 SgClassDeclaration* temp_definingDeclaration = isSgClassDeclaration(defdecl->get_definingDeclaration());
10327 ROSE_ASSERT(temp_firstNondefiningDeclaration != NULL);
10328 ROSE_ASSERT(temp_definingDeclaration != NULL);
10329 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_name() == temp_definingDeclaration->get_name());
10330 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_type() == temp_definingDeclaration->get_type());
10362 ROSE_ASSERT(scope != NULL);
10369 ROSE_ASSERT(defdecl != NULL);
10374 namespaceDef->set_namespaceDeclaration(defdecl);
10383 mysymbol = scope->lookup_namespace_symbol(name);
10389 printf (
"Warning: In SageBuilder::buildNamespaceDeclaration_nfi(): scope == NULL \n");
10392 if (mysymbol != NULL)
10395 ROSE_ASSERT(namespaceDeclaration != NULL);
10396 nondefdecl = isSgNamespaceDeclarationStatement(namespaceDeclaration);
10398 ROSE_ASSERT(nondefdecl != NULL);
10399 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10405 if (namespaceDeclaration->
get_definition()->get_global_definition() == NULL)
10407 printf (
"ERROR: namespaceDeclaration->get_definition()->get_global_definition() == NULL: namespaceDeclaration = %p = %s namespaceDeclaration->get_definition() = %p \n",
10410 ROSE_ASSERT(namespaceDeclaration->
get_definition()->get_global_definition() != NULL);
10411 namespaceDef->set_global_definition(namespaceDeclaration->
get_definition()->get_global_definition());
10412 ROSE_ASSERT(namespaceDef->get_global_definition() != NULL);
10415 ROSE_ASSERT(namespaceDef->get_global_definition() == namespaceDef->get_global_definition()->get_global_definition());
10417 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
10419 ROSE_ASSERT(nondefdecl->
get_definition()->get_previousNamespaceDefinition() == NULL);
10423 ROSE_ASSERT(i != NULL);
10424 while (i != NULL && i->get_nextNamespaceDefinition() != NULL)
10426 i = i->get_nextNamespaceDefinition();
10427 ROSE_ASSERT(i->get_previousNamespaceDefinition() != NULL);
10430 ROSE_ASSERT(i != NULL);
10431 i->set_nextNamespaceDefinition(namespaceDef);
10432 namespaceDef->set_previousNamespaceDefinition(i);
10439 nondefdecl = defdecl;
10440 ROSE_ASSERT(nondefdecl != NULL);
10442 ROSE_ASSERT(namespaceDef->get_namespaceDeclaration() != NULL);
10446 namespaceDef->set_global_definition(global_definition_namespaceDef);
10447 ROSE_ASSERT(namespaceDef->get_global_definition() != NULL);
10450 global_definition_namespaceDef->set_global_definition(global_definition_namespaceDef);
10452 global_definition_namespaceDef->set_isUnionOfReentrantNamespaceDefinitions(
true);
10455 ROSE_ASSERT(global_definition_namespaceDef->
get_parent() == NULL);
10456 global_definition_namespaceDef->
set_parent(defdecl);
10457 ROSE_ASSERT(global_definition_namespaceDef->
get_parent() != NULL);
10460 ROSE_ASSERT(global_definition_namespaceDef->get_namespaceDeclaration() == NULL);
10461 global_definition_namespaceDef->set_namespaceDeclaration(nondefdecl);
10462 ROSE_ASSERT(global_definition_namespaceDef->get_namespaceDeclaration() != NULL);
10465 global_definition_namespaceDef->set_namespaceDeclaration(nondefdecl);
10466 ROSE_ASSERT(global_definition_namespaceDef->get_namespaceDeclaration() != NULL);
10470 defdecl->
get_definition()->set_global_definition(global_definition_namespaceDef);
10474 ROSE_ASSERT(global_definition_namespaceDef == global_definition_namespaceDef->get_global_definition());
10475 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
10476 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() == namespaceDef->get_global_definition());
10495 printf (
"Warning: no scope provided to support symbol table entry! \n");
10499 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
10501 ROSE_ASSERT(nondefdecl->
get_definition()->get_previousNamespaceDefinition() == NULL);
10502 ROSE_ASSERT(nondefdecl->
get_definition()->get_nextNamespaceDefinition() == NULL);
10505 ROSE_ASSERT(nondefdecl != NULL);
10525 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
10535 result->get_operands().push_back(lhs);
10546 result->get_operands().push_back(lhs);
10557 result->get_operands().push_back(lhs);
10568 result->get_operands().push_back(lhs);
10608 printf (
"In buildNondefiningClassDeclaration(): name = %s scope = %p = %s \n",name.str(),scope,scope != NULL ? scope->
class_name().c_str() :
"NULL");
10623 mysymbol = scope->lookup_class_symbol(name,NULL);
10634 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
10637 if (mysymbol != NULL)
10639 nondefdecl = isSgClassDeclaration(mysymbol->get_declaration());
10641 ROSE_ASSERT(nondefdecl != NULL);
10650 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10661 ROSE_ASSERT(nondefdecl != NULL);
10662 if (nondefdecl->get_type() == NULL)
10666 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());
10690 ROSE_ASSERT(nondefdecl->
get_scope() == NULL);
10695 ROSE_ASSERT(nondefdecl->
get_scope() != NULL);
10699 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());
10712 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10715 ROSE_ASSERT(scope == NULL || (scope != NULL && nondefdecl->
get_scope() != NULL));
10718 ROSE_ASSERT(nondefdecl != NULL);
10731 printf (
"WARNING: This function for building defining class declarations has different semantics from that of the function to build defining function declarations. \n");
10734 printf (
"In buildDefiningClassDeclaration(): name = %s scope = %p = %s \n",name.str(),scope,scope != NULL ? scope->
class_name().c_str() :
"NULL");
10745 ROSE_ASSERT(nondefiningClassDeclaration != NULL);
10748 ROSE_ASSERT(definingClassDefinition != NULL);
10751 SgClassType* classType = nondefiningClassDeclaration->get_type();
10752 ROSE_ASSERT(classType != NULL);
10759 ROSE_ASSERT(definingClassDeclaration != NULL);
10766 definingClassDefinition->set_declaration(definingClassDeclaration);
10776 ROSE_ASSERT(definingClassDeclaration->get_definition() != NULL);
10778 ROSE_ASSERT(definingClassDeclaration->
get_scope() == NULL);
10781 definingClassDeclaration->
set_scope(scope);
10782 ROSE_ASSERT(definingClassDeclaration->
get_scope() != NULL);
10783 ROSE_ASSERT(nondefiningClassDeclaration->
get_scope() != NULL);
10786 ROSE_ASSERT(definingClassDeclaration->get_definition()->
get_parent() != NULL);
10789 ROSE_ASSERT(definingClassDeclaration->get_type() != NULL);
10791 return definingClassDeclaration;
10798 ROSE_ASSERT(scope != NULL);
10800 ROSE_ASSERT(definingClassDeclaration != NULL);
10802 return definingClassDeclaration;
10819#define DEBUG_CLASS_DECLARATION 0
10823 printf (
"WARNING: In SageBuilder::buildClassDeclaration_nfi(): the nonDefiningDecl pointer = %p (input parameter) does not appear to be used. \n",nonDefiningDecl);
10829 if (nonDefiningDecl != NULL)
10831 ROSE_ASSERT(nonDefiningDecl->get_type() != NULL);
10832 ROSE_ASSERT(nonDefiningDecl->get_type()->get_declaration() != NULL);
10833 printf (
"nonDefiningDecl->get_type() = %p = %s \n",nonDefiningDecl->get_type(),nonDefiningDecl->get_type()->
class_name().c_str());
10834 printf (
"nonDefiningDecl->get_type()->get_declaration() = %p = %s \n",nonDefiningDecl->get_type()->get_declaration(),nonDefiningDecl->get_type()->get_declaration()->
class_name().c_str());
10836 printf (
"In buildClassDeclaration_nfi(): nonDefiningDecl: unparseNameToString() = %s \n",nonDefiningDecl->unparseNameToString().c_str());
10847 bool buildTemplateDeclaration = (isSgTemplateClassDeclaration(nonDefiningDecl) != NULL);
10850 if (buildTemplateDeclaration ==
true)
10853 printf (
"ERROR: If buildTemplateDeclaration == true, then we should have called a different function to build the associated SgTemplateClassDeclaration \n");
10855 ROSE_ASSERT(buildTemplateDeclaration ==
false);
10858 printf (
"In SageBuilder::buildClassDeclaration_nfi(): XXX_name = %s \n",XXX_name.str());
10859 printf (
"In SageBuilder::buildClassDeclaration_nfi(): the nonDefiningDecl pointer = %p = %s \n",nonDefiningDecl,nonDefiningDecl != NULL ? nonDefiningDecl->
class_name().c_str() :
"null");
10860 printf (
"In SageBuilder::buildClassDeclaration_nfi(): buildTemplateDeclaration = %s \n",buildTemplateDeclaration ?
"true" :
"false");
10861 printf (
" --- templateArgumentsList = %p \n",templateArgumentsList);
10862 if (templateArgumentsList != NULL)
10864 printf (
" --- templateArgumentsList.size() = %zu \n",templateArgumentsList->size());
10865 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
10867 printf (
" --- --- argument pointer: templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
10876 printf (
"In SageBuilder::buildClassDeclaration_nfi(): no scope was provided so using the SageBuilder::topScopeStack() = %p = %s \n",scope,scope->
class_name().c_str());
10882 printf (
"In SageBuilder::buildClassDeclaration_nfi(): scope was provided scope = %p = %s \n",scope,scope->
class_name().c_str());
10887 printf (
"Building a SgClassDeclaration: buildClassDeclaration_nfi() XXX_name = %s buildTemplateInstantiation = %s \n",XXX_name.str(),buildTemplateInstantiation ?
"true" :
"false");
10897 SgName nameWithoutTemplateArguments = XXX_name;
10898 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
10899 if (buildTemplateInstantiation ==
true)
10901 ROSE_ASSERT(templateArgumentsList != NULL);
10905#if DEBUG_CLASS_DECLARATION
10906 printf (
"In SageBuilder::buildClassDeclaration_nfi():\n");
10907 printf (
" -- nameWithoutTemplateArguments = %s\n", nameWithoutTemplateArguments.str());
10908 printf (
" -- nameWithTemplateArguments = %s\n", nameWithTemplateArguments.str());
10921#if DEBUG_CLASS_DECLARATION
10922 printf (
"Looking up the SgClassSymbol in scope = %p = %s nameWithTemplateArguments = %s \n",scope,scope->
class_name().c_str(),nameWithTemplateArguments.str());
10933 printf (
"This was a redundant call to lookup_class_symbol \n");
10938 if (buildTemplateDeclaration ==
true)
10940#if DEBUG_CLASS_DECLARATION
10941 printf (
"Note: In SageBuilder::buildClassDeclaration_nfi(): Need to look up a template symbol \n");
10943 ROSE_ASSERT(nonDefiningDecl != NULL);
10945 SgTemplateParameterPtrList templateParameterList;
10946 SgTemplateArgumentPtrList templateSpecializationArgumentList;
10948 ROSE_ASSERT(scope->lookup_template_class_symbol(nameWithTemplateArguments,&templateParameterList,&templateSpecializationArgumentList) != NULL);
10950 mysymbol = scope->lookup_template_class_symbol(nameWithTemplateArguments,&templateParameterList,&templateSpecializationArgumentList);
10952 ROSE_ASSERT(mysymbol != NULL);
10954 printf (
"ERROR: Need to look up a template symbol \n");
10960#if DEBUG_CLASS_DECLARATION
10961 printf (
"In SageBuilder::buildClassDeclaration_nfi(): calling lookup_class_symbol(nameWithTemplateArguments = %s,templateArgumentsList->size() = %zu \n",
10962 nameWithTemplateArguments.str(),(templateArgumentsList != NULL) ? templateArgumentsList->size() : 999);
10963 if (templateArgumentsList != NULL)
10965 printf (
" --- templateArgumentsList elements: \n");
10966 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
10968 printf (
" --- --- templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
10969 printf (
" --- --- templateArgumentsList->[%zu] = %s \n",i,templateArgumentsList->operator[](i)->class_name().c_str());
10970 templateArgumentsList->operator[](i)->
display(
"In SageBuilder::buildClassDeclaration_nfi()");
10974 mysymbol = scope->lookup_class_symbol(nameWithTemplateArguments,templateArgumentsList);
10975#if DEBUG_CLASS_DECLARATION
10976 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
10979 if (mysymbol == NULL)
10981#if DEBUG_CLASS_DECLARATION
10982 printf (
"WARNING: scope->lookup_class_symbol(nameWithTemplateArguments = %s,templateArgumentsList->size() = %zu) == NULL \n",nameWithTemplateArguments.str(),templateArgumentsList->size());
10987#if DEBUG_CLASS_DECLARATION
10988 printf (
"Checking lookup_class_symbol() using nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
10990 ROSE_ASSERT(scope->lookup_class_symbol(nameWithoutTemplateArguments,templateArgumentsList) == NULL);
10992#if DEBUG_CLASS_DECLARATION
10993 printf (
"nonDefiningDecl = %p \n",nonDefiningDecl);
10995 if (nonDefiningDecl != NULL)
10997#if DEBUG_CLASS_DECLARATION
10998 printf (
"nonDefiningDecl = %p = %s \n",nonDefiningDecl,nonDefiningDecl->
class_name().c_str());
11002 ROSE_ASSERT(temp_mysymbol != NULL);
11004 mysymbol = isSgClassSymbol(temp_mysymbol);
11005 ROSE_ASSERT(mysymbol != NULL);
11008 ROSE_ASSERT(scope == nonDefiningDecl->
get_scope());
11016 if (mysymbol != NULL)
11018 SgClassDeclaration* symbol_declaration = isSgClassDeclaration(mysymbol->get_declaration());
11019 ROSE_ASSERT(symbol_declaration != NULL);
11020 ROSE_ASSERT(symbol_declaration->
get_scope() == scope);
11022 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Testing scope->get_symbol_table()->exists(mysymbol) == true (expensive) \n");
11036#if DEBUG_CLASS_DECLARATION
11037 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
11040 if (mysymbol != NULL)
11042 nondefdecl = isSgClassDeclaration(mysymbol->get_declaration());
11044 ROSE_ASSERT(nondefdecl != NULL);
11046#if DEBUG_CLASS_DECLARATION
11047 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol->get_declaration(): nondefdecl = %p = %s nondefdecl->get_definition() = %p = %s \n",
11048 nondefdecl,nondefdecl->class_name().c_str(),nondefdecl->get_definition(),
11049 nondefdecl->get_definition() != NULL ? nondefdecl->get_definition()->class_name().c_str() :
"NULL");
11054 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
11057 ROSE_ASSERT(nondefdecl == nondefdecl->get_firstNondefiningDeclaration());
11062#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11064 detectTransformations(nondefdecl);
11068 ROSE_ASSERT(nondefdecl->get_type() != NULL);
11071 if (nondefdecl->get_parent() == NULL)
11073#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11074 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Note that nondefdecl->get_parent() == NULL, this might be OK. \n");
11083 if (nondefdecl->get_definingDeclaration() != NULL)
11085#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11086 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",
11087 nondefdecl,nondefdecl->class_name().c_str(),nondefdecl->get_definingDeclaration(),nondefdecl->get_definingDeclaration()->class_name().c_str());
11089 SgClassDeclaration* nondefining_classDeclaration = isSgClassDeclaration(nondefdecl);
11090 ROSE_ASSERT(nondefining_classDeclaration != NULL);
11091 SgClassDeclaration* defining_classDeclaration = isSgClassDeclaration(nondefdecl->get_definingDeclaration());
11092 ROSE_ASSERT(defining_classDeclaration != NULL);
11094#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11095 printf (
"In SageBuilder::buildClassDeclaration_nfi(): nondefining_classDeclaration: scope = %p = %s name = %s \n",
11096 nondefining_classDeclaration->
get_scope(),nondefining_classDeclaration->
get_scope()->
class_name().c_str(),nondefining_classDeclaration->get_name().str());
11097 printf (
"In SageBuilder::buildClassDeclaration_nfi(): defining_classDeclaration: scope = %p = %s name = %s \n",
11098 defining_classDeclaration->
get_scope(),defining_classDeclaration->
get_scope()->
class_name().c_str(),defining_classDeclaration->get_name().str());
11099 defining_classDeclaration->
get_file_info()->display(
"already has a defining declaration");
11102 printf (
"Error: In SageBuilder::buildClassDeclaration_nfi(): exiting as part of test \n");
11106#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11107 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);
11112 printf (
"Exiting as a test! \n");
11115 return defining_classDeclaration;
11122 ROSE_ASSERT(nondefdecl->get_definingDeclaration() == defdecl);
11123 ROSE_ASSERT(nondefdecl->get_firstNondefiningDeclaration() != defdecl);
11128#if DEBUG_CLASS_DECLARATION
11129 printf (
"In SageBuilder::buildClassDeclaration_nfi(): building a nondefining declaration since it does not exist \n");
11132 ROSE_ASSERT(nondefdecl == NULL);
11136 if (buildTemplateInstantiation ==
true)
11139#if DEBUG_CLASS_DECLARATION
11140 printf (
"************************************************************************* \n");
11141 printf (
"Building SgTemplateInstantiationDecl with empty SgTemplateArgumentPtrList \n");
11142 printf (
" --- using nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
11143 printf (
"************************************************************************* \n");
11145 SgTemplateArgumentPtrList emptyList;
11148 ROSE_ASSERT(nondefdecl != NULL);
11149#if DEBUG_CLASS_DECLARATION
11150 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Build SgTemplateInstantiationDecl: nondefdecl = %p \n",nondefdecl);
11154 ROSE_ASSERT(nondefdecl->get_type() == NULL);
11155 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl) != NULL);
11157 printf (
"In buildClassDeclaration_nfi(): nondefdecl->get_name() = %s nondefdecl->get_templateName() = %s \n",nondefdecl->get_name().str(),isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().str());
11159#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11168 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().is_null() ==
true);
11171 ROSE_ASSERT(templateArgumentsList != NULL);
11181 if (templateArgumentsList->size() == 0)
11183 printf (
"Warning: In SageBuilder::buildClassDeclaration_nfi(): templateArgumentsList->size() == 0 \n");
11187 nondefdecl->set_firstNondefiningDeclaration(nondefdecl);
11204#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11205 printf (
"Warning: In buildClassDeclaration_nfi(): calling set_templateName(nameWithTemplateArguments = %s) for nondefining declaration \n",nameWithTemplateArguments.str());
11210 isSgTemplateInstantiationDecl(nondefdecl)->
set_templateName(nameWithoutTemplateArguments);
11217 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().is_null() ==
false);
11223 if (
hasTemplateSyntax(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName()) ==
false)
11225#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11226 printf (
"WARNING: No template syntax present in name of template class instantiation (nondefdecl) \n");
11231#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11236 ROSE_ASSERT(nondefdecl->get_file_info() == NULL);
11241#if DEBUG_CLASS_DECLARATION
11242 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);
11243 printf (
" --- nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
11248 ROSE_ASSERT(nondefdecl != NULL);
11249#if DEBUG_CLASS_DECLARATION
11250 printf (
"In buildClassDeclaration_nfi(): (no file info set): nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
11252 ROSE_ASSERT(nameWithoutTemplateArguments == nameWithTemplateArguments);
11254#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11260 nondefdecl->set_firstNondefiningDeclaration(nondefdecl);
11265 ROSE_ASSERT(nondefdecl->get_file_info() == NULL);
11268 ROSE_ASSERT(nondefdecl != NULL);
11272 ROSE_ASSERT(nondefdecl == nondefdecl->get_firstNondefiningDeclaration());
11281 ROSE_ASSERT(scope != NULL);
11283#if DEBUG_CLASS_DECLARATION
11284 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Set the scope of the new non-defining declaration to %p = %s \n",scope,scope->
class_name().c_str());
11286 nondefdecl->set_scope(scope);
11287 ROSE_ASSERT(nondefdecl->get_scope() != NULL);
11296 printf (
"In buildClassDeclaration_nfi(): setting the parent of the non defining declaration to be the scope by default) \n");
11303 ROSE_ASSERT(nondefdecl->get_type() == NULL);
11305 if (nondefdecl->get_type() == NULL)
11307#if DEBUG_CLASS_DECLARATION
11309 printf (
"Calling scope->get_type_table()->lookup_type(): nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
11311 printf (
"WE NEED THE MANGLED NAME FOR THIS TO BE RELEVANT! \n");
11317#if DEBUG_CLASS_DECLARATION
11318 printf (
"In SageBuilder::buildClassDeclaration_nfi(): kind == SgClassDeclaration::e_java_parameter = %s \n",(kind ==
SgClassDeclaration::e_java_parameter) ?
"true" :
"false");
11323#if DEBUG_CLASS_DECLARATION
11324 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());
11326 nondefdecl->set_type(class_type);
11327#if DEBUG_CLASS_DECLARATION
11328 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());
11330 SgClassDeclaration* tmp_classDeclarationFromType = isSgClassDeclaration(class_type->get_declaration());
11331 ROSE_ASSERT(tmp_classDeclarationFromType != NULL);
11332#if DEBUG_CLASS_DECLARATION
11334 printf (
"tmp_classDeclarationFromType: scope = %p = %s \n",scope,scope->
class_name().c_str());
11335 printf (
"tmp_classDeclarationFromType = %p = %s \n",tmp_classDeclarationFromType,tmp_classDeclarationFromType->
class_name().c_str());
11336 printf (
"tmp_classDeclarationFromType name = %s \n",tmp_classDeclarationFromType->get_name().str());
11339 tmp_classDeclarationFromType->
get_file_info()->display(
"tmp_classDeclarationFromType: debug");
11344 ROSE_ASSERT(nondefdecl->get_type() != NULL);
11345 if (nondefdecl->get_type()->get_declaration() != nondefdecl)
11347 printf (
"ERROR: nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
11348 printf (
"ERROR: nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
11349 printf (
"ERROR: nondefdecl->get_type()->get_declaration() = %p = %s \n",nondefdecl->get_type()->get_declaration(),nondefdecl->get_type()->get_declaration()->class_name().c_str());
11351 SgClassDeclaration* classDeclarationFromType = isSgClassDeclaration(nondefdecl->get_type()->get_declaration());
11352 ROSE_ASSERT(classDeclarationFromType != NULL);
11354 printf (
"nondefdecl->get_name() = %s \n",nondefdecl->get_name().str());
11355 printf (
"nondefdecl->get_type()->get_name() = %s \n",nondefdecl->get_type()->get_name().str());
11356 printf (
"nondefdecl->get_type()->get_declaration()->get_name() = %s \n",classDeclarationFromType->get_name().str());
11358 printf (
"nondefdecl->get_mangled_name() = %s \n",nondefdecl->get_mangled_name().getString().c_str());
11359 printf (
"nondefdecl->get_type()->get_mangled() = %s \n",nondefdecl->get_type()->get_mangled().getString().c_str());
11360 printf (
"nondefdecl->get_type()->get_declaration()->get_mangled_name() = %s \n",classDeclarationFromType->get_mangled_name().getString().c_str());
11363 printf (
"nondefdecl->get_type()->get_declaration()->get_firstNondefiningDeclaration() = %s \n",classDeclarationFromType->
get_firstNondefiningDeclaration() ?
"true" :
"false");
11364 printf (
"nondefdecl->get_firstNondefiningDeclaration() = %s \n",nondefdecl->get_firstNondefiningDeclaration() ?
"true" :
"false");
11370 if (parent != NULL)
11372 printf (
"nondefdecl->get_parent() = %p = %s \n",parent,parent->
class_name().c_str());
11377#if DEBUG_CLASS_DECLARATION
11378 nondefdecl->get_type()->get_declaration()->get_file_info()->display(
"nondefdecl->get_type()->get_declaration()");
11385 if (nondefdecl->get_file_info() == NULL)
11387 printf (
"ERROR: In SageBuilder::buildClassDeclaration_nfi(): nondefdecl = %p = %s does not have its source position information setup \n",nondefdecl,nondefdecl->class_name().c_str());
11388 printf (
" --- nondefdecl = %s \n",nondefdecl->get_name().str());
11389 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p \n",nondefdecl->get_firstNondefiningDeclaration());
11390 printf (
" --- nondefdecl->get_definingDeclaration() = %p \n",nondefdecl->get_definingDeclaration());
11391 printf (
" --- nondefdecl->get_type() = %p \n",nondefdecl->get_type());
11392 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
11393 printf (
"The real error is: (nondefdecl->get_type()->get_declaration() != nondefdecl) \n");
11397 ROSE_ASSERT(nondefdecl->get_file_info() != NULL);
11398 nondefdecl->get_file_info()->display(
"nondefdecl");
11402 ROSE_ASSERT(nondefdecl->get_type()->get_declaration() == nondefdecl);
11405 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());
11416 ROSE_ASSERT (nondefdecl->get_startOfConstruct() != NULL);
11418#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11422 detectTransformations(nondefdecl);
11430 nondefdecl->setForward();
11436 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");
11445 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());
11451 ROSE_ASSERT(nondefdecl->get_scope() == scope);
11458 printf (
"Warning: no scope provided to support symbol table entry! \n");
11471 if (buildTemplateInstantiation ==
true)
11474 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
11478 ROSE_ASSERT((*templateArgumentsList)[i]->get_parent() != NULL);
11488 (*templateArgumentsList)[i]->set_parent(nondefdecl);
11503 printf (
"Building a SgClassDeclaration: buildClassDeclaration_nfi() buildTemplateInstantiation = %s \n",buildTemplateInstantiation ?
"true:" :
"false");
11508 if (buildTemplateInstantiation ==
true)
11511 SgTemplateArgumentPtrList emptyList;
11517 ROSE_ASSERT(defdecl->get_type() == NULL);
11518 ROSE_ASSERT(isSgTemplateInstantiationDecl(defdecl) != NULL);
11520 printf (
"In buildClassDeclaration_nfi(): defdecl->get_name() = %s defdecl->get_templateName() = %s \n",defdecl->get_name().str(),isSgTemplateInstantiationDecl(defdecl)->get_templateName().str());
11524 ROSE_ASSERT(isSgTemplateInstantiationDecl(defdecl)->get_templateName().is_null() ==
true);
11527 printf (
"Warning: In buildClassDeclaration_nfi(): calling set_templateName(name = %s) for defining declaration \n",name.str());
11536 ROSE_ASSERT(name.getString().find(
'<') == string::npos);
11539 SgName templateName = generateTemplateNameFromTemplateNameWithTemplateArguments(name);
11540 printf (
"In buildClassDeclaration_nfi(): templateName = %s \n",templateName.str());
11555 printf (
"In buildClassDeclaration_nfi(): nameWithoutTemplateArguments = %s nameWithTemplateArguments = %s \n",nameWithoutTemplateArguments.str(),nameWithTemplateArguments.str());
11557 isSgTemplateInstantiationDecl(defdecl)->
set_templateName(nameWithoutTemplateArguments);
11559#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11563 printf (
"WARNING: In buildClassDeclaration_nfi(): nameWithTemplateArguments = %s is not using template syntax \n",nameWithTemplateArguments.str());
11572 ROSE_ASSERT(isSgTemplateInstantiationDecl(defdecl)->get_templateName().is_null() ==
false);
11575 if (isSgTemplateInstantiationDecl(defdecl)->get_templateName().getString().find(
'>') == string::npos)
11577#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11578 printf (
"WARNING: No template syntax present in name of template class instantiation (defdecl) \n");
11583 printf (
"Should we have set the template instantiation name at this point? \n");
11587 ROSE_ASSERT(defdecl->get_definition() != NULL);
11588 ROSE_ASSERT(isSgTemplateInstantiationDefn(defdecl->get_definition()) != NULL);
11593 printf (
"Building a SgClassDeclaration, but we might require a SgTemplateClassDeclaration \n");
11600 if (buildTemplateDeclaration ==
true)
11602 printf (
"In buildClassDeclaration_nfi(): I think we also want template specialization arguments to be more general: using nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
11608 ROSE_ASSERT(defdecl->get_type() == NULL);
11610 printf (
"Exiting afte test! \n");
11620 printf (
"In SageBuilder::buildClassDeclaration_nfi(): build a SgClassDeclaration: defdecl = %p \n",defdecl);
11624 ROSE_ASSERT(defdecl->get_type() == NULL);
11628 ROSE_ASSERT(defdecl->get_definition() != NULL);
11629 ROSE_ASSERT(isSgTemplateInstantiationDefn(defdecl->get_definition()) == NULL);
11631 ROSE_ASSERT(defdecl != NULL);
11634 printf (
"In buildClassDeclaration_nfi(): nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
11638 nondefdecl->set_definingDeclaration(defdecl);
11640 ROSE_ASSERT(nondefdecl->get_definingDeclaration() == defdecl);
11641 ROSE_ASSERT(nondefdecl->get_firstNondefiningDeclaration() != defdecl);
11647 classDef->set_declaration(defdecl);
11648 defdecl->set_definingDeclaration(defdecl);
11662 defdecl->set_firstNondefiningDeclaration(nondefdecl);
11664 if (buildTemplateInstantiation ==
true)
11671 ROSE_ASSERT(defdecl->get_type() == NULL);
11678 if (defdecl->get_type() != NULL)
11682 if (defdecl->get_type()->get_declaration() == isSgDeclarationStatement(defdecl))
11685 ROSE_ASSERT (nondefdecl->get_type() != NULL);
11688 if (nondefdecl->get_type() != defdecl->get_type())
11691 printf (
"Deleting defdecl->get_type() = %p = %s (using type from nondefdecl = %p) \n",defdecl->get_type(),defdecl->get_type()->class_name().c_str(),nondefdecl);
11692 printf (
"Skipping delete of %p to maintain unique type pointers \n",defdecl->get_type());
11694 delete defdecl->get_type();
11697 defdecl->set_type(NULL);
11699 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());
11703 printf (
"Is this executed! \n");
11707 ROSE_ASSERT (nondefdecl->get_type() != NULL);
11708 defdecl->set_type(nondefdecl->get_type());
11710 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());
11714 ROSE_ASSERT(classType != NULL);
11715 SgClassDeclaration* local_classDeclaration = isSgClassDeclaration(classType->get_declaration());
11716 ROSE_ASSERT (local_classDeclaration != NULL);
11717 printf (
"In buildClassDeclaration_nfi(): classType = %p local_classDeclaration = %p \n",classType,local_classDeclaration);
11726 ROSE_ASSERT (nondefdecl->get_type() != NULL);
11727 defdecl->set_type(nondefdecl->get_type());
11729 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());
11732 ROSE_ASSERT (nondefdecl->get_firstNondefiningDeclaration() != NULL);
11736 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()))
11738 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");
11739 printf (
" --- nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
11740 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
11741 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl->get_firstNondefiningDeclaration(),nondefdecl->get_firstNondefiningDeclaration()->class_name().c_str());
11747 ROSE_ASSERT (nondefdecl->get_type()->get_declaration() == isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()));
11751 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
11754 ROSE_ASSERT (nondefdecl->get_type() != NULL);
11757 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl))
11759 printf (
"nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
11760 printf (
"nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
11761 printf (
"nondefdecl->get_type()->get_declaration() = %p = %s \n",nondefdecl->get_type()->get_declaration(),nondefdecl->get_type()->get_declaration()->class_name().c_str());
11762 printf (
"nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl->get_firstNondefiningDeclaration(),nondefdecl->get_firstNondefiningDeclaration()->class_name().c_str());
11766 ROSE_ASSERT (defdecl->get_type() != NULL);
11767 ROSE_ASSERT (defdecl->get_type()->get_declaration() != NULL);
11768 ROSE_ASSERT (defdecl->get_type()->get_declaration() != isSgDeclarationStatement(defdecl));
11769 ROSE_ASSERT (nondefdecl->get_firstNondefiningDeclaration() != NULL);
11770 ROSE_ASSERT (nondefdecl->get_firstNondefiningDeclaration() == nondefdecl);
11772 ROSE_ASSERT (nondefdecl->get_type()->get_declaration() == isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()));
11778 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()))
11780 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");
11781 printf (
" --- nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
11782 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
11783 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl->get_firstNondefiningDeclaration(),nondefdecl->get_firstNondefiningDeclaration()->class_name().c_str());
11786 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl))
11788 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");
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,nondefdecl->class_name().c_str());
11798 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
11801 defdecl->set_type(nondefdecl->get_type());
11804 printf (
"In buildClassDeclaration_nfi(): after calling set_type() again: defdecl = %p = %s defdecl->get_type() = %p = %s \n",
11805 defdecl,defdecl->class_name().c_str(),defdecl->get_type(),defdecl->get_type()->class_name().c_str());
11808 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
11813 nondefdecl->setForward();
11817 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
11822 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
11826 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
11830 ROSE_ASSERT(mysymbol);
11832 printf (
"@@@@@@@@@@@@@@ In buildClassDeclaration_nfi(): setting scope of defining and non-defining declaration to scope = %s \n",scope->
class_name().c_str());
11833 defdecl->set_scope(scope);
11834 nondefdecl->set_scope(scope);
11840 nondefdecl->set_parent(scope);
11843 defdecl->set_parent(scope);
11855 ROSE_ASSERT(defdecl->get_parent() == NULL);
11860 ROSE_ASSERT(defdecl->get_definingDeclaration() == defdecl);
11861 ROSE_ASSERT(defdecl->get_firstNondefiningDeclaration() != defdecl->get_definingDeclaration());
11867 SgClassDeclaration* temp_firstNondefiningDeclaration = isSgClassDeclaration(defdecl->get_firstNondefiningDeclaration());
11868 SgClassDeclaration* temp_definingDeclaration = isSgClassDeclaration(defdecl->get_definingDeclaration());
11869 ROSE_ASSERT(temp_firstNondefiningDeclaration != NULL);
11870 ROSE_ASSERT(temp_definingDeclaration != NULL);
11873 printf (
"Leaving buildClassDeclaration_nfi(): defdecl = %p = %s = %s \n",defdecl,defdecl->class_name().c_str(),defdecl->get_name().str());
11874 printf (
" --- defdecl->get_firstNondefiningDeclaration() = %p \n",defdecl->get_firstNondefiningDeclaration());
11875 printf (
" --- defdecl->get_definingDeclaration() = %p \n",defdecl->get_definingDeclaration());
11877 printf (
" --- defdecl->get_firstNondefiningDeclaration()->get_name() = %s \n",temp_firstNondefiningDeclaration->get_name().str());
11878 printf (
" --- defdecl->get_definingDeclaration()->get_name() = %s \n",temp_definingDeclaration->get_name().str());
11880 printf (
" --- defdecl->get_firstNondefiningDeclaration()->get_type() = %p = %s \n",
11881 temp_firstNondefiningDeclaration->get_type(),temp_firstNondefiningDeclaration->get_type()->
unparseToString().c_str());
11882 printf (
" --- defdecl->get_definingDeclaration()->get_type() = %p = %s \n",
11883 temp_definingDeclaration->get_type(),temp_definingDeclaration->get_type()->
unparseToString().c_str());
11885 printf (
" --- nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
11886 printf (
" --- nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
11889 printf (
"Leaving buildClassDeclaration_nfi(): defdecl: unparseNameToString() = %s \n",defdecl->unparseNameToString().c_str());
11893 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_name() == temp_definingDeclaration->get_name());
11894 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_type() == temp_definingDeclaration->get_type());
11899 if (definingDeclaration != NULL && nondefiningDeclaration != NULL)
11905 printf (
"NOTE: buildClassDeclaration_nfi(): Setting the templateDeclaration for the defining declaration = %p using the value = %p from the nondefiningDeclaration = %p \n",
11906 definingDeclaration,templateDeclaration,nondefiningDeclaration);
11916 if (definingDeclaration != NULL)
11921 printf (
"NOTE: buildClassDeclaration_nfi(): definingDeclaration->get_templateDeclaration() == NULL \n");
11928 printf (
"Leaving buildClassDeclaration_nfi(): defdecl = %p defdecl->unparseNameToString() = %s \n",defdecl,defdecl->unparseNameToString().c_str());
11933 printf (
"Leaving buildClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
11934 SgSymbol* test_symbol = nondefdecl->get_scope()->find_symbol_from_declaration(nondefdecl);
11937 printf (
"Leaving buildClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
11938 ROSE_ASSERT(nondefdecl->get_symbol_from_symbol_table() != NULL);
11963 ROSE_ASSERT(scope != NULL);
11965 ROSE_ASSERT(definingClassDeclaration != NULL);
11967 return definingClassDeclaration;
11986 ROSE_ASSERT(result);
11991 result->setCaseInsensitive(
true);
12010 printf(
"In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(XXX_name = %p):\n", XXX_name.str());
12017 ROSE_ASSERT(scope != NULL);
12020 printf (
"SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): XXX_name = %s scope = %p = %s \n",XXX_name.str(),scope,scope->
class_name().c_str());
12024 SgName nameWithoutTemplateArguments = XXX_name;
12028 printf (
"SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): nameWithTemplateSpecializationArguments = %s \n",nameWithTemplateSpecializationArguments.str());
12056 mysymbol = scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList);
12063 printf (
"Warning: In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): scope == NULL \n");
12066 printf (
"In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
12069 if (mysymbol != NULL)
12075 ROSE_ASSERT(classType != NULL);
12085 if (nondefdecl->get_type() != NULL)
12087 printf (
"Note: SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): nondefdecl->get_type() != NULL: name = %s \n",nondefdecl->get_name().str());
12092 ROSE_ASSERT(nondefdecl != NULL);
12095 ROSE_ASSERT(templateParameterList != NULL);
12096 nondefdecl->get_templateParameters() = *templateParameterList;
12107 nondefdecl->set_nonreal_decl_scope(nonreal_decl_scope);
12113 printf(
"In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(XXX_name = %p): nrscope = %p (new)\n", XXX_name.str(), nonreal_decl_scope);
12123 ROSE_ASSERT(templateSpecializationArgumentList != NULL);
12124 nondefdecl->get_templateSpecializationArguments() = *templateSpecializationArgumentList;
12127 if (nondefdecl->get_templateParameters().size() == 0)
12129#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12130 printf (
"WARNING: In buildNondefiningTemplateClassDeclaration_nfi(): (part 1) nondefdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations nondefdecl = %p \n",nondefdecl);
12150 nondefdecl->set_templateName(nameWithoutTemplateArguments);
12157 ROSE_ASSERT(nondefdecl != NULL);
12160 ROSE_ASSERT(templateParameterList != NULL);
12161 nondefdecl->get_templateParameters() = *templateParameterList;
12171 if (nondefdecl->get_templateParameters().size() == 0)
12173#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12174 printf (
"WARNING: In buildNondefiningTemplateClassDeclaration_nfi(): (part 2) nondefdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations nondefdecl = %p \n",nondefdecl);
12180 nondefdecl->set_templateName(nameWithoutTemplateArguments);
12184 if (nondefdecl->get_type() == NULL)
12191 ROSE_ASSERT(nondefdecl->get_type() != NULL);
12210 printf (
"In buildNondefiningTemplateClassDeclaration_nfi(): Commented out setting the parent to the scope. \n");
12220 if (nondefdecl->get_type() == NULL)
12227 ROSE_ASSERT(nondefdecl->get_type() != NULL);
12229 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());
12238 printf (
"Building a SgTemplateSymbol using nameWithTemplateSpecializationArguments = %s and nondefdecl = %p = %s \n",nameWithTemplateSpecializationArguments.str(),nondefdecl,nondefdecl->
class_name().c_str());
12244 ROSE_ASSERT(mysymbol != NULL);
12250 ROSE_ASSERT(scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList) == NULL);
12254 scope->
insert_symbol(nameWithTemplateSpecializationArguments, mysymbol);
12256 printf (
"SageBuilder::buildNondefiningTemplateClassDeclaration_nfi() (after building symbol): scope = %p = %s \n",scope,scope->
class_name().c_str());
12258 ROSE_ASSERT(nondefdecl->
get_scope() != NULL);
12265 ROSE_ASSERT(scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList) != NULL);
12284 ROSE_ASSERT(templateClassDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateClassDeclaration->get_templateParameters().size()));
12301 if (defdecl->get_type() != NULL)
12305 if (defdecl->get_type()->get_declaration() == isSgDeclarationStatement(defdecl) )
12307 delete defdecl->get_type();
12312 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12313 ROSE_ASSERT (nondefdecl->get_type()->get_declaration() == isSgDeclarationStatement(nondefdecl));
12314 defdecl->set_type(nondefdecl->get_type());
12317 ROSE_ASSERT(nondefdecl->get_type() != NULL);
12335 ROSE_ASSERT(defdecl->get_definingDeclaration() == defdecl);
12336 ROSE_ASSERT(defdecl->get_firstNondefiningDeclaration() != defdecl->get_definingDeclaration());
12338 ROSE_ASSERT(defdecl->get_scope() != NULL);
12342 ROSE_ASSERT(nondefdecl->
get_parent() == NULL);
12345 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
12351 printf (
"Leaving buildNondefiningTemplateClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
12353 SgSymbol* test_symbol = nondefdecl->
get_scope()->find_symbol_from_declaration(tmp_classDeclaration);
12356 printf (
"Leaving buildNondefiningTemplateClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
12365 SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateSpecializationArgumentList )
12374 SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateSpecializationArgumentList )
12383 printf (
"In buildTemplateClassDeclaration_nfi(): nonDefiningDecl = %p \n",nonDefiningDecl);
12384 if (nonDefiningDecl != NULL)
12387 printf (
"--- nonDefiningDecl->get_definingDeclaration() = %p \n",nonDefiningDecl->
get_definingDeclaration());
12392 ROSE_ASSERT(scope != NULL);
12395 SgName nameWithoutTemplateArguments = XXX_name;
12404 if (nonDefiningDecl != NULL)
12409 SgName templateString =
"template string";
12411 SgTemplateParameterPtrList templateParameters;
12428 printf (
"In buildTemplateClassDeclaration_nfi(): calling new SgTemplateClassDeclaration() name = %s \n",nameWithTemplateSpecializationArguments.str());
12443 if (nonDefiningDecl != NULL)
12451 ROSE_ASSERT(defdecl != NULL);
12453 printf (
"In buildTemplateClassDeclaration_nfi(): Reusing the defining declaration previously build: defdecl = %p = %s \n",defdecl,defdecl->get_name().str());
12459 printf (
"In buildTemplateClassDeclaration_nfi(): No defining declaration found, so we have to build one. \n");
12464 if (defdecl == NULL)
12467 printf (
"Building a defining declaration \n");
12472 ROSE_ASSERT(defdecl != NULL);
12475 printf (
"In buildTemplateClassDeclaration_nfi(): defdecl = %p = %s \n",defdecl,defdecl->
class_name().c_str());
12479 ROSE_ASSERT(templateParameterList != NULL);
12480 defdecl->get_templateParameters() = *templateParameterList;
12483 ROSE_ASSERT(templateSpecializationArgumentList != NULL);
12484 defdecl->get_templateSpecializationArguments() = *templateSpecializationArgumentList;
12490 if (defdecl->get_templateParameters().size() == 0)
12492#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12493 printf (
"WARNING: In buildTemplateClassDeclaration_nfi(): defdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations defdecl = %p \n",defdecl);
12499 defdecl->set_templateName(nameWithoutTemplateArguments);
12502 printf (
"SageBuilder::buildTemplateClassDeclaration_nfi(): scope = %p = %s \n",scope,scope->
class_name().c_str());
12511 ROSE_ASSERT(classDef != NULL);
12518 classDef->set_declaration(defdecl);
12527 if (nondefdecl == NULL) {
12528 ROSE_ASSERT(scope != NULL);
12530 SgClassSymbol* mysymbol = scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList);
12532 printf (
"In buildTemplateClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
12535 if (mysymbol != NULL) {
12536 nondefdecl = isSgTemplateClassDeclaration(mysymbol->get_declaration());
12537 ROSE_ASSERT(nondefdecl != NULL);
12544 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
12551 printf(
" start build non-defn decl for %p\n",defdecl);
12555 ROSE_ASSERT(nondefdecl != NULL);
12560 printf(
" nondefdecl = %p\n",nondefdecl);
12567 nondefdecl->set_nonreal_decl_scope(nonreal_decl_scope);
12573 printf(
"In buildTemplateClassDeclaration_nfi(): nrscope = %p\n", nonreal_decl_scope);
12577 ROSE_ASSERT(templateParameterList != NULL);
12578 nondefdecl->get_templateParameters() = *templateParameterList;
12586 if (nondefdecl->get_templateParameters().size() == 0)
12588#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12589 printf (
"WARNING: In buildTemplateClassDeclaration_nfi(): nondefdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations nondefdecl = %p \n",nondefdecl);
12594 printf(
" next 1\n");
12598 nondefdecl->set_templateName(nameWithoutTemplateArguments);
12601 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
12616 printf(
" next 2\n");
12619 if (nondefdecl->get_type() == NULL)
12623 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());
12627 printf(
" next 3\n");
12631 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
12642 ROSE_ASSERT(templateClassDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateClassDeclaration->get_templateParameters().size()));
12645 scope->
insert_symbol(nameWithTemplateSpecializationArguments, mysymbol);
12647 printf(
" end build non-defn decl\n");
12651 SgClassSymbol* mysymbol = scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList);
12652 if (mysymbol == NULL) {
12653 printf(
"WARNING: In buildTemplateClassDeclaration_nfi(): non-defining declaration was provided but cannot be located in the associated scope.\n");
12658 printf (
"In buildTemplateClassDeclaration_nfi(): Setting the firstNondefiningDeclaration to be nondefdecl = %p \n",nondefdecl);
12674 if (defdecl->get_type() != NULL)
12680 if (defdecl->get_type()->get_declaration() == isSgDeclarationStatement(defdecl) )
12682 delete defdecl->get_type();
12694 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12698 if (isSgClassType(nondefdecl->get_type())->get_declaration() != isSgDeclarationStatement(nondefdecl))
12701 printf (
"In buildTemplateClassDeclaration_nfi(): detected isSgClassType(nondefdecl->get_type())->get_declaration() != isSgDeclarationStatement(nondefdecl) (problem with Boost code in ROSE compiling ROSE) \n");
12706 defdecl->set_type(nondefdecl->get_type());
12709 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());
12724 printf (
"***** WARNING *****: Commented out call to fixStructDeclaration() \n");
12732 ROSE_ASSERT(defdecl->
get_scope() != NULL);
12736 ROSE_ASSERT(defdecl->get_type() != NULL);
12739 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
12745#if PRINT_DEVELOPER_WARNINGS
12746 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());
12751 ROSE_ASSERT(defdecl->get_templateName().is_null() ==
false);
12754 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
12761 printf (
"Leaving buildTemplateClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
12763 SgSymbol* test_symbol = defdecl->
get_scope()->find_symbol_from_declaration(tmp_classDeclaration);
12766 printf (
"Leaving buildTemplateClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
12796 ASSERT_not_null(scope);
12807 SgEnumSymbol* existing_symbol = scope->lookup_enum_symbol(name);
12808 if (existing_symbol != NULL)
12810 enumType = isSgEnumType(existing_symbol->
get_type());
12811 first_nondefdecl = existing_symbol->get_declaration();
12812 ROSE_ASSERT(first_nondefdecl != NULL);
12821 ROSE_ASSERT(nondefdecl);
12825 if (first_nondefdecl)
12840 ASSERT_not_null(type);
12846 SgEnumSymbol* existing_symbol = scope->lookup_enum_symbol(name);
12848 if (existing_symbol)
12850 mysymbol = existing_symbol;
12851 first_nondefdecl = mysymbol->get_declaration();
12855 first_nondefdecl = nondefdecl;
12858 ASSERT_not_null(mysymbol);
12868 if (first_nondefdecl != nondefdecl)
12878 ASSERT_not_null(nondefdecl->
get_type());
12879 ASSERT_not_null(scope->lookup_enum_symbol(name));
12888 ROSE_ASSERT(scope != NULL);
12891 printf (
"In buildEnumDeclaration_nfi(): name = %s scope = %p = %s \n",name.str(),scope,scope->
class_name().c_str());
12899 SgEnumSymbol* existing_symbol = scope->lookup_enum_symbol(name);
12900 if (existing_symbol != NULL)
12902 enumType = isSgEnumType(existing_symbol->
get_type());
12907 printf (
"In buildEnumDeclaration_nfi(): name = %s building using enumType = %p \n",name.str(),enumType);
12912 ROSE_ASSERT(defdecl);
12915 printf (
"In buildEnumDeclaration_nfi(): built defining declaration = %p name = %s scope = %p = %s \n",defdecl,name.str(),scope,scope->
class_name().c_str());
12920 ROSE_ASSERT(type != NULL);
12927 printf (
"In buildEnumDeclaration_nfi(): name = %s \n",name.str());
12932 ROSE_ASSERT(scope != NULL);
12933 SgEnumSymbol* enumSymbol = scope->lookup_enum_symbol(name);
12936 if (enumSymbol != NULL)
12938 ROSE_ASSERT(enumSymbol->get_declaration() != NULL);
12939 nondefdecl = enumSymbol->get_declaration();
12940 ROSE_ASSERT(nondefdecl != NULL);
12947 printf (
"###### In buildEnumDeclaration_nfi(): built a non-defining declaration to support the symbol table: name = %s nondefdecl = %p \n",name.str(),nondefdecl);
12976 ROSE_ASSERT(mysymbol);
12996 printf (
"In buildEnumDeclaration_nfi(): name = %s defdecl = %p \n",name.str(),defdecl);
13000 ROSE_ASSERT(scope->lookup_enum_symbol(name) != NULL);
13012 ROSE_ASSERT(classDeclaration != NULL);
13013 ROSE_ASSERT(classDefinition != NULL);
13024 ROSE_ASSERT(baseclass != NULL);
13026 if (isVirtual ==
true)
13030 ROSE_ASSERT(baseclass->get_baseClassModifier() != NULL);
13031 baseclass->get_baseClassModifier()->setVirtual();
13043 classDefinition->append_inheritance(baseclass);
13052 ROSE_ASSERT(nrdecl != NULL);
13053 ROSE_ASSERT(classDefinition != NULL);
13056 ROSE_ASSERT(baseclass != NULL);
13058 if (isVirtual ==
true)
13060 baseclass->get_baseClassModifier()->setVirtual();
13065 classDefinition->append_inheritance(baseclass);
13075SageBuilder::buildAccessModifier (
unsigned int access )
13083 printf (
"In SageBuilder::set_access_modifiers(): Mark as public \n");
13090 printf (
"In SageBuilder::set_access_modifiers(): Mark as protected \n");
13097 printf (
"In SageBuilder::set_access_modifiers(): Mark as private \n");
13103 printf (
"Error: default reached in SageBuilder::set_access_modifiers() \n");
13118 ROSE_ASSERT(subtreeRoot != NULL);
13119 ROSE_ASSERT(newFileName !=
"");
13121#define DEBUG_FIXUP 0
13124 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): newFileName = %s \n",newFileName.c_str());
13125 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
13132 Traversal(
const std::string& tmp_newFileName,
int tmp_new_file_id,
int tmp_originalFileId)
13134 newFileName = tmp_newFileName;
13135 new_file_id = tmp_new_file_id;
13136 originalFileId = tmp_originalFileId;
13138 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): newFileName = %s new_file_id = %d originalFileId = %d \n",newFileName.c_str(),new_file_id,originalFileId);
13145 printf (
"In fixupSourcePositionFileSpecification visit(): node = %p = %s \n",node,node->
class_name().c_str());
13149 if (locatedNode != NULL)
13160 printf (
"Found SgLocatedNode marked as isShared() == true: locatedNode = %p = %s \n",locatedNode,locatedNode->
class_name().c_str());
13163 printf (
"Exiting as a test! \n");
13174 printf (
"locatedNode->get_startOfConstruct()->get_filename() = %s locatedNode->get_startOfConstruct()->get_physical_filename() = %s \n",
13176 printf (
"locatedNode->get_startOfConstruct()->get_file_id() = %d locatedNode->get_startOfConstruct()->get_physical_file_id() = %d \n",
13178 printf (
"locatedNode->get_startOfConstruct()->isShared() = %s \n",locatedNode->
get_startOfConstruct()->
isShared() ?
"true" :
"false");
13184 printf (
"NOT MATCHING: originalFileId = %d locatedNode->get_startOfConstruct()->get_file_id() = %d locatedNode->get_startOfConstruct()->get_physical_file_id() = %d \n",
13186 printf (
" ------------ originalFileId = %d locatedNode->get_endOfConstruct()->get_file_id() = %d locatedNode->get_endOfConstruct()->get_physical_file_id() = %d \n",
13194 if (initializedName != NULL)
13212 if (sourceFile != NULL)
13220 printf (
"sourceFile->get_endOfConstruct() == NULL: fixup endOfConstruct \n");
13234 printf (
"sourceFile->get_startOfConstruct()->get_file_id() = %d \n",sourceFile->
get_startOfConstruct()->get_file_id());
13235 printf (
"sourceFile->get_startOfConstruct()->get_physical_file_id() = %d \n",sourceFile->
get_startOfConstruct()->get_physical_file_id());
13244 printf (
"Unhandled: node = %p = %s \n",node,node->
class_name().c_str());
13251 if (expression != NULL)
13253 if (expression->get_operatorPosition()->get_physical_file_id() == originalFileId)
13255 expression->get_operatorPosition()->set_file_id(new_file_id);
13256 expression->get_operatorPosition()->set_physical_file_id(new_file_id);
13263 int originalFileId;
13264 string newFileName;
13268 SgFile* file = isSgFile(subtreeRoot);
13269 int new_file_id = -1;
13270 int originalFileId = -1;
13279 printf (
"originalFileId = %d \n",originalFileId);
13292 int new_file_id_2 = Sg_File_Info::getIDFromFilename(newFileName);
13294 printf (
"new_file_id = %d new_file_id_2 = %d \n",new_file_id,new_file_id_2);
13296 ROSE_ASSERT(new_file_id == new_file_id_2);
13298 string new_filename_2 = Sg_File_Info::getFilenameFromID(new_file_id);
13300 printf (
"newFileName = %s new_filename_2 = %s \n",newFileName.c_str(),new_filename_2.c_str());
13302 ROSE_ASSERT(newFileName == new_filename_2);
13306 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): file != NULL: newFileName = %s new_file_id = %d \n",newFileName.c_str(),new_file_id);
13311 SgLocatedNode* subtreeLocatedNode = isSgLocatedNode(subtreeRoot);
13312 if (subtreeLocatedNode != NULL)
13315 printf (
"subtreeLocatedNode->get_startOfConstruct()->get_file_id() = %d \n",subtreeLocatedNode->
get_startOfConstruct()->get_file_id());
13316 printf (
"subtreeLocatedNode->get_startOfConstruct()->get_physical_file_id() = %d \n",subtreeLocatedNode->
get_startOfConstruct()->get_physical_file_id());
13319 new_file_id = Sg_File_Info::getIDFromFilename(newFileName);
13321 printf (
"originalFileId = %d \n",originalFileId);
13322 printf (
"new_file_id = %d \n",new_file_id);
13325 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): subtreeLocatedNode = %s : originalFileId = %d newFileName = %s new_file_id = %d \n",
13326 subtreeLocatedNode->
class_name().c_str(),originalFileId,newFileName.c_str(),new_file_id);
13331 printf (
"Error: In SageBuilder::fixupSourcePositionFileSpecification(): subtree should be a SgFile or SgLocatedNode: subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
13336 printf (
"Error: In SageBuilder::fixupSourcePositionFileSpecification(): subtree should be a SgFile: subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
13341 ROSE_ASSERT(new_file_id >= 0);
13344 Traversal traversal (newFileName,new_file_id,originalFileId);
13349 traversal.traverse(subtreeRoot, preorder);
13352 printf (
"Exiting as a test in SageBuilder::fixupSourcePositionFileSpecification() \n");
13370 ROSE_ASSERT(subtreeRoot != NULL);
13371 ROSE_ASSERT(new_file_id >= 0);
13374 printf (
"In SageBuilder::fixupSharingSourcePosition(): subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
13375 printf (
"In SageBuilder::fixupSharingSourcePosition(): new_file_id = %d \n",new_file_id);
13382 Traversal(
int tmp_new_file_id)
13384 new_file_id = tmp_new_file_id;
13386 printf (
"In SageBuilder::fixupSharingSourcePosition(): new_file_id = %d \n",new_file_id);
13390 void visit (
SgNode* node)
13393 printf (
"In fixupSharingSourcePosition visit(): node = %p = %s new_file_id = %d \n",node,node->
class_name().c_str(),new_file_id);
13397 if (statement != NULL)
13402 printf (
"new_file_id = %d startOfConstruct->get_physical_file_id() = %d \n",new_file_id,startOfConstruct->get_physical_file_id());
13405 if (startOfConstruct->get_physical_file_id() == new_file_id)
13413 printf (
" --- adding entries for file_id and line number to support sharing: new_file_id = %d line = %d end line = %d \n",
13416 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == startOfConstruct->get_fileLineNumbersToUnparse().size());
13417 ROSE_ASSERT(endOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
13418 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
13421 startOfConstruct->get_fileIDsToUnparse().push_back(new_file_id);
13422 startOfConstruct->get_fileLineNumbersToUnparse().push_back(startOfConstruct->
get_line());
13424 endOfConstruct->get_fileIDsToUnparse().push_back(new_file_id);
13425 endOfConstruct->get_fileLineNumbersToUnparse().push_back(endOfConstruct->
get_line());
13427 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == startOfConstruct->get_fileLineNumbersToUnparse().size());
13428 ROSE_ASSERT(endOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
13429 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
13435 printf (
"Unhandled: node = %p = %s \n",node,node->
class_name().c_str());
13445 SgStatement* statement = isSgStatement(subtreeRoot);
13446 if (statement != NULL)
13449 printf (
"statement->get_startOfConstruct()->get_file_id() = %d \n",statement->
get_startOfConstruct()->get_file_id());
13450 printf (
"statement->get_startOfConstruct()->get_physical_file_id() = %d \n",statement->
get_startOfConstruct()->get_physical_file_id());
13453 printf (
"new_file_id = %d \n",new_file_id);
13456 printf (
"In SageBuilder::fixupSharingSourcePosition(): statement = %s : new_file_id = %d \n",statement->
class_name().c_str(),new_file_id);
13461 printf (
"Error: In SageBuilder::fixupSharingSourcePosition(): subtree should be a SgFile or SgLocatedNode: subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
13465 ROSE_ASSERT(new_file_id >= 0);
13468 Traversal traversal (new_file_id);
13473 traversal.traverse(subtreeRoot, preorder);
13476 printf (
"Exiting as a test in SageBuilder::fixupSharingSourcePosition() \n");
13493#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
13496 printf (
"In SageBuilder::buildFile(inputFileName = %s, outputFileName = %s, project = %p) \n",inputFileName.c_str(),outputFileName.c_str(),project);
13502 ROSE_ASSERT(project != NULL);
13505 if (tmp1_collectionOfModifiedLocatedNodes.size() > 0)
13507 printf (
"In Traversal::evaluateInheritedAttribute(): tmp1_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp1_collectionOfModifiedLocatedNodes.size());
13509 printf (
"Exiting as a test! \n");
13510 ROSE_ASSERT(
false);
13515 ROSE_ASSERT(inputFileName.size() != 0);
13520 string sourceFilename = inputFileName;
13524 printf (
"sourceFilename = %s \n",sourceFilename.c_str());
13530 if (project != NULL)
13532 SgGlobal* globalScopeAcrossFiles = project->get_globalScopeAcrossFiles();
13533 ROSE_ASSERT(globalScopeAcrossFiles != NULL);
13536 ROSE_ASSERT(globalScopeAcrossFiles->
get_symbol_table()->get_table() != NULL);
13539 printf (
"In SageBuilder::buildFile(): globalScopeAcrossFiles = %p \n",globalScopeAcrossFiles);
13540 printf (
" --- globalScopeAcrossFiles->get_declarations().size() = %zu \n",globalScopeAcrossFiles->
get_declarations().size());
13541 printf (
" --- globalScopeAcrossFiles->get_symbol_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->
size());
13542 printf (
" --- globalScopeAcrossFiles->get_symbol_table()->get_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->get_table()->size());
13545 printf (
"Removing all elements from the globalScopeAcrossFiles->get_symbol_table() \n");
13551 if (clear_globalScopeAcrossFiles ==
true)
13553 globalScopeAcrossFiles->
get_symbol_table()->get_table()->delete_elements();
13557 printf (
"After removing all symbols (alias symbols): globalScopeAcrossFiles->get_symbol_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->
size());
13558 printf (
"After removing all symbols (alias symbols): globalScopeAcrossFiles->get_symbol_table()->get_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->get_table()->size());
13565 Rose_STL_Container<std::string> arglist;
13566 int nextErrorCode = 0;
13569 bool set_header_file_unparsing_optimization =
false;
13573 bool isCopyOfExistingFile_testForSharedNodes =
false;
13574 SgFile* fileBeingCopied = NULL;
13576 if (project == NULL)
13581 printf (
"In SageBuilder::buildFile(): build the SgProject \n");
13584 ROSE_ASSERT(project);
13585 project->get_fileList().clear();
13587 arglist.push_back(
"cc");
13588 arglist.push_back(
"-c");
13596 SgFilePtrList & files = project->get_fileList();
13597 for (SgFilePtrList::iterator i = files.begin(); i != files.end(); i++)
13601 printf (
"file = %p = %s name = %s \n",file,file->
class_name().c_str(), file->
getFileName().c_str());
13603 printf (
"file->get_header_file_unparsing_optimization() = %s \n",file->get_header_file_unparsing_optimization() ?
"true" :
"false");
13604 printf (
"file->get_header_file_unparsing_optimization_source_file() = %s \n",file->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
13605 printf (
"file->get_header_file_unparsing_optimization_header_file() = %s \n",file->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
13610 printf (
"This is a copy of an existing file in the project: sourceFilename = %s \n",sourceFilename.c_str());
13613 isCopyOfExistingFile_testForSharedNodes =
true;
13614 fileBeingCopied = file;
13619 if (file->get_header_file_unparsing_optimization() ==
true)
13621 set_header_file_unparsing_optimization =
true;
13628 printf (
"Exiting as a test! \n");
13633 ifstream testfile(inputFileName.c_str());
13634 if (!testfile.is_open())
13640 ofstream outputfile(inputFileName.c_str(),ios::out);
13642 outputfile<<
"// Output file generated so that StringUtility::getAbsolutePathFromRelativePath() will see a vaild file ... unparsed file will have rose_ prefix "<<endl;
13643 outputfile.close();
13663 project->get_sourceFileNameList().push_back(inputFileName);
13665 Rose_STL_Container<string> sourceFilenames = project->get_sourceFileNameList();
13673 if (std::find(arglist.begin(), arglist.end(), sourceFilename) == arglist.end())
13675 arglist.push_back(sourceFilename);
13680 if (outputFileName.empty() ==
false)
13682 arglist.push_back(
"-rose:o");
13684 arglist.push_back(outputFileName);
13701 SgFile* result = determineFileType(arglist, nextErrorCode, project);
13702 ROSE_ASSERT(result != NULL);
13705 printf (
"In SageBuilder::buildFile(): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",project,project->get_fileList_ptr()->get_listOfFiles().size());
13709 if (sourceFile != NULL)
13711 SgGlobal* globalScope = sourceFile->get_globalScope();
13712 ROSE_ASSERT(globalScope != NULL);
13721 printf (
"In SageBuilder::buildFile(): globalScope->get_isModified() == true: reset to false \n");
13725 printf (
"In SageBuilder::buildFile(): Verify false setting: globalScope->get_isModified() = %s \n",globalScope->
get_isModified() ?
"true" :
"false");
13740 ROSE_ASSERT(project != NULL);
13743 if (tmp2_collectionOfModifiedLocatedNodes.size() > 0)
13745 printf (
"In Traversal::evaluateInheritedAttribute(): tmp2_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp2_collectionOfModifiedLocatedNodes.size());
13747 printf (
"Exiting as a test! \n");
13748 ROSE_ASSERT(
false);
13755 ROSE_ASSERT(project != NULL);
13758 if (tmp22_collectionOfModifiedLocatedNodes.size() > 0)
13760 printf (
"In Traversal::evaluateInheritedAttribute(): tmp22_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp22_collectionOfModifiedLocatedNodes.size());
13762 printf (
"Exiting as a test! \n");
13763 ROSE_ASSERT(
false);
13769 printf (
"Calling outputFileIds() \n");
13773 printf (
"DONE: Calling outputFileIds() \n");
13778 printf (
"In SageBuilder::buildFile(): file = %p = %s result->get_header_file_unparsing_optimization() = %s \n",
13779 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization() ?
"true" :
"false");
13783 printf (
"In SageBuilder::buildFile(): file = %p = %s result->get_header_file_unparsing_optimization_source_file() = %s \n",
13784 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
13785 printf (
"In SageBuilder::buildFile(): file = %p = %s result->get_header_file_unparsing_optimization_header_file() = %s \n",
13786 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
13798 if (set_header_file_unparsing_optimization ==
true)
13800 result->set_header_file_unparsing_optimization(
true);
13810 result->set_header_file_unparsing_optimization_header_file(
false);
13813 printf (
"In SageBuilder::buildFile(): set_header_file_unparsing_optimization == true: file = %p = %s result->get_header_file_unparsing_optimization() = %s \n",
13814 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization() ?
"true" :
"false");
13815 printf (
"In SageBuilder::buildFile(): set_header_file_unparsing_optimization == true: file = %p = %s result->get_header_file_unparsing_optimization_source_file() = %s \n",
13816 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
13817 printf (
"In SageBuilder::buildFile(): set_header_file_unparsing_optimization == true: file = %p = %s result->get_header_file_unparsing_optimization_header_file() = %s \n",
13818 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
13834 if (project->get_Java_only() ==
true)
13837 printf (
"WARNING: Java specific action to add new file to SgProject (using set_file()) (more uniform language handling symantics would avoid this problem) \n");
13849 printf (
"In SageBuilder::buildFile(): Outliner::use_dlopen = %s \n",Outliner::use_dlopen ?
"true" :
"false");
13854 ROSE_ASSERT(project != NULL);
13857 if (tmp23_collectionOfModifiedLocatedNodes.size() > 0)
13859 printf (
"In Traversal::evaluateInheritedAttribute(): tmp23_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp23_collectionOfModifiedLocatedNodes.size());
13861 printf (
"Exiting as a test! \n");
13862 ROSE_ASSERT(
false);
13869 ROSE_ASSERT(project != NULL);
13872 if (tmp24_collectionOfModifiedLocatedNodes.size() > 0)
13874 printf (
"In Traversal::evaluateInheritedAttribute(): tmp24_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp24_collectionOfModifiedLocatedNodes.size());
13876 printf (
"Exiting as a test! \n");
13877 ROSE_ASSERT(
false);
13887 if (!Outliner::use_dlopen)
13890 printf (
"In SageBuilder::buildFile(): (after test for (!Outliner::use_dlopen) == true: project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
13891 project,project->get_fileList_ptr()->get_listOfFiles().size());
13896 printf (
"In SageBuilder::buildFile(): (after 2nd project->set_file()): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
13897 project,project->get_fileList_ptr()->get_listOfFiles().size());
13903 printf (
"In SageBuilder::buildFile(): (after test for (!Outliner::use_dlopen) == false: project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
13904 project,project->get_fileList_ptr()->get_listOfFiles().size());
13919 SgFilePtrList& flist = project->get_fileList();
13920 flist.insert(flist.begin(),result);
13922 printf (
"In SageBuilder::buildFile(): (after flist.insert(flist.begin(),result)): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
13923 project,project->get_fileList_ptr()->get_listOfFiles().size());
13930 ROSE_ASSERT(project != NULL);
13933 if (tmp25_collectionOfModifiedLocatedNodes.size() > 0)
13935 printf (
"In Traversal::evaluateInheritedAttribute(): tmp25_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp25_collectionOfModifiedLocatedNodes.size());
13937 printf (
"Exiting as a test! \n");
13938 ROSE_ASSERT(
false);
13946 EDG_ROSE_Translation::suppress_detection_of_transformations =
true;
13949 printf (
"In SageBuilder::buildFile(): EDG_ROSE_Translation::suppress_detection_of_transformations = %s \n",EDG_ROSE_Translation::suppress_detection_of_transformations ?
"true" :
"false");
13953 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());
13976 ROSE_ASSERT(project != NULL);
13979 if (tmp251_collectionOfModifiedLocatedNodes.size() > 0)
13981 printf (
"In Traversal::evaluateInheritedAttribute(): tmp251_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp251_collectionOfModifiedLocatedNodes.size());
13983 printf (
"Exiting as a test! \n");
13984 ROSE_ASSERT(
false);
13992 result->runFrontend(nextErrorCode);
13995 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());
13999 printf (
"After result->runFrontend(): calling outputFileIds() \n");
14003 printf (
"DONE: After result->runFrontend(): calling outputFileIds() \n");
14018 ROSE_ASSERT(project != NULL);
14021 if (tmp26_collectionOfModifiedLocatedNodes.size() > 0)
14023 printf (
"In Traversal::evaluateInheritedAttribute(): tmp26_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp26_collectionOfModifiedLocatedNodes.size());
14025 printf (
"Exiting as a test! \n");
14026 ROSE_ASSERT(
false);
14033 printf (
"Generating a dot file... (SgFile only) \n");
14034 generateDOT ( *project );
14039 printf (
"In SageBuilder::buildFile(): Generate the dot output for multiple files (ROSE AST) \n");
14041 generateDOTforMultipleFile ( *project );
14042 printf (
"DONE: Generate the dot output of the SAGE III AST \n");
14048 const int MAX_NUMBER_OF_IR_NODES_TO_GRAPH_FOR_WHOLE_GRAPH = 8000;
14049 generateAstGraph(project,MAX_NUMBER_OF_IR_NODES_TO_GRAPH_FOR_WHOLE_GRAPH);
14054 printf (
"In SageBuilder::buildFile(): calling astPostProcessing() \n");
14057 if (!project->get_skip_post_processing()) AstPostProcessing(result);
14060 printf (
"In SageBuilder::buildFile(): DONE: calling astPostProcessing() \n");
14073 ROSE_ASSERT(project != NULL);
14076 if (tmp265_collectionOfModifiedLocatedNodes.size() > 0)
14078 printf (
"In Traversal::evaluateInheritedAttribute(): tmp265_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp265_collectionOfModifiedLocatedNodes.size());
14080 printf (
"Exiting as a test! \n");
14081 ROSE_ASSERT(
false);
14087 result->display(
"SageBuilder::buildFile()");
14090 ROSE_ASSERT(project != NULL);
14091 project->set_frontendErrorCode(max(project->get_frontendErrorCode(), nextErrorCode));
14106 printf (
"Exiting as a test! \n");
14112 ROSE_ASSERT(project != NULL);
14115 if (tmp27_collectionOfModifiedLocatedNodes.size() > 0)
14117 printf (
"In Traversal::evaluateInheritedAttribute(): tmp27_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp27_collectionOfModifiedLocatedNodes.size());
14119 printf (
"Exiting as a test! \n");
14120 ROSE_ASSERT(
false);
14126 if (isCopyOfExistingFile_testForSharedNodes ==
true)
14132 printf (
"Found isCopyOfExistingFile_testForSharedNodes == true \n");
14133 printf (
"fileBeingCopied = %p = %s \n",fileBeingCopied,fileBeingCopied->
getFileName().c_str());
14136 SgSourceFile* sourceFileBeingCopied = isSgSourceFile(fileBeingCopied);
14137 ROSE_ASSERT(sourceFileBeingCopied != NULL);
14140 ROSE_ASSERT(sourceResult != NULL);
14142 SgGlobal* fileBeingCopied_globalScope = sourceFileBeingCopied->get_globalScope();
14143 SgGlobal* result_globalScope = sourceResult->get_globalScope();
14145 printf (
"fileBeingCopied_globalScope = %p \n",fileBeingCopied_globalScope);
14146 printf (
"result_globalScope = %p \n",result_globalScope);
14148 ROSE_ASSERT(fileBeingCopied_globalScope != NULL);
14149 ROSE_ASSERT(result_globalScope != NULL);
14151 SgDeclarationStatementPtrList fileBeingCopied_declarationList = fileBeingCopied_globalScope->
get_declarations();
14152 SgDeclarationStatementPtrList result_declarationList = result_globalScope->
get_declarations();
14157 vector<SgDeclarationStatement*>::iterator it;
14158 SgDeclarationStatementPtrList v(fileBeingCopied_declarationList.size());
14161 std::sort(fileBeingCopied_declarationList.begin(),fileBeingCopied_declarationList.end());
14162 std::sort(result_declarationList.begin(),result_declarationList.end());
14166 it = std::set_intersection(fileBeingCopied_declarationList.begin(),fileBeingCopied_declarationList.end(),result_declarationList.begin(),result_declarationList.end(),v.begin());
14168 v.resize(it-v.begin());
14170 int fileBeingCopied_file_id = fileBeingCopied->
get_startOfConstruct()->get_physical_file_id();
14173 for (
size_t i = 0; i < v.size(); i++)
14178 printf (
" --- SageBuilder::buildFile() is sharing this node: %p %s \n",intersection_element,intersection_element->
class_name().c_str());
14184 printf (
"Exiting as a test! \n");
14191 ROSE_ASSERT(project != NULL);
14194 if (tmp28_collectionOfModifiedLocatedNodes.size() > 0)
14196 printf (
"In Traversal::evaluateInheritedAttribute(): tmp28_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp28_collectionOfModifiedLocatedNodes.size());
14198 printf (
"Exiting as a test! \n");
14199 ROSE_ASSERT(
false);
14211 std::vector<SgDeclarationStatementPtrList::iterator> removeList;
14212 SgDeclarationStatementPtrList::iterator i = fileBeingCopied_declarationList.begin();
14213 while (i != fileBeingCopied_declarationList.end())
14216 if (emptyDeclaration != NULL)
14218 removeList.push_back(i);
14228 for (std::vector<SgDeclarationStatementPtrList::iterator>::iterator i = removeList.begin(); i != removeList.end(); i++)
14230 fileBeingCopied_declarationList.erase(*i);
14235 if (fileBeingCopied_declarationList.size() != result_declarationList.size())
14237 printf (
"fileBeingCopied_declarationList.size() = %zu \n",fileBeingCopied_declarationList.size());
14238 printf (
"result_declarationList.size() = %zu \n",result_declarationList.size());
14240 ROSE_ASSERT(fileBeingCopied_declarationList.size() == result_declarationList.size());
14245 printf (
"Statements from global scope (size = %zu): \n",fileBeingCopied_declarationList.size());
14247 for (
size_t i = 0; i < fileBeingCopied_declarationList.size(); i++)
14252 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());
14254 if (fileBeingCopied_decl == result_decl)
14257 printf (
" --- SageBuilder::buildFile() is sharing this node: %p %s \n",fileBeingCopied_decl,fileBeingCopied_decl->
class_name().c_str());
14263 int fileBeingCopied_file_id = fileBeingCopied->
get_startOfConstruct()->get_physical_file_id();
14266 printf (
"Exiting as a test! \n");
14277 printf (
"exiting as a test! \n");
14287 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
14288 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
14289 printf (
"Leaving SageBuilder::buildFile(): (after result->runFrontend()): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
14290 project,project->get_fileList_ptr()->get_listOfFiles().size());
14291 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
14292 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
14301 ROSE_ASSERT(result->get_preprocessorDirectivesAndCommentsList() != NULL);
14305 ROSE_ASSERT(project != NULL);
14308 if (tmp3_collectionOfModifiedLocatedNodes.size() > 0)
14310 printf (
"In Traversal::evaluateInheritedAttribute(): tmp3_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp3_collectionOfModifiedLocatedNodes.size());
14312 printf (
"Exiting as a test! \n");
14313 ROSE_ASSERT(
false);
14341 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
14342 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
14343 printf (
"In SageBuilder::buildSourceFile(outputFileName = %s, project = %p) \n",outputFileName.c_str(),project);
14344 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
14345 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
14349 string inputFilePrefix =
"temp_dummy_file_";
14352 printf (
"In SageBuilder::buildSourceFile(const std::string& outputFileName, SgProject* project): calling buildFile() \n");
14355 SgFile* file =
buildFile(inputFilePrefix+outputFileName,outputFileName,project,clear_globalScopeAcrossFiles);
14356 ROSE_ASSERT(file != NULL);
14359 printf (
"DONE: In SageBuilder::buildSourceFile(): calling buildFile() \n");
14363 ROSE_ASSERT(sourceFile != NULL);
14365 ROSE_ASSERT(sourceFile->get_globalScope() != NULL);
14368 printf (
"call the unparser on the just built file \n");
14372 printf (
"Exiting as a test! \n");
14383 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
14384 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
14385 printf (
"In SageBuilder::buildSourceFile(const std::string& inputFileName,const std::string& outputFileName, SgProject* project): calling buildFile() \n");
14387 printf (
" --- inputFileName = %s \n",inputFileName.c_str());
14388 printf (
" --- outputFileName = %s \n",outputFileName.c_str());
14389 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
14390 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
14395 ROSE_ASSERT(project != NULL);
14398 if (tmp1_collectionOfModifiedLocatedNodes.size() > 0)
14400 printf (
"In Traversal::evaluateInheritedAttribute(): tmp1_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp1_collectionOfModifiedLocatedNodes.size());
14402 printf (
"Exiting as a test! \n");
14403 ROSE_ASSERT(
false);
14408 SgFile* file =
buildFile(inputFileName, outputFileName,project,clear_globalScopeAcrossFiles);
14409 ROSE_ASSERT(file != NULL);
14412 printf (
"DONE: In SageBuilder::buildSourceFile(): calling buildFile() \n");
14417 ROSE_ASSERT(project != NULL);
14420 if (tmp2_collectionOfModifiedLocatedNodes.size() > 0)
14422 printf (
"In Traversal::evaluateInheritedAttribute(): tmp2_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp2_collectionOfModifiedLocatedNodes.size());
14424 printf (
"Exiting as a test! \n");
14425 ROSE_ASSERT(
false);
14431 ROSE_ASSERT(sourceFile != NULL);
14433 ROSE_ASSERT(sourceFile->get_globalScope() != NULL);
14437 printf (
"Debugging the unparsing header file optimization \n");
14439 printf (
"sourceFile->get_header_file_unparsing_optimization() = %s \n",sourceFile->get_header_file_unparsing_optimization() ?
"true" :
"false");
14440 printf (
"sourceFile->get_header_file_unparsing_optimization_source_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
14441 printf (
"sourceFile->get_header_file_unparsing_optimization_header_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
14448 ROSE_ASSERT(sourceFile->get_header_file_unparsing_optimization() ==
true);
14449 ROSE_ASSERT(sourceFile->get_header_file_unparsing_optimization_source_file() ==
true);
14451 ROSE_ASSERT(sourceFile->get_header_file_unparsing_optimization_header_file() ==
false);
14457 SgFilePtrList & fileList = project->get_fileList();
14460 printf (
"Looking for file = %s \n",inputFileName.c_str());
14463 for (SgFilePtrList::iterator i = fileList.begin(); i != fileList.end(); i++)
14467 printf (
"temp_file = %p = %s name = %s \n",temp_file,temp_file->
class_name().c_str(),temp_file->
getFileName().c_str());
14469 if (temp_file != file)
14484 printf (
"sourceFile = %p = %s \n",sourceFile,sourceFile->
class_name().c_str());
14485 printf (
"sourceFile->get_header_file_unparsing_optimization() = %s \n",sourceFile->get_header_file_unparsing_optimization() ?
"true" :
"false");
14486 printf (
"sourceFile->get_header_file_unparsing_optimization_source_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
14487 printf (
"sourceFile->get_header_file_unparsing_optimization_header_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
14489 printf (
"temp_file = %p = %s \n",temp_file,temp_file->
class_name().c_str());
14490 printf (
"temp_file->get_header_file_unparsing_optimization() = %s \n",temp_file->get_header_file_unparsing_optimization() ?
"true" :
"false");
14491 printf (
"temp_file->get_header_file_unparsing_optimization_source_file() = %s \n",temp_file->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
14492 printf (
"temp_file->get_header_file_unparsing_optimization_header_file() = %s \n",temp_file->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
14511 printf (
"Sg_File_Info::get_nametofileid_map()[sourceFile->get_file_info()->get_filename()] = %d \n",filename_id);
14512 printf (
"Sg_File_Info::get_nametofileid_map()[sourceFile->get_file_info()->get_filename()] = %d \n",filename_physical_id);
14513 sourceFile->
get_file_info()->set_physical_file_id(filename_physical_id);
14515 printf (
"sourceFile->get_file_info()->get_physical_filename() = %s \n",sourceFile->
get_file_info()->get_physical_filename().c_str());
14516 printf (
"sourceFile->get_file_info()->get_physical_file_id() = %d \n",sourceFile->
get_file_info()->get_physical_file_id());
14520 printf (
"Exiting as a test! \n");
14532 if (sourceFile->get_preprocessorDirectivesAndCommentsList() == NULL)
14535 printf (
"Initialize NULL p_preprocessorDirectivesAndCommentsList to empty ROSEAttributesListContainer \n");
14538 sourceFile->set_preprocessorDirectivesAndCommentsList(tmp_preprocessorDirectivesAndCommentsList);
14543 printf (
"NOTE: p_preprocessorDirectivesAndCommentsList is already defined! \n");
14544 printf (
" --- inputFileName = %s \n",inputFileName.c_str());
14545 printf (
" --- outputFileName = %s \n",outputFileName.c_str());
14546 printf (
" --- sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size() = %zu \n",sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size());
14549 ROSE_ASSERT (sourceFile->get_preprocessorDirectivesAndCommentsList() != NULL);
14556 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");
14561 ROSE_ASSERT(filePreprocInfo != NULL);
14567 printf (
"In SageBuilder::buildSourceFile(const std::string& inputFileName,const std::string& outputFileName, SgProject* project): calling attachPreprocessingInfo() \n");
14568 printf (
" --- sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size() = %zu \n",sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size());
14573 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");
14574 printf (
" --- inputFileName = %s \n",inputFileName.c_str());
14575 printf (
" --- outputFileName = %s \n",outputFileName.c_str());
14576 printf (
"sourceFile = %p \n",sourceFile);
14577 printf (
"sourceFile->get_token_list.size() = %zu \n",sourceFile->get_token_list().size());
14578 printf (
"sourceFile->get_tokenSubsequenceMap().size() = %zu \n",sourceFile->get_tokenSubsequenceMap().size());
14586 attachPreprocessingInfo (sourceFile,outputFileName);
14593 printf (
"Exiting after test! processed first phase of collecting comments and CPP directives for source file) \n");
14594 ROSE_ASSERT(
false);
14598 printf (
"DONE: In SageBuilder::buildSourceFile(const std::string& inputFileName,const std::string& outputFileName, SgProject* project): calling attachPreprocessingInfo() \n");
14602 printf (
"call the unparser on the just built file \n");
14606 printf (
"In buildSourceFile(): AS A TEST: calling unparseFile(): filename = %s \n",sourceFile->
getFileName().c_str());
14625 printf (
"In SageBuilder::buildSourceFile(): changing the name of the file represented in sourceFile: \n");
14626 printf (
"inputFileName = %s \n",inputFileName.c_str());
14627 printf (
"outputFileName = %s \n",outputFileName.c_str());
14628 printf (
"sourceFile->getFileName() = %s \n",sourceFile->
getFileName().c_str());
14631 SgGlobal* globalScope = sourceFile->get_globalScope();
14634 printf (
"Leaving SageBuilder::buildSourceFile() sourceFile = %p globalScope = %p \n",sourceFile,sourceFile->get_globalScope());
14635 printf (
"sourceFile->get_file_info()->get_file_id() = %d \n",sourceFile->
get_file_info()->get_file_id());
14636 printf (
"sourceFile->get_file_info()->get_physical_file_id() = %d \n",sourceFile->
get_file_info()->get_physical_file_id());
14637 printf (
"sourceFile->get_token_list.size() = %zu \n",sourceFile->get_token_list().size());
14638 printf (
"sourceFile->get_tokenSubsequenceMap().size() = %zu \n",sourceFile->get_tokenSubsequenceMap().size());
14639 printf (
"inputFileName = %s \n",inputFileName.c_str());
14640 printf (
"outputFileName = %s \n",outputFileName.c_str());
14641 printf (
"sourceFile->getFileName() = %s \n",sourceFile->
getFileName().c_str());
14643 printf (
"sourceFile->get_globalScope() = %p \n",globalScope);
14644 printf (
"globalScope->get_isModified() = %s \n",globalScope->
get_isModified() ?
"true" :
"false");
14654 printf (
"globalScope->get_isModified() == true: reset to false \n");
14658 printf (
"Verify false setting: globalScope->get_isModified() = %s \n",globalScope->
get_isModified() ?
"true" :
"false");
14664 ROSE_ASSERT(project != NULL);
14667 if (tmp3_collectionOfModifiedLocatedNodes.size() > 0)
14669 printf (
"In Traversal::evaluateInheritedAttribute(): tmp3_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp3_collectionOfModifiedLocatedNodes.size());
14671 printf (
"Exiting as a test! \n");
14672 ROSE_ASSERT(
false);
14678 printf (
"Exiting as a test! \n");
14694 bool isSystemHeader)
14696 std::string content;
14697 if (isSystemHeader)
14698 content =
"#include <" + header_filename +
"> \n";
14700 content =
"#include \"" + header_filename +
"\" \n";
14702 content,
"Transformation generated",0, 0, 0, position);
14703 ROSE_ASSERT(result);
14712 ROSE_ASSERT(target != NULL);
14714 std::string content2 = content;
14715 boost::algorithm::trim(content2);
14716 string prefix =
"#define";
14717 string::size_type pos = content2.find(prefix, 0);
14718 ROSE_ASSERT (pos == 0);
14722 PreprocessingInfo::DirectiveType mytype = PreprocessingInfo::CpreprocessorDefineDeclaration;
14726 result =
new PreprocessingInfo (mytype,content,
"transformation-generated", 0, 0, 0, position);
14727 ROSE_ASSERT(result);
14728 target->addToAttachedPreprocessingInfo(result);
14734#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
14739 static std::map<SgNode*, AbstractHandle::abstract_handle *> handleMap;
14741 ROSE_ASSERT(n != NULL);
14746 ROSE_ASSERT(anode !=NULL );
14749 ROSE_ASSERT(ahandle != NULL);
14758 ROSE_ASSERT(exp1 != NULL);
14759 ROSE_ASSERT(exp2 != NULL);
14764 ROSE_ASSERT(equivalenceStatement->get_equivalence_set_list() == NULL);
14765 equivalenceStatement->set_equivalence_set_list(setList);
14766 ROSE_ASSERT(equivalenceStatement->get_equivalence_set_list() != NULL);
14769 return equivalenceStatement;
14782 typedef Rose_STL_Container<SgScopeStatement*> SgScopeStatementPtrList;
14783 SgScopeStatementPtrList snippet_scope_list;
14789 printf (
"First scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
14791 if (temp_classDefinition != NULL)
14794 SgName className = temp_classDeclaration->get_name();
14796 printf (
"Input snippet declaration's class name = %s \n",className.str());
14800 if (namespaceDefinitionStatement != NULL)
14805 snippet_scope_list.push_back(snippet_scope);
14806 while (snippet_scope != NULL && isSgGlobal(snippet_scope) == NULL)
14812 snippet_scope = snippet_scope->
get_scope();
14814 printf (
"snippet_scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
14816 snippet_scope_list.push_back(snippet_scope);
14820 printf (
"snippet_scope_list.size() = %" PRIuPTR
" \n",snippet_scope_list.size());
14823 SgGlobal* global_scope_in_target_ast = TransformationSupport::getGlobalScope(targetScope);
14824 SgScopeStatementPtrList::reverse_iterator i = snippet_scope_list.rbegin();
14829 ROSE_ASSERT(isSgGlobal(snippet_AST_scope) != NULL);
14834 while (i != snippet_scope_list.rend())
14838 printf (
"snippet_AST_scope list *i = %p = %s \n",*i,(*i)->class_name().c_str());
14845 if (classDefinition != NULL)
14848 SgName className = classDeclaration->get_name();
14850 printf (
"Found snippet class name = %s \n",className.str());
14852 SgClassSymbol* classSymbol = target_AST_scope->lookup_class_symbol(className);
14853 ROSE_ASSERT(classSymbol != NULL);
14854 ROSE_ASSERT(classSymbol->get_declaration() != NULL);
14856 printf (
"Associated symbol in taget AST: declaration = %p name = %s \n",classSymbol->get_declaration(),classSymbol->get_declaration()->get_name().str());
14859 returnSymbol = classSymbol;
14862 target_AST_scope = classDefinition;
14867 if (functionDefinition != NULL)
14869 printf (
"ERROR: Found an unusual case of SgFunctionDefinition in list of scopes holding a declaration for a type \n");
14874 if (namespaceDefinition != NULL)
14879 printf (
"Found snippet namespace name = %s \n",namespaceName.str());
14881 SgNamespaceSymbol* namespaceSymbol = target_AST_scope->lookup_namespace_symbol(namespaceName);
14882 ROSE_ASSERT(namespaceSymbol != NULL);
14888 returnSymbol = namespaceSymbol;
14891 target_AST_scope = namespaceDefinition;
14899 switch (snippet_declaration->
variantT())
14901 case V_SgClassDeclaration:
14903 SgClassDeclaration* snippet_classDeclaration = isSgClassDeclaration(snippet_declaration);
14904 ROSE_ASSERT(snippet_classDeclaration != NULL);
14906 SgName snippet_className = snippet_classDeclaration->get_name();
14908 printf (
"snippet snippet declaration's class name = %s \n",snippet_className.str());
14910 SgClassSymbol* target_symbol = target_AST_scope->lookup_class_symbol(snippet_className);
14911 ROSE_ASSERT(target_symbol != NULL);
14912 returnSymbol = target_symbol;
14914 SgClassSymbol* classSymbolInTargetAST = isSgClassSymbol(returnSymbol);
14915 ROSE_ASSERT(classSymbolInTargetAST != NULL);
14916 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
14917 ROSE_ASSERT(target_classDeclaration != NULL);
14919 printf (
"snippet: classDeclaration = %p = %s \n",snippet_classDeclaration,snippet_classDeclaration->get_name().str());
14920 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
14922 ROSE_ASSERT(snippet_classDeclaration->get_name() == target_classDeclaration->get_name());
14926 case V_SgTypedefDeclaration:
14928 SgTypedefDeclaration* snippet_typedefDeclaration = isSgTypedefDeclaration(snippet_declaration);
14929 ROSE_ASSERT(snippet_typedefDeclaration != NULL);
14931 SgName snippet_typedefName = snippet_typedefDeclaration->get_name();
14933 printf (
"snippet snippet declaration's typedef name = %s \n",snippet_typedefName.str());
14935 SgTypedefSymbol* target_symbol = target_AST_scope->lookup_typedef_symbol(snippet_typedefName);
14936 ROSE_ASSERT(target_symbol != NULL);
14937 returnSymbol = target_symbol;
14939 SgTypedefSymbol* typedefSymbolInTargetAST = isSgTypedefSymbol(returnSymbol);
14940 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
14941 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
14942 ROSE_ASSERT(target_typedefDeclaration != NULL);
14944 printf (
"snippet: typedefDeclaration = %p = %s \n",snippet_typedefDeclaration,snippet_typedefDeclaration->get_name().str());
14945 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
14947 ROSE_ASSERT(snippet_typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
14951 case V_SgEnumDeclaration:
14953 SgEnumDeclaration* snippet_enumDeclaration = isSgEnumDeclaration(snippet_declaration);
14954 ROSE_ASSERT(snippet_enumDeclaration != NULL);
14958 printf (
"snippet snippet declaration's enum name = %s \n",snippet_enumName.str());
14961 bool isUnNamed = snippet_enumDeclaration->get_isUnNamed();
14962 if (isUnNamed ==
false)
14966 if (target_symbol == NULL)
14970 printf (
"scope = %p = %s \n",scope,scope->
class_name().c_str());
14971 scope->
get_file_info()->display(
"case V_SgEnumDeclaration: target_symbol == NULL: scope: debug");
14973 ROSE_ASSERT(target_symbol != NULL);
14974 returnSymbol = target_symbol;
14976 SgEnumSymbol* enumSymbolInTargetAST = isSgEnumSymbol(returnSymbol);
14977 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
14978 SgEnumDeclaration* target_enumDeclaration = isSgEnumDeclaration(enumSymbolInTargetAST->get_declaration());
14979 ROSE_ASSERT(target_enumDeclaration != NULL);
14981 printf (
"snippet: enumDeclaration = %p = %s \n",snippet_enumDeclaration,snippet_enumDeclaration->
get_name().str());
14982 printf (
"target: enumDeclaration = %p = %s \n",target_enumDeclaration,target_enumDeclaration->
get_name().str());
14984 ROSE_ASSERT(snippet_enumDeclaration->
get_name() == target_enumDeclaration->
get_name());
14989 printf (
"Warning: can't handle unnamed enum declarations \n");
14990 ROSE_ASSERT(returnSymbol == NULL);
14996 case V_SgMemberFunctionDeclaration:
14997 case V_SgFunctionDeclaration:
15000 ROSE_ASSERT(snippet_functionDeclaration != NULL);
15002 printf (
"snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15004 SgName snippet_functionName = snippet_functionDeclaration->get_name();
15006 printf (
"snippet snippet declaration's function name = %s \n",snippet_functionName.str());
15007 printf (
" --- target_AST_scope = %p = %s \n",target_AST_scope,target_AST_scope->
class_name().c_str());
15009 SgFunctionSymbol* target_symbol = target_AST_scope->lookup_function_symbol(snippet_functionName);
15010 ROSE_ASSERT(target_symbol != NULL);
15011 returnSymbol = target_symbol;
15013 SgFunctionSymbol* functionSymbolInTargetAST = isSgFunctionSymbol(returnSymbol);
15014 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
15015 SgFunctionDeclaration* target_functionDeclaration = isSgFunctionDeclaration(functionSymbolInTargetAST->get_declaration());
15016 ROSE_ASSERT(target_functionDeclaration != NULL);
15018 printf (
"snippet: functionDeclaration = %p = %s \n",snippet_functionDeclaration,snippet_functionDeclaration->get_name().str());
15019 printf (
"target: functionDeclaration = %p = %s \n",target_functionDeclaration,target_functionDeclaration->get_name().str());
15021 ROSE_ASSERT(snippet_functionDeclaration->get_name() == target_functionDeclaration->get_name());
15027 printf (
"Error: default reached in switch: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15033 return returnSymbol;
15045#define DEBUG_FIND_ASSOCIATED_DECLARATION 0
15052#if DEBUG_FIND_ASSOCIATED_DECLARATION
15053 printf (
"isDefiningDeclaration = %s \n",isDefiningDeclaration ?
"true" :
"false");
15059 typedef Rose_STL_Container<SgScopeStatement*> SgScopeStatementPtrList;
15060 SgScopeStatementPtrList snippet_scope_list;
15065#if DEBUG_FIND_ASSOCIATED_DECLARATION
15066 printf (
"First scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
15068 if (temp_classDefinition != NULL)
15071 SgName className = temp_classDeclaration->get_name();
15072 printf (
"Input declaration's class name = %s \n",className.str());
15076 if (namespaceDefinitionStatement != NULL)
15080 printf (
"Input declaration's namespace name = %s \n",namespaceName.str());
15084 snippet_scope_list.push_back(snippet_scope);
15085 while (snippet_scope != NULL && isSgGlobal(snippet_scope) == NULL)
15091 snippet_scope = snippet_scope->
get_scope();
15093#if DEBUG_FIND_ASSOCIATED_DECLARATION
15094 printf (
"snippet_scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
15096 snippet_scope_list.push_back(snippet_scope);
15103#if DEBUG_FIND_ASSOCIATED_DECLARATION
15104 printf (
"snippet_scope_list.size() = %" PRIuPTR
" \n",snippet_scope_list.size());
15105 for (SgScopeStatementPtrList::iterator i = snippet_scope_list.begin(); i != snippet_scope_list.end(); i++)
15109 SgGlobal* global_scope_from_declarations_scope = TransformationSupport::getGlobalScope(scope);
15110 printf (
" --- --- global_scope_from_declarations_scope = %p \n",global_scope_from_declarations_scope);
15118 SgGlobal* global_scope_in_target_ast = TransformationSupport::getGlobalScope(targetScope);
15119 SgScopeStatementPtrList::reverse_iterator i = snippet_scope_list.rbegin();
15121#if DEBUG_FIND_ASSOCIATED_DECLARATION
15122 printf (
"global_scope_in_target_ast = %p = %s \n",global_scope_in_target_ast,global_scope_in_target_ast->
class_name().c_str());
15131 ROSE_ASSERT(isSgGlobal(snippet_AST_scope) != NULL);
15135#if DEBUG_FIND_ASSOCIATED_DECLARATION
15136 string otherASTnameFromGlobalScope = global_scope_in_target_ast->
get_file_info()->get_filenameString();
15137 SgSourceFile* otherSourceFile = SageInterface::getEnclosingNode<SgSourceFile>(targetScope,
true);
15138 string otherASTnameFromSourceFile = otherSourceFile->
getFileName();
15139 printf (
"Now traverse the list of scopes in reverse to find the declaration in the other AST: \n");
15140 printf (
"otherASTnameFromGlobalScope = %s \n",otherASTnameFromGlobalScope.c_str());
15141 printf (
"otherASTnameFromSourceFile = %s \n",otherASTnameFromSourceFile.c_str());
15148 while (i != snippet_scope_list.rend())
15154#if DEBUG_FIND_ASSOCIATED_DECLARATION
15155 printf (
"snippet_AST_scope list *i = %p = %s \n",*i,(*i)->class_name().c_str());
15157 printf (
" --- target_AST_scope = %p = %s \n",target_AST_scope,target_AST_scope ->class_name().c_str());
15164#if DEBUG_FIND_ASSOCIATED_DECLARATION
15165 SgSourceFile* otherSourceFile = SageInterface::getEnclosingNode<SgSourceFile>(targetScope,
true);
15166 string otherASTnameFromSourceFile = otherSourceFile->
getFileName();
15167 printf (
" --- otherASTnameFromSourceFile = %s \n",otherASTnameFromSourceFile.c_str());
15172 if (classDefinition != NULL)
15175 SgName className = classDeclaration->get_name();
15176#if DEBUG_FIND_ASSOCIATED_DECLARATION
15177 printf (
" --- Found snippet class name = %s \n",className.str());
15179 SgClassSymbol* classSymbol = target_AST_scope->lookup_class_symbol(className);
15180 ROSE_ASSERT(classSymbol != NULL);
15181 ROSE_ASSERT(classSymbol->get_declaration() != NULL);
15182#if DEBUG_FIND_ASSOCIATED_DECLARATION
15183 printf (
" --- Associated symbol in taget AST: declaration = %p name = %s \n",classSymbol->get_declaration(),classSymbol->get_declaration()->get_name().str());
15186 returnSymbol = classSymbol;
15189 SgClassDeclaration* temp_classDeclaration_in_target_ast = classSymbol->get_declaration();
15190 ROSE_ASSERT(temp_classDeclaration_in_target_ast != NULL);
15192 ROSE_ASSERT(classDeclaration_in_target_ast != NULL);
15193 SgClassDefinition* classDefinition_in_target_ast = classDeclaration_in_target_ast->get_definition();
15194 ROSE_ASSERT(classDefinition_in_target_ast != NULL);
15201 target_AST_scope = classDefinition_in_target_ast;
15209 if (functionDefinition != NULL)
15211 printf (
"ERROR: Found an unusual case of SgFunctionDefinition in list of scopes holding a declaration for a type \n");
15216 if (namespaceDefinition != NULL)
15220#if DEBUG_FIND_ASSOCIATED_DECLARATION
15221 printf (
" --- Found snippet namespace name = %s \n",namespaceName.str());
15223 SgNamespaceSymbol* namespaceSymbol = target_AST_scope->lookup_namespace_symbol(namespaceName);
15224 ROSE_ASSERT(namespaceSymbol != NULL);
15227#if DEBUG_FIND_ASSOCIATED_DECLARATION
15231 returnSymbol = namespaceSymbol;
15238 target_AST_scope = otherASTnamespaceDeclaration->
get_definition();
15247#if DEBUG_FIND_ASSOCIATED_DECLARATION
15248 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());
15251 SgSourceFile* otherSourceFile = SageInterface::getEnclosingNode<SgSourceFile>(target_AST_scope,
true);
15252 string otherASTnameFromSourceFile = otherSourceFile->
getFileName();
15253 printf (
" --- At base of loop: otherASTnameFromSourceFile = %s \n",otherASTnameFromSourceFile.c_str());
15260#if DEBUG_FIND_ASSOCIATED_DECLARATION
15261 printf (
"##### Now based on the kind of declaration, search for that same named declaration in the target_AST_scope = %p = %s \n",
15262 target_AST_scope,target_AST_scope->
class_name().c_str());
15268 switch (snippet_declaration->
variantT())
15270 case V_SgClassDeclaration:
15272 SgClassDeclaration* snippet_classDeclaration = isSgClassDeclaration(snippet_declaration);
15273 ROSE_ASSERT(snippet_classDeclaration != NULL);
15275 SgName snippet_className = snippet_classDeclaration->get_name();
15277#if DEBUG_FIND_ASSOCIATED_DECLARATION
15278 printf (
"snippet snippet declaration's class name = %s \n",snippet_className.str());
15280 SgClassSymbol* target_symbol = target_AST_scope->lookup_class_symbol(snippet_className);
15281 ROSE_ASSERT(target_symbol != NULL);
15282 returnSymbol = target_symbol;
15284 SgClassSymbol* classSymbolInTargetAST = isSgClassSymbol(returnSymbol);
15285 ROSE_ASSERT(classSymbolInTargetAST != NULL);
15286 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
15287 ROSE_ASSERT(target_classDeclaration != NULL);
15289#if DEBUG_FIND_ASSOCIATED_DECLARATION
15290 printf (
"snippet: classDeclaration = %p = %s \n",snippet_classDeclaration,snippet_classDeclaration->get_name().str());
15291 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
15293 ROSE_ASSERT(snippet_classDeclaration->get_name() == target_classDeclaration->get_name());
15297 case V_SgTypedefDeclaration:
15299 SgTypedefDeclaration* snippet_typedefDeclaration = isSgTypedefDeclaration(snippet_declaration);
15300 ROSE_ASSERT(snippet_typedefDeclaration != NULL);
15302 SgName snippet_typedefName = snippet_typedefDeclaration->get_name();
15304#if DEBUG_FIND_ASSOCIATED_DECLARATION
15305 printf (
"snippet snippet declaration's typedef name = %s \n",snippet_typedefName.str());
15307 SgTypedefSymbol* target_symbol = target_AST_scope->lookup_typedef_symbol(snippet_typedefName);
15308 ROSE_ASSERT(target_symbol != NULL);
15309 returnSymbol = target_symbol;
15311 SgTypedefSymbol* typedefSymbolInTargetAST = isSgTypedefSymbol(returnSymbol);
15312 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
15313 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
15314 ROSE_ASSERT(target_typedefDeclaration != NULL);
15316#if DEBUG_FIND_ASSOCIATED_DECLARATION
15317 printf (
"snippet: typedefDeclaration = %p = %s \n",snippet_typedefDeclaration,snippet_typedefDeclaration->get_name().str());
15318 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
15320 ROSE_ASSERT(snippet_typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
15324 case V_SgEnumDeclaration:
15326 SgEnumDeclaration* snippet_enumDeclaration = isSgEnumDeclaration(snippet_declaration);
15327 ROSE_ASSERT(snippet_enumDeclaration != NULL);
15331#if DEBUG_FIND_ASSOCIATED_DECLARATION
15332 printf (
"snippet snippet declaration's enum name = %s \n",snippet_enumName.str());
15335 bool isUnNamed = snippet_enumDeclaration->get_isUnNamed();
15336 if (isUnNamed ==
false)
15340 if (target_symbol == NULL)
15344 printf (
"scope = %p = %s \n",scope,scope->
class_name().c_str());
15345 scope->
get_file_info()->display(
"case V_SgEnumDeclaration: target_symbol == NULL: scope: debug");
15347 ROSE_ASSERT(target_symbol != NULL);
15348 returnSymbol = target_symbol;
15350 SgEnumSymbol* enumSymbolInTargetAST = isSgEnumSymbol(returnSymbol);
15351 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
15352 SgEnumDeclaration* target_enumDeclaration = isSgEnumDeclaration(enumSymbolInTargetAST->get_declaration());
15353 ROSE_ASSERT(target_enumDeclaration != NULL);
15355#if DEBUG_FIND_ASSOCIATED_DECLARATION
15356 printf (
"snippet: enumDeclaration = %p = %s \n",snippet_enumDeclaration,snippet_enumDeclaration->
get_name().str());
15357 printf (
"target: enumDeclaration = %p = %s \n",target_enumDeclaration,target_enumDeclaration->
get_name().str());
15359 ROSE_ASSERT(snippet_enumDeclaration->
get_name() == target_enumDeclaration->
get_name());
15364 printf (
"Warning: can't handle unnamed enum declarations \n");
15365 ROSE_ASSERT(returnSymbol == NULL);
15371 case V_SgTemplateMemberFunctionDeclaration:
15373 case V_SgTemplateFunctionDeclaration:
15375 case V_SgMemberFunctionDeclaration:
15376 case V_SgFunctionDeclaration:
15379 ROSE_ASSERT(snippet_functionDeclaration != NULL);
15381#if DEBUG_FIND_ASSOCIATED_DECLARATION
15382 printf (
"snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15384 SgName snippet_functionName = snippet_functionDeclaration->get_name();
15386#if DEBUG_FIND_ASSOCIATED_DECLARATION
15387 printf (
"snippet snippet declaration's function name = %s \n",snippet_functionName.str());
15388 printf (
" --- target_AST_scope = %p = %s \n",target_AST_scope,target_AST_scope->
class_name().c_str());
15390 SgFunctionSymbol* target_symbol = target_AST_scope->lookup_function_symbol(snippet_functionName);
15391 ROSE_ASSERT(target_symbol != NULL);
15392 returnSymbol = target_symbol;
15394 SgFunctionSymbol* functionSymbolInTargetAST = isSgFunctionSymbol(returnSymbol);
15395 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
15396 SgFunctionDeclaration* target_functionDeclaration = isSgFunctionDeclaration(functionSymbolInTargetAST->get_declaration());
15397 ROSE_ASSERT(target_functionDeclaration != NULL);
15399#if DEBUG_FIND_ASSOCIATED_DECLARATION
15400 printf (
"snippet: functionDeclaration = %p = %s \n",snippet_functionDeclaration,snippet_functionDeclaration->get_name().str());
15401 printf (
"target: functionDeclaration = %p = %s \n",target_functionDeclaration,target_functionDeclaration->get_name().str());
15402 printf (
"isDefiningDeclaration = %s \n",isDefiningDeclaration ?
"true" :
"false");
15404 if (isDefiningDeclaration ==
true)
15406#if DEBUG_FIND_ASSOCIATED_DECLARATION
15407 printf (
"get the defining declaration instead of the firstNondefining declaration from the function symbol \n");
15412 ROSE_ASSERT(snippet_functionDeclaration->get_name() == target_functionDeclaration->get_name());
15418 printf (
"Error: default reached in switch: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15423 ROSE_ASSERT(returnDeclaration != NULL);
15430 return returnDeclaration;
15438 SgType* returnType = NULL;
15440 ROSE_ASSERT(snippet_type != NULL);
15441 ROSE_ASSERT(targetScope != NULL);
15449 SgType* type_copy = snippet_type;
15450 printf (
"(before type_copy->getInternalTypes()): type_copy = %p = %s \n",type_copy,type_copy->
class_name().c_str());
15453 SgNamedType* namedType = isSgNamedType(snippet_type);
15454 if (namedType != NULL)
15458 ROSE_ASSERT(snippet_declaration != NULL);
15460 printf (
"Need to find the declaration in the target AST that is associated with the snippet_declaration in the snippet AST \n");
15461 printf (
" --- snippet_declaration = %p = %s = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str(),
SageInterface::get_name(snippet_declaration).c_str());
15466 case V_SgClassType:
15469 if (classDeclaration != NULL)
15472 if (classSymbolInTargetAST == NULL)
15479 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");
15480 printf (
" --- Looking for target AST match for class name = %s \n",classDeclaration->get_name().str());
15483 ROSE_ASSERT(symbol != NULL);
15485 classSymbolInTargetAST = isSgClassSymbol(symbol);
15488 ROSE_ASSERT(classSymbolInTargetAST != NULL);
15489 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
15490 ROSE_ASSERT(target_classDeclaration != NULL);
15492 printf (
"snippet: classDeclaration = %p = %s \n",classDeclaration,classDeclaration->get_name().str());
15493 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
15495 ROSE_ASSERT(classDeclaration->get_name() == target_classDeclaration->get_name());
15497 returnType = classSymbolInTargetAST->
get_type();
15502 case V_SgTypedefType:
15505 if (typedefDeclaration != NULL)
15512 if (typedefSymbolInTargetAST == NULL)
15515 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");
15516 printf (
" --- The target AST must have a valid typedef type (and associated declaration) to support resetting the SgTypedefType: %p \n",typedefDeclaration->get_type());
15521 ROSE_ASSERT(symbol != NULL);
15523 typedefSymbolInTargetAST = isSgTypedefSymbol(symbol);
15529 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
15530 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
15531 ROSE_ASSERT(target_typedefDeclaration != NULL);
15533 printf (
"snippet: typedefDeclaration = %p = %s \n",typedefDeclaration,typedefDeclaration->get_name().str());
15534 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
15536 ROSE_ASSERT(typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
15538 returnType = typedefSymbolInTargetAST->
get_type();
15546 if (enumDeclaration != NULL)
15548 ROSE_ASSERT(enumDeclaration->
get_name().is_null() ==
false);
15554 if (enumSymbolInTargetAST == NULL)
15556 printf (
"Error: It is an error to not have a enum type defined in the target AST! \n");
15557 printf (
" --- The target AST must have a valid enum type (and associated declaration) to support resetting the SgEnumType: %p \n",enumDeclaration->
get_type());
15560 returnType = snippet_type;
15567 returnType = enumSymbolInTargetAST->
get_type();
15574 case V_SgJavaParameterizedType:
15580 printf (
"In getTargetFileTypeSupport(): case V_SgJavaParameterizedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15584 if (classDeclaration != NULL)
15587 printf (
"Looking for classDeclaration = %s \n",classDeclaration->get_name().str());
15590 ROSE_ASSERT(javaParameterizedType != NULL);
15594 ROSE_ASSERT(templateParameterListNode != NULL);
15595 SgTemplateParameterPtrList* templateParameterList = &templateParameterListNode->get_args();
15603 printf (
"Calling lookupTemplateClassSymbolInParentScopes() name = %s \n",classDeclaration->get_name().str());
15608 printf (
"DONE: Calling lookupTemplateClassSymbolInParentScopes() \n");
15611 printf (
"targetScope->get_symbol_table()->size() = %d \n",targetScope->
get_symbol_table()->
size());
15612 if (templateClassSymbolInTargetAST == NULL)
15618 if (templateClassSymbolInTargetAST == NULL)
15621 printf (
"Calling findAssociatedSymbolInTargetAST \n");
15624 ROSE_ASSERT(symbol != NULL);
15626 templateClassSymbolInTargetAST = isSgClassSymbol(symbol);
15628 ROSE_ASSERT(templateClassSymbolInTargetAST != NULL);
15632 ROSE_ASSERT(templateClassSymbolInTargetAST != NULL);
15634 returnType = templateClassSymbolInTargetAST->
get_type();
15638 if (javaParameterizedType != NULL)
15642 returnType = javaParameterizedType;
15644 SgType* internal_type = javaParameterizedType->get_raw_type();
15645 ROSE_ASSERT(internal_type != NULL);
15649 printf (
"SgJavaParameterizedType not yet tested! \n");
15655 case V_SgJavaQualifiedType:
15666 printf (
"In getTargetFileTypeSupport(): case V_SgJavaQualifiedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15669 if (javaQualifiedType != NULL)
15672 returnType = javaQualifiedType;
15674 SgType* internal_type_1 = javaQualifiedType->get_parent_type();
15675 ROSE_ASSERT(internal_type_1 != NULL);
15676 SgType* internal_type_2 = javaQualifiedType->get_type();
15677 ROSE_ASSERT(internal_type_2 != NULL);
15680 printf (
"Case of SgJavaQualifiedType: not yet handled: commented out assertion! \n");
15685 case V_SgJavaWildcardType:
15694 printf (
"In getTargetFileTypeSupport(): case V_SgJavaWildcardType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15697 if (javaWildcardType != NULL)
15700 returnType = javaWildcardType;
15703 printf (
"SgJavaWildcardType not yet tested! \n");
15709 printf (
"Error: In getTargetFileTypeSupport(): default reached in switch: namedType = %p = %s \n",namedType,namedType->
class_name().c_str());
15714 ROSE_ASSERT(returnType != NULL);
15716 printf (
"Exiting as a test! \n");
15735 SgType* returnType = NULL;
15737 ROSE_ASSERT(snippet_type != NULL);
15738 ROSE_ASSERT(targetScope != NULL);
15742 SgType* type_copy = snippet_type;
15745 printf (
"(before type_copy->getInternalTypes()): type_copy = %p = %s \n",type_copy,type_copy->
class_name().c_str());
15752 for (
size_t i = 0; i < typeList.size(); i++)
15754 printf (
"Input type: typeList[i=%" PRIuPTR
"] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
15762 SgNamedType* namedType = isSgNamedType(snippet_type);
15766 if (namedType != NULL)
15770 ROSE_ASSERT(snippet_declaration != NULL);
15772 printf (
"Need to find the declaration in the target AST that is associated with the snippet_declaration in the snippet AST \n");
15773 printf (
" --- snippet_declaration = %p = %s = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str(),
SageInterface::get_name(snippet_declaration).c_str());
15778 case V_SgClassType:
15781 if (classDeclaration != NULL)
15784 if (classSymbolInTargetAST == NULL)
15791 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");
15792 printf (
" --- Looking for target AST match for class name = %s \n",classDeclaration->get_name().str());
15795 ROSE_ASSERT(symbol != NULL);
15797 classSymbolInTargetAST = isSgClassSymbol(symbol);
15800 ROSE_ASSERT(classSymbolInTargetAST != NULL);
15801 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
15802 ROSE_ASSERT(target_classDeclaration != NULL);
15804 printf (
"snippet: classDeclaration = %p = %s \n",classDeclaration,classDeclaration->get_name().str());
15805 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
15807 ROSE_ASSERT(classDeclaration->get_name() == target_classDeclaration->get_name());
15809 returnType = classSymbolInTargetAST->
get_type();
15814 case V_SgTypedefType:
15817 if (typedefDeclaration != NULL)
15824 if (typedefSymbolInTargetAST == NULL)
15827 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");
15828 printf (
" --- The target AST must have a valid typedef type (and associated declaration) to support resetting the SgTypedefType: %p \n",typedefDeclaration->get_type());
15833 ROSE_ASSERT(symbol != NULL);
15835 typedefSymbolInTargetAST = isSgTypedefSymbol(symbol);
15841 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
15842 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
15843 ROSE_ASSERT(target_typedefDeclaration != NULL);
15845 printf (
"snippet: typedefDeclaration = %p = %s \n",typedefDeclaration,typedefDeclaration->get_name().str());
15846 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
15848 ROSE_ASSERT(typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
15850 returnType = typedefSymbolInTargetAST->
get_type();
15858 if (enumDeclaration != NULL)
15860 ROSE_ASSERT(enumDeclaration->
get_name().is_null() ==
false);
15866 if (enumSymbolInTargetAST == NULL)
15868 printf (
"Error: It is an error to not have a enum type defined in the target AST! \n");
15869 printf (
" --- The target AST must have a valid enum type (and associated declaration) to support resetting the SgEnumType: %p \n",enumDeclaration->
get_type());
15872 returnType = snippet_type;
15879 returnType = enumSymbolInTargetAST->
get_type();
15886 case V_SgJavaParameterizedType:
15892 printf (
"In getTargetFileType(): case V_SgJavaParameterizedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15895 if (classDeclaration != NULL)
15897 SgTemplateParameterPtrList* templateParameterList = NULL;
15898 SgTemplateArgumentPtrList* templateSpecializationArgumentList = NULL;
15902 ROSE_ASSERT(templateClassSymbolInTargetAST != NULL);
15904 returnType = templateClassSymbolInTargetAST->
get_type();
15908 if (javaParameterizedType != NULL)
15911 returnType = javaParameterizedType;
15913 SgType* internal_type = javaParameterizedType->get_raw_type();
15914 ROSE_ASSERT(internal_type != NULL);
15917 printf (
"SgJavaParameterizedType not yet tested! \n");
15921 case V_SgJavaQualifiedType:
15928 printf (
"In getTargetFileType(): case V_SgJavaQualifiedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15931 if (javaQualifiedType != NULL)
15934 returnType = javaQualifiedType;
15936 SgType* internal_type_1 = javaQualifiedType->get_parent_type();
15937 ROSE_ASSERT(internal_type_1 != NULL);
15938 SgType* internal_type_2 = javaQualifiedType->get_type();
15939 ROSE_ASSERT(internal_type_2 != NULL);
15942 printf (
"SgJavaQualifiedType not yet tested! \n");
15946 case V_SgJavaWildcardType:
15955 printf (
"In getTargetFileType(): case V_SgJavaWildcardType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15958 if (javaWildcardType != NULL)
15961 returnType = javaWildcardType;
15963 SgType* internal_type_1 = javaWildcardType->get_bound_type();
15967 printf (
"SgJavaWildcardType not yet tested! \n");
15973 printf (
"Error: In getTargetFileType(): default reached in switch: namedType = %p = %s \n",namedType,namedType->
class_name().c_str());
15978 ROSE_ASSERT(returnType != NULL);
15980 printf (
"Exiting as a test! \n");
15993 SgType* new_type = returnType;
15997 if (new_type != NULL && typeList.size() > 1)
15999 int size = (int)typeList.size();
16000 for (
int i = size - 2; i >= 0; i--)
16003 printf (
"Rebuild type: typeList[i=%d] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
16006 switch(typeList[i]->variantT())
16008 case V_SgModifierType:
16011 ROSE_ASSERT(modifierType != NULL);
16012 if (modifierType->
get_typeModifier().get_constVolatileModifier().isConst() ==
true)
16014 ROSE_ASSERT(new_type != NULL);
16016 printf (
"Building a SgModifierType: calling buildConstType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
16023 printf (
"Modifier kind not handled (not implemented) check what sort of modifier this is: \n");
16030 case V_SgTypedefType:
16033 ROSE_ASSERT(typedefType != NULL);
16039 ROSE_ASSERT(new_typedefType != NULL);
16040 ROSE_ASSERT(isSgTypedefType(new_typedefType) != NULL);
16042 new_type = new_typedefType;
16044 printf (
"ERROSE: SgTypedefType kind not handled (not implemented) \n");
16050 case V_SgPointerType:
16053 ROSE_ASSERT(pointerType != NULL);
16055 printf (
"Building a SgPointerType: calling buildPointerType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
16057 ROSE_ASSERT(new_type != NULL);
16060 printf (
"ERROSE: SgPointerType kind not handled (not implemented) \n");
16068 printf (
"Error: default reached in evaluation of typelist: typeList[i] = %p = %s \n",typeList[i],typeList[i]->class_name().c_str());
16074 returnType = new_type;
16078 if (typeList.size() > 1)
16080 printf (
"Exiting as a test! \n");
16095 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());
16099 SgStatement* statement_copy = isSgStatement(node_copy);
16100 SgStatement* statement_original = isSgStatement(node_original);
16101 if (statement_copy != NULL)
16108 ROSE_ASSERT(statement_original != NULL);
16110 ROSE_ASSERT(scope_copy != NULL);
16111 ROSE_ASSERT(scope_original != NULL);
16118 printf (
"Warning: SgStatement: scope = %p = %s \n",scope_original,scope_original->
class_name().c_str());
16123 ROSE_ASSERT(snippetFile != NULL);
16124 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
16126 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
16129 if (failOnWarning ==
true)
16131 printf (
"Exit on warning! \n");
16136 SgNode* insertionPointScope = (insertionPointIsScope ==
true) ? insertionPoint : insertionPoint->get_parent();
16137 printf (
"insertionPointIsScope = %s insertionPointScope = %p = %s \n",insertionPointIsScope ?
"true" :
"false",insertionPointScope,insertionPointScope->
class_name().c_str());
16156 printf (
"SgClassDeclaration: Exiting as a test! \n");
16160 if (TransformationSupport::getFile(scope) != targetFile)
16162 printf (
"Warning: SgStatement: scope = %p = %s \n",scope,scope->
class_name().c_str());
16163 SgFile* snippetFile = TransformationSupport::getFile(scope);
16164 ROSE_ASSERT(snippetFile != NULL);
16165 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
16167 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
16177 if (declarationStatement_copy != NULL)
16187 if (snippetFile != NULL && snippetFile != targetFile)
16192 printf (
"Note: SgDeclarationStatement: firstNondefiningDeclaration_original is not in target file (allowed for merged ASTs) \n");
16195 if (failOnWarning ==
true)
16197 printf (
"Exit on warning! \n");
16204 if (snippetFile == NULL)
16206 printf (
"Note: firstNondefiningDeclaration_original = %p getEnclosingFileNode() returned NULL \n",firstNondefiningDeclaration_original);
16208 if (failOnWarning ==
true)
16210 printf (
"Exit on warning! \n");
16218 if (definingDeclaration_original != NULL)
16225 if (snippetFile != NULL && snippetFile != targetFile)
16228 printf (
"Warning: SgDeclarationStatement: definingDeclaration is not in target file \n");
16231 if (failOnWarning ==
true)
16233 printf (
"Exit on warning! \n");
16237 if (declarationStatement_original == definingDeclaration_original)
16246 if (snippetFile == NULL)
16248 printf (
"Note: definingDeclaration_original = %p getEnclosingFileNode() returned NULL \n",definingDeclaration_original);
16250 if (failOnWarning ==
true)
16252 printf (
"Exit on warning! \n");
16262 if (expression != NULL)
16272 ROSE_ASSERT(type != NULL);
16277 printf (
"Leaving errorCheckingTargetAST() \n");
16291 T* classDeclaration_copy_defining =
dynamic_cast<T*
>(classDeclaration_copy->get_definingDeclaration());
16292 T* classDeclaration_copy_nondefining =
dynamic_cast<T*
>(classDeclaration_copy->get_firstNondefiningDeclaration());
16293 T* classDeclaration_original_defining =
dynamic_cast<T*
>(classDeclaration_original->get_definingDeclaration());
16294 T* classDeclaration_original_nondefining =
dynamic_cast<T*
>(classDeclaration_original->get_firstNondefiningDeclaration());
16297 if (classDeclaration_copy_defining != NULL && classDeclaration_copy_defining->get_scope() == classDeclaration_original_defining->get_scope())
16300 printf (
"reset the scope of classDeclaration_copy_defining \n");
16302 classDeclaration_copy_defining->set_scope(targetScope);
16306 if (classDeclaration_copy_nondefining != NULL && classDeclaration_copy_nondefining->get_scope() == classDeclaration_original_nondefining->get_scope())
16309 printf (
"reset the scope of classDeclaration_copy_nondefining \n");
16311 classDeclaration_copy_nondefining->set_scope(targetScope);
16315 if (classDeclaration_copy_nondefining != NULL && classDeclaration_copy_nondefining->get_parent() == classDeclaration_original_nondefining->get_parent())
16318 printf (
"reset the parent of classDeclaration_copy_nondefining \n");
16320 classDeclaration_copy_nondefining->set_parent(classDeclaration_copy->get_parent());
16345 printf (
"In fixupCopyOfNodeFromSeperateFileInNewTargetAst: node_copy = %p = %s \n",node_copy,node_copy->
class_name().c_str());
16349 printf (
"Disabled fixupCopyOfNodeFromSeperateFileInNewTargetAst() \n");
16357 printf (
" --- targetFile = %p = %s \n",targetFile,targetFile->get_sourceFileNameWithPath().c_str());
16358 printf (
" --- insertionPointIsScope = %s \n",insertionPointIsScope ?
"true" :
"false");
16365 SgNode* insertionPointScope = (insertionPointIsScope ==
true) ? insertionPoint : insertionPoint->
get_parent();
16367 printf (
"insertionPointScope = %p = %s \n",insertionPointScope,insertionPointScope->class_name().c_str());
16370 ROSE_ASSERT(targetScope != NULL);
16382 SgStatement* statement_copy = isSgStatement(node_copy);
16383 SgStatement* statement_original = isSgStatement(node_original);
16384 if (statement_copy != NULL)
16392 ROSE_ASSERT(scope_copy != NULL);
16393 ROSE_ASSERT(scope_original != NULL);
16399 printf (
"Warning: SgStatement: scope = %p = %s \n",scope_original,scope_original->
class_name().c_str());
16403 ROSE_ASSERT(snippetFile != NULL);
16404 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
16406 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
16411 SgNode* insertionPointScope = (insertionPointIsScope ==
true) ? insertionPoint : insertionPoint->
get_parent();
16412 printf (
"insertionPointIsScope = %s insertionPointScope = %p = %s \n",insertionPointIsScope ?
"true" :
"false",insertionPointScope,insertionPointScope->
class_name().c_str());
16431 printf (
"SgClassDeclaration: Exiting as a test! \n");
16435 if (TransformationSupport::getFile(scope) != targetFile)
16437 printf (
"Warning: SgStatement: scope = %p = %s \n",scope,scope->
class_name().c_str());
16438 SgFile* snippetFile = TransformationSupport::getFile(scope);
16439 ROSE_ASSERT(snippetFile != NULL);
16440 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
16442 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
16454 if (declarationStatement_copy != NULL)
16461 if (snippetFile != NULL && snippetFile != targetFile)
16466 printf (
"Note: SgDeclarationStatement: firstNondefiningDeclaration_original is not in target file (allowed for merged ASTs) \n");
16473 if (snippetFile == NULL)
16475 printf (
"Note: firstNondefiningDeclaration_original = %p getEnclosingFileNode() returned NULL \n",firstNondefiningDeclaration_original);
16482 if (definingDeclaration_original != NULL)
16487 if (snippetFile != NULL && snippetFile != targetFile)
16490 printf (
"Warning: SgDeclarationStatement: definingDeclaration is not in target file \n");
16493 if (declarationStatement_original == definingDeclaration_original)
16502 if (snippetFile == NULL)
16504 printf (
"Note: definingDeclaration_original = %p getEnclosingFileNode() returned NULL \n",definingDeclaration_original);
16516 if (expression != NULL)
16526 ROSE_ASSERT(type != NULL);
16531 if (new_type != NULL)
16541 case V_SgInitializedName:
16544 SgInitializedName* initializedName_original = isSgInitializedName(node_original);
16551 SgStatement* enclosingStatement_copy = TransformationSupport::getStatement(initializedName_copy);
16553 printf (
"enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
16559 ROSE_ASSERT(scope_copy != NULL);
16560 ROSE_ASSERT(scope_original != NULL);
16566 ROSE_ASSERT(initializedName_copy != NULL);
16567 printf (
"initializedName_copy = %p = %s \n",initializedName_copy,initializedName_copy->get_name().str());
16568 ROSE_ASSERT(initializedName_original != NULL);
16569 printf (
"initializedName_original = %p = %s \n",initializedName_original,initializedName_original->get_name().str());
16570 SgType* initializedName_original_type = initializedName_original->get_type();
16571 printf (
"initializedName_original_type = %p = %s \n",initializedName_original_type,initializedName_original_type->
class_name().c_str());
16572 SgClassType* classType = isSgClassType(initializedName_original_type);
16574 if (classType != NULL)
16576 SgClassDeclaration* classDeclaration = isSgClassDeclaration(classType->get_declaration());
16577 ROSE_ASSERT(classDeclaration != NULL);
16578 printf (
"classDeclaration = %p = %s \n",classDeclaration,classDeclaration->get_name().str());
16582 printf (
"Warning: case V_SgInitializedName: scope_copy = %p = %s \n",scope_copy,scope_copy->
class_name().c_str());
16583 printf (
"Warning: case V_SgInitializedName: scope_original = %p = %s \n",scope_original,scope_original->
class_name().c_str());
16585 printf (
"Warning: case V_SgInitializedName: initializedName_copy->get_parent() = %p \n",initializedName_copy->
get_parent());
16586 printf (
"Warning: case V_SgInitializedName: initializedName_original->get_parent() = %p \n",initializedName_original->
get_parent());
16591 ROSE_ASSERT(snippetFile != NULL);
16592 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
16594 printf (
"Warning: case V_SgInitializedName: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
16600 SgType* type_copy = initializedName_copy->get_type();
16602 printf (
"(before type_copy->getInternalTypes()): type_copy = %p = %s \n",type_copy,type_copy->
class_name().c_str());
16612 for (
size_t i = 0; i < typeList.size(); i++)
16614 printf (
"Input type: typeList[i=%" PRIuPTR
"] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
16623 if (new_type != NULL && typeList.size() > 1)
16625 int size = (int)typeList.size();
16626 for (
int i = size - 2; i >= 0; i--)
16629 printf (
"Rebuild type: typeList[i=%d] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
16632 switch(typeList[i]->variantT())
16634 case V_SgModifierType:
16637 ROSE_ASSERT(modifierType != NULL);
16638 if (modifierType->
get_typeModifier().get_constVolatileModifier().isConst() ==
true)
16640 ROSE_ASSERT(new_type != NULL);
16642 printf (
"Building a SgModifierType: calling buildConstType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
16649 printf (
"Modifier kind not handled (not implemented) check what sort of modifier this is: \n");
16658 case V_SgTypedefType:
16661 ROSE_ASSERT(typedefType != NULL);
16665 ROSE_ASSERT(new_typedefType != NULL);
16666 ROSE_ASSERT(isSgTypedefType(new_typedefType) != NULL);
16668 new_type = new_typedefType;
16670 printf (
"ERROSE: SgTypedefType kind not handled (not implemented) \n");
16678 case V_SgPointerType:
16681 ROSE_ASSERT(pointerType != NULL);
16683 printf (
"Building a SgPointerType: calling buildPointerType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
16685 ROSE_ASSERT(new_type != NULL);
16688 printf (
"ERROSE: SgPointerType kind not handled (not implemented) \n");
16698 printf (
"Error: default reached in evaluation of typelist: typeList[i] = %p = %s \n",typeList[i],typeList[i]->class_name().c_str());
16705 if (typeList.size() > 1)
16707 printf (
"Exiting as a test! \n");
16721 printf (
"new_type = %p \n",new_type);
16723 if (new_type != NULL)
16727 printf (
"Reset type for initializedName_copy = %p from type = %p to type = %p \n",initializedName_copy,initializedName_copy->get_type(),new_type);
16729 SgType* original_type = initializedName_copy->get_type();
16730 SgNamedType* original_named_type = isSgNamedType(original_type);
16731 SgNamedType* new_named_type = isSgNamedType(new_type);
16732 if (original_named_type != NULL)
16734 ROSE_ASSERT(new_named_type != NULL);
16735 SgClassDeclaration* original_classDeclaration = isSgClassDeclaration(original_named_type->get_declaration());
16736 SgClassDeclaration* new_classDeclaration = isSgClassDeclaration(new_named_type->get_declaration());
16737 if (original_classDeclaration != NULL)
16739 ROSE_ASSERT(new_classDeclaration != NULL);
16741 printf (
"original_classDeclaration = %p = %s \n",original_classDeclaration,original_classDeclaration->get_name().str());
16742 printf (
"new_classDeclaration = %p = %s \n",new_classDeclaration,new_classDeclaration->get_name().str());
16745 ROSE_ASSERT(new_classDeclaration->get_name() == original_classDeclaration->get_name());
16749 SgType* old_type = initializedName_copy->get_type();
16750 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());
16752 initializedName_copy->set_type(new_type);
16755 printf (
"enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
16758 if (functionParameterList != NULL)
16765 ROSE_ASSERT(functionDeclaration != NULL);
16767 if (functionDefinition != NULL)
16769 ROSE_ASSERT(initializedName_copy->get_scope() == functionDefinition);
16775 ROSE_ASSERT(globalScope != NULL);
16776 if (initializedName_copy->get_scope() != globalScope)
16779 printf (
"Reset scope for initializedName_copy = %p = %s \n",initializedName_copy,initializedName_copy->get_name().str());
16781 initializedName_copy->set_scope(globalScope);
16783 ROSE_ASSERT(initializedName_copy->get_scope() == globalScope);
16789 printf (
"initializedName_copy->get_scope() = %p = %s \n",initializedName_copy->get_scope(),initializedName_copy->get_scope()->
class_name().c_str());
16791 SgEnumDeclaration* enumDeclaration = isSgEnumDeclaration(enclosingStatement_copy);
16792 if (enumDeclaration != NULL)
16802 SgName name = initializedName_copy->get_name();
16803 SgSymbol* symbol = initializedName_copy->get_scope()->lookup_enum_field_symbol(name);
16804 ROSE_ASSERT(symbol != NULL);
16807 ROSE_ASSERT(enumFieldSymbol != NULL);
16812 ROSE_ASSERT(new_enumFieldSymbol != NULL);
16818 initializedName_copy->set_scope(targetScope);
16820 printf (
"Exiting as a test! \n");
16827 printf (
"enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
16830 if (catchOptionStatement != NULL)
16833 ROSE_ASSERT(variableDeclaration != NULL);
16836 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(initializedName_original);
16837 ROSE_ASSERT(enclosingStatement_original != NULL);
16842 if (symbol == NULL)
16844 printf (
"ERROR: (symbol == NULL): initializedName_copy->get_name() = %s \n",initializedName_copy->get_name().str());
16847 ROSE_ASSERT(symbol != NULL);
16849 initializedName_copy->set_scope(targetScope);
16852 ROSE_ASSERT(new_variableSymbol != NULL);
16855 targetScope->
insert_symbol(initializedName_copy->get_name(),new_variableSymbol);
16861 if (javaForEachStatement != NULL)
16864 ROSE_ASSERT(variableDeclaration != NULL);
16866 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(initializedName_original);
16867 ROSE_ASSERT(enclosingStatement_original != NULL);
16871 if (symbol == NULL)
16873 printf (
"ERROR: (symbol == NULL): initializedName_copy->get_name() = %s \n",initializedName_copy->get_name().str());
16876 ROSE_ASSERT(symbol != NULL);
16878 initializedName_copy->set_scope(targetScope);
16881 ROSE_ASSERT(new_variableSymbol != NULL);
16884 targetScope->
insert_symbol(initializedName_copy->get_name(),new_variableSymbol);
16886 printf (
"Need to handle case of SgJavaForEachStatement \n");
16894 if (symbol == NULL)
16896 printf (
"ERROR: enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
16897 ROSE_ASSERT(enclosingStatement_copy->
get_parent() != NULL);
16898 printf (
"ERROR: enclosingStatement_copy->get_parent() = %p = %s \n",enclosingStatement_copy->
get_parent(),enclosingStatement_copy->
get_parent()->
class_name().c_str());
16899 printf (
"ERROR: (symbol == NULL): initializedName_copy->get_name() = %s \n",initializedName_copy->get_name().str());
16900 initializedName_original->
get_file_info()->display(
"ERROR: (symbol == NULL): debug");
16903 SgScopeStatement* initializedName_copy_scope = isSgScopeStatement(initializedName_copy->get_scope());
16904 ROSE_ASSERT(initializedName_copy_scope != NULL);
16905 SgVariableSymbol* variableSymbol = initializedName_copy_scope->lookup_variable_symbol(initializedName_copy->get_name());
16906 ROSE_ASSERT(variableSymbol != NULL);
16908 symbol = variableSymbol;
16910 ROSE_ASSERT(symbol != NULL);
16913 ROSE_ASSERT(variableSymbol != NULL);
16915 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());
16920 ROSE_ASSERT(new_variableSymbol != NULL);
16923 targetScope->
insert_symbol(initializedName_copy->get_name(),new_variableSymbol);
16926 initializedName_copy->set_scope(targetScope);
16929 SgName mangledName = variableSymbol->get_mangled_name();
16930 printf (
"initializedName_copy: mangledName = %s \n",mangledName.str());
16934 if (initializedName_copy->get_scope() != targetScope)
16936 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());
16938 printf (
"I think this should be an error! \n");
16949 case V_SgVariableDeclaration:
16954 ROSE_ASSERT(variableDeclaration != NULL);
16959#define DEBUG_FUNCTION_DECLARATION 0
16961 case V_SgFunctionDeclaration:
16973 SgFunctionType* functionType_copy = functionDeclaration_copy->get_type();
16974 SgFunctionType* functionType_original = functionDeclaration_original->get_type();
16975 ROSE_ASSERT(functionType_copy != NULL);
16976 ROSE_ASSERT(functionType_original != NULL);
16977 ROSE_ASSERT(functionType_copy == functionType_original);
16978#if DEBUG_FUNCTION_DECLARATION
16979 printf (
"case SgFunctionDeclaration: part 1: Calling functionDeclaration_copy->search_for_symbol_from_symbol_table() \n");
16983 ROSE_ASSERT(symbol_original != NULL);
16984 SgFunctionSymbol* functionSymbol_original = isSgFunctionSymbol(symbol_original);
16985 ROSE_ASSERT(functionSymbol_original != NULL);
16988 ROSE_ASSERT(snippetFile != NULL);
16989 if (snippetFile != targetFile)
16991#if DEBUG_FUNCTION_DECLARATION
16992 printf (
"Warning: case V_SgFunctionDeclaration: functionSymbol_original not in target file \n");
16996 ROSE_ASSERT(isSgMemberFunctionSymbol(symbol_original) == NULL);
17002 SgName name = functionDeclaration_copy->get_name();
17003 SgType* functionType = functionDeclaration_copy->get_type();
17004 ROSE_ASSERT(functionType != NULL);
17005#if DEBUG_FUNCTION_DECLARATION
17006 printf (
"case V_SgFunctionDeclaration: name = %s \n",name.str());
17007 printf (
"case V_SgFunctionDeclaration: functionType = %p \n",functionType);
17008 printf (
"case V_SgFunctionDeclaration: functionType_original = %p \n",functionType_original);
17009 printf (
"case V_SgFunctionDeclaration: functionType_copy = %p \n",functionType_copy);
17013 ROSE_ASSERT(targetScope != NULL);
17014 functionDeclaration_copy->
set_scope(targetScope);
17021 if (functionSymbolInTargetAST == NULL)
17023#if DEBUG_FUNCTION_DECLARATION
17024 printf (
"functionSymbolInTargetAST not found in targetScope = %p = %s \n",targetScope,targetScope->
class_name().c_str());
17028 ROSE_ASSERT(otherPossibleScope != NULL);
17029#if DEBUG_FUNCTION_DECLARATION
17030 printf (
"case V_SgFunctionDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope,otherPossibleScope->
class_name().c_str());
17034 functionSymbolInTargetAST = otherPossibleScope->lookup_function_symbol(name,functionType);
17036 if (functionSymbolInTargetAST == NULL)
17038 printf (
"function symbol not found in otherPossibleScope = %p = %s \n",otherPossibleScope,otherPossibleScope->
class_name().c_str());
17041 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
17042#if DEBUG_FUNCTION_DECLARATION
17043 printf (
"(building a new SgFunctionSymbol): functionSymbolInTargetAST->get_declaration() = %p \n",functionSymbolInTargetAST->get_declaration());
17051 ROSE_ASSERT(new_symbol != NULL);
17055 functionSymbolInTargetAST = new_symbol;
17065#if DEBUG_FUNCTION_DECLARATION
17066 printf (
"(using existing symbol found in target scope): functionSymbolInTargetAST->get_declaration() = %p \n",functionSymbolInTargetAST->get_declaration());
17068 functionDeclaration_copy_firstNondefining = isSgFunctionDeclaration(functionSymbolInTargetAST->get_declaration());
17071 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
17074 ROSE_ASSERT(functionDeclaration_copy_firstNondefining != NULL);
17083 ROSE_ASSERT(functionDeclaration_original_firstNondefining != NULL);
17084 printf (
"functionSymbolInTargetAST->get_declaration() = %p \n",functionSymbolInTargetAST->get_declaration());
17086 printf (
"functionDeclaration_original = %p = %s \n",functionDeclaration_original,functionDeclaration_original->
class_name().c_str());
17087 printf (
"functionDeclaration_copy = %p = %s \n",functionDeclaration_copy,functionDeclaration_copy->
class_name().c_str());
17088 printf (
"functionDeclaration_original_firstNondefining = %p \n",functionDeclaration_original_firstNondefining);
17089 printf (
"functionDeclaration_copy_firstNondefining = %p \n",functionDeclaration_copy_firstNondefining);
17090 printf (
"functionDeclaration_original_defining = %p \n",functionDeclaration_original_defining);
17091 printf (
"functionDeclaration_copy_defining = %p \n",functionDeclaration_copy_defining);
17093 printf (
"functionDeclaration_original->get_scope() = %p = %s \n",functionDeclaration_original->
get_scope(),functionDeclaration_original->
get_scope()->
class_name().c_str());
17094 printf (
"functionDeclaration_copy->get_scope() = %p = %s \n",functionDeclaration_copy->
get_scope(),functionDeclaration_copy->
get_scope()->
class_name().c_str());
17095 printf (
"functionDeclaration_original_firstNondefining->get_scope() = %p = %s \n",functionDeclaration_original_firstNondefining->
get_scope(),functionDeclaration_original_firstNondefining->
get_scope()->
class_name().c_str());
17096 printf (
"functionDeclaration_copy_firstNondefining->get_scope() = %p = %s \n",functionDeclaration_copy_firstNondefining->
get_scope(),functionDeclaration_copy_firstNondefining->
get_scope()->
class_name().c_str());
17097 printf (
"functionDeclaration_original_defining->get_scope() = %p = %s \n",functionDeclaration_original_defining->
get_scope(),functionDeclaration_original_defining->
get_scope()->
class_name().c_str());
17098 printf (
"functionDeclaration_copy_defining->get_scope() = %p = %s \n",functionDeclaration_copy_defining->
get_scope(),functionDeclaration_copy_defining->
get_scope()->
class_name().c_str());
17099 printf (
"functionSymbolInTargetAST = %p = %s \n",functionSymbolInTargetAST,functionSymbolInTargetAST->
class_name().c_str());
17102 ROSE_ASSERT(targetScope->lookup_function_symbol(name,functionType) != NULL);
17116 bool isDefiningDeclaration (functionDeclaration_original->get_declaration() != NULL);
17117 if (isDefiningDeclaration ==
true)
17122 ROSE_ASSERT(nondefiningDeclarationFile != NULL);
17123 if (nondefiningDeclarationFile == targetFile)
17140 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
17148 resetDeclaration(functionDeclaration_copy,functionDeclaration_original,targetScope);
17150 printf (
"SageBuilder::fixupCopyOfNodeFromSeperateFileInNewTargetAst(): Need to be able to fixup the SgFunctionDeclaration \n");
17156 case V_SgClassDeclaration:
17160 SgClassDeclaration* classDeclaration_original = isSgClassDeclaration(node_original);
17161 SgClassType* classType = classDeclaration_copy->get_type();
17162 ROSE_ASSERT(classType != NULL);
17164 printf (
"Need to handle named types from class declarations \n");
17175 printf (
"Warning: case V_SgClassDeclaration: assume getEnclosingFileNode(classDeclaration_copy) != targetFile \n");
17187 SgName name = classDeclaration_copy->get_name();
17190 printf (
"case V_SgClassDeclaration: targetScope = %p classSymbol_copy->get_name() = %s \n",targetScope,classSymbol_copy->get_name().str());
17195 if (classSymbolInTargetAST == NULL)
17199 ROSE_ASSERT(otherPossibleScope != NULL);
17201 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p \n",otherPossibleScope);
17205 ROSE_ASSERT(classSymbolInTargetAST != NULL);
17209 ROSE_ASSERT(classDeclaration != NULL);
17211 ROSE_ASSERT(scope != NULL);
17212 classDeclaration_copy->
set_scope(scope);
17215 classDeclaration_copy->
set_scope(targetScope);
17219 ROSE_ASSERT(classSymbol != NULL);
17220 classSymbolInTargetAST = classSymbol;
17230 ROSE_ASSERT(classDeclaration != NULL);
17232 ROSE_ASSERT(scope != NULL);
17233 classDeclaration_copy->
set_scope(scope);
17236 ROSE_ASSERT(classSymbolInTargetAST != NULL);
17243 SgClassType* new_class_type = isSgClassType(new_type);
17244 if (new_class_type != NULL)
17247 classDeclaration_copy->set_type(new_class_type);
17249 printf (
"case V_SgClassDeclaration: built class type: part 1: classDeclaration_copy->get_type() = %p = %s \n",
17250 classDeclaration_copy->get_type(),classDeclaration_copy->get_type()->
class_name().c_str());
17254 resetDeclaration(classDeclaration_copy,classDeclaration_original,targetScope);
17256 printf (
"SgClassDeclaration: Exiting as a test! \n");
17262 case V_SgEnumDeclaration:
17266 SgEnumDeclaration* enumDeclaration_original = isSgEnumDeclaration(node_original);
17276 printf (
"case V_SgEnumDeclaration: targetScope = %p enumSymbol_copy->get_name() = %s \n",targetScope,name.str());
17280 if (enumSymbolInTargetAST == NULL)
17284 ROSE_ASSERT(otherPossibleScope != NULL);
17286 printf (
"case V_SgEnumDeclaration: otherPossibleScope = %p \n",otherPossibleScope);
17290 printf (
"Since the symbol has not been inserted yet, what symbol are we looking for? \n");
17294 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
17296 ROSE_ASSERT(enumDeclaration != NULL);
17298 ROSE_ASSERT(enumDeclaration != enumDeclaration_original);
17305 ROSE_ASSERT(enumSymbol != NULL);
17306 enumSymbolInTargetAST = enumSymbol;
17313 ROSE_ASSERT(scope != NULL);
17314 enumDeclaration_copy->
set_scope(scope);
17316 printf (
"case V_SgEnumDeclaration: insert_symbol(): name = %s enumSymbolInTargetAST = %p \n",name.str(),enumSymbolInTargetAST);
17325 printf (
"Found an existing enum declaration: name = %s enumSymbolInTargetAST = %p \n",name.str(),enumSymbolInTargetAST);
17329 ROSE_ASSERT(enumDeclaration != NULL);
17332 ROSE_ASSERT(scope != NULL);
17333 ROSE_ASSERT(scope == targetScope);
17341 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
17344 printf (
"Exiting as a test 1! \n");
17348 ROSE_ASSERT(enumType != NULL);
17351 printf (
"Return type from getTargetFileType(): original enumType = %p new_type = %p \n",enumType,new_type);
17353 SgEnumType* new_enum_type = isSgEnumType(new_type);
17354 if (new_enum_type != NULL)
17358 printf (
"reset the type using the new enum type from the target AST \n");
17360 enumDeclaration_copy->
set_type(new_enum_type);
17363 printf (
"Exiting as a test 2! \n");
17367 resetDeclaration(enumDeclaration_copy,enumDeclaration_original,targetScope);
17372 case V_SgTemplateClassDeclaration:
17376 SgClassType* templateClassType = templateClassDeclaration->get_type();
17377 ROSE_ASSERT(templateClassType != NULL);
17381 SgClassType* new_templateClass_type = isSgClassType(new_type);
17382 if (new_templateClass_type != NULL)
17385 templateClassDeclaration->set_type(new_templateClass_type);
17387 printf (
"case V_SgTemplateClassDeclaration: built class type: part 1: templateClassDeclaration->get_type() = %p = %s \n",
17388 templateClassDeclaration->get_type(),templateClassDeclaration->get_type()->
class_name().c_str());
17395 case V_SgTypedefDeclaration:
17401 SgType* base_type = typedefDeclaration_copy->get_base_type();
17402 ROSE_ASSERT(base_type != NULL);
17404 if (new_base_type != NULL)
17407 typedefDeclaration_copy->set_base_type(new_base_type);
17412 SgName name = typedefDeclaration_copy->get_name();
17415 printf (
"case V_SgTypedefDeclaration: targetScope = %p typedefSymbol_copy->get_name() = %s \n",targetScope,name.str());
17419 if (typedefSymbolInTargetAST == NULL)
17423 ROSE_ASSERT(otherPossibleScope != NULL);
17425 printf (
"case V_SgTypedefDeclaration: otherPossibleScope = %p \n",otherPossibleScope);
17429 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
17431 ROSE_ASSERT(typedefDeclaration != NULL);
17434 ROSE_ASSERT(scope != NULL);
17435 typedefDeclaration_copy->
set_scope(scope);
17439 ROSE_ASSERT(typedefSymbol != NULL);
17440 typedefSymbolInTargetAST = typedefSymbol;
17442 printf (
"case V_SgTypedefDeclaration: insert_symbol(): name = %s typedefSymbolInTargetAST = %p \n",name.str(),typedefSymbolInTargetAST);
17451 printf (
"Found an existing typedef declaration: name = %s typedefSymbolInTargetAST = %p \n",name.str(),typedefSymbolInTargetAST);
17455 ROSE_ASSERT(typedefDeclaration != NULL);
17457 ROSE_ASSERT(scope != NULL);
17458 typedefDeclaration_copy->
set_scope(scope);
17461 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
17464 printf (
"Exiting as a test 1! \n");
17467 SgTypedefType* typedefType = typedefDeclaration_copy->get_type();
17468 ROSE_ASSERT(typedefType != NULL);
17470 SgTypedefType* new_typedef_type = isSgTypedefType(new_type);
17471 if (new_typedef_type != NULL)
17475 printf (
"reset the type using the new typedef type from the target AST \n");
17477 typedefDeclaration_copy->set_type(new_typedef_type);
17479 printf (
"case V_SgTypedefDeclaration: built class type: part 1: typedefDeclaration_copy->get_type() = %p = %s \n",
17480 typedefDeclaration_copy->get_type(),typedefDeclaration_copy->get_type()->
class_name().c_str());
17484 resetDeclaration(typedefDeclaration_copy,typedefDeclaration_original,targetScope);
17486 printf (
"Exiting as a test 2! \n");
17492 case V_SgVarRefExp:
17503 SgVarRefExp* varRefExp_copy = isSgVarRefExp(node_copy);
17504 SgVarRefExp* varRefExp_original = isSgVarRefExp(node_original);
17505 SgVariableSymbol* variableSymbol_copy = isSgVariableSymbol(varRefExp_copy->get_symbol());
17506 ROSE_ASSERT(variableSymbol_copy != NULL);
17511 printf (
"Warning: case V_SgVarRefExp: variableSymbol not in target file: name = %s \n",variableSymbol_copy->
get_name().str());
17514 printf (
"insertionPoint = %p = %s \n",insertionPoint,insertionPoint->
class_name().c_str());
17527 if (variableSymbolInTargetAST == NULL)
17533 printf (
"Error: The associated variable = %s should have been found in a parent scope of the target AST \n",variableSymbol_copy->
get_name().str());
17538 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(varRefExp_original);
17539 ROSE_ASSERT(enclosingStatement_original != NULL);
17541 printf (
"case V_SgVarRefExp: enclosingStatement_original = %p = %s \n",enclosingStatement_original,enclosingStatement_original->
class_name().c_str());
17544 ROSE_ASSERT(otherPossibleScope_original != NULL);
17547 ROSE_ASSERT(file != NULL);
17549 printf (
"enclosingStatement_original: associated file name = %s \n",file->get_sourceFileNameWithPath().c_str());
17552 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope_original,otherPossibleScope_original->
class_name().c_str());
17553 printf (
"case V_SgClassDeclaration: variableSymbol_copy->get_name() = %s \n",variableSymbol_copy->
get_name().str());
17556 if (variableSymbolInTargetAST == NULL)
17560 otherPossibleScope_original->
get_symbol_table()->
print(
"otherPossibleScope_original: symbol table");
17565 SgBinaryOp* parentBinaryOp = isSgBinaryOp(parentExpression);
17566 SgDotExp* parentDotExp = isSgDotExp(parentExpression);
17567 SgArrowExp* parentArrowExp = isSgArrowExp(parentExpression);
17568 if (parentDotExp != NULL || parentArrowExp != NULL)
17572 ROSE_ASSERT(lhs != NULL);
17576 ROSE_ASSERT(type != NULL);
17578 printf (
"type = %p = %s \n",type,type->
class_name().c_str());
17581 ROSE_ASSERT(namedType != NULL);
17583 ROSE_ASSERT(declaration != NULL);
17585 ROSE_ASSERT(classDeclaration != NULL);
17587 ROSE_ASSERT(definingClassDeclaration != NULL);
17588 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
17589 ROSE_ASSERT(classDefinition != NULL);
17591 printf (
"case V_SgClassDeclaration: classDefinition = %p = %s \n",classDefinition,classDefinition->
class_name().c_str());
17594 otherPossibleScope_original = classDefinition;
17600 ROSE_ASSERT(variableSymbolInTargetAST != NULL);
17601 SgInitializedName* initializedName = variableSymbolInTargetAST->get_declaration();
17602 ROSE_ASSERT(initializedName != NULL);
17604 ROSE_ASSERT(scope != NULL);
17607 initializedName->set_scope(scope);
17612 ROSE_ASSERT(variableSymbolInTargetAST != NULL);
17615 varRefExp_copy->set_symbol(variableSymbolInTargetAST);
17624 case V_SgFunctionRefExp:
17629 SgFunctionSymbol* functionSymbol_copy = isSgFunctionSymbol(functionRefExp_copy->get_symbol());
17630 ROSE_ASSERT(functionSymbol_copy != NULL);
17635 printf (
"Warning: case V_SgFunctionRefExp: functionSymbol_copy not in target file (find function = %s) \n",functionSymbol_copy->
get_name().str());
17639 printf (
"insertionPointIsScope = %s insertionPointScope = %p = %s \n",insertionPointIsScope ?
"true" :
"false",insertionPointScope,insertionPointScope->class_name().c_str());
17651 if (functionSymbolInTargetAST == NULL)
17662 fprintf (stderr,
"Error: The associated function = \"%s\" should have been found in a parent scope"
17663 " of the target AST\n", name.str());
17665 fprintf (stderr,
" targetScope = %p = %s \n",targetScope,targetScope->
class_name().c_str());
17666 SgGlobal* globalScope = TransformationSupport::getGlobalScope(targetScope);
17667 ROSE_ASSERT(globalScope != NULL);
17668 fprintf (stderr,
" globalScope = %p = %s \n",globalScope,globalScope->
class_name().c_str());
17670 targetScope->
get_file_info()->display(
"case V_SgFunctionRefExp: targetScope: debug");
17671 node_original->
get_file_info()->display(
"case V_SgFunctionRefExp: node_original: debug");
17677 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(functionRefExp_original);
17678 ROSE_ASSERT(enclosingStatement_original != NULL);
17680 printf (
"case V_SgFunctionRefExp: enclosingStatement_original = %p = %s \n",enclosingStatement_original,enclosingStatement_original->
class_name().c_str());
17683 ROSE_ASSERT(otherPossibleScope_original != NULL);
17686 ROSE_ASSERT(file != NULL);
17688 printf (
"enclosingStatement_original: associated file name = %s \n",file->get_sourceFileNameWithPath().c_str());
17691 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope_original,otherPossibleScope_original->
class_name().c_str());
17692 printf (
"case V_SgClassDeclaration: functionSymbol_copy->get_name() = %s \n",functionSymbol_copy->
get_name().str());
17696 if (functionSymbolInTargetAST == NULL)
17700 SgBinaryOp* parentBinaryOp = isSgBinaryOp(parentExpression);
17701 SgDotExp* parentDotExp = isSgDotExp(parentExpression);
17702 SgArrowExp* parentArrowExp = isSgArrowExp(parentExpression);
17703 if (parentDotExp != NULL || parentArrowExp != NULL)
17707 ROSE_ASSERT(lhs != NULL);
17708 ROSE_ASSERT(parentBinaryOp->
get_rhs_operand() == functionRefExp_copy);
17711 ROSE_ASSERT(type != NULL);
17713 printf (
"type = %p = %s \n",type,type->
class_name().c_str());
17716 ROSE_ASSERT(namedType != NULL);
17718 ROSE_ASSERT(declaration != NULL);
17720 ROSE_ASSERT(classDeclaration != NULL);
17722 ROSE_ASSERT(definingClassDeclaration != NULL);
17723 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
17724 ROSE_ASSERT(classDefinition != NULL);
17726 printf (
"case V_SgClassDeclaration: classDefinition = %p = %s \n",classDefinition,classDefinition->
class_name().c_str());
17729 otherPossibleScope_original = classDefinition;
17736 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
17738 ROSE_ASSERT(functionDeclaration != NULL);
17740 ROSE_ASSERT(scope != NULL);
17745 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
17750 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
17753 functionRefExp_copy->set_symbol(functionSymbolInTargetAST);
17755 printf (
"Exiting as a test! \n");
17763#define DEBUG_MEMBER_FUNCTION_REF_EXP 0
17765 case V_SgMemberFunctionRefExp:
17770 SgMemberFunctionSymbol* memberFunctionSymbol_copy = isSgMemberFunctionSymbol(memberFunctionRefExp_copy->get_symbol());
17771 ROSE_ASSERT(memberFunctionSymbol_copy != NULL);
17776#if DEBUG_MEMBER_FUNCTION_REF_EXP
17777 printf (
"Warning: case V_SgMemberFunctionRefExp: memberFunctionSymbol_copy not in target file (find member function = %s) \n",memberFunctionSymbol_copy->
get_name().str());
17781 if (memberFunctionSymbolInTargetAST == NULL)
17786#if DEBUG_MEMBER_FUNCTION_REF_EXP
17787 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());
17792 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(memberFunctionRefExp_original);
17793 ROSE_ASSERT(enclosingStatement_original != NULL);
17794#if DEBUG_MEMBER_FUNCTION_REF_EXP
17795 printf (
"case V_SgMemberFunctionRefExp: enclosingStatement_original = %p = %s \n",enclosingStatement_original,enclosingStatement_original->
class_name().c_str());
17798 ROSE_ASSERT(otherPossibleScope_original != NULL);
17801 ROSE_ASSERT(file != NULL);
17802#if DEBUG_MEMBER_FUNCTION_REF_EXP
17803 printf (
"enclosingStatement_original: associated file name = %s \n",file->get_sourceFileNameWithPath().c_str());
17806 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope_original,otherPossibleScope_original->
class_name().c_str());
17807 printf (
"case V_SgClassDeclaration: memberFunctionSymbol_copy->get_name() = %s \n",memberFunctionSymbol_copy->
get_name().str());
17810 if (memberFunctionSymbolInTargetAST == NULL)
17812#if DEBUG_MEMBER_FUNCTION_REF_EXP
17813 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");
17818 ROSE_ASSERT(parentExpression != NULL);
17819#if DEBUG_MEMBER_FUNCTION_REF_EXP
17820 printf (
"parentExpression = %p = %s \n",parentExpression,parentExpression->
class_name().c_str());
17822 bool handle_as_java =
false;
17824 if (functionCallExp != NULL)
17828 handle_as_java =
true;
17832 ROSE_ASSERT(parentOfFunctionCallExpression != NULL);
17833#if DEBUG_MEMBER_FUNCTION_REF_EXP
17834 printf (
"parentOfFunctionCallExpression = %p = %s \n",parentOfFunctionCallExpression,parentOfFunctionCallExpression->
class_name().c_str());
17836 parentExpression = parentOfFunctionCallExpression;
17839 SgBinaryOp* parentBinaryOp = isSgBinaryOp(parentExpression);
17840 SgDotExp* parentDotExp = isSgDotExp(parentExpression);
17841 SgArrowExp* parentArrowExp = isSgArrowExp(parentExpression);
17842#if DEBUG_MEMBER_FUNCTION_REF_EXP
17843 printf (
"parentBinaryOp = %p \n",parentBinaryOp);
17844 printf (
"parentDotExp = %p \n",parentDotExp);
17845 printf (
"parentArrowExp = %p \n",parentArrowExp);
17847 if (parentDotExp != NULL || parentArrowExp != NULL)
17851 ROSE_ASSERT(lhs != NULL);
17854 if (handle_as_java ==
true)
17862 ROSE_ASSERT(parentBinaryOp->
get_rhs_operand() == memberFunctionRefExp_copy);
17864#if DEBUG_MEMBER_FUNCTION_REF_EXP
17865 printf (
"lhs = %p = %s \n",lhs,lhs->
class_name().c_str());
17871 if (varRefExp != NULL)
17873 SgVariableSymbol* variableSymbol = isSgVariableSymbol(varRefExp->get_symbol());
17874 ROSE_ASSERT(variableSymbol != NULL);
17876 ROSE_ASSERT(initializedName != NULL);
17878 SgType* initializedName_type = initializedName->get_type();
17879#if DEBUG_MEMBER_FUNCTION_REF_EXP
17880 printf (
"initializedName = %p = %s \n",initializedName,initializedName->get_name().str());
17881 printf (
"initializedName_type = %p \n",initializedName_type);
17883 SgClassType* classType = isSgClassType(initializedName_type);
17884 if (classType != NULL)
17886 SgClassDeclaration* classDeclaration = isSgClassDeclaration(classType->get_declaration());
17887 ROSE_ASSERT(classDeclaration != NULL);
17889 ROSE_ASSERT(definingClassDeclaration != NULL);
17890 printf (
"definingClassDeclaration->get_name() = %s \n",definingClassDeclaration->get_name().str());
17892 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
17893 ROSE_ASSERT(classDefinition != NULL);
17894 SgType* memberFunctionType = memberFunctionSymbol_copy->
get_type();
17895 SgName memberFunctionName = memberFunctionSymbol_copy->
get_name();
17896 ROSE_ASSERT(memberFunctionType != NULL);
17897 SgFunctionSymbol *functionSymbol = classDefinition->lookup_function_symbol(memberFunctionName,memberFunctionType);
17898 if (functionSymbol == NULL)
17900 printf (
"Symbol not found: output symbol table (size = %d): \n",classDefinition->
get_symbol_table()->
size());
17901#if DEBUG_MEMBER_FUNCTION_REF_EXP
17902 classDefinition->
get_symbol_table()->
print(
"Symbol not found: output symbol table: SgClassDefinition");
17907 printf (
"\n*************************************************************** \n");
17908 printf (
"ERROR: target has not be properly setup to receive the snippet. \n");
17909 printf (
"*************************************************************** \n");
17911 ROSE_ASSERT(functionSymbol != NULL);
17913 ROSE_ASSERT(memberFunctionSymbol != NULL);
17915 memberFunctionSymbolInTargetAST = memberFunctionSymbol;
17917 printf (
"Exiting as a test! \n");
17927 if (valueExp != NULL)
17929 memberFunctionSymbolInTargetAST = memberFunctionSymbol_copy;
17930 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
17933 if (memberFunctionSymbolInTargetAST == NULL)
17937 ROSE_ASSERT(type != NULL);
17938#if DEBUG_MEMBER_FUNCTION_REF_EXP
17939 printf (
"type = %p = %s \n",type,type->
class_name().c_str());
17942 ROSE_ASSERT(namedType != NULL);
17944 ROSE_ASSERT(declaration != NULL);
17946 ROSE_ASSERT(classDeclaration != NULL);
17948 ROSE_ASSERT(definingClassDeclaration != NULL);
17949 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
17950 ROSE_ASSERT(classDefinition != NULL);
17951#if DEBUG_MEMBER_FUNCTION_REF_EXP
17952 printf (
"case V_SgClassDeclaration: classDefinition = %p = %s \n",classDefinition,classDefinition->
class_name().c_str());
17955 otherPossibleScope_original = classDefinition;
17956#if DEBUG_MEMBER_FUNCTION_REF_EXP
17959#if DEBUG_MEMBER_FUNCTION_REF_EXP
17962 printf (
"associated_classDeclaration = %p name = %s \n",associated_classDeclaration,associated_classDeclaration->get_name().str());
17963 printf (
"functionSymbol = %p \n",functionSymbol);
17966 if (memberFunctionSymbolInTargetAST == NULL)
17969 printf (
"Error: (memberFunctionSymbolInTargetAST == NULL): memberFunctionSymbol_copy->get_name() = %s \n",memberFunctionSymbol_copy->
get_name().str());
17972 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
17974 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
17978 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
17980 ROSE_ASSERT(functionDeclaration != NULL);
17982 ROSE_ASSERT(scope != NULL);
17987 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
17990 memberFunctionRefExp_copy->set_symbol(memberFunctionSymbolInTargetAST);
18000 printf (
"Exiting as a test! (SgTryStmt) \n");
18007 case V_SgCatchStatementSeq:
18012 printf (
"Exiting as a test! (SgCatchStatementSeq) \n");
18019 case V_SgCatchOptionStmt:
18024 ROSE_ASSERT(catchOptionStatement_copy);
18026 printf (
"Need to check the symbol table of the SgCatchOptionStmt (which is a SgScopeStatement) \n");
18029 printf (
"Exiting as a test! (SgCatchOptionStmt) \n");
18036 case V_SgJavaPackageStatement:
18039 printf (
"Exiting as a test! (SgJavaPackageStatement) \n");
18049 printf (
"enum values contain a reference to the associated SgEnumDeclaration \n");
18051 SgEnumVal* enumVal_copy = isSgEnumVal(node_copy);
18052 SgEnumVal* enumVal_original = isSgEnumVal(node_original);
18054 printf (
" --- enumVal_original = %p = %d name = %s \n",enumVal_original,enumVal_original->get_value(),enumVal_original->get_name().str());
18056 SgEnumDeclaration* associatedEnumDeclaration_copy = isSgEnumDeclaration(enumVal_copy->get_declaration());
18057 SgEnumDeclaration* associatedEnumDeclaration_original = isSgEnumDeclaration(enumVal_original->get_declaration());
18060 bool isUnNamed = associatedEnumDeclaration_original->get_isUnNamed();
18061 if (isUnNamed ==
false)
18063 if (associatedEnumDeclaration_copy == associatedEnumDeclaration_original)
18066 printf (
" --- The stored reference to the enum declaration in the SgEnumVal must be reset \n");
18070 if (symbol == NULL)
18073 enumVal_original->
get_file_info()->display(
"case V_SgEnumVal: symbol == NULL: debug");
18075 ROSE_ASSERT(symbol != NULL);
18077 ROSE_ASSERT(enumSymbol != NULL);
18078 SgEnumDeclaration* new_associatedEnumDeclaration_copy = enumSymbol->get_declaration();
18079 ROSE_ASSERT(new_associatedEnumDeclaration_copy != NULL);
18082 ROSE_ASSERT(new_associatedEnumDeclaration_copy != associatedEnumDeclaration_original);
18084 ROSE_ASSERT(new_associatedEnumDeclaration_copy != associatedEnumDeclaration_original->
get_definingDeclaration());
18086 enumVal_copy->set_declaration(new_associatedEnumDeclaration_copy);
18088 printf (
"Exiting as a test! \n");
18097 printf (
"Warning: can't handle enum values from unnamed enum declarations \n");
18098 printf (
" --- enumVal_original = %p = %lld name = %s \n",enumVal_original,enumVal_original->get_value(),enumVal_original->get_name().str());
18132 ROSE_ASSERT(insertionPoint != NULL);
18133 ROSE_ASSERT(toInsert != NULL);
18134 ROSE_ASSERT(original_before_copy != NULL);
18138 SgSymbolTable::set_force_search_of_base_classes(
true);
18145 ROSE_ASSERT(targetFile != NULL);
18154 ROSE_ASSERT(snippetFile_of_copy == targetFile);
18159 ROSE_ASSERT(snippetFile_of_original != targetFile);
18162 printf (
" --- targetFile = %p = %s \n",targetFile,targetFile->get_sourceFileNameWithPath().c_str());
18163 printf (
" --- snippetFile_of_copy = %p = %s \n",snippetFile_of_copy,snippetFile_of_copy->get_sourceFileNameWithPath().c_str());
18164 printf (
" --- snippetFile_of_original = %p = %s \n",snippetFile_of_original,snippetFile_of_original->get_sourceFileNameWithPath().c_str());
18176 if (isStructurallyEquivalent ==
false)
18178 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");
18181 ROSE_ASSERT(isStructurallyEquivalent ==
true);
18191 RoseAst ast_of_copy(toInsert);
18192 RoseAst ast_of_original(original_before_copy);
18201 while (i_copy != ast_of_copy.
end())
18205 if ((*i_copy)->variantT() != (*i_original)->variantT())
18207 printf (
"ERROR: return from fixupCopyOfAstFromSeparateFileInNewTargetAst(): "
18208 "(*i_copy)->variantT() != (*i_original)->variantT() \n");
18210 printf (
"Making this an error! \n");
18223 ROSE_ASSERT(i_original != ast_of_original.
end());
18228 ROSE_ASSERT(i_copy == ast_of_copy.
end() && i_original == ast_of_original.
end());
18234 if (functionDeclaration != NULL)
18236 printf (
"functionDeclaration = %s \n",functionDeclaration->get_name().str());
18238 printf (
"Exiting as a test! \n");
18245 SgSymbolTable::set_force_search_of_base_classes(
false);
18255 ROSE_ASSERT (scope != NULL);
18265 ROSE_ASSERT(result != NULL);
18269 cerr<<
"Error. buildStatementFromString() cannot parse the input string:"<<s
18270 <<
"\n\t within the given scope:"<<scope->
class_name() <<endl;
18294 template <
class SgAstNode>
18297 static const bool explicitlySpecified =
true;
18315 res = createTemplateArg_(*isSgType(&n));
18316 else if (isSgExpression(&n))
18317 res = createTemplateArg_(*isSgExpression(&n));
18320 ROSE_ASSERT(isSgTemplateDeclaration(&n));
18321 res = createTemplateArg_(*isSgTemplateDeclaration(&n));
18328 SgName genTemplateName(
SgName base, Rose_STL_Container<SgNode*>& targs)
18330 Rose_STL_Container<SgNode*>::iterator aa = targs.begin();
18331 Rose_STL_Container<SgNode*>::iterator zz = targs.begin();
18332 std::string name(base.getString());
18335 for ( ; aa != zz; ++aa) name.append((*aa)->unparseToString());
18341 SgTemplateArgumentPtrList genTemplateArgumentList(Rose_STL_Container<SgNode*>& targs)
18343 Rose_STL_Container<SgNode*>::iterator aa = targs.begin();
18344 Rose_STL_Container<SgNode*>::iterator zz = targs.begin();
18345 SgTemplateArgumentPtrList lst;
18347 for ( ; aa != zz; ++aa)
18349 lst.push_back(createTemplateArg(**aa));
18357 ROSE_ASSERT(main_decl);
18363 ROSE_ASSERT(tdecl);
18369 ROSE_ASSERT(tclassdecl);
18390 ROSE_ASSERT(tdecl);
18395 struct TemplateArgumentParentSetter
18413Rose_STL_Container<SgNode *>& template_args)
18420Rose_STL_Container<SgNode *>& template_args)
18422 ROSE_ASSERT(template_decl);
18425 SgName name = template_decl->get_name();
18427 SgTemplateArgumentPtrList targs = genTemplateArgumentList(template_args);
18430 ROSE_ASSERT(tinst);
18434 ROSE_ASSERT(tclass);
18437 tinst->set_type(tclass);
18441 std::for_each(targs.begin(), targs.end(), TemplateArgumentParentSetter(tinst));
18447#ifdef ROSE_BUILD_JAVA_LANGUAGE_SUPPORT
18454 ROSE_ASSERT(Rose::Frontend::Java::lengthSymbol);
18466 if (parent_scope != NULL) {
18467 scope -> set_parent(parent_scope);
18497 pair -> set_value(value);
18498 value -> set_parent(pair);
18525 for (std::list<SgJavaMemberValuePair *>::iterator i = pair_list.begin(); i != pair_list.end(); i++) {
18527 member_value_pair -> set_parent(annotation);
18528 annotation -> append_value_pair(member_value_pair);
18551 return initialized_name;
18560 package_statement -> set_firstNondefiningDeclaration(package_statement);
18561 package_statement -> set_definingDeclaration(package_statement);
18562 return package_statement;
18571 import_statement -> set_firstNondefiningDeclaration(import_statement);
18572 import_statement -> set_definingDeclaration(import_statement);
18573 return import_statement;
18580 ROSE_ASSERT(scope);
18581 SgName class_name = name;
18582 ROSE_ASSERT(scope -> lookup_class_symbol(class_name) == NULL);
18585 bool buildTemplateInstantiation =
false;
18586 SgTemplateArgumentPtrList* templateArgumentsList = NULL;
18588 ROSE_ASSERT(class_declaration);
18589 class_declaration -> set_parent(scope);
18590 class_declaration -> set_scope(scope);
18593 ROSE_ASSERT(class_definition);
18597 class_definition -> setAttribute(
"extension_type_names",
new AstRegExAttribute());
18600 type_space -> set_parent(class_definition);
18602 class_declaration -> setAttribute(
"type_space",
new AstSgNodeAttribute(type_space));
18604 return class_declaration;
18613 string filename = directory_name +
"/" + type_name +
".java";
18614 ROSE_ASSERT((*project)[filename] == NULL);
18616 string command = string(
"touch ") + filename;
18617 int status = system(command.c_str());
18618 ROSE_ASSERT(status == 0);
18619 project -> get_sourceFileNameList().push_back(filename);
18620 Rose_STL_Container<std::string> arg_list = project -> get_originalCommandLineArgumentList();
18621 arg_list.push_back(filename);
18625 int error_code = 0;
18626 SgFile *file = determineFileType(arg_list, error_code, project);
18628 ROSE_ASSERT(sourcefile);
18629 sourcefile -> set_parent(project);
18630 project -> get_fileList_ptr() -> get_listOfFiles().push_back(sourcefile);
18631 ROSE_ASSERT(sourcefile == isSgSourceFile((*project)[filename]));
18637 ROSE_ASSERT(pkgDefDecl != NULL);
18639 package_statement->
set_parent(package_definition);
18640 sourcefile->set_package(package_statement);
18646 import_statement_list -> set_parent(sourcefile);
18647 sourcefile -> set_import_list(import_statement_list);
18653 class_declaration_list -> set_parent(package_definition);
18654 sourcefile -> set_class_list(class_declaration_list);
18664 ROSE_ASSERT(num_dimensions > 0);
18665 if (num_dimensions > 1) {
18669 ROSE_ASSERT(base_type != NULL);
18671 if (attribute == NULL) {
18673 array_type -> set_rank(num_dimensions);
18675 base_type -> setAttribute(
"array", attribute);
18678 return isSgArrayType(attribute -> getNode());
18689 generic_type -> setAttribute(
"parameterized types", attribute);
18691 ROSE_ASSERT(attribute);
18693 return attribute -> findOrInsertParameterizedType(new_args);
18704 type -> setAttribute(
"qualified types", attribute);
18706 ROSE_ASSERT(attribute);
18708 for (
int i = 0; i < attribute -> size(); i++) {
18710 ROSE_ASSERT(qualified_type);
18711 if (qualified_type -> get_parent_type() == parent_type && qualified_type -> get_type() == type) {
18712 return qualified_type;
18717 qualified_type -> set_parent_type(parent_type);
18718 qualified_type -> set_type(type);
18720 attribute -> addNode(qualified_type);
18722 return qualified_type;
18733 SgClassDeclaration *class_declaration = isSgClassDeclaration(Rose::Frontend::Java::ObjectClassType -> get_declaration());
18736 Rose::Frontend::Java::ObjectClassType -> setAttribute(
"unbound", attribute);
18739 return isSgJavaWildcardType(attribute -> getNode());
18752 ROSE_ASSERT(array_type || named_type);
18753 SgClassDeclaration *class_declaration = isSgClassDeclaration((array_type ? (
SgNamedType *) Rose::Frontend::Java::ObjectClassType : named_type) -> get_declaration());
18756 wildcard -> set_has_extends(
true);
18759 type -> setAttribute(
"extends", attribute);
18762 return isSgJavaWildcardType(attribute -> getNode());
18775 ROSE_ASSERT(array_type || named_type);
18776 SgClassDeclaration *class_declaration = isSgClassDeclaration((array_type ? (
SgNamedType *) Rose::Frontend::Java::ObjectClassType : named_type) -> get_declaration());
18779 wildcard -> set_has_super(
true);
18782 type -> setAttribute(
"super", attribute);
18785 return isSgJavaWildcardType(attribute -> getNode());
18795 namespace Builder {
18796 namespace Templates {
18799 if (t ==
nullptr)
return nullptr;
18805 if (e ==
nullptr)
return nullptr;
18825std::string strTemplateArgument(
int v) {
18826 std::ostringstream oss;
18831std::string strTemplateArgument(
bool v) {
18832 std::ostringstream oss;
18833 if (v) oss <<
"true";
18834 else oss <<
"false";
18838std::string strTemplateArgument(
SgNamedType * nt) {
18839 std::ostringstream oss;
18844std::string strTemplateArgument(
SgType * t) {
18845 std::ostringstream oss;
18851 std::ostringstream oss;
18856#define DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps 0
18860 std::vector<std::vector<SgTemplateParameter *>> & tpl_params,
18861 std::vector<std::vector<SgTemplateArgument *>> & tpl_args
18863#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
18864 std::cout <<
"Rose::Builder::Templates::instantiateNonrealRefExps" << std::endl;
18865 std::cout <<
" expr = " << std::hex << expr <<
" : " << ( expr ? expr->
class_name() :
"" ) << std::endl;
18866 std::cout <<
" = " << ( expr ? expr->
unparseToString() :
"" ) << std::endl;
18870 }
else if (isSgNonrealRefExp(expr)) {
18871#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
18872 std::cerr <<
"Error: In instantiateNonrealRefExps: case of a SgNonrealRefExp!!!" << std::endl;
18875 }
else if (isSgVarRefExp(expr)) {
18878 ROSE_ASSERT(iname);
18879#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
18880 std::cout <<
" iname = " << std::hex << iname <<
" : " << ( iname ? iname->
class_name() :
"" ) << std::endl;
18881 std::cout <<
" iname->get_name() = " << iname->get_name() << std::endl;
18882 std::cout <<
" iname->get_initializer() = " << std::hex << iname->get_initializer() <<
" : " << ( iname->get_initializer() ? iname->get_initializer()->
class_name() :
"" ) << std::endl;
18886 unsigned depth = 0;
18888 for (
auto tpl_params_: tpl_params) {
18890 for (
auto tpl_param: tpl_params_) {
18891 if (tpl_param->get_initializedName()) {
18892#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
18893 std::cout <<
" tpl_param->get_initializedName() = " << std::hex << tpl_param->get_initializedName() << std::endl;
18894 std::cout <<
" tpl_param->get_initializedName()->get_name() = " << tpl_param->get_initializedName()->get_name() << std::endl;
18896 if (tpl_param->get_initializedName()->get_name() == iname->get_name()) {
18897 iname = tpl_param->get_initializedName();
18906 if (depth < tpl_args.size() && pos < tpl_args[depth].size()) {
18907 SgExpression * res = tpl_args[depth][pos]->get_expression();
18910 }
else if (depth < tpl_params.size() && pos < tpl_params[depth].size()) {
18911 SgExpression * dft = tpl_params[depth][pos]->get_defaultExpressionParameter();
18913 dft = instantiateNonrealRefExps(dft, tpl_params, tpl_args);
18917#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
18918 std::cerr <<
"Error: In instantiateNonrealRefExps: this should not be reached!!!" << std::endl;
18921 }
else if (isSgValueExp(expr)) {
18923 }
else if (isSgConditionalExp(expr)) {
18929 }
else if (isSgSizeOfOp(expr)) {
18931#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
18932 std::cout <<
" szo->get_operand_expr() = " << std::hex << szo->get_operand_expr() <<
" : " << ( szo->get_operand_expr() ? szo->get_operand_expr()->
class_name() :
"" ) << std::endl;
18933 std::cout <<
" szo->get_operand_type() = " << std::hex << szo->get_operand_type() <<
" : " << ( szo->get_operand_type() ? szo->get_operand_type()->
class_name() :
"" ) << std::endl;
18935 SgExpression * eres = instantiateNonrealRefExps(szo->get_operand_expr(), tpl_params, tpl_args);
18936 ROSE_ASSERT(szo->get_operand_expr() ==
nullptr || eres !=
nullptr);
18937 szo->set_operand_expr(eres);
18939 SgType * tres = instantiateNonrealTypes(szo->get_operand_type(), tpl_params, tpl_args);
18940 ROSE_ASSERT(szo->get_operand_type() ==
nullptr || tres !=
nullptr);
18941 szo->set_operand_type(tres);
18943#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
18944 std::cout <<
" szo->get_operand_expr() = " << std::hex << szo->get_operand_expr() <<
" : " << ( szo->get_operand_expr() ? szo->get_operand_expr()->
class_name() :
"" ) << std::endl;
18945 std::cout <<
" szo->get_operand_type() = " << std::hex << szo->get_operand_type() <<
" : " << ( szo->get_operand_type() ? szo->get_operand_type()->
class_name() :
"" ) << std::endl;
18948 }
else if (isSgCastExp(expr)) {
18950 auto operand = instantiateNonrealRefExps(cast->
get_operand_i(), tpl_params, tpl_args);
18951 if (operand ==
nullptr)
return nullptr;
18952 auto type = instantiateNonrealTypes(cast->
get_type(), tpl_params, tpl_args);
18953 if (type ==
nullptr)
return operand;
18955 cast->set_type(type);
18957 }
else if (isSgUnaryOp(expr)) {
18961 }
else if (isSgBinaryOp(expr)) {
18967 std::cerr <<
"!!! expr = " << std::hex << expr <<
" : " << ( expr ? expr->
class_name() :
"" ) << std::endl;
18974 std::vector<SgTemplateParameter *> & tpl_params,
18975 std::vector<SgTemplateArgument *> & tpl_args
18977 std::vector<std::vector<SgTemplateParameter *>> tpl_params_{tpl_params};
18978 std::vector<std::vector<SgTemplateArgument *>> tpl_args_{tpl_args};
18979 return instantiateNonrealRefExps(expr, tpl_params_, tpl_args_);
18982#define DEBUG_Rose_Builder_Templates_instantiateNonrealTypes 0
18984SgType * instantiateNonrealTypes(
18986 std::vector<std::vector<SgTemplateParameter *>> & tpl_params,
18987 std::vector<std::vector<SgTemplateArgument *>> & tpl_args
18989#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
18990 std::cout <<
"Rose::Builder::Templates::instantiateNonrealTypes" << std::endl;
18991 std::cout <<
" type = " << std::hex << type <<
" : " << ( type ? type->
class_name() :
"" ) << std::endl;
18992 std::cout <<
" = " << ( type ? type->
unparseToString() :
"" ) << std::endl;
18996 }
else if (isSgNonrealType(type)) {
18998 SgNonrealDecl * nrdecl = isSgNonrealDecl(nrtype->get_declaration());
18999 ROSE_ASSERT(nrdecl !=
nullptr);
19000#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19001 std::cout <<
" nrdecl = " << std::hex << nrdecl <<
" : " << nrdecl->
class_name() << std::endl;
19002 std::cout <<
" ->get_qualified_name() = " << nrdecl->get_qualified_name().getString() << std::endl;
19004 std::cout <<
" ->get_tpl_args() = " << std::dec << nrdecl->get_tpl_args().size() << std::endl;
19005 std::cout <<
" ->get_tpl_params() = " << std::dec << nrdecl->get_tpl_params().size() << std::endl;
19006 std::cout <<
" ->get_is_class_member() = " << ( nrdecl->get_is_class_member() ?
"true" :
"false" ) << std::endl;
19007 std::cout <<
" ->get_is_template_param() = " << ( nrdecl->get_is_template_param() ?
"true" :
"false" ) << std::endl;
19008 std::cout <<
" ->get_is_template_template_param() = " << ( nrdecl->get_is_template_template_param() ?
"true" :
"false" ) << std::endl;
19009 std::cout <<
" ->get_is_nonreal_template() = " << ( nrdecl->get_is_nonreal_template() ?
"true" :
"false" ) << std::endl;
19010 std::cout <<
" ->get_is_nonreal_function() = " << ( nrdecl->get_is_nonreal_function() ?
"true" :
"false" ) << std::endl;
19013 if (tpldecl !=
nullptr) {
19014#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19015 std::cout <<
" tpldecl = " << std::hex << tpldecl <<
" : " << tpldecl->
class_name() << std::endl;
19019 if (xtpldecl !=
nullptr) {
19020#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19021 std::cout <<
" xtpldecl->get_name() = " << xtpldecl->get_name() << std::endl;
19023 std::vector<SgTemplateArgument *> inst_tpl_args;
19025#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19026 std::cout <<
" tplarg = " << std::hex << tplarg <<
" : " << ( tplarg ? tplarg->class_name() :
"" ) << std::endl;
19027 std::cout <<
" ->get_argumentType() = " << tplarg->get_argumentType() << std::endl;
19029 switch (tplarg->get_argumentType()) {
19031#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19032 std::cout <<
" tplarg->get_type() = " << std::hex << tplarg->get_type() <<
" : " << ( tplarg->get_type() ? tplarg->get_type()->class_name() :
"" ) << std::endl;
19034 auto inst_tplarg = instantiateNonrealTypes(tplarg->get_type(), tpl_params, tpl_args);
19036 inst_tpl_args.push_back(buildTemplateArgument(inst_tplarg));
19040#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19041 std::cout <<
" tplarg->get_expression() = " << std::hex << tplarg->get_expression() <<
" : " << ( tplarg->get_expression() ? tplarg->get_expression()->class_name() :
"" ) << std::endl;
19042 std::cout <<
" ->unparseToString() = " << tplarg->get_expression()->unparseToString() << std::endl;
19045#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19046 std::cout <<
" inst_tplarg = " << std::hex << inst_tplarg <<
" : " << ( inst_tplarg ? inst_tplarg->class_name() :
"" ) << std::endl;
19047 std::cout <<
" inst_tplarg->unparseToString() = " << ( inst_tplarg ? inst_tplarg->unparseToString() :
"" ) << std::endl;
19050 inst_tpl_args.push_back(buildTemplateArgument(inst_tplarg));
19054#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19055 std::cout <<
" tplarg->get_templateDeclaration() = " << std::hex << tplarg->get_templateDeclaration() <<
" : " << ( tplarg->get_templateDeclaration() ? tplarg->get_templateDeclaration()->class_name() :
"" ) << std::endl;
19060#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19061 std::cout <<
" start_of_pack_expansion_argument" << std::endl;
19065 default: ROSE_ABORT();
19071 ROSE_ASSERT(inst_decl);
19072#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19073 std::cout <<
" inst_decl = " << std::hex << inst_decl <<
" : " << inst_decl->
class_name() << std::endl;
19075 std::cout <<
" inst_decl->get_definingDeclaration() = " << std::hex << inst_decl->
get_definingDeclaration() << std::endl;
19082 for (
auto inst_tpl_arg: inst_tpl_args) {
19083 inst_tpl_arg->set_parent(inst_decl);
19087 return inst_decl->get_type();
19091 }
else if (nrdecl->get_is_template_param()) {
19092 auto depth = nrdecl->get_template_parameter_depth();
19093 auto position = nrdecl->get_template_parameter_position();
19094#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19095 std::cout <<
" ->get_template_parameter_position() = " << std::dec <<
position << std::endl;
19096 std::cout <<
" ->get_template_parameter_depth() = " << std::dec << depth << std::endl;
19098 ROSE_ASSERT(depth > 0);
19099 ROSE_ASSERT(position > 0);
19100 if (std::size_t(depth) <= tpl_args.size() && std::size_t(position) <= tpl_args[depth-1].size()) {
19102#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19103 std::cout <<
" tpl_args[" << std::dec << depth-1 <<
"][" << std::dec <<
position-1 <<
"]->get_type() = " << std::dec << res << std::endl;
19106 }
else if (std::size_t(depth) <= tpl_params.size() && std::size_t(position) <= tpl_params[depth-1].size()) {
19107 SgType * dft_tpl_arg = tpl_params[depth-1][
position-1]->get_defaultTypeParameter();
19108#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19109 std::cout <<
" tpl_params[" << std::dec << depth-1 <<
"][" << std::dec <<
position-1 <<
"]->get_type() = " << std::dec << dft_tpl_arg << std::endl;
19111 dft_tpl_arg = instantiateNonrealTypes(dft_tpl_arg, tpl_params, tpl_args);
19112#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19113 std::cout <<
" dft_tpl_arg = " << std::dec << dft_tpl_arg << std::endl;
19115 return dft_tpl_arg;
19119 }
else if (nrdecl->get_is_class_member()) {
19120#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19121 std::cout <<
" Case of a non-real class member will return INT." << std::endl;
19133 }
else if (isSgTypeVoid(type) || isSgTypeUnsignedLong(type) || isSgTypeInt(type) || isSgTypeLong(type) || isSgTypeUnsignedInt(type) || isSgTypedefType(type) || isSgClassType(type)) {
19135 }
else if (isSgModifierType(type)) {
19137 SgType * btype = mtype->get_base_type();
19138 ROSE_ASSERT(btype !=
nullptr);
19140 ROSE_ASSERT(rtype !=
nullptr);
19144 std::cerr <<
"!!! type = " << std::hex << type <<
" : " << ( type ? type->
class_name() :
"" ) << std::endl;
19150SgType * instantiateNonrealTypes(
19152 std::vector<SgTemplateParameter *> & tpl_params,
19153 std::vector<SgTemplateArgument *> & tpl_args
19155 std::vector<std::vector<SgTemplateParameter *>> tpl_params_{tpl_params};
19156 std::vector<std::vector<SgTemplateArgument *>> tpl_args_{tpl_args};
19157 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.