8#include <rose_config.h>
10#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
11 #include "roseAdapter.h"
12 #include "markLhsValues.h"
14 #include "Outliner.hh"
17 #include "transformationSupport.h"
20#include <boost/algorithm/string/trim.hpp>
23#include "AstConsistencyTests.h"
32#define BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS 0
33#define BUILDER_MAKE_REDUNDANT_CALLS_TO_SYMBOL_TABLE_LOOKUP 0
40namespace EDG_ROSE_Translation
45#if defined(ROSE_BUILD_CXX_LANGUAGE_SUPPORT) && !defined(ROSE_USE_CLANG_FRONTEND)
47 extern bool suppress_detection_of_transformations;
50 bool suppress_detection_of_transformations;
62 static bool initialized =
false;
72template <
class actualFunction>
78template <
class actualFunction>
113 ASSERT_not_null(classType);
115 SgClassDeclaration* classDeclaration = isSgClassDeclaration(classType->get_declaration());
116 ASSERT_not_null(classDeclaration);
118 SgName className = classDeclaration->get_name();
121 printf (
"In SageBuilder::buildDefaultConstructor(): building default constructor for class = %s \n",className.str());
125 ASSERT_not_null(definingClassDeclaration);
127 ASSERT_not_null(classDefinition);
130 ASSERT_not_null(functionParameterList);
134 ASSERT_not_null(return_type);
137 bool buildTemplateInstantiation =
false;
140 unsigned int functionConstVolatileFlags = 0;
142 SgTemplateArgumentPtrList templateArgumentsList;
145 classDefinition, decoratorList, functionConstVolatileFlags, buildTemplateInstantiation, &templateArgumentsList);
146 ASSERT_not_null(first_nondefining_declaration);
148 first_nondefining_declaration->get_specialFunctionModifier().setConstructor();
149 ROSE_ASSERT(first_nondefining_declaration->get_specialFunctionModifier().isConstructor() ==
true);
159 classDefinition, decoratorList, buildTemplateInstantiation, functionConstVolatileFlags, first_nondefining_declaration, &templateArgumentsList);
160 ASSERT_not_null(memberFunctionDeclaration);
162 memberFunctionDeclaration->get_specialFunctionModifier().setConstructor();
163 ROSE_ASSERT(memberFunctionDeclaration->get_specialFunctionModifier().isConstructor() ==
true);
169 memberFunctionDeclaration->get_declarationModifier().get_accessModifier().setPublic();
171 ROSE_ASSERT (memberFunctionDeclaration->get_declarationModifier().get_accessModifier().isPublic() ==
true);
177 printf (
"In SageBuilder::buildDefaultConstructor(): building default constructor for class = %s \n",className.str());
178 printf (
" --- memberFunctionDeclaration = %p \n",memberFunctionDeclaration);
179 printf (
" --- first_nondefining_declaration = %p \n",first_nondefining_declaration);
181 printf (
" --- memberFunctionDeclaration->get_definingDeclaration() = %p \n",memberFunctionDeclaration->
get_definingDeclaration());
184 return memberFunctionDeclaration;
210 case e_sourcePositionError: s =
"e_sourcePositionError";
break;
220 printf (
"Error: default reached in SageBuilder::display(SourcePositionClassification & scp): scp = %d \n",scp);
234SgScopeStatement::find_symbol_by_type_of_function (
const SgName & name,
const SgType* func_type, SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateArgumentsList)
261 switch((VariantT)T::static_variant)
263 case V_SgFunctionDeclaration:
264 case V_SgProcedureHeaderStatement:
265 case V_SgTemplateInstantiationFunctionDecl:
268 if ((VariantT)T::static_variant == V_SgTemplateInstantiationFunctionDecl)
270 ROSE_ASSERT(templateArgumentsList != NULL);
274 ROSE_ASSERT(templateArgumentsList == NULL);
278 func_symbol = lookup_nontemplate_function_symbol(name,func_type,templateArgumentsList);
280 ROSE_ASSERT(isSgTemplateFunctionSymbol(func_symbol) == NULL);
284 case V_SgMemberFunctionDeclaration:
285 case V_SgTemplateInstantiationMemberFunctionDecl:
289 if ((VariantT)T::static_variant == V_SgTemplateInstantiationMemberFunctionDecl)
291 ROSE_ASSERT(templateArgumentsList != NULL);
295 ROSE_ASSERT(templateArgumentsList == NULL);
297 func_symbol = lookup_nontemplate_member_function_symbol(name,func_type,templateArgumentsList);
301 case V_SgTemplateFunctionDeclaration:
305 ROSE_ASSERT(templateArgumentsList == NULL);
308 ROSE_ASSERT(templateParameterList != NULL);
318 func_symbol = lookup_template_function_symbol(name,func_type,templateParameterList);
323 case V_SgTemplateMemberFunctionDeclaration:
327 ROSE_ASSERT(templateArgumentsList == NULL);
330 ROSE_ASSERT(templateParameterList != NULL);
335 func_symbol = lookup_template_member_function_symbol(name,func_type,templateParameterList);
341 printf (
"In SgScopeStatement::find_symbol_by_type_of_function(): default reached --- variantT(T::static_variant) = %d \n",T::static_variant);
351template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgTemplateFunctionDeclaration>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
352template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgTemplateInstantiationMemberFunctionDecl>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
353template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgTemplateInstantiationFunctionDecl>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
354template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgMemberFunctionDeclaration>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
355template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgTemplateMemberFunctionDeclaration>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
356template SgFunctionSymbol* SgScopeStatement::find_symbol_by_type_of_function<SgFunctionDeclaration>(
SgName const&,
SgType const*, SgTemplateParameterPtrList*, SgTemplateArgumentPtrList*);
361 ASSERT_not_null(stmt);
399 ASSERT_not_null(isSgGlobal(tempScope));
417 bool returnVar =
false;
418 std::list<SgScopeStatement*>::iterator i;
421 if (isSgSwitchStatement(*i) !=
nullptr)
446#define DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST 0
448#if DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST
449 printf (
"In SageBuilder::appendTemplateArgumentsToName(): CRITICAL FUNCTION TO BE REFACTORED (name = %s) \n",name.str());
454 ASSERT_not_null(info);
457 info->set_requiresGlobalNameQualification();
460 info->set_SkipClassDefinition();
461 info->set_SkipEnumDefinition();
462 info->set_use_generated_name_for_template_arguments(
true);
464 bool emptyArgumentList = templateArgumentsList.empty();
469 if (emptyArgumentList ==
false)
472 SgTemplateArgumentPtrList::const_iterator i = templateArgumentsList.begin();
473 bool need_separator =
false;
475 bool exit_after_name_is_generated =
false;
477 while (i != templateArgumentsList.end())
490#if DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST
491 printf (
"In SageBuilder::appendTemplateArgumentsToName(): (top of loop) templateArgumentsList element *i = %p = %s returnName = %s \n",*i,(*i)->class_name().c_str(),returnName.str());
501 bool used_fully_qualified_name =
false;
503#define DEBUG_TEMPLATE_ARGUMENT_NAMES 0
508 ASSERT_not_null(templateArgument);
515 ASSERT_not_null(type);
517#if DEBUG_TEMPLATE_ARGUMENT_NAMES
518 printf (
"In SageBuilder::appendTemplateArgumentsToName(): case SgTemplateArgument::type_argument: BEFORE stripType: type = %p = %s \n",type,type->
class_name().c_str());
522 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_POINTER_MEMBER_TYPE);
525#if DEBUG_TEMPLATE_ARGUMENT_NAMES
526 printf (
"In SageBuilder::appendTemplateArgumentsToName(): case SgTemplateArgument::type_argument: AFTER stripType: type = %p = %s \n",type,type->
class_name().c_str());
529 if (isSgPointerType(templateArgument->
get_type()) !=
nullptr)
532#if DEBUG_TEMPLATE_ARGUMENT_NAMES
533 printf (
"Found a templateArgument->get_type() that is SgPointerType: name = %s \n",name.str());
538 if (namedType !=
nullptr)
542 ASSERT_not_null(declaration);
546 case V_SgTemplateInstantiationDecl:
547 case V_SgTemplateClassDeclaration:
548 case V_SgClassDeclaration:
551 string fully_qualified_name = classDeclaration->get_qualified_name();
552#if DEBUG_TEMPLATE_ARGUMENT_NAMES
553 printf (
"fully_qualified_name = %s \n",fully_qualified_name.c_str());
555 returnName += fully_qualified_name;
556 used_fully_qualified_name =
true;
560 case V_SgTemplateInstantiationTypedefDeclaration:
561 case V_SgTemplateTypedefDeclaration:
562 case V_SgTypedefDeclaration:
565 string fully_qualified_name = typedefDeclaration->get_qualified_name();
566#if DEBUG_TEMPLATE_ARGUMENT_NAMES
567 printf (
"fully_qualified_name = %s \n",fully_qualified_name.c_str());
569 returnName += fully_qualified_name;
570 used_fully_qualified_name =
true;
574 case V_SgEnumDeclaration:
577 string fully_qualified_name = enumDeclaration->get_qualified_name();
578#if DEBUG_TEMPLATE_ARGUMENT_NAMES
579 printf (
"fully_qualified_name = %s \n",fully_qualified_name.c_str());
581 returnName += fully_qualified_name;
582 used_fully_qualified_name =
true;
587 case V_SgNonrealDecl:
589 SgNonrealDecl* nonrealDeclaration = isSgNonrealDecl(declaration);
590 string fully_qualified_name = nonrealDeclaration->get_qualified_name();
591#if DEBUG_TEMPLATE_ARGUMENT_NAMES
592 printf (
"fully_qualified_name = %s \n",fully_qualified_name.c_str());
594 returnName += fully_qualified_name;
595 used_fully_qualified_name =
true;
602 printf (
"In SageBuilder::appendTemplateArgumentsToName(): default reached: get_type() != NULL: declaration = %s \n",declaration->
class_name().c_str());
609#if DEBUG_TEMPLATE_ARGUMENT_NAMES
610 printf (
"In SageBuilder::appendTemplateArgumentsToName(): not a SgNamedType: get_type() != NULL: type = %s \n",type->
class_name().c_str());
620 ROSE_ASSERT (templateArgument->
get_expression() != NULL || templateArgument->get_initializedName() != NULL);
621 ROSE_ASSERT (templateArgument->
get_expression() == NULL || templateArgument->get_initializedName() == NULL);
625 ASSERT_not_null(expression);
629 SgVarRefExp* varRefExp = isSgVarRefExp(expression);
630 if (varRefExp != NULL)
634 ROSE_ASSERT(variableSymbol != NULL);
636 ROSE_ASSERT(initializedName != NULL);
638#if DEBUG_TEMPLATE_ARGUMENT_NAMES
639 printf (
"fully_qualified_name = %s \n",fully_qualified_name.c_str());
641 returnName += fully_qualified_name;
642 used_fully_qualified_name =
true;
647#if DEBUG_TEMPLATE_ARGUMENT_NAMES
648 printf (
"In SageBuilder::appendTemplateArgumentsToName(): Case of template argument varRefExp == NULL: expression = %p = %s \n",
652 printf (
"In SageBuilder::appendTemplateArgumentsToName(): Case of template argument varRefExp == NULL is not yet supported! \n");
663 ROSE_ASSERT(initializedName != NULL);
664 printf (
"initializedName = %p = %s \n",initializedName,initializedName->get_name().str());
666 printf (
"In SageBuilder::appendTemplateArgumentsToName(): Case of template argument initializedName != NULL: Unclear what do do in this case \n");
676 ASSERT_not_null(decl);
677#if DEBUG_TEMPLATE_ARGUMENT_NAMES
678 printf (
"In SageBuilder::appendTemplateArgumentsToName(): case SgTemplateArgument::template_template_argument: decl = %p = %s \n",decl,decl->
class_name().c_str());
680 exit_after_name_is_generated =
true;
682 printf (
"Exiting as a test! \n");
686 ROSE_ASSERT(tpl_decl == NULL);
693#if DEBUG_TEMPLATE_ARGUMENT_NAMES
694 printf(
"WARNING: start_of_pack_expansion_argument in evaluateNameQualificationForTemplateArgumentList (can happen from some debug output)\n");
702 printf(
"Error argument_undefined in evaluateNameQualificationForTemplateArgumentList \n");
710 printf(
"Error default reached in evaluateNameQualificationForTemplateArgumentList \n");
719 if (used_fully_qualified_name ==
false)
724#if DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST
725 printf (
"In SageBuilder::appendTemplateArgumentsToName(): (after appending template name) *i = %p returnName = %s \n",*i,returnName.str());
727 need_separator =
true;
730#if DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST
731 printf (
"In SageBuilder::appendTemplateArgumentsToName(): (bottom of loop) returnName = %s \n",returnName.str());
735 if (emptyArgumentList ==
false)
738#if DEBUG_APPEND_TEMPLATE_ARGUMENT_LIST || DEBUG_TEMPLATE_ARGUMENT_NAMES
739 printf (
"Leaving SageBuilder::appendTemplateArgumentsToName(): returnName = %s \n",returnName.str());
745 if (exit_after_name_is_generated ==
true)
747 printf (
"Exiting as a test! \n");
765 ROSE_ASSERT(templateArgument != NULL);
768 ROSE_ASSERT(info != NULL);
773 info->set_SkipClassDefinition();
774 info->set_SkipEnumDefinition();
775 info->set_use_generated_name_for_template_arguments(
true);
786SgTemplateArgumentPtrList*
792 ROSE_ASSERT(decl != NULL);
794 SgTemplateArgumentPtrList* templateArgumentsList = NULL;
799 case V_SgNamespaceAliasDeclarationStatement:
803 case V_SgNamespaceDeclarationStatement:
804 case V_SgEnumDeclaration:
805 case V_SgVariableDeclaration:
806 case V_SgTypedefDeclaration:
808 templateArgumentsList = NULL;
815 case V_SgProcedureHeaderStatement:
816 case V_SgJovialTableStatement:
817 case V_SgJavaPackageDeclaration:
818 case V_SgFunctionDeclaration:
819 case V_SgMemberFunctionDeclaration:
820 case V_SgClassDeclaration:
822 templateArgumentsList = NULL;
826 case V_SgTemplateInstantiationDecl:
832 case V_SgTemplateClassDeclaration:
834 templateArgumentsList = &(isSgTemplateClassDeclaration(decl)->get_templateSpecializationArguments());
838 case V_SgTemplateInstantiationFunctionDecl:
844 case V_SgTemplateFunctionDeclaration:
846 templateArgumentsList = &(isSgTemplateFunctionDeclaration(decl)->get_templateSpecializationArguments());
850 case V_SgTemplateInstantiationMemberFunctionDecl:
852 templateArgumentsList = &(isSgTemplateInstantiationMemberFunctionDecl(decl)->
get_templateArguments());
856 case V_SgTemplateMemberFunctionDeclaration:
858 templateArgumentsList = &(isSgTemplateMemberFunctionDeclaration(decl)->get_templateSpecializationArguments());
862 case V_SgTemplateVariableDeclaration:
864 templateArgumentsList = &(isSgTemplateVariableDeclaration(decl)->get_templateSpecializationArguments());
869 case V_SgTemplateTypedefDeclaration:
871 templateArgumentsList = &(isSgTemplateTypedefDeclaration(decl)->get_templateSpecializationArguments());
876 case V_SgTemplateInstantiationTypedefDeclaration:
878 templateArgumentsList = &(isSgTemplateInstantiationTypedefDeclaration(decl)->get_templateArguments());
882 case V_SgTemplateDeclaration:
884 templateArgumentsList = NULL;
888 case V_SgNonrealDecl:
890 templateArgumentsList = &(isSgNonrealDecl(decl)->get_tpl_args());
896 printf (
"getTemplateArgumentList(): Default reached in switch: decl = %p = %s \n",decl,decl->
class_name().c_str());
901 return templateArgumentsList;
906SgTemplateParameterPtrList*
912 ROSE_ASSERT(decl != NULL);
914 SgTemplateParameterPtrList* templateParameterList = NULL;
919 case V_SgNamespaceAliasDeclarationStatement:
923 case V_SgNamespaceDeclarationStatement:
924 case V_SgEnumDeclaration:
925 case V_SgVariableDeclaration:
926 case V_SgTypedefDeclaration:
928 templateParameterList = NULL;
935 case V_SgProcedureHeaderStatement:
936 case V_SgJovialTableStatement:
937 case V_SgJavaPackageDeclaration:
938 case V_SgFunctionDeclaration:
939 case V_SgMemberFunctionDeclaration:
940 case V_SgClassDeclaration:
942 templateParameterList = NULL;
947 case V_SgTemplateInstantiationTypedefDeclaration:
951 case V_SgTemplateInstantiationDecl:
952 case V_SgTemplateInstantiationFunctionDecl:
953 case V_SgTemplateInstantiationMemberFunctionDecl:
955 templateParameterList = NULL;
959 case V_SgTemplateClassDeclaration:
961 templateParameterList = &(isSgTemplateClassDeclaration(decl)->get_templateParameters());
965 case V_SgTemplateFunctionDeclaration:
967 templateParameterList = &(isSgTemplateFunctionDeclaration(decl)->get_templateParameters());
971 case V_SgTemplateMemberFunctionDeclaration:
973 templateParameterList = &(isSgTemplateMemberFunctionDeclaration(decl)->get_templateParameters());
977 case V_SgTemplateVariableDeclaration:
979 templateParameterList = &(isSgTemplateVariableDeclaration(decl)->get_templateParameters());
984 case V_SgTemplateTypedefDeclaration:
986 templateParameterList = &(isSgTemplateTypedefDeclaration(decl)->get_templateParameters());
990 case V_SgNonrealDecl:
992 templateParameterList = &(isSgNonrealDecl(decl)->get_tpl_params());
996 case V_SgTemplateDeclaration:
998 templateParameterList = &(isSgTemplateDeclaration(decl)->get_templateParameters());
1004 printf (
"getTemplateParameterList(): Default reached in switch: decl = %p = %s \n",decl,decl->
class_name().c_str());
1009 return templateParameterList;
1019 ROSE_ASSERT(decl != NULL);
1023 if (templateArgumentsList != NULL)
1026 ROSE_ASSERT(first_decl != NULL);
1028 SgTemplateArgumentPtrList::iterator i = templateArgumentsList->begin();
1029 while (i != templateArgumentsList->end())
1044 (*i)->set_parent(first_decl);
1049 if (declaration != NULL)
1051#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
1052 printf (
"In setTemplateArgumentParents(): Template argument already set to declaration = %p = %s \n",declaration,declaration->
class_name().c_str());
1057#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
1058 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());
1076 ROSE_ASSERT(decl != NULL);
1080 if (templateParameterList != NULL)
1083 ROSE_ASSERT(first_decl != NULL);
1085 SgTemplateParameterPtrList::iterator i = templateParameterList->begin();
1086 while (i != templateParameterList->end())
1100 (*i)->set_parent(first_decl);
1117 ROSE_ASSERT(decl != NULL);
1121 if (templateArgumentsList != NULL)
1123 SgTemplateArgumentPtrList::iterator i = templateArgumentsList->begin();
1124 while (i != templateArgumentsList->end())
1129 printf (
"Error: In testTemplateArgumentParents(): decl = %p = %s has template argument = %p with null parent \n",decl,decl->
class_name().c_str(),*i);
1131 ROSE_ASSERT(parent != NULL);
1150 ROSE_ASSERT(decl != NULL);
1154 if (templateParameterList != NULL)
1156 SgTemplateParameterPtrList::iterator i = templateParameterList->begin();
1157 while (i != templateParameterList->end())
1162 printf (
"Error: In testTemplateParameterParents(): decl = %p = %s has template argument = %p with null parent \n",decl,decl->
class_name().c_str(),*i);
1164 ROSE_ASSERT(parent != NULL);
1172 printf (
"Error: In testTemplateParameterParents(): decl = %p = %s has template argument = %p with parent = %p = %s \n",decl,decl->
class_name().c_str(),*i,parent,parent->
class_name().c_str());
1192 ROSE_ASSERT(templateArgumentsList_input != NULL);
1194 ROSE_ASSERT(decl->
variantT() == V_SgTemplateInstantiationDecl ||
1195 decl->
variantT() == V_SgTemplateInstantiationFunctionDecl ||
1196 decl->
variantT() == V_SgTemplateInstantiationMemberFunctionDecl ||
1197 decl->
variantT() == V_SgTemplateInstantiationTypedefDeclaration);
1201 if (templateArgumentsList_from_declaration != NULL)
1203 *templateArgumentsList_from_declaration = *templateArgumentsList_input;
1218 ROSE_ASSERT(templateSpecializationArgumentsList_input != NULL);
1220 ROSE_ASSERT(decl->
variantT() == V_SgTemplateClassDeclaration || decl->
variantT() == V_SgTemplateFunctionDeclaration ||
1221 decl->
variantT() == V_SgTemplateMemberFunctionDeclaration || decl->
variantT() == V_SgTemplateVariableDeclaration );
1223 SgTemplateArgumentPtrList* templateSpecializationArgumentsList_from_declaration =
getTemplateArgumentList(decl);
1225 if (templateSpecializationArgumentsList_from_declaration != NULL)
1227 *templateSpecializationArgumentsList_from_declaration = *templateSpecializationArgumentsList_input;
1241 ROSE_ASSERT(templateParameterList_input != NULL);
1243 ROSE_ASSERT(decl->
variantT() == V_SgTemplateClassDeclaration || decl->
variantT() == V_SgTemplateFunctionDeclaration ||
1244 decl->
variantT() == V_SgTemplateMemberFunctionDeclaration || decl->
variantT() == V_SgTemplateVariableDeclaration );
1248 if (templateParameterList_from_declaration != NULL)
1250 *templateParameterList_from_declaration = *templateParameterList_input;
1266 ASSERT_not_null(type);
1269 ASSERT_not_null(initializedName);
1272 return initializedName;
1287 string var_name(name);
1294 ASSERT_not_null(type);
1297 ASSERT_not_null(initializedName);
1298 ASSERT_require(init ==
nullptr || init->get_parent() == initializedName);
1302 return initializedName;
1315 ROSE_ASSERT(name.is_null() ==
false);
1316 ROSE_ASSERT(type != NULL);
1319 ROSE_ASSERT(varDecl);
1332 bool isFortranParameter =
false;
1340 if (v_symbol != NULL)
1344 ROSE_ASSERT (default_initName != NULL);
1346 ROSE_ASSERT (new_initName != NULL);
1347 ROSE_ASSERT (default_initName != new_initName);
1350 std::replace (n_list.begin(), n_list.end(),default_initName, new_initName );
1351 ROSE_ASSERT (varDecl->get_decl_item (name)==new_initName);
1355 ROSE_ASSERT (old_parent != NULL);
1356 ROSE_ASSERT (isSgFunctionParameterList(old_parent) != NULL);
1364 ROSE_ASSERT (var_def != NULL);
1367 new_initName->set_declptr(var_def);
1369 delete (default_initName);
1375 isFortranParameter =
true;
1379 if (! isFortranParameter)
1385 ROSE_ASSERT(initName != NULL);
1386 ROSE_ASSERT((initName->get_declptr())!=NULL);
1404 unsetNodesMarkedAsModified(varDecl);
1420#define DEBUG_BUILD_VARIABLE_DECLARATION 0
1422#if DEBUG_BUILD_VARIABLE_DECLARATION
1423 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): name = %s scope = %p varInit = %p \n",name.str(),scope,varInit);
1426 printf (
" --- scope = %p = %s \n",scope,scope->
class_name().c_str());
1432#if DEBUG_BUILD_VARIABLE_DECLARATION
1433 printf (
"Scope determined from the SageBuilder::topScopeStack() \n");
1438 ROSE_ASSERT (scope != NULL);
1439 ROSE_ASSERT(type != NULL);
1444#if DEBUG_BUILD_VARIABLE_DECLARATION
1445 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): variableSymbol = %p \n",variableSymbol);
1450 if (variableSymbol == NULL)
1453#if DEBUG_BUILD_VARIABLE_DECLARATION
1455 ROSE_ASSERT(tmp_initializedName != NULL);
1456 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): variableSymbol == NULL: varDecl = %p: initializedName = %p = %s \n",varDecl,tmp_initializedName,tmp_initializedName->get_name().str());
1457 printf (
" --- tmp_initializedName->get_initptr() = %p \n",tmp_initializedName->get_initptr());
1460 if (builtFromUseOnly ==
true)
1462#if DEBUG_BUILD_VARIABLE_DECLARATION
1463 printf (
"In buildVariableDeclaration_nfi(): this is the first reference to this variable: building a new SgVariableDeclaration: varDecl = %p name = %s \n",varDecl,name.str());
1465 varDecl->set_builtFromUseOnly(
true);
1471 ROSE_ASSERT(initializedName != NULL);
1475#if DEBUG_BUILD_VARIABLE_DECLARATION
1476 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): initializedName->get_parent() = %p \n",initializedName->
get_parent());
1479 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): initializedName->get_parent() = %p = %s \n",initializedName->
get_parent(),initializedName->
get_parent()->
class_name().c_str());
1481 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): associatedVariableDeclaration = %p \n",associatedVariableDeclaration);
1483#if DEBUG_BUILD_VARIABLE_DECLARATION
1486 if (associatedVariableDeclaration != NULL && associatedVariableDeclaration->
get_parent() != NULL)
1488 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): associatedVariableDeclaration->get_parent() = %p = %s \n",
1493#if DEBUG_BUILD_VARIABLE_DECLARATION
1494 printf (
"associatedVariableDeclaration = %p \n",associatedVariableDeclaration);
1495 if (associatedVariableDeclaration != NULL)
1497 printf (
"associatedVariableDeclaration->get_builtFromUseOnly() = %s \n",associatedVariableDeclaration->get_builtFromUseOnly() ?
"true" :
"false");
1502 bool reuseTheAssociatedVariableDeclaration = ((associatedVariableDeclaration != NULL) && (associatedVariableDeclaration->get_builtFromUseOnly() ==
true));
1503 if (reuseTheAssociatedVariableDeclaration ==
true)
1509 ROSE_ASSERT(associatedVariableDeclaration != NULL);
1512 varDecl = associatedVariableDeclaration;
1515 varDecl->set_builtFromUseOnly(
false);
1526#if DEBUG_BUILD_VARIABLE_DECLARATION
1527 if (
variable->get_initptr() != NULL)
1529 printf (
"Found initializer associated with variable declaration being reused: variable = %p name = %s \n",
variable,
variable->get_name().str());
1538 ROSE_ASSERT(reuseTheAssociatedVariableDeclaration ==
false);
1544 if (associatedVariableDeclaration == NULL)
1546 ROSE_ASSERT(initializedName->
get_parent() != NULL);
1548 if (scopeStatement != NULL)
1550#if DEBUG_BUILD_VARIABLE_DECLARATION
1551 printf (
"scopeStatement = %p = %s \n",scopeStatement,scopeStatement->
class_name().c_str());
1556#if DEBUG_BUILD_VARIABLE_DECLARATION
1568#if DEBUG_BUILD_VARIABLE_DECLARATION
1569 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): initializedName->get_scope() = %p = %s \n",initializedName->get_scope(),initializedName->get_scope()->
class_name().c_str());
1572 if (scopeStatement != NULL)
1574 additional_variable = initializedName;
1578 if (additional_variable->get_initptr() != NULL)
1580#if DEBUG_BUILD_VARIABLE_DECLARATION
1581 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): borrowed SgInitializedName is alread initialized \n");
1582 printf (
" --- additional_variable->get_initptr() = %p \n",additional_variable->get_initptr());
1583 printf (
" --- varInit = %p \n",varInit);
1590 additional_variable->set_initptr(varInit);
1593#if DEBUG_BUILD_VARIABLE_DECLARATION || 0
1594 printf (
" --- additional_variable->get_scope() = %p = %s \n",additional_variable->get_scope(),additional_variable->get_scope()->
class_name().c_str());
1595 printf (
" --- Reusing the SgInitializedName (not associated with a previous SgVariableDeclaration where the parent is a SgScopeStatement) \n");
1600#if DEBUG_BUILD_VARIABLE_DECLARATION
1601 printf (
" --- Building a new SgInitializedName \n");
1606#if DEBUG_BUILD_VARIABLE_DECLARATION
1607 ROSE_ASSERT(initializedName->get_scope() != NULL);
1611 if (additional_variable != initializedName)
1613 additional_variable->set_prev_decl_item(initializedName);
1618#if DEBUG_BUILD_VARIABLE_DECLARATION
1619 ROSE_ASSERT(initializedName->
get_parent() != NULL);
1621 ROSE_ASSERT(additional_variable->
get_parent() != NULL);
1622 printf (
"additional_variable->get_parent() = %p = %s \n",additional_variable->
get_parent(),additional_variable->
get_parent()->
class_name().c_str());
1627 ASSERT_not_null(initializedName->get_scope());
1630 if (additional_variable != initializedName)
1632 additional_variable->set_scope(initializedName->get_scope());
1636#if DEBUG_BUILD_VARIABLE_DECLARATION
1637 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): After sharing the exisitng SgInitializedName: initializedName = %p = %s \n",initializedName,initializedName->get_name().str());
1638 printf (
" --- initializedName->get_initptr() = %p \n",initializedName->get_initptr());
1639 printf (
" --- additional_variable->get_initptr() = %p \n",additional_variable->get_initptr());
1649 ASSERT_not_null(varDecl);
1651 varDecl->get_declarationModifier().get_storageModifier().set_modifier(sm);
1672 ASSERT_not_null(initName);
1673 ASSERT_not_null(initName->get_declptr());
1675 if (initName->get_scope())
1678#if DEBUG_BUILD_VARIABLE_DECLARATION
1679 printf (
"WARNING: Note in buildVariableDeclaration_nfi(): initName->get_scope() == NULL \n");
1687 SgVariableDefinition* variableDefinition_original = isSgVariableDefinition(initName->get_declptr());
1688 ASSERT_not_null(variableDefinition_original);
1703 unsetNodesMarkedAsModified(varDecl);
1705 ASSERT_not_null(varDecl);
1707#if DEBUG_BUILD_VARIABLE_DECLARATION
1708 printf (
"Leaving buildVariableDeclaration_nfi(): varDecl = %p varDecl->get_parent() = %p \n",varDecl,varDecl->
get_parent());
1720 ROSE_ASSERT (decl!=NULL);
1721 ROSE_ASSERT (init_name !=NULL);
1725 if (!isSgFunctionType(init_name->get_type()))
1731 ROSE_ASSERT (copyOfFileInfo != NULL);
1735 ROSE_ASSERT (defn_stmt != NULL);
1753 ROSE_ASSERT(defn_stmt != NULL);
1776 ROSE_ASSERT (scope != NULL);
1777 ROSE_ASSERT(type != NULL);
1780 ROSE_ASSERT(varDecl);
1796 ROSE_ASSERT(initName);
1797 ROSE_ASSERT((initName->get_declptr())!=NULL);
1802 SgVariableDefinition* variableDefinition_original = isSgVariableDefinition(initName->get_declptr());
1803 ROSE_ASSERT(variableDefinition_original != NULL);
1840 ROSE_ASSERT (base_type != NULL);
1848 ASSERT_not_null(scope);
1854 ASSERT_not_null(stripedBaseType);
1856 SgNamedType* namedType = isSgNamedType(stripedBaseType);
1865 base_decl = namedType->get_declaration();
1868 ROSE_ASSERT(base_decl != NULL);
1875#ifndef ROSE_USE_CLANG_FRONTEND
1888 if (declaration && !isSgAdaDiscriminatedTypeDecl(declaration))
1890 mprintf (
"Found a valid declaration = %p = %s \n",declaration,declaration->
class_name().c_str());
1896 ROSE_ASSERT(parent_scope != NULL);
1903 ROSE_ASSERT(type_decl != NULL);
1923 SgClassDeclaration* def_class = isSgClassDeclaration(base_class->get_definingDeclaration());
1924 SgClassDeclaration* nondef_class = isSgClassDeclaration(base_class->get_firstNondefiningDeclaration());
1926 if (has_defining_base)
1928 if (def_class != NULL)
1934 if (nondef_class != NULL)
1943 ROSE_ASSERT(typedef_symbol);
1956 ROSE_ASSERT (base_type != NULL);
1964 ROSE_ASSERT(scope != NULL);
1977 if (declaration != NULL)
1982 ROSE_ASSERT(parent_scope != NULL);
1985 SgNamedType* namedType = isSgNamedType(base_type);
1989 if (namedType != NULL)
1994 ROSE_ASSERT(declarationStatement != NULL);
1995 if (declarationStatement != NULL)
1998 if (templateInstantiationDecl != NULL)
2000 SgName name = templateInstantiationDecl->get_name();
2002 if (scope->lookup_template_typedef_symbol(name) != NULL)
2004 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());
2006 ROSE_ASSERT(scope->lookup_template_typedef_symbol(name) == NULL);
2014 ROSE_ASSERT(type_decl != NULL);
2021 ROSE_ASSERT(type_decl->get_type() == NULL);
2024 ROSE_ASSERT(typedefType != NULL);
2027 type_decl->set_type(typedefType);
2030 ROSE_ASSERT(type_decl->get_type() != NULL);
2040 SgNamedType* namedType = isSgNamedType(base_type);
2044 if (namedType != NULL)
2049 ROSE_ASSERT(declarationStatement != NULL);
2050 if (declarationStatement != NULL)
2053 if (templateInstantiationDecl != NULL)
2055 SgName name = templateInstantiationDecl->get_name();
2057 if (scope->lookup_template_typedef_symbol(name) != NULL)
2059 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());
2061 ROSE_ASSERT(scope->lookup_template_typedef_symbol(name) == NULL);
2067 ROSE_ASSERT(typedef_symbol);
2072 ROSE_ASSERT(scope->lookup_template_typedef_symbol(name) != NULL);
2077#define DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi 0
2083 SgTemplateArgumentPtrList & templateArgumentsList
2085#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2086 std::cout <<
"SageBuilder::buildTemplateInstantiationTypedefDeclaration_nfi" << std::endl;
2087 std::cout <<
" name = " << name.getString() << std::endl;
2088 std::cout <<
" base_type = " << std::hex << base_type <<
" : " << ( base_type ? base_type->
class_name() :
"" ) << std::endl;
2090 ROSE_ASSERT (base_type != NULL);
2092 SgName nameWithoutTemplateArguments = name;
2094#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2095 std::cout <<
" nameWithoutTemplateArguments = " << nameWithoutTemplateArguments.getString() << std::endl;
2096 std::cout <<
" nameWithTemplateArguments = " << nameWithTemplateArguments.getString() << std::endl;
2100 ROSE_ASSERT(scope != NULL);
2112 if (declaration != NULL)
2117 ROSE_ASSERT(parent_scope != NULL);
2122 ROSE_ASSERT(templateTypedefDeclaration != NULL);
2124 SgTemplateTypedefSymbol* prexisting_template_typedef_symbol = scope->lookup_template_typedef_symbol(nameWithTemplateArguments);
2125 if (prexisting_template_typedef_symbol != NULL)
2128 ROSE_ASSERT(declarationStatement != NULL);
2130 ROSE_ASSERT(return_declaration != NULL);
2131 return return_declaration;
2133 ROSE_ASSERT(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) == NULL);
2140 ROSE_ASSERT(type_decl != NULL);
2141 ROSE_ASSERT(type_decl->get_base_type() == base_type);
2143#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2144 std::cout <<
" type_decl = " << std::hex << type_decl <<
" : " << ( type_decl ? type_decl->
class_name() :
"" ) << std::endl;
2145 std::cout <<
" ->get_base_type() = " << std::hex << type_decl->get_base_type() <<
" : " << ( type_decl->get_base_type() ? type_decl->get_base_type()->
class_name() :
"" ) << std::endl;
2150 ROSE_ASSERT(type_decl->get_type() == NULL);
2154 type_decl->set_templateName(nameWithoutTemplateArguments);
2156 ROSE_ASSERT(scope != NULL);
2161 ROSE_ASSERT(type_decl->get_name() == nameWithTemplateArguments);
2164 if (scope->lookup_template_typedef_symbol(nameWithTemplateArguments) != NULL)
2166 printf (
"Error: it appears that there is already a symbol in scope = %p = %s for name = %s \n",scope,scope->
class_name().c_str(),name.str());
2168 ROSE_ASSERT(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) == NULL);
2172 ROSE_ASSERT(type_decl->get_type() == NULL);
2175 ROSE_ASSERT(new_typedefType != NULL);
2177 type_decl->set_type(new_typedefType);
2178 ROSE_ASSERT(type_decl->get_type() != NULL);
2179 ROSE_ASSERT(type_decl->
get_scope() != NULL);
2186 SgName mangled_name = type_decl->get_mangled_name();
2193 ROSE_ASSERT(type_decl->get_type() != NULL);
2194 ROSE_ASSERT(scope != NULL);
2196#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2197 std::cout <<
" type_decl = " << std::hex << type_decl <<
" : " << ( type_decl ? type_decl->
class_name() :
"" ) << std::endl;
2198 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;
2203 if (scope->lookup_template_typedef_symbol(nameWithTemplateArguments) != NULL)
2205 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());
2207 ROSE_ASSERT(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) == NULL);
2210 ROSE_ASSERT(typedef_symbol);
2212 scope->
insert_symbol(nameWithTemplateArguments,typedef_symbol);
2215 ROSE_ASSERT(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) != NULL);
2218#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2219 std::cout <<
" type_decl = " << std::hex << type_decl <<
" : " << ( type_decl ? type_decl->
class_name() :
"" ) << std::endl;
2220 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;
2236 ROSE_ASSERT (parameterList);
2252 if (in10)
appendArg(parameterList, in10);
2254 return parameterList;
2260 ROSE_ASSERT (parameterList);
2266 return parameterList;
2273 ROSE_ASSERT (ctorInitList);
2279 return ctorInitList;
2288 if (paralist == NULL)
2290 printf (
"WARNING: In buildFunctionParameterTypeList(): Accepting NULL input and returning NULL pointer. \n");
2300 ROSE_ASSERT(typePtrList != NULL);
2302 SgInitializedNamePtrList args = paralist->
get_args();
2303 SgInitializedNamePtrList::const_iterator i;
2304 for(i = args.begin(); i != args.end(); i++)
2305 (typePtrList->
get_arguments()).push_back( (*i)->get_type() );
2316 if (expList ==NULL)
return NULL;
2317 SgExpressionPtrList expPtrList = expList->get_expressions();
2320 ROSE_ASSERT(typePtrList);
2322 SgExpressionPtrList::const_iterator i;
2323 for (i=expPtrList.begin();i!=expPtrList.end();i++)
2338 ROSE_ASSERT(typePtrList);
2342 if (type0 != NULL) types.push_back(type0);
2343 if (type1 != NULL) types.push_back(type1);
2344 if (type2 != NULL) types.push_back(type2);
2345 if (type3 != NULL) types.push_back(type3);
2346 if (type4 != NULL) types.push_back(type4);
2347 if (type5 != NULL) types.push_back(type5);
2348 if (type6 != NULL) types.push_back(type6);
2349 if (type7 != NULL) types.push_back(type7);
2361 ROSE_ASSERT(return_type != NULL);
2364 ROSE_ASSERT(typeList != NULL);
2367 ROSE_ASSERT(fTable);
2373 SgFunctionType* funcType = isSgFunctionType(fTable->lookup_function_type(typeName));
2375 if (funcType == NULL)
2379 ROSE_ASSERT(funcType);
2381 if (typeList != NULL)
2384 if (funcType->get_argument_list() != NULL)
2386 delete funcType->get_argument_list();
2387 funcType->set_argument_list(NULL);
2389 ROSE_ASSERT(funcType->get_argument_list() == NULL);
2391 funcType->set_argument_list(typeList);
2395 fTable->insert_function_type(typeName,funcType);
2415 ROSE_ASSERT(fTable != NULL);
2421 ROSE_ASSERT(typeList != NULL);
2425 SgType* typeInTable = fTable->lookup_function_type(typeName);
2428 printf (
"In buildMemberFunctionType(SgType*,SgFunctionParameterTypeList*,SgType*,int,int): fTable->lookup_function_type(typeName = %s) = %p \n",typeName.str(),typeInTable);
2429 printf (
" --- mfunc_specifier = %d ref_qualifiers = %d \n",mfunc_specifier,ref_qualifiers);
2434 if (ref_qualifiers > 0)
2436 printf (
"Exiting as a test! \n");
2442 if (typeInTable == NULL)
2444 bool has_ellipses =
false;
2448 ROSE_ASSERT(partialFunctionType != NULL);
2450 printf (
"Building a SgPartialFunctionType: partialFunctionType = %p \n",partialFunctionType);
2451 printf (
" --- partialFunctionType->isLvalueReferenceFunc() = %s \n",partialFunctionType->
isLvalueReferenceFunc() ?
"true" :
"false");
2452 printf (
" --- partialFunctionType->isRvalueReferenceFunc() = %s \n",partialFunctionType->
isRvalueReferenceFunc() ?
"true" :
"false");
2455 if (partialFunctionType->get_argument_list() != NULL)
2457 delete partialFunctionType->get_argument_list();
2458 partialFunctionType->set_argument_list(NULL);
2460 ROSE_ASSERT(partialFunctionType->get_argument_list() == NULL);
2467 partialFunctionType->set_argument_list(typeList);
2469 ROSE_ASSERT(partialFunctionType->get_argument_list() != NULL);
2478 partialFunctionType->set_argument_list(NULL);
2481 delete partialFunctionType;
2482 partialFunctionType = NULL;
2487 ROSE_ASSERT(funcType->get_argument_list() != NULL);
2490 if (typeInTable ==
nullptr)
2492 ASSERT_not_null(funcType);
2493 fTable->insert_function_type(typeName,funcType);
2499 ASSERT_require(typeInTable != funcType);
2503 funcType = isSgMemberFunctionType(typeInTable);
2504 ASSERT_not_null(funcType);
2524 ROSE_ASSERT(return_type != NULL);
2529 ROSE_ASSERT(struct_name != NULL);
2532 printf(
"In buildMemberFunctionType():\n");
2533 printf(
" - struct_name = %p (%s)\n", struct_name, struct_name->
class_name().c_str());
2538 printf (
"SageBuilder::buildMemberFunctionType(SgType*,SgFunctionParameterTypeList*,SgScopeStatement*,int,int): This function does not use the input ref_qualifiers = %x \n",ref_qualifiers);
2539 printf (
" --- mfunc_specifier = %d ref_qualifiers = %d \n",mfunc_specifier,ref_qualifiers);
2543 printf (
"Exiting as a test! \n");
2547 ROSE_ASSERT(struct_name->
get_parent() != NULL);
2551 printf(
"struct_name = %p ( %s )\n", struct_name, struct_name->
class_name().c_str());
2558 if (classDefinition == NULL && decl_scope == NULL)
2560 printf (
"Error: (classDefinition == NULL && decl_scope == NULL): struct_name = %p = %s name = %s \n",
2563 ROSE_ASSERT(classDefinition != NULL || decl_scope != NULL);
2566 if (classDefinition != NULL)
2570 else if (decl_scope != NULL)
2572 declaration = isSgDeclarationStatement(decl_scope->
get_parent());
2579 ROSE_ASSERT(declaration != NULL);
2581 if (typeList != NULL)
2585 for (SgTypePtrList::iterator i = typeListArgs.begin(); i != typeListArgs.end(); i++)
2587 printf (
" --- type argument = %p = %s \n",*i,(*i)->class_name().c_str());
2593 printf (
"WARNING: typeList == NULL \n");
2600 ROSE_ASSERT(classDeclaration != NULL || nrdecl != NULL);
2607 SgType* classType = NULL;
2608 if (classDeclaration != NULL)
2610 classType = classDeclaration->get_type();
2612 else if (decl_scope != NULL)
2614 classType = nrdecl->get_type();
2621 ROSE_ASSERT(classType != NULL);
2624 printf (
"In buildMemberFunctionType(): Calling refactored function: buildMemberFunctionType(...,classType = %p,...) \n",classType);
2631 printf (
"In buildMemberFunctionType(): DONE: Calling refactored function: buildMemberFunctionType(...,classType = %p,...) \n",classType);
2641 ROSE_ASSERT(base_type != NULL);
2643 ROSE_ASSERT(classType != NULL);
2645 return pointerToMemberType;
2663 if (type_symbol == NULL)
2666 ROSE_ASSERT(type_decl);
2672 ROSE_ASSERT(type_symbol);
2688 type_decl = type_symbol->get_declaration();
2689 result = type_decl->get_type();
2691 ROSE_ASSERT(result);
2701 ASSERT_not_null(argList);
2706 if (func_type->get_argument_list() != typeList)
2723 if (isSgMemberFunctionDeclaration(func) != NULL)
2725#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
2726 printf (
"WARNING: setting parent of function to match scope by default \n");
2730 ROSE_ASSERT(scope != NULL);
2732 if (isSgTemplateInstantiationMemberFunctionDecl(func) != NULL)
2740#if !ENFORCE_NO_FUNCTION_TEMPLATE_DECLARATIONS_IN_TEMPLATE_CLASS_INSTANTIATIONS
2747 if (isSgTemplateFunctionDeclaration(func) != NULL)
2749 if (isSgTemplateInstantiationMemberFunctionDecl(func) != NULL)
2751 ROSE_ASSERT(isSgTemplateClassDefinition(scope) != NULL);
2763template <
class actualFunction>
2765SageBuilder::buildNondefiningFunctionDeclaration_T (
2768 SgTemplateArgumentPtrList* templateArgumentsList, SgTemplateParameterPtrList* templateParameterList,
2779 if (scope ==
nullptr)
2783 ASSERT_not_null(scope);
2785 if (XXX_name.is_null() ==
true)
2788 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");
2791 SgName nameWithoutTemplateArguments = XXX_name;
2792 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
2794 bool buildTemplateInstantiation = ((VariantT)actualFunction::static_variant == V_SgTemplateInstantiationFunctionDecl || (VariantT)actualFunction::static_variant == V_SgTemplateInstantiationMemberFunctionDecl);
2797 bool buildTemplateDeclaration = ((VariantT)actualFunction::static_variant == V_SgTemplateFunctionDeclaration || (VariantT)actualFunction::static_variant == V_SgTemplateMemberFunctionDeclaration);
2801 if (buildTemplateInstantiation ==
true)
2803 ASSERT_not_null(templateArgumentsList);
2808 if (nameWithTemplateArguments.is_null() ==
true)
2812 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");
2815 if (nameWithoutTemplateArguments.is_null() ==
true)
2819 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");
2822 ASSERT_not_null(return_type);
2823 ASSERT_not_null(paralist);
2829#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
2830 printf (
"Warning: In buildNondefiningFunctionDeclaration_T(): nameWithoutTemplateArguments = %s nameWithTemplateArguments = %s \n",nameWithoutTemplateArguments.str(),nameWithTemplateArguments.str());
2840 if (isMemberFunction ==
true)
2850 ASSERT_not_null(func_type);
2853 actualFunction* func =
nullptr;
2871 func_symbol = scope->find_symbol_by_type_of_function<actualFunction>(nameWithTemplateArguments,func_type,templateParameterList,templateArgumentsList);
2874 printf (
"In buildNondefiningFunctionDeclaration_T(): func_symbol from scope->find_symbol_by_type_of_function<actualFunction>(name = %s) = %p \n",nameWithTemplateArguments.str(),func_symbol);
2875 if (func_symbol != NULL) {
2876 printf (
"In buildNondefiningFunctionDeclaration_T(): func_symbol->get_declaration() = %p \n", func_symbol->get_declaration());
2881 if (func_symbol == NULL)
2884 ROSE_ASSERT(func_type != NULL);
2889 if (func_symbol != NULL)
2891 switch((VariantT)actualFunction::static_variant)
2893 case V_SgFunctionDeclaration:
2894 case V_SgProcedureHeaderStatement:
2895 case V_SgTemplateInstantiationFunctionDecl:
2897 ROSE_ASSERT(isSgFunctionSymbol(func_symbol) != NULL);
2900 case V_SgMemberFunctionDeclaration:
2901 case V_SgTemplateInstantiationMemberFunctionDecl:
2903 ROSE_ASSERT(isSgMemberFunctionSymbol(func_symbol) != NULL);
2906 case V_SgTemplateFunctionDeclaration:
2908 ROSE_ASSERT(isSgTemplateFunctionSymbol(func_symbol) != NULL);
2911 case V_SgTemplateMemberFunctionDeclaration:
2913 ROSE_ASSERT(isSgTemplateMemberFunctionSymbol(func_symbol) != NULL);
2919 printf (
"default reach in buildNondefiningFunctionDeclaration_T(): variantT(actualFunction::static_variant) = %d \n",actualFunction::static_variant);
2926 ROSE_ASSERT(scope != NULL);
2927 if ( isSgGlobal(scope) != NULL
2928 && scope != func_symbol->get_scope()
2930 && !scope->symbol_exists(nameWithTemplateArguments, func_symbol) )
2932 scope->
insert_symbol(nameWithTemplateArguments, func_symbol);
2936 if (func_symbol == NULL)
2938 func =
new actualFunction (nameWithTemplateArguments,func_type,NULL);
2939 ROSE_ASSERT(func != NULL);
2942 func->get_declarationModifier().get_storageModifier().set_modifier(sm);
2945 ROSE_ASSERT(func->get_file_info() == NULL);
2948 func->set_scope(scope);
2951 checkThatNoTemplateInstantiationIsDeclaredInTemplateDefinitionScope(func,scope);
2954 ROSE_ASSERT(func->get_parameterList() != NULL);
2962 if (isSgMemberFunctionDeclaration(func))
2967 if (isSgTemplateMemberFunctionDeclaration(func) != NULL)
2972 ROSE_ASSERT(memberFunctionDeclaration != NULL);
2976 ROSE_ASSERT(func_symbol != NULL);
2977 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
2982 if (isSgTemplateFunctionDeclaration(func))
2988 ROSE_ASSERT(templatedeclaration != NULL);
2990 ROSE_ASSERT(template_symbol != NULL);
2991 ROSE_ASSERT(template_symbol->get_symbol_basis() != NULL);
2992 func_symbol = template_symbol;
2997 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
3001 ROSE_ASSERT(func_symbol != NULL);
3002 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
3003 scope->
insert_symbol(nameWithTemplateArguments, func_symbol);
3006 ROSE_ASSERT(func->get_symbol_from_symbol_table() != NULL);
3008 if (isSgFunctionDeclaration(func) == NULL)
3014 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3022 ROSE_ASSERT(buildTemplateDeclaration ==
false || templateParameterList != NULL);
3028 ROSE_ASSERT(scope->lookup_function_symbol(nameWithTemplateArguments) != NULL ||
3029 scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL ||
3030 scope->lookup_template_member_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3032#if BUILDER_MAKE_REDUNDANT_CALLS_TO_SYMBOL_TABLE_LOOKUP
3036 if (scope->lookup_function_symbol(nameWithTemplateArguments,templateArgumentList) == NULL || scope->lookup_template_symbol(nameWithTemplateArguments,templateParameterList,NULL) != NULL)
3039 printf (
"Need to make sure this is a template function declaration... \n");
3045 ROSE_ASSERT(func->get_scope() != NULL);
3047 if (isSgFunctionDeclaration(func) == NULL)
3053 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3055 func->set_firstNondefiningDeclaration(func);
3056 func->set_definingDeclaration(NULL);
3059 ROSE_ASSERT(func->get_firstNondefiningDeclaration() == func);
3061 ROSE_ASSERT(func->get_definingDeclaration() == NULL);
3065 if (testMemberDecl != NULL)
3067 ROSE_ASSERT(testMemberDecl->
get_scope() != NULL);
3068 ROSE_ASSERT(testMemberDecl->get_class_scope() != NULL);
3069 ROSE_ASSERT(testMemberDecl->get_associatedClassDeclaration() != NULL);
3074 ROSE_ASSERT(func_symbol != NULL);
3076 ROSE_ASSERT(scope != NULL);
3084 SgNode* associatedSymbolBasis = func_symbol->get_symbol_basis();
3085 ROSE_ASSERT(associatedSymbolBasis != NULL);
3088 ROSE_ASSERT(associatedDeclaration != NULL);
3092 if (functionDeclaration != NULL)
3094 func_type = functionDeclaration->get_type();
3098 if (templateFunctionDeclaration != NULL)
3103 printf (
"This code should not be reachable! \n");
3106 func_type = templateFunctionDeclaration->get_type();
3114 ROSE_ASSERT(func_type != NULL);
3116 func =
new actualFunction(nameWithTemplateArguments,func_type,NULL);
3117 ROSE_ASSERT(func != NULL);
3119#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3126 func->set_scope(scope);
3129 ROSE_ASSERT(func->get_symbol_from_symbol_table() == NULL);
3132 checkThatNoTemplateInstantiationIsDeclaredInTemplateDefinitionScope(func,scope);
3138 if (functionDeclaration != NULL)
3140 prevDecl = functionDeclaration;
3144 ROSE_ASSERT(templateFunctionDeclaration != NULL);
3145 prevDecl = templateFunctionDeclaration;
3148 ROSE_ASSERT(prevDecl != NULL);
3155 printf (
"WARNING: Switching declaration in functionSymbol to point to the non-defining declaration \n");
3156 function_symbol->set_declaration(isSgFunctionDeclaration(func));
3157 ROSE_ASSERT(function_symbol->get_declaration() != NULL);
3162 if (nondefiningDeclaration == NULL)
3164 nondefiningDeclaration = func;
3167 ROSE_ASSERT(nondefiningDeclaration != NULL);
3168 ROSE_ASSERT(func != NULL);
3169 ROSE_ASSERT(prevDecl != NULL);
3171 func->set_firstNondefiningDeclaration(nondefiningDeclaration);
3175 ROSE_ASSERT(func->get_firstNondefiningDeclaration()->get_symbol_from_symbol_table() != NULL);
3179 if (func->get_symbol_from_symbol_table() == NULL)
3181 ROSE_ASSERT(nondefiningDeclaration != NULL);
3182 ROSE_ASSERT(func->get_firstNondefiningDeclaration() == nondefiningDeclaration);
3186 ROSE_ASSERT(scope != NULL);
3187 ROSE_ASSERT(func->get_scope() != NULL);
3188 ROSE_ASSERT(func->get_scope() == scope);
3192 if (testMemberDecl != NULL)
3194 ROSE_ASSERT(testMemberDecl->
get_scope() != NULL);
3195 ROSE_ASSERT(testMemberDecl->get_associatedClassDeclaration() != NULL);
3199 if (isSgFunctionDeclaration(func) == NULL)
3210 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3214 ROSE_ASSERT(func != NULL);
3216 ROSE_ASSERT(func->get_file_info() == NULL);
3219 ROSE_ASSERT(func->get_firstNondefiningDeclaration() != NULL);
3220 ROSE_ASSERT(func_symbol != NULL);
3221 ROSE_ASSERT(func_symbol->get_symbol_basis() == func->get_firstNondefiningDeclaration());
3222 ROSE_ASSERT(func->get_symbol_from_symbol_table() != NULL || func->get_firstNondefiningDeclaration()->get_symbol_from_symbol_table() != NULL);
3225 ROSE_ASSERT(func->get_parameterList() != NULL);
3226 delete func->get_parameterList();
3227 func->set_parameterList(NULL);
3230 if (buildTemplateInstantiation ==
true)
3236 if (buildTemplateDeclaration ==
true)
3242 ROSE_ASSERT(templateFunctionDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateFunctionDeclaration->get_templateParameters().size()));
3245 ROSE_ASSERT(templateMemberFunctionDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateMemberFunctionDeclaration->get_templateParameters().size()));
3254 i_name->set_scope(scope);
3259 printf (
"In buildNondefiningFunctionDeclaration_T(): setting the source position information (calling setTransformation()) \n");
3267 printf (
"In buildNondefiningFunctionDeclaration_T(): DONE: setting the source position information (calling setTransformation()) \n");
3270#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3272 if (SourcePositionClassificationMode != e_sourcePositionTransformation)
3274 detectTransformations_local(paralist);
3278 ASSERT_not_null(scope);
3279 ASSERT_not_null(func->get_scope());
3280 ASSERT_require(func->get_scope() == scope);
3288#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
3289 printf (
"Warning: SageBuilder::buildNondefiningFunctionDeclaration_T(): scope parameter may not be the same as the topScopeStack() (e.g. for member functions) \n");
3294 func->set_parent(scope);
3295 ASSERT_not_null(func->get_firstNondefiningDeclaration());
3300 ROSE_ASSERT(func->get_file_info() == NULL);
3305 ROSE_ASSERT(func->get_file_info() != NULL);
3307#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3309 if (SourcePositionClassificationMode != e_sourcePositionTransformation)
3311 detectTransformations_local(func);
3321 ROSE_ASSERT (f_func != NULL);
3335 ROSE_ASSERT(func->get_firstNondefiningDeclaration() != NULL);
3336 SgSymbol* symbol_from_first_nondefining_function = func->get_firstNondefiningDeclaration()->get_symbol_from_symbol_table();
3337 ROSE_ASSERT(symbol_from_first_nondefining_function != NULL);
3340 if (func != func->get_firstNondefiningDeclaration())
3342 SgSymbol* symbol_from_nondefining_function = func->get_symbol_from_symbol_table();
3343 ROSE_ASSERT(symbol_from_nondefining_function == NULL);
3347 if (isSgFunctionDeclaration(func) == NULL)
3353 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3359#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3361 if (SourcePositionClassificationMode !=e_sourcePositionTransformation)
3363 detectTransformations_local(func);
3368 if (functionConstVolatileFlags & SgMemberFunctionType::e_restrict)
3370 func->get_declarationModifier().get_typeModifier().setRestrict();
3378 unsetNodesMarkedAsModified(func);
3389 ROSE_ASSERT(funcdecl!=NULL);
3390 SgName name=funcdecl->get_name();
3392 SgType* return_type = funcType->get_return_type();
3397 ROSE_ASSERT(funcType== ref_funcType);
3402 returnFunction->set_linkage(funcdecl->get_linkage());
3403 if (funcdecl->get_declarationModifier().get_storageModifier().
isExtern() ==
true)
3405 returnFunction->get_declarationModifier().get_storageModifier().
setExtern();
3408 ROSE_ASSERT (returnFunction->get_linkage() == funcdecl->get_linkage());
3409 ROSE_ASSERT (returnFunction->get_declarationModifier().get_storageModifier().
isExtern() ==
3410 funcdecl->get_declarationModifier().get_storageModifier().
isExtern());
3419 return returnFunction;
3428 result = buildNondefiningFunctionDeclaration_T <SgProcedureHeaderStatement> (name,return_type,paralist,
false, scope, decoratorList,
false, NULL, NULL, sm);
3433 if (buildTemplateInstantiation ==
true)
3435 result = buildNondefiningFunctionDeclaration_T <SgTemplateInstantiationFunctionDecl> (name,return_type,paralist,
false, scope, decoratorList,
false, templateArgumentsList, NULL, sm);
3439 result = buildNondefiningFunctionDeclaration_T <SgFunctionDeclaration> (name,return_type,paralist,
false, scope, decoratorList,
false, NULL, NULL, sm);
3452 unsigned int memberFunctionModifiers = 0;
3466 unsigned int memberFunctionModifiers = 0;
3473 if (member_func_symbol != NULL)
3475 nondefining_decl = member_func_symbol->get_declaration();
3499 ROSE_ASSERT(result != NULL);
3519 ROSE_ASSERT(first_nondefining_declaration != NULL);
3526 SgTemplateFunctionDeclaration* result = buildDefiningFunctionDeclaration_T <SgTemplateFunctionDeclaration> (name,return_type,paralist,
false, scope, decoratorList, 0, first_nondefining_declaration, NULL);
3538 SgTemplateMemberFunctionDeclaration* result = buildDefiningFunctionDeclaration_T <SgTemplateMemberFunctionDeclaration> (name,return_type,paralist,
true, scope, decoratorList, functionConstVolatileFlags, first_nondefining_declaration, NULL);
3539 ROSE_ASSERT(result != NULL);
3541 ROSE_ASSERT(result->get_definition() != NULL);
3548 SgExprListExp* decoratorList,
unsigned int functionConstVolatileFlags,
bool buildTemplateInstantiation, SgTemplateArgumentPtrList* templateArgumentsList)
3555 if (buildTemplateInstantiation ==
true)
3558 result = buildNondefiningFunctionDeclaration_T <SgTemplateInstantiationMemberFunctionDecl> (name,return_type,paralist,
true,scope,decoratorList,functionConstVolatileFlags,templateArgumentsList,NULL,
SgStorageModifier::e_default);
3563 result = buildNondefiningFunctionDeclaration_T <SgMemberFunctionDeclaration> (name,return_type,paralist,
true,scope,decoratorList,functionConstVolatileFlags,NULL,NULL,
SgStorageModifier::e_default);
3565 ROSE_ASSERT(result != NULL);
3569 ROSE_ASSERT(ctor != NULL);
3576 ROSE_ASSERT(result->get_associatedClassDeclaration() != NULL);
3578 if (result->get_associatedClassDeclaration() == NULL)
3580 printf (
"Warning, must set the SgMemberFunctionDeclaration::associatedClassDeclaration \n");
3582 ROSE_ASSERT(scope != NULL);
3584 ROSE_ASSERT(classDefinition != NULL);
3586 ROSE_ASSERT(associatedDeclaration != NULL);
3587 SgClassDeclaration* associatedClassDeclaration = isSgClassDeclaration(associatedDeclaration);
3608 ROSE_ASSERT(result != NULL);
3610#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3614 detectTransformations_local(result);
3621 SgSymbol* associatedSymbol = scope->lookup_template_member_function_symbol(name,result->get_type(),templateParameterList);
3622 if (associatedSymbol == NULL)
3624 printf (
"ERROR: associatedSymbol == NULL \n");
3625 printf (
" --- result = %p = %s \n",result,result->
class_name().c_str());
3626 printf (
" --- scope = %p = %s \n",scope,scope->
class_name().c_str());
3627 printf (
" --- name = %s \n",name.str());
3628 printf (
" --- result->get_type() = %p = %s \n",result->get_type(),result->get_type()->
class_name().c_str());
3629 printf (
" --- result->get_type()->get_mangled() = %s \n",result->get_type()->get_mangled().str());
3631 ROSE_ASSERT(associatedSymbol != NULL);
3634 ROSE_ASSERT(ctor != NULL);
3642 ROSE_ASSERT(symbol_from_first_nondefining_function != NULL);
3648 ROSE_ASSERT(symbol_from_nondefining_function == NULL);
3651#if BUILDER_MAKE_REDUNDANT_CALLS_TO_SYMBOL_TABLE_LOOKUP
3654 if (scope->lookup_template_member_function_symbol(name,result->get_type(),templateParameterList) == NULL)
3656 printf (
"Error: scope->lookup_template_member_function_symbol(name,result->get_type()) == NULL (investigate this) \n");
3657 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());
3658 scope->
get_symbol_table()->
print(
"Error: scope->lookup_template_member_function_symbol(name,result->get_type()) == NULL (investigate this)");
3661 ROSE_ASSERT(scope->lookup_template_member_function_symbol(name,result->get_type(),templateParameterList) != NULL);
3663#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3667 detectTransformations_local(result);
3679 if (buildTemplateInstantiation ==
true)
3682 ROSE_ASSERT(templateInstantiationMemberFunctionDecl != NULL);
3686 ROSE_ASSERT(templateArgumentsList != NULL);
3687 string nameWithoutTemplateArguments = name;
3689 SgMemberFunctionType* func_type = isSgMemberFunctionType(first_nondefining_declaration->get_type());
3690 ROSE_ASSERT(func_type != NULL);
3694 if (func_symbol == NULL)
3696 printf (
"ERROR caught in SageBuilder::buildDefiningMemberFunctionDeclaration(): nameWithTemplateArguments = %s buildTemplateInstantiation = %s \n",nameWithTemplateArguments.c_str(),buildTemplateInstantiation ?
"true:" :
"false");
3697 printf (
"ERROR caught in SageBuilder::buildDefiningMemberFunctionDeclaration(): func_symbol == NULL for first_nondefining_declaration = %p = %s and func_type = %p = %s \n",
3698 templateInstantiationMemberFunctionDecl,templateInstantiationMemberFunctionDecl->
class_name().c_str(),func_type,func_type->
class_name().c_str());
3702 result = buildDefiningFunctionDeclaration_T <SgTemplateInstantiationMemberFunctionDecl> (name, return_type, paralist,
true, scope, decoratorList, functionConstVolatileFlags, templateInstantiationMemberFunctionDecl, templateArgumentsList);
3703 ROSE_ASSERT(isSgTemplateInstantiationMemberFunctionDecl(result) != NULL);
3704 ROSE_ASSERT(isSgTemplateInstantiationMemberFunctionDecl(result)->get_templateName().is_null() ==
false);
3708 ROSE_ASSERT(first_nondefining_declaration != NULL);
3714 result = buildDefiningFunctionDeclaration_T <SgMemberFunctionDeclaration> (name,return_type,paralist,
true,scope,decoratorList,functionConstVolatileFlags,first_nondefining_declaration, NULL);
3717 ROSE_ASSERT(result != NULL);
3721 ROSE_ASSERT(ctor != NULL);
3728 ROSE_ASSERT(result->get_associatedClassDeclaration() != NULL);
3738template <
class actualFunction>
3747#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
3748 printf (
"WARNING: This function for building defining function declarations has different semantics from that of the function to build defining class declarations. \n");
3751 ASSERT_not_null(first_nondefining_declaration);
3752 ASSERT_require(first_nondefining_declaration->get_firstNondefiningDeclaration() == first_nondefining_declaration);
3754 if (scope ==
nullptr)
3759 ASSERT_require(XXX_name.is_null() ==
false);
3760 ASSERT_not_null(scope);
3761 ASSERT_not_null(return_type);
3763 SgName nameWithoutTemplateArguments = XXX_name;
3764 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
3766 bool buildTemplateInstantiation = ((VariantT)actualFunction::static_variant == V_SgTemplateInstantiationFunctionDecl || (VariantT)actualFunction::static_variant == V_SgTemplateInstantiationMemberFunctionDecl);
3769 bool buildTemplateDeclaration = ((VariantT)actualFunction::static_variant == V_SgTemplateFunctionDeclaration || (VariantT)actualFunction::static_variant == V_SgTemplateMemberFunctionDeclaration);
3772 if (buildTemplateInstantiation ==
true)
3774 ASSERT_not_null(templateArgumentsList);
3776 SgTemplateArgumentPtrList & templateArgumentsList_from_first_nondefining_declaration = (isMemberFunction ==
false) ?
3778 isSgTemplateInstantiationMemberFunctionDecl(first_nondefining_declaration)->
get_templateArguments();
3780 ASSERT_not_null(templateArgumentsList);
3782 ASSERT_require(templateArgumentListsAreEquivalent ==
true);
3785 SgTemplateParameterPtrList* templateParameterList =
nullptr;
3786 if (buildTemplateDeclaration ==
true)
3789 templateParameterList = (isMemberFunction ==
false) ?
3790 &(isSgTemplateFunctionDeclaration(first_nondefining_declaration)->get_templateParameters()) :
3791 &(isSgTemplateMemberFunctionDeclaration(first_nondefining_declaration)->get_templateParameters());
3793 ASSERT_require(templateArgumentsList ==
nullptr);
3794 ASSERT_not_null(templateParameterList);
3797 if (buildTemplateInstantiation ==
true)
3799 ASSERT_not_null(templateArgumentsList);
3802 if (nameWithTemplateArguments ==
"insert < __normal_iterator< SgInitializedName ** , __type > > ")
3804 printf (
"In buildDefiningFunctionDeclaration_T(): Found function nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
3808 ASSERT_require(nameWithoutTemplateArguments.is_null() ==
false);
3809 ASSERT_require(nameWithTemplateArguments.is_null() ==
false);
3810 ASSERT_not_null(paralist);
3818 actualFunction* defining_func =
nullptr;
3824 ASSERT_not_null(first_nondefining_declaration);
3841 func_type = first_nondefining_declaration->get_type();
3842 ASSERT_not_null(func_type);
3845 ASSERT_require(func_type == first_nondefining_declaration->get_type());
3850 SgSymbol* func_symbol = scope->find_symbol_by_type_of_function<actualFunction>(nameWithTemplateArguments,func_type,templateParameterList,templateArgumentsList);
3853 ASSERT_not_null(func_symbol);
3855 if (func_symbol ==
nullptr)
3860 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");
3874 if (temp_function_sym !=
nullptr)
3876 func_type = temp_function_sym->get_declaration()->get_type();
3882 ASSERT_not_null(temp_template_sym);
3885 ASSERT_not_null(firstNondefiningFunctionDeclaration);
3888 defining_func =
new actualFunction(nameWithTemplateArguments,func_type,
nullptr);
3889 ASSERT_not_null(defining_func);
3891 ASSERT_not_null(firstNondefiningFunctionDeclaration);
3892 defining_func->set_firstNondefiningDeclaration(firstNondefiningFunctionDeclaration);
3898 if (decoratorList !=
nullptr)
3900 defining_func->set_decoratorList(decoratorList);
3905 defining_func->set_definingDeclaration(defining_func);
3909 ASSERT_not_null(func_body);
3915 if (templateFunctionDeclaration ==
nullptr)
3918 ASSERT_not_null(functionDeclaration);
3923 ASSERT_not_null(templateFunctionDeclaration);
3926 ASSERT_not_null(func_def);
3930 func_def->setCaseInsensitive(
true);
3931 func_body->setCaseInsensitive(
true);
3944 i_name->set_scope(func_def);
3947 ASSERT_not_null(variableSymbol);
3948 func_def->
insert_symbol(i_name->get_name(), variableSymbol);
3951 SgArrayType* arrayType = isSgArrayType(i_name->get_type());
3952 if (arrayType !=
nullptr)
3956 SgExpression* indexExpression = arrayType->get_index();
3958 if (indexExpression !=
nullptr)
3962 vector<SgVarRefExp* > varRefList;
3965 for (
size_t i = 0; i < varRefList.size(); i++)
3969 ASSERT_not_null(dimension_variableSymbol);
3970 ASSERT_require(dimension_variableSymbol != variableSymbol);
3973 SgSymbol* symbolFromLookup = func_def->lookup_symbol(dimension_variableSymbol->
get_name());
3974 if (symbolFromLookup !=
nullptr)
3976 SgVariableSymbol* variableSymbolFromLookup = isSgVariableSymbol(symbolFromLookup);
3977 ASSERT_not_null(variableSymbolFromLookup);
3979 varRefList[i]->set_symbol(variableSymbolFromLookup);
3980 ASSERT_require(dimension_variableSymbol != variableSymbol);
3991 defining_func->set_parent(scope);
3992 defining_func->set_scope(scope);
3994 ASSERT_not_null(defining_func->get_scope());
3996 checkThatNoTemplateInstantiationIsDeclaredInTemplateDefinitionScope(defining_func,scope);
4002 if (isMemberFunction ==
true)
4004 ASSERT_not_null(isSgMemberFunctionDeclaration(defining_func));
4011 if (buildTemplateInstantiation ==
true)
4017 if (buildTemplateDeclaration ==
true)
4023 ROSE_ASSERT(templateFunctionDeclaration ==
nullptr || (templateParameterList !=
nullptr && templateParameterList->size() == templateFunctionDeclaration->get_templateParameters().size()));
4025 ROSE_ASSERT(templateMemberFunctionDeclaration ==
nullptr || (templateParameterList !=
nullptr && templateParameterList->size() == templateMemberFunctionDeclaration->get_templateParameters().size()));
4029 if (functionConstVolatileFlags & SgMemberFunctionType::e_restrict)
4031 defining_func->get_declarationModifier().get_typeModifier().setRestrict();
4038 unsetNodesMarkedAsModified(defining_func);
4040 return defining_func;
4050 bool isTemplateInstantition = (templateInstantiationFunctionDecl != NULL) || (templateInstantiationMemberFunctionDecl != NULL);
4051 if (isTemplateInstantition ==
true)
4055 SgName templateNameWithoutArguments = name;
4061 bool isMemberFunction = (templateInstantiationMemberFunctionDecl != NULL);
4062 if (isMemberFunction ==
true)
4064 ROSE_ASSERT(templateInstantiationMemberFunctionDecl != NULL);
4065 ROSE_ASSERT(templateInstantiationFunctionDecl == NULL);
4067 if (templateInstantiationMemberFunctionDecl->
get_templateName().is_null() ==
true)
4071 templateInstantiationMemberFunctionDecl->
set_templateName(templateNameWithoutArguments);
4075 ROSE_ASSERT(templateInstantiationMemberFunctionDecl->
get_templateName().is_null() ==
false);
4079 ROSE_ASSERT(templateInstantiationFunctionDecl != NULL);
4080 ROSE_ASSERT(templateInstantiationMemberFunctionDecl == NULL);
4082 if (templateInstantiationFunctionDecl->
get_templateName().is_null() ==
true)
4086 templateInstantiationFunctionDecl->
set_templateName(templateNameWithoutArguments);
4091 ROSE_ASSERT(templateInstantiationFunctionDecl->
get_templateName().is_null() ==
false);
4101 if (buildTemplateInstantiation ==
true)
4105 ROSE_ASSERT(first_nondefining_declaration != NULL);
4107 func = buildDefiningFunctionDeclaration_T<SgTemplateInstantiationFunctionDecl>(name,return_type,paralist,
false,scope,decoratorList,0,templateInstantiationFunctionDecl, templateArgumentsList);
4109 ROSE_ASSERT(isSgTemplateInstantiationFunctionDecl(func) != NULL);
4110 ROSE_ASSERT(isSgTemplateInstantiationFunctionDecl(func)->get_templateName().is_null() ==
false);
4114 ROSE_ASSERT(first_nondefining_declaration != NULL);
4116 func = buildDefiningFunctionDeclaration_T<SgFunctionDeclaration>(name,return_type,paralist,
false,scope,decoratorList,0,first_nondefining_declaration, NULL);
4118 ROSE_ASSERT(isSgFunctionDeclaration(func) != NULL);
4133 ROSE_ASSERT(return_type != NULL);
4134 ROSE_ASSERT(parameter_list != NULL);
4150 if (func_symbol != NULL)
4152 nondefiningDeclaration = func_symbol->get_declaration();
4159 ROSE_ASSERT(nondefiningDeclaration != NULL);
4171 ASSERT_not_null(return_type);
4172 ASSERT_not_null(param_list);
4176 if (scope ==
nullptr) {
4182 nondef_decl = buildNondefiningFunctionDeclaration_T <SgProcedureHeaderStatement>
4183 ( name, return_type, param_list,
false, scope,
nullptr,
4186 ASSERT_not_null(isSgProcedureHeaderStatement(nondef_decl));
4189 nondef_decl->set_subprogram_kind(kind);
4198 ASSERT_not_null(return_type);
4199 ASSERT_not_null(parameter_list);
4203 if (scope ==
nullptr) {
4209 if (func_symbol ==
nullptr)
4211 nondef_decl = buildNondefiningFunctionDeclaration_T <SgProcedureHeaderStatement>
4212 ( name, return_type, parameter_list,
false, scope,
4217 nondef_decl = func_symbol->get_declaration();
4221 ASSERT_not_null(proc_header_stmt);
4234 ASSERT_not_null(firstNondefDecl);
4242 mlog[ERROR] <<
"unhandled subprogram kind for Fortran (or Jovial) function declaration:"
4247 func = buildDefiningFunctionDeclaration_T<SgProcedureHeaderStatement>(
SgName(name), returnType, params,
false,
4248 scope,
nullptr, 0U, firstNondefDecl,
nullptr);
4249 ASSERT_not_null(func);
4250 func->set_subprogram_kind(kind);
4261 ROSE_ASSERT(boolValue);
4272 ROSE_ASSERT(boolValue);
4280 ROSE_ASSERT(nullptrValue);
4282 return nullptrValue;
4288 ROSE_ASSERT(nullptrValue);
4290 return nullptrValue;
4296 ROSE_ASSERT(voidValue);
4304 ROSE_ASSERT(voidValue);
4312 ROSE_ASSERT(result);
4320 ROSE_ASSERT(result);
4328 ROSE_ASSERT(result);
4336 ROSE_ASSERT(result);
4345 ROSE_ASSERT(result);
4353 ROSE_ASSERT(result);
4362 ROSE_ASSERT(result);
4370 ROSE_ASSERT(result);
4379 ROSE_ASSERT(result);
4382 if (real_value != NULL)
4385 if (imaginary_value != NULL)
4388 ROSE_ASSERT(real_value == NULL || real_value->
get_parent() != NULL);
4389 ROSE_ASSERT(imaginary_value == NULL || imaginary_value->
get_parent() != NULL);
4397 ROSE_ASSERT(imaginary_value != NULL);
4399 ROSE_ASSERT(result != NULL);
4402 if (real_value != NULL)
4405 if (imaginary_value != NULL)
4408 ROSE_ASSERT(real_value == NULL || real_value->
get_parent() != NULL);
4409 ROSE_ASSERT(imaginary_value == NULL || imaginary_value->
get_parent() != NULL);
4418 ROSE_ASSERT(result);
4421 result->get_imaginary_value()->
set_parent(result);
4422 ROSE_ASSERT(result->get_imaginary_value()->
get_parent() != NULL);
4430 ROSE_ASSERT(imaginary_value != NULL);
4433 ROSE_ASSERT(result);
4437 ROSE_ASSERT(imaginary_value->
get_parent() != NULL);
4445 ROSE_ASSERT(imaginary_value != NULL);
4449 ROSE_ASSERT(result);
4452 ROSE_ASSERT(imaginary_value->
get_parent() != NULL);
4477 ROSE_ASSERT(result);
4485 ROSE_ASSERT(result);
4493 ROSE_ASSERT(result);
4508 ASSERT_not_null(intValue);
4516 ASSERT_not_null(intValue);
4524 ASSERT_not_null(intValue);
4532 ASSERT_not_null(intValue);
4545 ASSERT_not_null(intValue);
4553 ASSERT_not_null(intValue);
4561 ASSERT_not_null(intValue);
4569 ASSERT_not_null(intValue);
4577 ASSERT_not_null(enumVal);
4586 ASSERT_not_null(enumVal);
4593 ROSE_ASSERT(init_name != NULL);
4595 ROSE_ASSERT(assign_init != NULL);
4596 SgEnumVal * enum_val = isSgEnumVal(assign_init->get_operand_i());
4597 ROSE_ASSERT(enum_val != NULL);
4605 ASSERT_not_null(result);
4613 ASSERT_not_null(result);
4621 ASSERT_not_null(result);
4629 ASSERT_not_null(result);
4637 ASSERT_not_null(result);
4645 ASSERT_not_null(result);
4653 ASSERT_not_null(result);
4661 ASSERT_not_null(result);
4669 ASSERT_not_null(result);
4677 ASSERT_not_null(result);
4685 ASSERT_not_null(result);
4693 ASSERT_not_null(result);
4701 ASSERT_not_null(result);
4709 ASSERT_not_null(result);
4717 ASSERT_not_null(result);
4725 ASSERT_not_null(result);
4733 ASSERT_not_null(result);
4741 ASSERT_not_null(result);
4749 ASSERT_not_null(result);
4757 ASSERT_not_null(result);
4765 ASSERT_not_null(result);
4773 ASSERT_not_null(result);
4781 ASSERT_not_null(result);
4789 ASSERT_not_null(result);
4797 ASSERT_not_null(result);
4805 ASSERT_not_null(result);
4812 SgJovialBitVal* result =
new SgJovialBitVal(str);
4813 ASSERT_not_null(result);
4821 ASSERT_not_null (result);
4830 ROSE_ASSERT (result);
4838 ROSE_ASSERT(templateParameterValue);
4842 ROSE_ASSERT(templateParameterValue->
get_parent() == NULL);
4844 return templateParameterValue;
4850 ROSE_ASSERT(templateParameterValue);
4854 ROSE_ASSERT(templateParameterValue->
get_parent() == NULL);
4856 return templateParameterValue;
4859#define DEBUG_BUILD_NONREAL_DECL 0
4862 ROSE_ASSERT(scope != NULL);
4863#if DEBUG_BUILD_NONREAL_DECL
4864 printf(
"ENTER SageBuilder::buildNonrealDecl\n");
4865 printf(
" --- name = %s\n", name.str());
4866 printf(
" --- scope = %p (%s)\n", scope, scope->
class_name().c_str());
4874#if DEBUG_BUILD_NONREAL_DECL
4875 printf(
" --- nrdecl = %p (%s)\n", nrdecl, nrdecl->
class_name().c_str());
4880#if DEBUG_BUILD_NONREAL_DECL
4881 printf(
" --- symbol = %p (%s)\n", symbol, symbol->
class_name().c_str());
4885 type->set_declaration(nrdecl);
4887 nrdecl->set_type(type);
4889#if DEBUG_BUILD_NONREAL_DECL
4890 printf(
" --- type = %p (%s)\n", type, type->
class_name().c_str());
4893 if (child_scope == NULL) {
4895#if DEBUG_BUILD_NONREAL_DECL
4896 printf(
" --- child_scope = %p (new)\n", name.str(), child_scope);
4902#if DEBUG_BUILD_NONREAL_DECL
4903 printf(
" --- child_scope = %p (provided)\n", name.str(), child_scope);
4908 nrdecl->set_nonreal_decl_scope(child_scope);
4910#if DEBUG_BUILD_NONREAL_DECL
4911 printf(
"LEAVE SageBuilder::buildNonrealDecl\n");
4921 ROSE_ASSERT(result);
4930 ROSE_ASSERT(result);
4939 ROSE_ASSERT(result);
4948 ROSE_ASSERT(result);
4956 ROSE_ASSERT(result);
4964 ROSE_ASSERT(result);
4972 ROSE_ASSERT(result);
4980 ROSE_ASSERT(result);
4988 ROSE_ASSERT(result);
4996 ROSE_ASSERT(result);
5092#define BUILD_UNARY_DEF(suffix) \
5093 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix##_nfi(SgExpression* op) \
5095 return SageBuilder::buildUnaryExpression_nfi<Sg##suffix>(op); \
5097 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix(SgExpression* op) \
5099 return SageBuilder::buildUnaryExpression<Sg##suffix>(op); \
5102BUILD_UNARY_DEF(AddressOfOp)
5103BUILD_UNARY_DEF(BitComplementOp)
5104BUILD_UNARY_DEF(MinusOp)
5105BUILD_UNARY_DEF(NotOp)
5106BUILD_UNARY_DEF(PointerDerefExp)
5107BUILD_UNARY_DEF(UnaryAddOp)
5108BUILD_UNARY_DEF(AbsOp)
5109BUILD_UNARY_DEF(MinusMinusOp)
5110BUILD_UNARY_DEF(PlusPlusOp)
5111BUILD_UNARY_DEF(RealPartOp)
5112BUILD_UNARY_DEF(ImagPartOp)
5113BUILD_UNARY_DEF(ConjugateOp)
5114BUILD_UNARY_DEF(VarArgStartOneOperandOp)
5115BUILD_UNARY_DEF(VarArgEndOp)
5117BUILD_UNARY_DEF(MatrixTransposeOp)
5119#undef BUILD_UNARY_DEF
5122 SgType * expression_type,
5126 ROSE_ASSERT(result);
5127 if (operand_i) {operand_i->
set_parent(result); markLhsValues(result);}
5138 short int need_global_specifier,
5142 SgNewExp* result =
new SgNewExp(specified_type, placement_args, constructor_args, builtin_args, need_global_specifier, newOperatorDeclaration);
5143 ROSE_ASSERT(result);
5151 short need_global_specifier,
5155 need_global_specifier, deleteOperatorDeclaration);
5156 ROSE_ASSERT(result);
5166 ROSE_ASSERT(result != NULL);
5174 ROSE_ASSERT(result);
5175 if (operand_i) {operand_i->
set_parent(result); markLhsValues(result);}
5182 ROSE_ASSERT(result);
5183 if (operand_i) {operand_i->
set_parent(result); markLhsValues(result);}
5190 SgMinusMinusOp* result = buildUnaryExpression<SgMinusMinusOp>(operand_i);
5191 ROSE_ASSERT(result);
5198 SgMinusMinusOp* result = buildUnaryExpression_nfi<SgMinusMinusOp>(operand_i);
5199 ROSE_ASSERT(result);
5206 SgMinusOp* result = buildUnaryExpression<SgMinusOp>(operand_i);
5207 ROSE_ASSERT(result);
5214 SgMinusOp* result = buildUnaryExpression_nfi<SgMinusOp>(operand_i);
5215 ROSE_ASSERT(result);
5222 SgPlusPlusOp* result = buildUnaryExpression<SgPlusPlusOp>(operand_i);
5223 ROSE_ASSERT(result);
5231 SgPlusPlusOp* result = buildUnaryExpression_nfi<SgPlusPlusOp>(operand_i);
5232 ROSE_ASSERT(result);
5246 markLhsValues(result);
5252 operand_i -> set_parent(result);
5254 ROSE_ASSERT(result);
5261#define BUILD_BINARY_DEF(suffix) \
5262 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix##_nfi(SgExpression* lhs, SgExpression* rhs) \
5264 return buildBinaryExpression_nfi<Sg##suffix>(lhs, rhs); \
5266 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix(SgExpression* lhs, SgExpression* rhs) \
5268 return buildBinaryExpression<Sg##suffix>(lhs, rhs); \
5271BUILD_BINARY_DEF(AddOp)
5272BUILD_BINARY_DEF(AndAssignOp)
5273BUILD_BINARY_DEF(AndOp)
5274BUILD_BINARY_DEF(ArrowExp)
5275BUILD_BINARY_DEF(ArrowStarOp)
5276BUILD_BINARY_DEF(AssignOp)
5277BUILD_BINARY_DEF(AtOp)
5278BUILD_BINARY_DEF(BitAndOp)
5279BUILD_BINARY_DEF(BitOrOp)
5280BUILD_BINARY_DEF(BitXorOp)
5282BUILD_BINARY_DEF(CommaOpExp)
5283BUILD_BINARY_DEF(ConcatenationOp)
5284BUILD_BINARY_DEF(DivAssignOp)
5285BUILD_BINARY_DEF(DivideOp)
5286BUILD_BINARY_DEF(DotExp)
5287BUILD_BINARY_DEF(DotStarOp)
5288BUILD_BINARY_DEF(EqualityOp)
5290BUILD_BINARY_DEF(ExponentiationOp)
5291BUILD_BINARY_DEF(ExponentiationAssignOp)
5292BUILD_BINARY_DEF(GreaterOrEqualOp)
5293BUILD_BINARY_DEF(GreaterThanOp)
5294BUILD_BINARY_DEF(IntegerDivideOp)
5295BUILD_BINARY_DEF(IntegerDivideAssignOp)
5296BUILD_BINARY_DEF(IorAssignOp)
5297BUILD_BINARY_DEF(IsOp)
5298BUILD_BINARY_DEF(IsNotOp)
5300BUILD_BINARY_DEF(LessOrEqualOp)
5301BUILD_BINARY_DEF(LessThanOp)
5302BUILD_BINARY_DEF(LshiftAssignOp)
5303BUILD_BINARY_DEF(LshiftOp)
5305BUILD_BINARY_DEF(MembershipOp)
5306BUILD_BINARY_DEF(MinusAssignOp)
5307BUILD_BINARY_DEF(ModAssignOp)
5308BUILD_BINARY_DEF(ModOp)
5309BUILD_BINARY_DEF(MultAssignOp)
5310BUILD_BINARY_DEF(MultiplyOp)
5312BUILD_BINARY_DEF(NotEqualOp)
5313BUILD_BINARY_DEF(NonMembershipOp)
5314BUILD_BINARY_DEF(OrOp)
5315BUILD_BINARY_DEF(PlusAssignOp)
5316BUILD_BINARY_DEF(PntrArrRefExp)
5317BUILD_BINARY_DEF(RemOp)
5318BUILD_BINARY_DEF(RshiftAssignOp)
5319BUILD_BINARY_DEF(JavaUnsignedRshiftAssignOp)
5321BUILD_BINARY_DEF(RshiftOp)
5322BUILD_BINARY_DEF(JavaUnsignedRshiftOp)
5323BUILD_BINARY_DEF(ScopeOp)
5324BUILD_BINARY_DEF(SubtractOp)
5325BUILD_BINARY_DEF(XorAssignOp)
5327BUILD_BINARY_DEF(VarArgCopyOp)
5328BUILD_BINARY_DEF(VarArgStartOp)
5331BUILD_BINARY_DEF(ReplicationOp);
5334BUILD_BINARY_DEF(PowerOp);
5335BUILD_BINARY_DEF(ElementwisePowerOp);
5336BUILD_BINARY_DEF(ElementwiseMultiplyOp);
5337BUILD_BINARY_DEF(ElementwiseDivideOp);
5338BUILD_BINARY_DEF(LeftDivideOp);
5339BUILD_BINARY_DEF(ElementwiseLeftDivideOp);
5340BUILD_BINARY_DEF(ElementwiseAddOp);
5341BUILD_BINARY_DEF(ElementwiseSubtractOp);
5344BUILD_BINARY_DEF(SpaceshipOp)
5346#undef BUILD_BINARY_DEF
5354 ROSE_ASSERT(base_type != NULL);
5358 if (dim_info == NULL)
5369 ROSE_ASSERT(array_type);
5370 ROSE_ASSERT(array_type->get_dim_info() == NULL);
5375 array_type->set_dim_info(dim_info);
5376 array_type->set_rank(dim_info->get_expressions().size());
5384 ASSERT_not_null(result);
5386 if (index !=
nullptr) {
5407 if (a) {a->
set_parent(result); markLhsValues(a);}
5408 if (b) {b->
set_parent(result); markLhsValues(b);}
5416 ROSE_ASSERT(result);
5436 ASSERT_not_null(expr);
5450 ROSE_ASSERT(result);
5451 if (operand_i!=NULL)
5455 markLhsValues(result);
5464 ASSERT_not_null(result);
5469 markLhsValues(result);
5482 ROSE_ASSERT(result);
5483 if (initializers!=NULL)
5487 result->set_need_explicit_braces(
true);
5496 ROSE_ASSERT(result);
5497 if (initializers!=NULL)
5501 result->set_need_explicit_braces(
true);
5510 ROSE_ASSERT(result);
5511 if (initializers!=NULL)
5523 ROSE_ASSERT(result);
5524 if (initializers!=NULL)
5539 bool need_qualifier ,
5540 bool need_parenthesis_after_name ,
5541 bool associated_class_unknown )
5548 ROSE_ASSERT(declaration == NULL || declaration->get_associatedClassDeclaration() != NULL);
5551 need_qualifier, need_parenthesis_after_name, associated_class_unknown );
5552 ROSE_ASSERT(result != NULL);
5571 bool need_qualifier ,
5572 bool need_parenthesis_after_name ,
5573 bool associated_class_unknown )
5579 ROSE_ASSERT(declaration == NULL || declaration->get_associatedClassDeclaration() != NULL);
5582 ROSE_ASSERT(result != NULL);
5607 ROSE_ASSERT(result);
5608 if (initializers!=NULL)
5619 ROSE_ASSERT(result);
5620 if (initializers!=NULL)
5637 ROSE_ASSERT(result);
5641 markLhsValues(result);
5655 ROSE_ASSERT(result);
5659 markLhsValues(result);
5670 ROSE_ASSERT(result);
5680 ROSE_ASSERT(result);
5692 ROSE_ASSERT(result);
5696 markLhsValues(result);
5709 ROSE_ASSERT(result);
5713 markLhsValues(result);
5726 ROSE_ASSERT(result);
5730 markLhsValues(result);
5744 ROSE_ASSERT(result);
5748 markLhsValues(result);
5759 ROSE_ASSERT(result);
5768 ROSE_ASSERT(result);
5777 ROSE_ASSERT(expList);
5799 ROSE_ASSERT(expList);
5802 for (
size_t i = 0; i < exprs.size(); ++i) {
5811 ROSE_ASSERT(expList);
5820 ROSE_ASSERT(expList != NULL);
5823 for (
size_t i = 0; i < exprs.size(); ++i)
5829 testAstForUniqueNodes(expList);
5837 if (lower_bound == NULL)
5846 ROSE_ASSERT(lower_bound);
5847 ROSE_ASSERT(upper_bound);
5848 ROSE_ASSERT(stride);
5851 ROSE_ASSERT(subscript);
5865 ROSE_ASSERT(initname);
5872 if (initname->get_scope()!=NULL)
5877 varRef =
new SgVarRefExp(isSgVariableSymbol(symbol));
5879 ROSE_ASSERT(varRef);
5924 varSymbol = isSgVariableSymbol(symbol);
5932 name1->set_scope(scope);
5938 if (varSymbol == NULL)
5940 printf (
"Error: varSymbol == NULL for name = %s \n",name.str());
5942 ROSE_ASSERT(varSymbol != NULL);
5946 ROSE_ASSERT(varRef != NULL);
5948 ROSE_ASSERT (isSgVariableSymbol(varRef->get_symbol())->get_declaration()!=NULL);
5958 ROSE_ASSERT(symbol);
5968 ROSE_ASSERT(varRef);
5979 ROSE_ASSERT(varRef);
5990 ROSE_ASSERT(refexp != NULL);
6005 ROSE_ASSERT(scope != NULL);
6016 ROSE_ASSERT(isSgVariableSymbol(symbol));
6042 ROSE_ASSERT(compoundLiteral != NULL);
6046 return compoundLiteral;
6055 ROSE_ASSERT(compoundLiteral != NULL);
6059 return compoundLiteral;
6067 ROSE_ASSERT (s!= NULL);
6069 ROSE_ASSERT (result != NULL);
6078 if (paraTypeList==NULL)
return paraList;
6081 SgTypePtrList::iterator i;
6082 for (i=typeList.begin();i!=typeList.end();i++)
6095 ROSE_ASSERT (paraList);
6097 SgTypePtrList::iterator i;
6098 for (i=typeList.begin();i!=typeList.end();i++)
6110 ASSERT_not_null(funcType);
6112 ASSERT_not_null(func_type);
6114 bool isMemberFunc = isSgMemberFunctionType(func_type);
6116 if (scope ==
nullptr) {
6119 ASSERT_not_null(scope);
6121 if (symbol ==
nullptr)
6124 SgType* return_type = func_type->get_return_type();
6130 ASSERT_require(isMemberFunc ==
false);
6136 funcDecl = buildNondefiningFunctionDeclaration_T
6141 funcDecl = buildNondefiningFunctionDeclaration_T
6145 funcDecl->get_declarationModifier().get_storageModifier().
setExtern();
6148 ASSERT_not_null(symbol);
6153 ASSERT_not_null(func_ref);
6168 ROSE_ASSERT(func_decl != NULL);
6172 if (nondef_func != NULL)
6174 ROSE_ASSERT(nondef_func!= NULL);
6176 ROSE_ASSERT( symbol != NULL);
6179 else if (def_func != NULL)
6185 std::cerr<<
"Fatal error: SageBuilder::buildFunctionRefExp():defining and nondefining declarations for a function cannot be both NULL"<<std::endl;
6188 ROSE_ASSERT( symbol != NULL);
6199 ROSE_ASSERT(func_ref);
6209 ROSE_ASSERT(func_ref);
6218 ROSE_ASSERT(sym != NULL);
6221 ROSE_ASSERT(func_ref != NULL);
6226 ROSE_ASSERT(func_ref->get_symbol() != NULL);
6237 ROSE_ASSERT(func_ref);
6247 ROSE_ASSERT(func_ref);
6257 ROSE_ASSERT(func_ref);
6267 ROSE_ASSERT(class_ref);
6276 ROSE_ASSERT(class_ref);
6286 ROSE_ASSERT(scope != NULL);
6300 printf (
"Error: buildFunctionRefExp(): This function should not be used! \n");
6311 funcDecl->get_declarationModifier().get_storageModifier().
setExtern();
6314 ROSE_ASSERT(symbol);
6320 ROSE_ASSERT(func_ref);
6336 ROSE_ASSERT(expStmt);
6346 ROSE_ASSERT(expStmt);
6357 ROSE_ASSERT(expStmt);
6369 ROSE_ASSERT(expStmt);
6379 if (scope ==
nullptr) {
6382 ASSERT_not_null(scope);
6384 if (parameters ==
nullptr) {
6395 ASSERT_not_null(func_call_expr);
6397 return func_call_expr;
6405 ROSE_ASSERT (sym != NULL);
6406 if (parameters == NULL)
6408 ROSE_ASSERT (parameters != NULL);
6415 if (memberFunctionSymbol != NULL)
6418 bool virtual_call =
false;
6421 bool need_qualifier =
false;
6439 ROSE_ASSERT(func_call_expr);
6440 return func_call_expr;
6446 ROSE_ASSERT(f != NULL);
6448 ROSE_ASSERT(func_call_expr != NULL);
6453 if (parameters != NULL) {
6458 return func_call_expr;
6464 ROSE_ASSERT(f != NULL);
6466 ROSE_ASSERT(func_call_expr != NULL);
6469 if (parameters) parameters->
set_parent(func_call_expr);
6472 return func_call_expr;
6483 ROSE_ASSERT(scope != NULL);
6509 std::string functionName,
6515 ROSE_ASSERT(classSymbol);
6519 ROSE_ASSERT(classDeclaration != NULL);
6522 ROSE_ASSERT(classDefinition);
6526 ROSE_ASSERT(functionSymbol);
6549 ROSE_ASSERT(builtin_func_call_expr != NULL);
6551 SgNodePtrList & args = builtin_func_call_expr->get_args();
6552 for (SgNodePtrList::iterator it = parameters.begin(); it != parameters.end(); ++it) {
6553 args.push_back(*it);
6554 (*it)->set_parent(builtin_func_call_expr);
6557 return builtin_func_call_expr;
6564 ROSE_ASSERT(kernel);
6565 ROSE_ASSERT(parameters);
6566 ROSE_ASSERT(config);
6571 if (func_ref_exp == NULL && template_func_ref_exp == NULL)
6573 std::cerr <<
"SgCudaKernelCallExp accept only direct reference to a function. Got, " <<
typeid(*kernel).name()
6580 else if ( (func_ref_exp != NULL && func_ref_exp->get_symbol_i()->get_declaration()->get_functionModifier().isCudaKernel() ==
false) &&
6581 (template_func_ref_exp != NULL && template_func_ref_exp->get_symbol_i()->get_declaration()->get_functionModifier().isCudaKernel() ==
false) )
6583 std::cerr <<
"To build a SgCudaKernelCallExp the callee needs to be a kernel (having \"__global__\" attribute)." << std::endl;
6595 ROSE_ASSERT(kernel_call_expr);
6597 return kernel_call_expr;
6602 if (!grid || !blocks) {
6603 std::cerr <<
"SgCudaKernelExecConfig need fields 'grid' and 'blocks' to be set." << std::endl;
6620 ROSE_ASSERT(config);
6629 ROSE_ASSERT(lhs != NULL);
6630 ROSE_ASSERT(rhs != NULL);
6635 ROSE_ASSERT(assignOp);
6656 ROSE_ASSERT(lhs != NULL);
6657 ROSE_ASSERT(rhs != NULL);
6662 ROSE_ASSERT(assignOp);
6689 ROSE_ASSERT(labelstmt);
6709 ASSERT_not_null(labelStmt);
6712 if (stmt !=
nullptr) {
6726 ROSE_ASSERT(conditional);
6727 ROSE_ASSERT(true_body);
6729 ROSE_ASSERT(ifstmt);
6734 ifstmt->setCaseInsensitive(
true);
6739 if (false_body != NULL) false_body->
set_parent(ifstmt);
6749 if (isSgBasicBlock(true_body)|| isSgFortranDo(true_body)|| isSgIfStmt(true_body))
6762 ROSE_ASSERT(ifstmt);
6777 ASSERT_not_null(result);
6780 result->setCaseInsensitive(
true);
6787 increment->set_parent(result);
6801 ASSERT_not_null(result);
6804 result->setCaseInsensitive(
true);
6811 increment->set_parent(result);
6834 ROSE_ASSERT(forInit != NULL);
6836 ROSE_ASSERT(statement != NULL);
6837 forInit->append_init_stmt(statement);
6851 (*it)->set_parent(result);
6866 (*it)->set_parent(result);
6880 ROSE_ASSERT(result);
6883 result->setCaseInsensitive(
true);
6891 increment->set_parent(result);
6895 result->set_else_body(else_body);
6910 for_init_stmt->set_parent(result);
6915 ROSE_ASSERT(init_stmt);
6929 if (initialize_stmt)
6931 init_stmt->append_init_stmt(initialize_stmt);
6934 if (isSgVariableDeclaration(initialize_stmt))
6952 ROSE_ASSERT(result);
6957 result->setCaseInsensitive(
true);
6961 if (loop_body) loop_body->
set_parent(result);
6962 if (increment) increment->set_parent(result);
6963 if (else_body) else_body->
set_parent(result);
6965 result->set_else_body(else_body);
6967 if (initialize_stmt != NULL)
6970 ROSE_ASSERT(init_stmt);
6972 init_stmt->append_init_stmt(initialize_stmt);
6984 ROSE_ASSERT(result != NULL);
7000 ROSE_ASSERT(result != NULL);
7009 if (result->get_test() != NULL && test != result->get_test())
7011 delete result->get_test();
7012 result->set_test(NULL);
7015 if (result->get_increment() != NULL && increment != result->get_increment())
7017 delete result->get_increment();
7018 result->set_increment(NULL);
7027 if (result->get_else_body() != NULL && else_body != result->get_else_body())
7029 delete result->get_else_body();
7030 result->set_else_body(NULL);
7034 result->set_test(test);
7035 result->set_increment(increment);
7039 result->setCaseInsensitive(
true);
7043 if (loop_body) loop_body->
set_parent(result);
7044 if (increment) increment->set_parent(result);
7045 if (init_stmt) init_stmt->
set_parent(result);
7046 if (else_body) else_body->
set_parent(result);
7048 result->set_else_body(else_body);
7051 ROSE_ASSERT(result->get_test() != NULL);
7052 ROSE_ASSERT(result->get_increment() != NULL);
7076 ROSE_ASSERT(result != NULL);
7080 if (initializer != NULL) initializer->
set_parent(result);
7081 if (range != NULL) range->
set_parent(result);
7083 if (begin_declaration != NULL) begin_declaration->
set_parent(result);
7084 if (end_declaration != NULL) end_declaration->
set_parent(result);
7086 if (not_equal_expression != NULL) not_equal_expression->
set_parent(result);
7087 if (increment_expression != NULL) increment_expression->
set_parent(result);
7103 ASSERT_not_null(result);
7104 ASSERT_not_null(body);
7105 ASSERT_not_null(condition);
7107 ASSERT_require(result->
get_body() ==
nullptr);
7118 ASSERT_not_null(result->
get_body());
7132 ROSE_ASSERT(result);
7135 if (loop_body) loop_body->
set_parent(result);
7136 if (increment) increment->set_parent(result);
7139 if (initialize_stmt != NULL) {
7141 ROSE_ASSERT(init_stmt);
7143 init_stmt->append_init_stmt(initialize_stmt);
7154 ROSE_ASSERT(result);
7159 result->setCaseInsensitive(
true);
7163 if (loop_body) loop_body->
set_parent(result);
7164 if (increment) increment->set_parent(result);
7166 if (init_stmt) init_stmt->
set_parent(result);
7229 ROSE_ASSERT(condition);
7232 ROSE_ASSERT(result);
7237 result->setCaseInsensitive(
true);
7244 if (else_body != NULL) {
7245 result->set_else_body(else_body);
7257 ROSE_ASSERT(result);
7262 result->setCaseInsensitive(
true);
7265 if (condition) condition->
set_parent(result);
7269 if (else_body != NULL)
7271 result->set_else_body(else_body);
7285 ROSE_ASSERT(expr != NULL && body != NULL);
7296 ROSE_ASSERT(expr != NULL && body != NULL);
7307 ROSE_ASSERT(condition);
7310 ROSE_ASSERT(result);
7320 ROSE_ASSERT(result);
7322 if (condition) condition->
set_parent(result);
7332 ROSE_ASSERT(result != NULL);
7343 ROSE_ASSERT(result);
7351 ROSE_ASSERT(result);
7359 ASSERT_not_null(result);
7367 ASSERT_not_null(result);
7375 ASSERT_not_null(result);
7383 ASSERT_not_null(result);
7391 ROSE_ASSERT(result);
7399 ROSE_ASSERT(result);
7406 SgDeleteExp *result =
new SgDeleteExp(target, is_array, need_global_specifier, deleteOperatorDeclaration);
7407 target->set_parent(result);
7414 SgDeleteExp *result =
new SgDeleteExp(target, is_array, need_global_specifier, deleteOperatorDeclaration);
7415 target->set_parent(result);
7423 ROSE_ASSERT(test != NULL);
7436 ROSE_ASSERT(result);
7440 markLhsValues(result);
7450 ROSE_ASSERT(test != NULL);
7452 if (exceptionArgument != NULL) {
7453 result -> set_exception_argument(exceptionArgument);
7463 ROSE_ASSERT(test != NULL);
7471 ROSE_ASSERT(value != NULL);
7480 ROSE_ASSERT(value != NULL);
7489 ROSE_ASSERT(key != NULL && datum != NULL);
7499 ROSE_ASSERT(key != NULL && datum != NULL);
7510 ROSE_ASSERT(result);
7511 for (
size_t i = 0; i < pairs.size(); ++i)
7512 result->append_pair(pairs[i]);
7520 ROSE_ASSERT(result);
7521 for (
size_t i = 0; i < pairs.size(); ++i)
7522 result->append_pair(pairs[i]);
7530 ROSE_ASSERT(target != NULL);
7531 ROSE_ASSERT(iter != NULL);
7533 ROSE_ASSERT(result);
7535 target->set_parent(result);
7546 ROSE_ASSERT(target != NULL);
7547 ROSE_ASSERT(iter != NULL);
7549 ROSE_ASSERT(result);
7550 target->set_parent(result);
7560 ROSE_ASSERT(elt != NULL);
7561 ROSE_ASSERT(generators != NULL);
7572 ROSE_ASSERT(elt != NULL);
7573 ROSE_ASSERT(generators != NULL);
7584 ROSE_ASSERT(elt != NULL);
7585 ROSE_ASSERT(generators != NULL);
7596 ROSE_ASSERT(elt != NULL);
7597 ROSE_ASSERT(generators != NULL);
7608 ROSE_ASSERT(kd_pair != NULL);
7609 ROSE_ASSERT(generators != NULL);
7620 ROSE_ASSERT(kd_pair != NULL);
7621 ROSE_ASSERT(generators != NULL);
7631 ROSE_ASSERT(arg != NULL);
7640 ROSE_ASSERT(arg != NULL);
7654 ROSE_ASSERT(pragma);
7659 ROSE_ASSERT(result);
7681 ROSE_ASSERT(result);
7691 ROSE_ASSERT(emptyDeclaration != NULL);
7704 ROSE_ASSERT(emptyDeclaration->
get_parent() != NULL);
7707 return emptyDeclaration;
7714 ROSE_ASSERT(result);
7719 result->setCaseInsensitive(
true);
7739 ROSE_ASSERT(result);
7745 result->setCaseInsensitive(
true);
7751 printf (
"In buildBasicBlock_nfi(): returning result = %p \n",result);
7763 printf (
"In buildBasicBlock_nfi(const vector<SgStatement*>& stmts): returning result = %p \n",result);
7767 printf (
"Exiting as a test! \n");
7790 ROSE_ASSERT(result);
7799 ROSE_ASSERT (symbol != NULL);
7805 result->set_label_expression(l_exp);
7810 ROSE_ASSERT (l_stmt != NULL);
7813 ROSE_ASSERT(result);
7821 ROSE_ASSERT(result);
7832 result->set_selector_expression(label_expression);
7833 ROSE_ASSERT(result);
7845 if (expression == NULL)
7850 ROSE_ASSERT(result);
7851 if (expression != NULL) expression->
set_parent(result);
7860 ROSE_ASSERT(result);
7861 if (expression != NULL) expression->
set_parent(result);
7869 ROSE_ASSERT(result);
7879 ROSE_ASSERT(result);
7889 ROSE_ASSERT(result);
7894 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7895 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7896 printf (
"SageBuilder::buildDefaultOptionStmt() body = %p \n",body);
7897 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7898 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7907 ROSE_ASSERT(result);
7912 static int count = 0;
7914 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7915 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7916 printf (
"SageBuilder::buildDefaultOptionStmt_nfi() body = %p \n",body);
7917 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7918 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7922 printf (
"Exiting as a test! \n");
7934 ROSE_ASSERT(result);
7939 result->setCaseInsensitive(
true);
7942 if (item_selector) item_selector->
set_parent(result);
7951 ROSE_ASSERT(result);
7956 result->setCaseInsensitive(
true);
7959 if (item_selector) item_selector->
set_parent(result);
7974 ROSE_ASSERT(result);
7984 ROSE_ASSERT(result);
7993 if (locals != NULL && globals == NULL)
7994 ROSE_ASSERT(!
"buildExecStatement with non-NULL locals requires non-NULL globals");
7995 ROSE_ASSERT(executable != NULL);
7999 if (globals != NULL) globals->
set_parent(result);
8000 if (locals != NULL) locals->
set_parent(result);
8010 if (locals != NULL && globals == NULL)
8011 ROSE_ASSERT(!
"buildExecStatement with non-NULL locals requires non-NULL globals");
8012 ROSE_ASSERT(executable != NULL);
8016 if (globals != NULL) globals->
set_parent(result);
8017 if (locals != NULL) locals->
set_parent(result);
8026 ROSE_ASSERT(body != NULL);
8028 ROSE_ASSERT(async_stmt);
8038 ROSE_ASSERT(body != NULL);
8040 ROSE_ASSERT(finish_stmt);
8050 ROSE_ASSERT(expression);
8063 ROSE_ASSERT(body != NULL);
8065 ROSE_ASSERT(atomic_stmt);
8075 ROSE_ASSERT(expression);
8088 ROSE_ASSERT(expression);
8101 ROSE_ASSERT(expression);
8133 ROSE_ASSERT(body != NULL);
8152 if (catch0 != NULL) try_stmt->append_catch_statement(catch0);
8153 if (catch1 != NULL) try_stmt->append_catch_statement(catch1);
8154 if (catch2 != NULL) try_stmt->append_catch_statement(catch2);
8155 if (catch3 != NULL) try_stmt->append_catch_statement(catch3);
8156 if (catch4 != NULL) try_stmt->append_catch_statement(catch4);
8173 ROSE_ASSERT(try_body != NULL);
8175 try_body -> set_parent(try_stmt);
8181 try_stmt -> set_finally_body(finally_body);
8182 finally_body -> set_parent(try_stmt);
8196 if (catch_option_stmt) {
8197 catch_statement_sequence -> append_catch_statement(catch_option_stmt);
8198 catch_option_stmt -> set_parent(catch_statement_sequence);
8201 return catch_statement_sequence;
8208 if (condition) condition->
set_parent(result);
8216 ROSE_ASSERT(expression);
8231 ROSE_ASSERT(throw_stmt);
8243 ROSE_ASSERT(foreach_stmt);
8245 if (collection) collection -> set_parent(foreach_stmt);
8246 if (body) body -> set_parent(foreach_stmt);
8248 return foreach_stmt;
8254 ROSE_ASSERT(label_stmt);
8258 stmt -> set_parent(label_stmt);
8264 ROSE_ASSERT(lsymbol);
8265 label_stmt -> insert_symbol(lsymbol ->
get_name(), lsymbol);
8315 ROSE_ASSERT(result);
8316 result->set_assemblyCode(s);
8327 ROSE_ASSERT(result);
8328 result->set_assemblyCode(s);
8338#define NOP_1_BYTE_STRING "nop"
8339#define NOP_2_BYTE_STRING ".byte 0x66,0x90"
8340#define NOP_3_BYTE_STRING "nopl (%eax)"
8341#define NOP_4_BYTE_STRING "nopl 0x01(%eax)"
8342#define NOP_5_BYTE_STRING ".byte 0x0f,0x1f,0x44,0x00,0x00"
8343#define NOP_6_BYTE_STRING ".byte 0x66,0x0f,0x1f,0x44,0x00,0x00"
8344#define NOP_7_BYTE_STRING ".byte 0x0f,0x1f,0x80,0x00,0x00,0x00,0x00"
8345#define NOP_8_BYTE_STRING ".byte 0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00"
8346#define NOP_9_BYTE_STRING ".byte 0x66,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00"
8366 printf (
"Only supporting values of multi-byte nop's up to 9 bytes long. \n");
8371 return nopStatement;
8378 ROSE_ASSERT(condition != NULL);
8381 ROSE_ASSERT(result != NULL);
8398 ROSE_ASSERT(result != NULL);
8430 if (isSgReferenceType (base_type))
8432 cerr<<
"Error in SageBuilder::buildPointerType(): trying to build a pointer to a reference type! This is not allowed in C++."<<endl;
8437 ROSE_ASSERT(result != NULL);
8451 ROSE_ASSERT(result != NULL);
8458 ROSE_ASSERT(base_type != NULL);
8460 ROSE_ASSERT(result != NULL);
8467 ROSE_ASSERT(base_expression != NULL);
8471 if (isSgFunctionParameterRefExp(base_expression) != NULL)
8474 result->set_base_type(base_type);
8481 ROSE_ASSERT(result != NULL);
8494#define DEBUG_TYPEOF_TYPE 0
8496#if DEBUG_TYPEOF_TYPE
8497 printf (
"In SageBuilder::buildTypeOfType(): base_expression = %p = %s \n",base_expression,base_expression != NULL ? base_expression->
class_name().c_str() :
"NULL");
8498 printf (
" ------------------------------- base_type = %p = %s \n",base_type,base_type != NULL ? base_type->
class_name().c_str() :
"NULL");
8502 if (isSgFunctionParameterRefExp(base_expression) != NULL)
8504#if DEBUG_TYPEOF_TYPE
8505 printf (
"In SageBuilder::buildTypeOfType(): isSgFunctionParameterRefExp(base_expression) != NULL: calling new SgTypeOfType(base_expression,NULL) \n");
8510 ROSE_ASSERT(result != NULL);
8511#if DEBUG_TYPEOF_TYPE
8512 printf (
"In buildTypeOfType(): test 1: result = %p = %s \n",result,result->class_name().c_str());
8514 result->set_base_type(base_type);
8518 if (base_expression != NULL)
8520#if DEBUG_TYPEOF_TYPE
8521 printf (
"In SageBuilder::buildTypeOfType(): isSgFunctionParameterRefExp(base_expression) == NULL: base_expression != NULL: calling SgTypeOfType::createType(base_expression,NULL) \n");
8526 ROSE_ASSERT(result != NULL);
8527#if DEBUG_TYPEOF_TYPE
8528 printf (
"In buildTypeOfType(): test 2: result = %p = %s \n",result,result->class_name().c_str());
8533 ROSE_ASSERT(base_type != NULL);
8535#if DEBUG_TYPEOF_TYPE
8536 printf (
"In SageBuilder::buildTypeOfType(): isSgFunctionParameterRefExp(base_expression) == NULL: base_expression == NULL: calling SgTypeOfType::createType(base_type,NULL) \n");
8541 ROSE_ASSERT(result != NULL);
8543#if DEBUG_TYPEOF_TYPE
8544 printf (
"In buildTypeOfType(): test 3: result = %p = %s \n",result,result->class_name().c_str());
8547 if (result->get_base_type() != base_type)
8549 ROSE_ASSERT(result->get_base_type() != NULL);
8550#if DEBUG_TYPEOF_TYPE
8551 printf (
"result->get_base_type() = %p = %s \n",result->get_base_type(),result->get_base_type()->class_name().c_str());
8553 ROSE_ASSERT(base_type != NULL);
8554#if DEBUG_TYPEOF_TYPE
8555 printf (
"base_type = %p = %s \n",base_type,base_type->
class_name().c_str());
8561 ROSE_ASSERT(result != NULL);
8563 if (base_expression != NULL)
8569 ROSE_ASSERT(result != NULL);
8571#if DEBUG_TYPEOF_TYPE
8572 printf (
"In buildTypeOfType(): test 4: result = %p = %s \n",result,result->class_name().c_str());
8586 printf (
"Error: this function SageBuilder::buildModifierType() should not be called! (call the buildConst() function (or whatever other function is required) directly \n");
8593 ROSE_ASSERT(result != NULL);
8598 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
8607 ROSE_ASSERT(result);
8608 if (kind_expr != NULL) kind_expr->
set_parent(result);
8618 ROSE_ASSERT(result);
8625 ROSE_ASSERT(result);
8630#define BUILD_SGTYPE_DEF(item) \
8631 SgType##item * SageBuilder::build##itemType() { \
8632 SgType##item * result =SgType##item::createType(); \
8633 ROSE_ASSERT(result); \
8637 BUILD_SGTYPE_DEF(Bool)
8638 BUILD_SGTYPE_DEF(Char)
8639 BUILD_SGTYPE_DEF(Double)
8640 BUILD_SGTYPE_DEF(Float)
8641 BUILD_SGTYPE_DEF(Int)
8642 BUILD_SGTYPE_DEF(Long)
8643 BUILD_SGTYPE_DEF(LongDouble)
8644 BUILD_SGTYPE_DEF(LongLong)
8645 BUILD_SGTYPE_DEF(Short)
8646 BUILD_SGTYPE_DEF(Void)
8648 BUILD_SGTYPE_DEF(Wchar)
8651 BUILD_SGTYPE_DEF(Char16)
8652 BUILD_SGTYPE_DEF(Char32)
8654 BUILD_SGTYPE_DEF(SignedChar)
8655 BUILD_SGTYPE_DEF(SignedInt)
8656 BUILD_SGTYPE_DEF(SignedLong)
8657 BUILD_SGTYPE_DEF(SignedShort)
8658 BUILD_SGTYPE_DEF(UnsignedChar)
8659 BUILD_SGTYPE_DEF(UnsignedInt)
8660 BUILD_SGTYPE_DEF(UnsignedLong)
8661 BUILD_SGTYPE_DEF(UnsignedLongLong)
8662 BUILD_SGTYPE_DEF(UnsignedShort)
8663#undef BUILD_SGTYPE_DEF
8668 ROSE_ASSERT(result);
8675 ROSE_ASSERT(result);
8682 ROSE_ASSERT(result);
8689 ROSE_ASSERT(result);
8697 ROSE_ASSERT(result);
8698 if (kind_expr != NULL) kind_expr->
set_parent(result);
8709 ROSE_ASSERT(result);
8715 ROSE_ASSERT(result);
8721 ROSE_ASSERT(result);
8728 ROSE_ASSERT(result);
8735 ROSE_ASSERT(result);
8742 ROSE_ASSERT(result);
8749 ROSE_ASSERT(result);
8757 ROSE_ASSERT(result);
8764 ROSE_ASSERT(result);
8773 ROSE_ASSERT(result);
8781 ROSE_ASSERT(result);
8789 ROSE_ASSERT(result);
8797 ROSE_ASSERT(result);
8804 ROSE_ASSERT(result);
8811 ROSE_ASSERT(result);
8818 ROSE_ASSERT(result);
8825 ROSE_ASSERT(result);
8832 ROSE_ASSERT(result);
8839 ROSE_ASSERT(result);
8851 ROSE_ASSERT(result != NULL);
8866 SgTypeString* result = SgTypeString::createType(stringLengthExpression);
8867 ASSERT_not_null(result);
8875 if (kind_expr != NULL)
8884 ASSERT_not_null(result);
8895 ROSE_ASSERT(result);
8903 if (kind_expr != NULL)
8912 ASSERT_not_null(result);
8918 ASSERT_not_null(result);
8926 ROSE_ASSERT(result);
8949 ROSE_ASSERT(base_type != NULL);
8953 ROSE_ASSERT(result != NULL);
8956 ROSE_ASSERT(result != base_type);
8961 SgModifierType* result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8963 if (result != result2)
8966 printf (
"WARNING: In SageBuilder::buildModifierType(): using previously build SgModifierType from global type table: result2 = %p = %s \n",result2,result2->
class_name().c_str());
8971 ROSE_ASSERT(result2 != base_type);
8980 ROSE_ASSERT(base_type != NULL);
8984 ROSE_ASSERT(result!=NULL);
8990 SgModifierType *result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
8992 if (result != result2)
8998 ROSE_ASSERT(result2 != base_type);
9008 ROSE_ASSERT(base_type != NULL);
9011 ROSE_ASSERT(result != NULL);
9013 result->set_type_kind(kindExpression);
9016 printf (
"In SageBuilder::buildFortranKindType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9019 SgModifierType *result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9021 if (result != result2)
9025 printf (
"(debugging) In SageBuilder::buildFortranKindType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9039 ROSE_ASSERT(base_type != NULL);
9042 ROSE_ASSERT(result!=NULL);
9047 printf (
"In SageBuilder::buildVolatileType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9053 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9054 if (result != result2)
9058 printf (
"(debugging) In SageBuilder::buildVolatileType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9072 ROSE_ASSERT(base_type != NULL);
9075 ROSE_ASSERT(result!=NULL);
9081 printf (
"In SageBuilder::buildConstVolatileType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9087 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9088 if (result != result2)
9092 printf (
"(debugging) In SageBuilder::buildConstVolatileType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9102generate_type_list (
SgType* type)
9105 string returnString;
9107 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);
9109 SgType* currentType = type;
9118 while (currentType != NULL)
9122 printf (
"In generate_type_list(): returnString = %s \n",returnString.c_str());
9124 if ( (bit_array & SgType::STRIP_MODIFIER_TYPE) && (modType = isSgModifierType(currentType)) )
9126 currentType = modType->get_base_type();
9128 else if ( (bit_array & SgType::STRIP_REFERENCE_TYPE) && (refType = isSgReferenceType(currentType)) )
9130 currentType = refType->get_base_type();
9132 else if ( (bit_array & SgType::STRIP_RVALUE_REFERENCE_TYPE) && (rRefType = isSgRvalueReferenceType(currentType)) )
9134 currentType = rRefType->get_base_type();
9136 else if ( (bit_array & SgType::STRIP_POINTER_TYPE) && (pointType = isSgPointerType(currentType)) )
9138 currentType = pointType->get_base_type();
9140 else if ( (bit_array & SgType::STRIP_ARRAY_TYPE) && (arrayType = isSgArrayType(currentType)) )
9142 currentType = arrayType->get_base_type();
9144 else if ( (bit_array & SgType::STRIP_TYPEDEF_TYPE) && (typedefType = isSgTypedefType(currentType)) )
9154 returnString +=
" , ";
9157 return returnString;
9164 ROSE_ASSERT(base_type != NULL);
9171 if (!isSgPointerType(base_type) && !isSgReferenceType(base_type) && !isSgArrayType(base_type) && !isSgTypedefType(base_type) && !isSgModifierType(base_type))
9173 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());
9174 printf (
" --- generate_type_list() = %s \n",generate_type_list(base_type).c_str());
9179 ROSE_ASSERT(result!=NULL);
9184 printf (
"In SageBuilder::buildRestrictType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9190 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9191 if (result != result2)
9195 printf (
"(debugging) In SageBuilder::buildRestrictType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9211 ASSERT_not_null(base_type);
9215 setModifiers(result);
9217 SgModifierType* result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9218 if (result != result2)
delete result;
9229 return _buildModifierType(base_type, op);
9236 return _buildModifierType(base_type, op);
9245 ROSE_ASSERT(base_type != NULL);
9248 ROSE_ASSERT(result!=NULL);
9253 printf (
"In SageBuilder::buildUpcStrictType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9259 SgModifierType *result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9260 if (result != result2)
9264 printf (
"(debugging) In SageBuilder::buildUpcStrictType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9278 ROSE_ASSERT(base_type != NULL);
9281 ROSE_ASSERT(result!=NULL);
9286 printf (
"In SageBuilder::buildUpcRelaxedType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9292 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9293 if (result != result2)
9297 printf (
"(debugging) In SageBuilder::buildUpcRelaxedType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9311 ROSE_ASSERT(base_type != NULL);
9314 ROSE_ASSERT(result!=NULL);
9323 printf (
"In SageBuilder::buildUpcSharedType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9329 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9330 if (result != result2)
9334 printf (
"(debugging) In SageBuilder::buildUpcSharedType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9348 ROSE_ASSERT(base_type != NULL);
9351 ROSE_ASSERT(result!=NULL);
9356 printf (
"In SageBuilder::buildUpcBlockIndefiniteType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9362 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
9372 ROSE_ASSERT(base_type != NULL);
9375 ROSE_ASSERT(result!=NULL);
9380 printf (
"In SageBuilder::buildUpcBlockStarType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9386 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
9396 ROSE_ASSERT(base_type != NULL);
9399 ROSE_ASSERT(result!=NULL);
9404 printf (
"In SageBuilder::buildUpcBlockNumberType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9410 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
9421 ROSE_ASSERT(base_type != NULL);
9424 ROSE_ASSERT(result!=NULL);
9432 ROSE_ASSERT(base_type != NULL);
9435 ROSE_ASSERT(result!=NULL);
9443 ROSE_ASSERT(result != NULL);
9451 ROSE_ASSERT(result != NULL);
9453 if(t1) result->append_type(t1);
9454 if(t2) result->append_type(t2);
9455 if(t3) result->append_type(t3);
9456 if(t4) result->append_type(t4);
9457 if(t5) result->append_type(t5);
9458 if(t6) result->append_type(t6);
9459 if(t7) result->append_type(t7);
9460 if(t8) result->append_type(t8);
9461 if(t9) result->append_type(t9);
9462 if(t10) result->append_type(t10);
9473 nrdecl->set_is_template_param (
true);
9474 return nrdecl->get_type();
9481 ROSE_ASSERT(result != NULL);
9483 result->append(start);
9491 ROSE_ASSERT(result != NULL);
9493 result->set_start(start);
9496 result->set_end(end);
9499 result->set_stride(stride);
9510 result->append_expression(firstRow);
9511 ROSE_ASSERT(result != NULL);
9521 ROSE_ASSERT(result != NULL);
9531 ROSE_ASSERT (result != NULL);
9532 result->set_modifier (mtype);
9565 ROSE_ASSERT(expr != NULL);
9577 ROSE_ASSERT(expr != NULL);
9588 ROSE_ASSERT(expr != NULL);
9591 if (lambda_capture_list != NULL)
9596 if (lambda_closure_class != NULL)
9601 if (lambda_function != NULL)
9606 if (lambda_closure_class != NULL)
9608 lambda_function->
set_parent(lambda_closure_class);
9612 printf (
"Warning: In SageBuilder::buildLambdaExp(): lambda_closure_class == NULL: lambda_function parent not set! \n");
9625 ROSE_ASSERT(expr != NULL);
9628 if (lambda_capture_list != NULL)
9633 if (lambda_closure_class != NULL)
9638 if (lambda_function != NULL)
9643 if (lambda_closure_class != NULL)
9645 lambda_function->
set_parent(lambda_closure_class);
9649 printf (
"Warning: In SageBuilder::buildLambdaExp(): lambda_closure_class == NULL: lambda_function parent not set! \n");
9663 ROSE_ASSERT(lambdaCapture != NULL);
9666 return lambdaCapture;
9673 ROSE_ASSERT(lambdaCapture != NULL);
9676 return lambdaCapture;
9683 ROSE_ASSERT(lambdaCapture != NULL);
9686 return lambdaCapture;
9693 ROSE_ASSERT(lambdaCapture != NULL);
9696 return lambdaCapture;
9704 ROSE_ASSERT(lambdaCaptureList != NULL);
9707 return lambdaCaptureList;
9714 ROSE_ASSERT(lambdaCaptureList != NULL);
9717 return lambdaCaptureList;
9725 ROSE_ASSERT(result != NULL);
9735 ROSE_ASSERT(result != NULL);
9746 ROSE_ASSERT(result != NULL);
9755 ROSE_ASSERT(result != NULL);
9766 ROSE_ASSERT(result != NULL);
9776 ROSE_ASSERT(result != NULL);
9798 ROSE_ASSERT(result);
9811 return nonreal_decl_scope;
9822 ROSE_ASSERT(buildTemplateInstantiation ==
false || isSgTemplateInstantiationDecl(d) != NULL);
9831 ROSE_ASSERT(result);
9837 result->setCaseInsensitive(
true);
9855 ROSE_ASSERT(buildTemplateInstantiation ==
false || isSgTemplateInstantiationDecl(d) != NULL);
9864 ROSE_ASSERT(result);
9869 result->setCaseInsensitive(
true);
9879 SgName nameWithoutTemplateArguments = XXX_name;
9881 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
9886#define DEBUG_NONDEFINING_CLASS_DECLARATION 0
9889#if DEBUG_NONDEFINING_CLASS_DECLARATION
9890 printf (
"Building a SgClassDeclaration: buildNondefiningClassDeclaration_nfi() nameWithoutTemplateArguments = %s buildTemplateInstantiation = %s \n",nameWithoutTemplateArguments.str(),buildTemplateInstantiation ?
"true:" :
"false");
9891 printf (
" --- scope = %p = %s \n",scope,(scope != NULL) ? scope->
class_name().c_str() :
"null");
9898 if (buildTemplateInstantiation ==
true)
9900 ROSE_ASSERT(templateArgumentsList != NULL);
9903#if DEBUG_NONDEFINING_CLASS_DECLARATION
9904 printf (
"Building a SgClassDeclaration: buildNondefiningClassDeclaration_nfi() nameWithTemplateArguments = %s buildTemplateInstantiation = %s \n",nameWithTemplateArguments.str(),buildTemplateInstantiation ?
"true:" :
"false");
9908 SgTemplateArgumentPtrList emptyList;
9911#if DEBUG_NONDEFINING_CLASS_DECLARATION
9912 printf (
"In buildNondefiningClassDeclaration_nfi(): built new SgTemplateInstantiationDecl: nondefdecl = %p \n",nondefdecl);
9914 ROSE_ASSERT(nondefdecl->get_type() == NULL);
9915 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl) != NULL);
9916#if DEBUG_NONDEFINING_CLASS_DECLARATION
9917 printf (
"In buildNondefiningClassDeclaration_nfi(): nondefdecl->get_name() = %s nondefdecl->get_templateName() = %s \n",
9918 nondefdecl->get_name().str(),isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().str());
9921 ROSE_ASSERT(templateArgumentsList != NULL);
9923#if DEBUG_NONDEFINING_CLASS_DECLARATION
9924 printf (
"nondefdecl->get_name() = %s \n",nondefdecl->get_name().str());
9925 printf (
"nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
9926 printf (
"Output templateArgumentsList: \n");
9927 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
9929 printf (
" --- --- templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
9935 ROSE_ASSERT(nondefdecl->get_name() == nameWithTemplateArguments);
9952 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
9956 ROSE_ASSERT((*templateArgumentsList)[i]->get_parent() != NULL);
9966 (*templateArgumentsList)[i]->set_parent(nondefdecl);
9970 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().is_null() ==
true);
9971 isSgTemplateInstantiationDecl(nondefdecl)->
set_templateName(nameWithoutTemplateArguments);
9977#if DEBUG_NONDEFINING_CLASS_DECLARATION
9978 printf (
"In buildNondefiningClassDeclaration_nfi(): built new SgClassDeclaration: nondefdecl = %p \n",nondefdecl);
9983 ROSE_ASSERT(nameWithoutTemplateArguments == nameWithTemplateArguments);
9986 ROSE_ASSERT(nondefdecl != NULL);
9989 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
9993 ROSE_ASSERT(nondefdecl->get_type() == NULL);
9998 if (nondefdecl->get_type() == NULL)
10005 printf (
"SageBuilder::buildNondefiningClassDeclaration_nfi(): (and setting source position) nondefdecl = %p \n",nondefdecl);
10030 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10037 ROSE_ASSERT(mysymbol != NULL);
10052 SgClassSymbol* mysymbol = scope->lookup_nontemplate_class_symbol(nameWithTemplateArguments,templateArgumentsList);
10054#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10055 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): mysymbol = %p = %s \n",mysymbol,(mysymbol != NULL) ? mysymbol->
class_name().c_str() :
"null");
10057 if (mysymbol != NULL)
10059 firstNondefdecl = isSgClassDeclaration(mysymbol->get_declaration());
10060 ROSE_ASSERT(firstNondefdecl != NULL);
10063 ROSE_ASSERT(firstNondefdecl->get_type() != NULL);
10066 ROSE_ASSERT(nondefdecl->get_type() == NULL);
10068 if (nondefdecl->get_type() == NULL)
10070#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10071 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);
10074#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10075 printf (
"NOTE: Call nondefdecl->set_type(firstNondefdecl->get_type()); instead of nondefdecl->set_type(SgClassType::createType(firstNondefdecl)); \n");
10080 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10082 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): built class type: part 1: nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str());
10085#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10086 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str());
10089 ROSE_ASSERT(nondefdecl->get_type() == firstNondefdecl->get_type());
10092#if (REUSE_CLASS_DECLARATION_FROM_SYMBOL == 0)
10093 ROSE_ASSERT(nondefdecl != NULL);
10094 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10100 printf (
"ERROR: In SgDeclarationStatement::set_firstNondefiningDeclaration(): nondefdecl = %p = %s IS NOT THE SAME AS firstNondefiningDeclaration = %p = %s \n",
10101 nondefdecl,nondefdecl->
class_name().c_str(),firstNondefdecl,firstNondefdecl->
class_name().c_str());
10103 nondefdecl->
get_file_info()->display(
"ERROR: In SgDeclarationStatement::set_firstNondefiningDeclaration(): nondefdecl: debug");
10105 firstNondefdecl->
get_file_info()->display(
"ERROR: In SgDeclarationStatement::set_firstNondefiningDeclaration(): firstNondefdecl: debug");
10117 ROSE_ASSERT(firstNondefdecl != NULL);
10118 ROSE_ASSERT(firstNondefdecl->get_type() != NULL);
10124 if (buildTemplateInstantiation ==
true)
10130 ROSE_ASSERT (nondefdecl->get_type() == firstNondefdecl->get_type());
10133 if (nondefdecl->get_type() != firstNondefdecl->get_type())
10136 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());
10137 printf (
"Skipping delete of %p so we can maintain unique type pointers \n",nondefdecl->get_type());
10139 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());
10140 nondefdecl->set_type(firstNondefdecl->get_type());
10143 printf (
"Unclear if this code is executed \n");
10150 ROSE_ASSERT(nondefdecl == NULL);
10157#if REUSE_CLASS_DECLARATION_FROM_SYMBOL
10166 ROSE_ASSERT(nondefdecl != NULL);
10167 if (nondefdecl->get_type() == NULL)
10170 printf (
"SageBuilder::buildNondefiningClassDeclaration_nfi(): nondefdecl = %p \n",nondefdecl);
10182 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
10185 firstNondefdecl = nondefdecl;
10188 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
10189 ROSE_ASSERT(mysymbol->get_declaration()->get_definition() == NULL);
10196 if (buildTemplateInstantiation ==
true)
10200#if DEBUG_NONDEFINING_CLASS_DECLARATION
10201 printf (
"BEFORE scope->insert_symbol(): scope = %p = %s nameWithTemplateArguments = %s mysymbol = %p = %s \n",
10202 scope,scope->
class_name().c_str(),nameWithTemplateArguments.str(),mysymbol,mysymbol->
class_name().c_str());
10209 ROSE_ASSERT(nondefdecl->get_type() == NULL);
10210 if (nondefdecl->get_type() == NULL)
10213 printf (
"In buildNondefiningClassDeclaration_nfi(): nondefdecl = %p = %s \n",nondefdecl,nondefdecl->
class_name().c_str());
10214 printf (
"In buildNondefiningClassDeclaration_nfi(): nondefdecl->get_firstNondefiningDeclaration() = %p \n",nondefdecl->
get_firstNondefiningDeclaration());
10218 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): built class type: part 2: nondefdecl->get_type() = %p = %s = %s \n",
10219 nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str(),nondefdecl->get_type()->
unparseToString().c_str());
10223#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10224 printf (
"NOTE: In buildNondefiningClassDeclaration_nfi(): 2nd time this is a performance issue (maybe) to call the lookup_nontemplate_class_symbol() again \n");
10234 SgClassSymbol* temp_classSymbol = nondefdecl->
get_scope()->lookup_nontemplate_class_symbol(nameWithTemplateArguments,templateArgumentsList);
10235#if DEBUG_NONDEFINING_CLASS_DECLARATION
10237 printf (
"In buildNondefiningClassDeclaration_nfi(): temp_classSymbol = %p \n",temp_classSymbol);
10238 printf (
"In buildNondefiningClassDeclaration_nfi(): nondefdecl->get_scope() = %p = %s scope = %p \n",nondefdecl->
get_scope(),nondefdecl->
get_scope()->
class_name().c_str(),scope);
10240 printf (
"In buildNondefiningClassDeclaration_nfi(): nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
10241 if (templateArgumentsList != NULL)
10243 printf (
" --- templateArgumentsList elements: \n");
10244 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
10246 printf (
" --- --- templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
10247 printf (
" --- --- templateArgumentsList->[%zu] = %s \n",i,templateArgumentsList->operator[](i)->class_name().c_str());
10248 templateArgumentsList->operator[](i)->
display(
"In SageBuilder::buildNondefiningClassDeclaration_nfi()");
10253 ROSE_ASSERT(nondefdecl->
get_scope()->lookup_class_symbol(nameWithTemplateArguments,templateArgumentsList) != NULL);
10254 ROSE_ASSERT(nondefdecl->
get_scope() == scope);
10258 ROSE_ASSERT(temp_classSymbol == NULL || temp_classSymbol->get_declaration()->get_definition() == NULL);
10261 ROSE_ASSERT(mysymbol != NULL);
10262 ROSE_ASSERT(firstNondefdecl != NULL);
10275 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10277 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10279#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10280 printf (
"NOTE: In buildNondefiningClassDeclaration_nfi(): 3rd time this is a performance issue (maybe) to call the lookup_nontemplate_class_symbol() again \n");
10290 SgClassSymbol* temp_classSymbol = nondefdecl->
get_scope()->lookup_nontemplate_class_symbol(nameWithTemplateArguments,templateArgumentsList);
10292 ROSE_ASSERT(temp_classSymbol == NULL || temp_classSymbol->get_declaration()->get_definition() == NULL);
10295 ROSE_ASSERT(nondefdecl != NULL);
10296 ROSE_ASSERT(nondefdecl->get_name() == nameWithTemplateArguments);
10299 if (isSgTemplateInstantiationDecl(nondefdecl) != NULL)
10303 ROSE_ASSERT(finalName == nameWithTemplateArguments);
10304 ROSE_ASSERT(finalName == nondefdecl->get_name());
10307#if DEBUG_NONDEFINING_CLASS_DECLARATION
10308 printf (
"Leaving buildNondefiningClassDeclaration_nfi(): nondefdecl = %p nondefdecl->unparseNameToString() = %s \n",nondefdecl,nondefdecl->unparseNameToString().c_str());
10309 printf (
" --- nondefdecl = %p = %s \n",nondefdecl,nondefdecl->
class_name().c_str());
10312#if DEBUG_NONDEFINING_CLASS_DECLARATION
10314 printf (
"Leaving buildNondefiningClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
10315 SgSymbol* test_symbol = nondefdecl->
get_scope()->find_symbol_from_declaration(nondefdecl);
10317 printf (
"test_symbol = %p \n",test_symbol);
10320 printf (
"Leaving buildNondefiningClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
10329 ROSE_ASSERT(stmt != NULL);
10341 ROSE_ASSERT(stmt != NULL);
10355 std::string directive_string(name);
10359 ROSE_ASSERT(scope);
10361 if (params.length() > 0)
10362 directive_string +=
" " + params;
10364 directive_string +=
" " + def_string;
10367 ROSE_ASSERT(define_decl);
10374 return define_decl;
10387 ASSERT_not_null(forStmt);
10393 forStmt->setCaseInsensitive(
true);
10412 ROSE_ASSERT(defdecl);
10415 classDef->set_declaration(defdecl);
10420 ROSE_ASSERT(nondefdecl);
10438 bool buildTemplateInstantiation =
false;
10458 SgDerivedTypeStatement* type_decl = buildClassDeclarationStatement_nfi <SgDerivedTypeStatement> (name, kind, scope);
10471 SgModuleStatement* module_stmt = buildClassDeclarationStatement_nfi <SgModuleStatement> (name, kind, scope);
10477 return module_stmt;
10485 SgJovialTableStatement* table_decl = buildClassDeclarationStatement_nfi <SgJovialTableStatement> (name, kind, scope);
10497 std::string type_name(name);
10500 type_name =
"_table_of_" + type_name;
10502 if (dim_info->get_expressions().size() > 0) {
10503 std::ostringstream address;
10504 address << (
void const *)dim_info;
10505 type_name +=
"_" + address.str();
10510 SgJovialTableStatement* table_decl = buildClassDeclarationStatement_nfi <SgJovialTableStatement> (type_name, kind, scope);
10518 ROSE_ASSERT(nondef_decl != NULL);
10522 ROSE_ASSERT(table_type != NULL);
10524 table_type->set_base_type(base_type);
10525 table_type->set_dim_info(dim_info);
10526 table_type->set_rank(dim_info->get_expressions().size());
10529 nondef_decl->set_type(table_type);
10535template <
class DeclClass> DeclClass *
10564 mysymbol = scope->lookup_class_symbol(name);
10566 if (mysymbol == NULL)
10569 if (nonDefiningDecl != NULL)
10573 ROSE_ASSERT(temp_mysymbol != NULL);
10575 mysymbol = isSgClassSymbol(temp_mysymbol);
10576 ROSE_ASSERT(mysymbol != NULL);
10579 ROSE_ASSERT(scope == nonDefiningDecl->
get_scope());
10584 if (mysymbol != NULL)
10586 nondefdecl = (mysymbol->get_declaration() == NULL)
10587 ? NULL : dynamic_cast<DeclClass*>(mysymbol->get_declaration());
10588 ROSE_ASSERT(nondefdecl != NULL);
10593 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
10598 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10599 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10604 DeclClass* nondefining_classDeclaration = (nondefdecl == NULL) ? NULL : dynamic_cast<DeclClass*>(nondefdecl);
10605 ROSE_ASSERT(nondefining_classDeclaration != NULL);
10607 ? NULL : dynamic_cast<DeclClass*>(nondefdecl->get_definingDeclaration());
10608 ROSE_ASSERT(defining_classDeclaration != NULL);
10610 return defining_classDeclaration;
10615 ROSE_ASSERT(nondefdecl == NULL);
10618 nondefdecl =
new DeclClass(name, kind, NULL, NULL);
10619 ROSE_ASSERT(nondefdecl != NULL);
10631 ROSE_ASSERT(scope != NULL);
10638 ROSE_ASSERT(nondefdecl->
get_scope() != NULL);
10639 ROSE_ASSERT(nondefdecl->get_type() == NULL);
10641 if (nondefdecl->get_type() == NULL)
10657 ROSE_ASSERT(class_type != NULL);
10659 nondefdecl->set_type(class_type);
10661 SgClassDeclaration* tmp_classDeclarationFromType = isSgClassDeclaration(class_type->get_declaration());
10662 ROSE_ASSERT(tmp_classDeclarationFromType != NULL);
10666 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10667 if (nondefdecl->get_type()->get_declaration() != nondefdecl)
10669 printf (
"ERROR: nondefdecl = %p = %s \n",nondefdecl,nondefdecl->
class_name().c_str());
10670 printf (
"ERROR: nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str());
10671 printf (
"ERROR: nondefdecl->get_type()->get_declaration() = %p = %s \n",nondefdecl->get_type()->get_declaration(),nondefdecl->get_type()->get_declaration()->
class_name().c_str());
10673 SgClassDeclaration* classDeclarationFromType = isSgClassDeclaration(nondefdecl->get_type()->get_declaration());
10674 ROSE_ASSERT(classDeclarationFromType != NULL);
10676 printf (
"nondefdecl->get_name() = %s \n",nondefdecl->get_name().str());
10677 printf (
"nondefdecl->get_type()->get_name() = %s \n",nondefdecl->get_type()->
get_name().str());
10678 printf (
"nondefdecl->get_type()->get_declaration()->get_name() = %s \n",classDeclarationFromType->get_name().str());
10680 printf (
"nondefdecl->get_mangled_name() = %s \n",nondefdecl->get_mangled_name().getString().c_str());
10681 printf (
"nondefdecl->get_type()->get_mangled() = %s \n",nondefdecl->get_type()->
get_mangled().getString().c_str());
10682 printf (
"nondefdecl->get_type()->get_declaration()->get_mangled_name() = %s \n",classDeclarationFromType->get_mangled_name().getString().c_str());
10685 printf (
"nondefdecl->get_type()->get_declaration()->get_firstNondefiningDeclaration() = %s \n",classDeclarationFromType->
get_firstNondefiningDeclaration() ?
"true" :
"false");
10695 ROSE_ASSERT(nondefdecl->get_type()->get_declaration() == nondefdecl);
10705#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
10707 if (SourcePositionClassificationMode != e_sourcePositionTransformation)
10709 detectTransformations(nondefdecl);
10720 ROSE_ASSERT(nondefdecl->
get_scope() == scope);
10733 DeclClass* defdecl =
new DeclClass(name,kind,NULL,classDef);
10734 ROSE_ASSERT(defdecl != NULL);
10735 ROSE_ASSERT(defdecl->get_type() == NULL);
10738 ROSE_ASSERT(defdecl->get_definition() != NULL);
10739 ROSE_ASSERT(defdecl != NULL);
10749 classDef->set_declaration(defdecl);
10750 defdecl->set_definingDeclaration(defdecl);
10752 defdecl->set_firstNondefiningDeclaration(nondefdecl);
10755 ROSE_ASSERT(defdecl->get_type() == NULL);
10762 if (defdecl->get_type() != NULL)
10769 ROSE_ASSERT (nondefdecl->get_type() != NULL);
10770 defdecl->set_type(nondefdecl->get_type());
10776 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10779 ROSE_ASSERT (nondefdecl->get_type() != NULL);
10782 ROSE_ASSERT (defdecl->get_type() != NULL);
10783 ROSE_ASSERT (defdecl->get_type()->get_declaration() != NULL);
10784 ROSE_ASSERT (defdecl->get_type()->get_declaration() != isSgDeclarationStatement(defdecl));
10789 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10799 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10805 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10810 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10820 ROSE_ASSERT(defdecl->get_parent() == NULL);
10825 ROSE_ASSERT(defdecl->get_definingDeclaration() == defdecl);
10826 ROSE_ASSERT(defdecl->get_firstNondefiningDeclaration() != defdecl->get_definingDeclaration());
10829 SgClassDeclaration* temp_firstNondefiningDeclaration = isSgClassDeclaration(defdecl->get_firstNondefiningDeclaration());
10830 SgClassDeclaration* temp_definingDeclaration = isSgClassDeclaration(defdecl->get_definingDeclaration());
10831 ROSE_ASSERT(temp_firstNondefiningDeclaration != NULL);
10832 ROSE_ASSERT(temp_definingDeclaration != NULL);
10835 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_name() == temp_definingDeclaration->get_name());
10836 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_type() == temp_definingDeclaration->get_type());
10840 printf (
"Leaving buildClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
10841 SgSymbol* test_symbol = nondefdecl->
get_scope()->find_symbol_from_declaration(nondefdecl);
10844 printf (
"Leaving buildClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
10879 ROSE_ASSERT(scope != NULL);
10890 ROSE_ASSERT(defdecl != NULL);
10894 printf (
"#################### SageBuilder::buildNamespaceDeclaration_nfi(): defdecl = %p = %s namespaceDef = %p \n",defdecl,defdecl->
get_name().str(),namespaceDef);
10901 namespaceDef->set_namespaceDeclaration(defdecl);
10916 mysymbol = scope->lookup_namespace_symbol(name);
10922 printf (
"Warning: In SageBuilder::buildNamespaceDeclaration_nfi(): scope == NULL \n");
10926 printf (
"In SageBuilder::buildNamespaceDeclaration_nfi(): mysymbol = %p \n",mysymbol);
10929 if (mysymbol != NULL)
10933 ROSE_ASSERT(namespaceDeclaration != NULL);
10934 nondefdecl = isSgNamespaceDeclarationStatement(namespaceDeclaration);
10936 ROSE_ASSERT(nondefdecl != NULL);
10937 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10947 if (namespaceDeclaration->
get_definition()->get_global_definition() == NULL)
10949 printf (
"ERROR: namespaceDeclaration->get_definition()->get_global_definition() == NULL: namespaceDeclaration = %p = %s namespaceDeclaration->get_definition() = %p \n",
10952 ROSE_ASSERT(namespaceDeclaration->
get_definition()->get_global_definition() != NULL);
10953 namespaceDef->set_global_definition(namespaceDeclaration->
get_definition()->get_global_definition());
10954 ROSE_ASSERT(namespaceDef->get_global_definition() != NULL);
10957 ROSE_ASSERT(namespaceDef->get_global_definition() == namespaceDef->get_global_definition()->get_global_definition());
10959 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
10961 ROSE_ASSERT(nondefdecl->
get_definition()->get_previousNamespaceDefinition() == NULL);
10965 ROSE_ASSERT(i != NULL);
10966 while (i != NULL && i->get_nextNamespaceDefinition() != NULL)
10968 i = i->get_nextNamespaceDefinition();
10969 ROSE_ASSERT(i->get_previousNamespaceDefinition() != NULL);
10972 ROSE_ASSERT(i != NULL);
10973 i->set_nextNamespaceDefinition(namespaceDef);
10974 namespaceDef->set_previousNamespaceDefinition(i);
10982 nondefdecl = defdecl;
10983 ROSE_ASSERT(nondefdecl != NULL);
10985 ROSE_ASSERT(namespaceDef->get_namespaceDeclaration() != NULL);
10996 ROSE_ASSERT(nondefdecl != NULL);
10998 printf (
"In SageBuilder::buildNamespaceDeclaration_nfi(): Built namespace definition for nondefdecl = %p = %s definition = %p \n",nondefdecl,nondefdecl->
get_name().str(),namespaceDef);
11001 ROSE_ASSERT(namespaceDef->get_namespaceDeclaration() == NULL);
11002 namespaceDef->set_namespaceDeclaration(nondefdecl);
11003 ROSE_ASSERT(namespaceDef->get_namespaceDeclaration() != NULL);
11008 namespaceDef->set_global_definition(global_definition_namespaceDef);
11009 ROSE_ASSERT(namespaceDef->get_global_definition() != NULL);
11012 global_definition_namespaceDef->set_global_definition(global_definition_namespaceDef);
11014 global_definition_namespaceDef->set_isUnionOfReentrantNamespaceDefinitions(
true);
11017 ROSE_ASSERT(global_definition_namespaceDef->
get_parent() == NULL);
11018 global_definition_namespaceDef->
set_parent(defdecl);
11019 ROSE_ASSERT(global_definition_namespaceDef->
get_parent() != NULL);
11022 ROSE_ASSERT(global_definition_namespaceDef->get_namespaceDeclaration() == NULL);
11023 global_definition_namespaceDef->set_namespaceDeclaration(nondefdecl);
11024 ROSE_ASSERT(global_definition_namespaceDef->get_namespaceDeclaration() != NULL);
11027 global_definition_namespaceDef->set_namespaceDeclaration(nondefdecl);
11028 ROSE_ASSERT(global_definition_namespaceDef->get_namespaceDeclaration() != NULL);
11031 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() == NULL);
11033 defdecl->
get_definition()->set_global_definition(global_definition_namespaceDef);
11036 printf (
"In SageBuilder::buildNamespaceDeclaration_nfi(): defdecl->get_definition()->get_global_definition() = %p \n",defdecl->
get_definition()->get_global_definition());
11040 defdecl->
get_definition()->set_global_definition(global_definition_namespaceDef);
11044 ROSE_ASSERT(global_definition_namespaceDef == global_definition_namespaceDef->get_global_definition());
11046 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
11047 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() == namespaceDef->get_global_definition());
11049 printf (
"In SageBuilder::buildNamespaceDeclaration_nfi(): Built namespace definition for nondefdecl = %p = %s get_global_definition() = %p \n",nondefdecl,nondefdecl->
get_name().str(),namespaceDef->get_global_definition());
11082 printf (
"Warning: no scope provided to support symbol table entry! \n");
11086 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
11088 ROSE_ASSERT(nondefdecl->
get_definition()->get_previousNamespaceDefinition() == NULL);
11089 ROSE_ASSERT(nondefdecl->
get_definition()->get_nextNamespaceDefinition() == NULL);
11092 ROSE_ASSERT(nondefdecl != NULL);
11114 ROSE_ASSERT(mysymbol);
11147 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
11153 defdecl->
get_file_info()->display(
"In buildNamespaceDeclaration_nfi(): namespaceDeclaration: debug");
11166 result->get_operands().push_back(lhs);
11177 result->get_operands().push_back(lhs);
11188 result->get_operands().push_back(lhs);
11199 result->get_operands().push_back(lhs);
11239 printf (
"In buildNondefiningClassDeclaration(): name = %s scope = %p = %s \n",name.str(),scope,scope != NULL ? scope->
class_name().c_str() :
"NULL");
11254 mysymbol = scope->lookup_class_symbol(name,NULL);
11265 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
11268 if (mysymbol != NULL)
11270 nondefdecl = isSgClassDeclaration(mysymbol->get_declaration());
11272 ROSE_ASSERT(nondefdecl != NULL);
11281 ROSE_ASSERT(nondefdecl->get_type() != NULL);
11292 ROSE_ASSERT(nondefdecl != NULL);
11293 if (nondefdecl->get_type() == NULL)
11297 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());
11321 ROSE_ASSERT(nondefdecl->
get_scope() == NULL);
11326 ROSE_ASSERT(nondefdecl->
get_scope() != NULL);
11330 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());
11343 ROSE_ASSERT(nondefdecl->get_type() != NULL);
11346 ROSE_ASSERT(scope == NULL || (scope != NULL && nondefdecl->
get_scope() != NULL));
11349 ROSE_ASSERT(nondefdecl != NULL);
11362 printf (
"WARNING: This function for building defining class declarations has different semantics from that of the function to build defining function declarations. \n");
11365 printf (
"In buildDefiningClassDeclaration(): name = %s scope = %p = %s \n",name.str(),scope,scope != NULL ? scope->
class_name().c_str() :
"NULL");
11376 ROSE_ASSERT(nondefiningClassDeclaration != NULL);
11379 ROSE_ASSERT(definingClassDefinition != NULL);
11382 SgClassType* classType = nondefiningClassDeclaration->get_type();
11383 ROSE_ASSERT(classType != NULL);
11390 ROSE_ASSERT(definingClassDeclaration != NULL);
11397 definingClassDefinition->set_declaration(definingClassDeclaration);
11407 ROSE_ASSERT(definingClassDeclaration->get_definition() != NULL);
11409 ROSE_ASSERT(definingClassDeclaration->
get_scope() == NULL);
11412 definingClassDeclaration->
set_scope(scope);
11413 ROSE_ASSERT(definingClassDeclaration->
get_scope() != NULL);
11414 ROSE_ASSERT(nondefiningClassDeclaration->
get_scope() != NULL);
11417 ROSE_ASSERT(definingClassDeclaration->get_definition()->
get_parent() != NULL);
11420 ROSE_ASSERT(definingClassDeclaration->get_type() != NULL);
11422 return definingClassDeclaration;
11429 ROSE_ASSERT(scope != NULL);
11431 ROSE_ASSERT(definingClassDeclaration != NULL);
11433 return definingClassDeclaration;
11450#define DEBUG_CLASS_DECLARATION 0
11454 printf (
"WARNING: In SageBuilder::buildClassDeclaration_nfi(): the nonDefiningDecl pointer = %p (input parameter) does not appear to be used. \n",nonDefiningDecl);
11460 if (nonDefiningDecl != NULL)
11462 ROSE_ASSERT(nonDefiningDecl->get_type() != NULL);
11463 ROSE_ASSERT(nonDefiningDecl->get_type()->get_declaration() != NULL);
11464 printf (
"nonDefiningDecl->get_type() = %p = %s \n",nonDefiningDecl->get_type(),nonDefiningDecl->get_type()->
class_name().c_str());
11465 printf (
"nonDefiningDecl->get_type()->get_declaration() = %p = %s \n",nonDefiningDecl->get_type()->get_declaration(),nonDefiningDecl->get_type()->get_declaration()->
class_name().c_str());
11467 printf (
"In buildClassDeclaration_nfi(): nonDefiningDecl: unparseNameToString() = %s \n",nonDefiningDecl->unparseNameToString().c_str());
11478 bool buildTemplateDeclaration = (isSgTemplateClassDeclaration(nonDefiningDecl) != NULL);
11481 if (buildTemplateDeclaration ==
true)
11484 printf (
"ERROR: If buildTemplateDeclaration == true, then we should have called a different function to build the associated SgTemplateClassDeclaration \n");
11486 ROSE_ASSERT(buildTemplateDeclaration ==
false);
11489 printf (
"In SageBuilder::buildClassDeclaration_nfi(): XXX_name = %s \n",XXX_name.str());
11490 printf (
"In SageBuilder::buildClassDeclaration_nfi(): the nonDefiningDecl pointer = %p = %s \n",nonDefiningDecl,nonDefiningDecl != NULL ? nonDefiningDecl->
class_name().c_str() :
"null");
11491 printf (
"In SageBuilder::buildClassDeclaration_nfi(): buildTemplateDeclaration = %s \n",buildTemplateDeclaration ?
"true" :
"false");
11492 printf (
" --- templateArgumentsList = %p \n",templateArgumentsList);
11493 if (templateArgumentsList != NULL)
11495 printf (
" --- templateArgumentsList.size() = %zu \n",templateArgumentsList->size());
11496 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
11498 printf (
" --- --- argument pointer: templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
11507 printf (
"In SageBuilder::buildClassDeclaration_nfi(): no scope was provided so using the SageBuilder::topScopeStack() = %p = %s \n",scope,scope->
class_name().c_str());
11513 printf (
"In SageBuilder::buildClassDeclaration_nfi(): scope was provided scope = %p = %s \n",scope,scope->
class_name().c_str());
11518 printf (
"Building a SgClassDeclaration: buildClassDeclaration_nfi() XXX_name = %s buildTemplateInstantiation = %s \n",XXX_name.str(),buildTemplateInstantiation ?
"true" :
"false");
11528 SgName nameWithoutTemplateArguments = XXX_name;
11529 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
11530 if (buildTemplateInstantiation ==
true)
11532 ROSE_ASSERT(templateArgumentsList != NULL);
11536#if DEBUG_CLASS_DECLARATION
11537 printf (
"In SageBuilder::buildClassDeclaration_nfi():\n");
11538 printf (
" -- nameWithoutTemplateArguments = %s\n", nameWithoutTemplateArguments.str());
11539 printf (
" -- nameWithTemplateArguments = %s\n", nameWithTemplateArguments.str());
11552#if DEBUG_CLASS_DECLARATION
11553 printf (
"Looking up the SgClassSymbol in scope = %p = %s nameWithTemplateArguments = %s \n",scope,scope->
class_name().c_str(),nameWithTemplateArguments.str());
11564 printf (
"This was a redundant call to lookup_class_symbol \n");
11569 if (buildTemplateDeclaration ==
true)
11571#if DEBUG_CLASS_DECLARATION
11572 printf (
"Note: In SageBuilder::buildClassDeclaration_nfi(): Need to look up a template symbol \n");
11574 ROSE_ASSERT(nonDefiningDecl != NULL);
11576 SgTemplateParameterPtrList templateParameterList;
11577 SgTemplateArgumentPtrList templateSpecializationArgumentList;
11579 ROSE_ASSERT(scope->lookup_template_class_symbol(nameWithTemplateArguments,&templateParameterList,&templateSpecializationArgumentList) != NULL);
11581 mysymbol = scope->lookup_template_class_symbol(nameWithTemplateArguments,&templateParameterList,&templateSpecializationArgumentList);
11583 ROSE_ASSERT(mysymbol != NULL);
11585 printf (
"ERROR: Need to look up a template symbol \n");
11591#if DEBUG_CLASS_DECLARATION
11592 printf (
"In SageBuilder::buildClassDeclaration_nfi(): calling lookup_class_symbol(nameWithTemplateArguments = %s,templateArgumentsList->size() = %zu \n",
11593 nameWithTemplateArguments.str(),(templateArgumentsList != NULL) ? templateArgumentsList->size() : 999);
11594 if (templateArgumentsList != NULL)
11596 printf (
" --- templateArgumentsList elements: \n");
11597 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
11599 printf (
" --- --- templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
11600 printf (
" --- --- templateArgumentsList->[%zu] = %s \n",i,templateArgumentsList->operator[](i)->class_name().c_str());
11601 templateArgumentsList->operator[](i)->
display(
"In SageBuilder::buildClassDeclaration_nfi()");
11605 mysymbol = scope->lookup_class_symbol(nameWithTemplateArguments,templateArgumentsList);
11606#if DEBUG_CLASS_DECLARATION
11607 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
11610 if (mysymbol == NULL)
11612#if DEBUG_CLASS_DECLARATION
11613 printf (
"WARNING: scope->lookup_class_symbol(nameWithTemplateArguments = %s,templateArgumentsList->size() = %zu) == NULL \n",nameWithTemplateArguments.str(),templateArgumentsList->size());
11618#if DEBUG_CLASS_DECLARATION
11619 printf (
"Checking lookup_class_symbol() using nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
11621 ROSE_ASSERT(scope->lookup_class_symbol(nameWithoutTemplateArguments,templateArgumentsList) == NULL);
11623#if DEBUG_CLASS_DECLARATION
11624 printf (
"nonDefiningDecl = %p \n",nonDefiningDecl);
11626 if (nonDefiningDecl != NULL)
11628#if DEBUG_CLASS_DECLARATION
11629 printf (
"nonDefiningDecl = %p = %s \n",nonDefiningDecl,nonDefiningDecl->
class_name().c_str());
11633 ROSE_ASSERT(temp_mysymbol != NULL);
11635 mysymbol = isSgClassSymbol(temp_mysymbol);
11636 ROSE_ASSERT(mysymbol != NULL);
11639 ROSE_ASSERT(scope == nonDefiningDecl->
get_scope());
11647 if (mysymbol != NULL)
11649 SgClassDeclaration* symbol_declaration = isSgClassDeclaration(mysymbol->get_declaration());
11650 ROSE_ASSERT(symbol_declaration != NULL);
11651 ROSE_ASSERT(symbol_declaration->
get_scope() == scope);
11653 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Testing scope->get_symbol_table()->exists(mysymbol) == true (expensive) \n");
11667#if DEBUG_CLASS_DECLARATION
11668 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
11671 if (mysymbol != NULL)
11673 nondefdecl = isSgClassDeclaration(mysymbol->get_declaration());
11675 ROSE_ASSERT(nondefdecl != NULL);
11677#if DEBUG_CLASS_DECLARATION
11678 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol->get_declaration(): nondefdecl = %p = %s nondefdecl->get_definition() = %p = %s \n",
11679 nondefdecl,nondefdecl->class_name().c_str(),nondefdecl->get_definition(),
11680 nondefdecl->get_definition() != NULL ? nondefdecl->get_definition()->class_name().c_str() :
"NULL");
11685 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
11688 ROSE_ASSERT(nondefdecl == nondefdecl->get_firstNondefiningDeclaration());
11693#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11695 detectTransformations(nondefdecl);
11699 ROSE_ASSERT(nondefdecl->get_type() != NULL);
11702 if (nondefdecl->get_parent() == NULL)
11704#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11705 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Note that nondefdecl->get_parent() == NULL, this might be OK. \n");
11714 if (nondefdecl->get_definingDeclaration() != NULL)
11716#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11717 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",
11718 nondefdecl,nondefdecl->class_name().c_str(),nondefdecl->get_definingDeclaration(),nondefdecl->get_definingDeclaration()->class_name().c_str());
11720 SgClassDeclaration* nondefining_classDeclaration = isSgClassDeclaration(nondefdecl);
11721 ROSE_ASSERT(nondefining_classDeclaration != NULL);
11722 SgClassDeclaration* defining_classDeclaration = isSgClassDeclaration(nondefdecl->get_definingDeclaration());
11723 ROSE_ASSERT(defining_classDeclaration != NULL);
11725#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11726 printf (
"In SageBuilder::buildClassDeclaration_nfi(): nondefining_classDeclaration: scope = %p = %s name = %s \n",
11727 nondefining_classDeclaration->
get_scope(),nondefining_classDeclaration->
get_scope()->
class_name().c_str(),nondefining_classDeclaration->get_name().str());
11728 printf (
"In SageBuilder::buildClassDeclaration_nfi(): defining_classDeclaration: scope = %p = %s name = %s \n",
11729 defining_classDeclaration->
get_scope(),defining_classDeclaration->
get_scope()->
class_name().c_str(),defining_classDeclaration->get_name().str());
11730 defining_classDeclaration->
get_file_info()->display(
"already has a defining declaration");
11733 printf (
"Error: In SageBuilder::buildClassDeclaration_nfi(): exiting as part of test \n");
11737#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11738 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);
11743 printf (
"Exiting as a test! \n");
11746 return defining_classDeclaration;
11753 ROSE_ASSERT(nondefdecl->get_definingDeclaration() == defdecl);
11754 ROSE_ASSERT(nondefdecl->get_firstNondefiningDeclaration() != defdecl);
11759#if DEBUG_CLASS_DECLARATION
11760 printf (
"In SageBuilder::buildClassDeclaration_nfi(): building a nondefining declaration since it does not exist \n");
11763 ROSE_ASSERT(nondefdecl == NULL);
11767 if (buildTemplateInstantiation ==
true)
11770#if DEBUG_CLASS_DECLARATION
11771 printf (
"************************************************************************* \n");
11772 printf (
"Building SgTemplateInstantiationDecl with empty SgTemplateArgumentPtrList \n");
11773 printf (
" --- using nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
11774 printf (
"************************************************************************* \n");
11776 SgTemplateArgumentPtrList emptyList;
11779 ROSE_ASSERT(nondefdecl != NULL);
11780#if DEBUG_CLASS_DECLARATION
11781 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Build SgTemplateInstantiationDecl: nondefdecl = %p \n",nondefdecl);
11785 ROSE_ASSERT(nondefdecl->get_type() == NULL);
11786 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl) != NULL);
11788 printf (
"In buildClassDeclaration_nfi(): nondefdecl->get_name() = %s nondefdecl->get_templateName() = %s \n",nondefdecl->get_name().str(),isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().str());
11790#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11799 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().is_null() ==
true);
11802 ROSE_ASSERT(templateArgumentsList != NULL);
11812 if (templateArgumentsList->size() == 0)
11814 printf (
"Warning: In SageBuilder::buildClassDeclaration_nfi(): templateArgumentsList->size() == 0 \n");
11818 nondefdecl->set_firstNondefiningDeclaration(nondefdecl);
11835#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11836 printf (
"Warning: In buildClassDeclaration_nfi(): calling set_templateName(nameWithTemplateArguments = %s) for nondefining declaration \n",nameWithTemplateArguments.str());
11841 isSgTemplateInstantiationDecl(nondefdecl)->
set_templateName(nameWithoutTemplateArguments);
11848 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().is_null() ==
false);
11854 if (
hasTemplateSyntax(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName()) ==
false)
11856#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11857 printf (
"WARNING: No template syntax present in name of template class instantiation (nondefdecl) \n");
11862#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11867 ROSE_ASSERT(nondefdecl->get_file_info() == NULL);
11872#if DEBUG_CLASS_DECLARATION
11873 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);
11874 printf (
" --- nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
11879 ROSE_ASSERT(nondefdecl != NULL);
11880#if DEBUG_CLASS_DECLARATION
11881 printf (
"In buildClassDeclaration_nfi(): (no file info set): nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
11886 ROSE_ASSERT(nameWithoutTemplateArguments == nameWithTemplateArguments);
11888#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11894 nondefdecl->set_firstNondefiningDeclaration(nondefdecl);
11899 ROSE_ASSERT(nondefdecl->get_file_info() == NULL);
11902 ROSE_ASSERT(nondefdecl != NULL);
11906 ROSE_ASSERT(nondefdecl == nondefdecl->get_firstNondefiningDeclaration());
11915 ROSE_ASSERT(scope != NULL);
11917#if DEBUG_CLASS_DECLARATION
11918 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Set the scope of the new non-defining declaration to %p = %s \n",scope,scope->
class_name().c_str());
11920 nondefdecl->set_scope(scope);
11921 ROSE_ASSERT(nondefdecl->get_scope() != NULL);
11930 printf (
"In buildClassDeclaration_nfi(): setting the parent of the non defining declaration to be the scope by default) \n");
11937 ROSE_ASSERT(nondefdecl->get_type() == NULL);
11939 if (nondefdecl->get_type() == NULL)
11941#if DEBUG_CLASS_DECLARATION
11943 printf (
"Calling scope->get_type_table()->lookup_type(): nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
11945 printf (
"WE NEED THE MANGLED NAME FOR THIS TO BE RELEVANT! \n");
11951#if DEBUG_CLASS_DECLARATION
11952 printf (
"In SageBuilder::buildClassDeclaration_nfi(): kind == SgClassDeclaration::e_java_parameter = %s \n",(kind ==
SgClassDeclaration::e_java_parameter) ?
"true" :
"false");
11957#if DEBUG_CLASS_DECLARATION
11958 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());
11960 nondefdecl->set_type(class_type);
11961#if DEBUG_CLASS_DECLARATION
11962 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());
11964 SgClassDeclaration* tmp_classDeclarationFromType = isSgClassDeclaration(class_type->get_declaration());
11965 ROSE_ASSERT(tmp_classDeclarationFromType != NULL);
11966#if DEBUG_CLASS_DECLARATION
11968 printf (
"tmp_classDeclarationFromType: scope = %p = %s \n",scope,scope->
class_name().c_str());
11969 printf (
"tmp_classDeclarationFromType = %p = %s \n",tmp_classDeclarationFromType,tmp_classDeclarationFromType->
class_name().c_str());
11970 printf (
"tmp_classDeclarationFromType name = %s \n",tmp_classDeclarationFromType->get_name().str());
11973 tmp_classDeclarationFromType->
get_file_info()->display(
"tmp_classDeclarationFromType: debug");
11979 ROSE_ASSERT(nondefdecl->get_type() != NULL);
11980 if (nondefdecl->get_type()->get_declaration() != nondefdecl)
11982 printf (
"ERROR: nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
11983 printf (
"ERROR: nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
11984 printf (
"ERROR: nondefdecl->get_type()->get_declaration() = %p = %s \n",nondefdecl->get_type()->get_declaration(),nondefdecl->get_type()->get_declaration()->class_name().c_str());
11986 SgClassDeclaration* classDeclarationFromType = isSgClassDeclaration(nondefdecl->get_type()->get_declaration());
11987 ROSE_ASSERT(classDeclarationFromType != NULL);
11989 printf (
"nondefdecl->get_name() = %s \n",nondefdecl->get_name().str());
11990 printf (
"nondefdecl->get_type()->get_name() = %s \n",nondefdecl->get_type()->get_name().str());
11991 printf (
"nondefdecl->get_type()->get_declaration()->get_name() = %s \n",classDeclarationFromType->get_name().str());
11993 printf (
"nondefdecl->get_mangled_name() = %s \n",nondefdecl->get_mangled_name().getString().c_str());
11994 printf (
"nondefdecl->get_type()->get_mangled() = %s \n",nondefdecl->get_type()->get_mangled().getString().c_str());
11995 printf (
"nondefdecl->get_type()->get_declaration()->get_mangled_name() = %s \n",classDeclarationFromType->get_mangled_name().getString().c_str());
11998 printf (
"nondefdecl->get_type()->get_declaration()->get_firstNondefiningDeclaration() = %s \n",classDeclarationFromType->
get_firstNondefiningDeclaration() ?
"true" :
"false");
11999 printf (
"nondefdecl->get_firstNondefiningDeclaration() = %s \n",nondefdecl->get_firstNondefiningDeclaration() ?
"true" :
"false");
12005 if (parent != NULL)
12007 printf (
"nondefdecl->get_parent() = %p = %s \n",parent,parent->
class_name().c_str());
12012#if DEBUG_CLASS_DECLARATION
12013 nondefdecl->get_type()->get_declaration()->get_file_info()->display(
"nondefdecl->get_type()->get_declaration()");
12020 if (nondefdecl->get_file_info() == NULL)
12022 printf (
"ERROR: In SageBuilder::buildClassDeclaration_nfi(): nondefdecl = %p = %s does not have its source position information setup \n",nondefdecl,nondefdecl->class_name().c_str());
12023 printf (
" --- nondefdecl = %s \n",nondefdecl->get_name().str());
12024 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p \n",nondefdecl->get_firstNondefiningDeclaration());
12025 printf (
" --- nondefdecl->get_definingDeclaration() = %p \n",nondefdecl->get_definingDeclaration());
12026 printf (
" --- nondefdecl->get_type() = %p \n",nondefdecl->get_type());
12027 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
12028 printf (
"The real error is: (nondefdecl->get_type()->get_declaration() != nondefdecl) \n");
12032 ROSE_ASSERT(nondefdecl->get_file_info() != NULL);
12033 nondefdecl->get_file_info()->display(
"nondefdecl");
12037 ROSE_ASSERT(nondefdecl->get_type()->get_declaration() == nondefdecl);
12040 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());
12051 ROSE_ASSERT (nondefdecl->get_startOfConstruct() != NULL);
12053#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
12057 detectTransformations(nondefdecl);
12065 nondefdecl->setForward();
12071 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");
12080 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());
12086 ROSE_ASSERT(nondefdecl->get_scope() == scope);
12093 printf (
"Warning: no scope provided to support symbol table entry! \n");
12106 if (buildTemplateInstantiation ==
true)
12109 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
12113 ROSE_ASSERT((*templateArgumentsList)[i]->get_parent() != NULL);
12123 (*templateArgumentsList)[i]->set_parent(nondefdecl);
12138 printf (
"Building a SgClassDeclaration: buildClassDeclaration_nfi() buildTemplateInstantiation = %s \n",buildTemplateInstantiation ?
"true:" :
"false");
12143 if (buildTemplateInstantiation ==
true)
12146 SgTemplateArgumentPtrList emptyList;
12152 ROSE_ASSERT(defdecl->get_type() == NULL);
12153 ROSE_ASSERT(isSgTemplateInstantiationDecl(defdecl) != NULL);
12155 printf (
"In buildClassDeclaration_nfi(): defdecl->get_name() = %s defdecl->get_templateName() = %s \n",defdecl->get_name().str(),isSgTemplateInstantiationDecl(defdecl)->get_templateName().str());
12159 ROSE_ASSERT(isSgTemplateInstantiationDecl(defdecl)->get_templateName().is_null() ==
true);
12162 printf (
"Warning: In buildClassDeclaration_nfi(): calling set_templateName(name = %s) for defining declaration \n",name.str());
12171 ROSE_ASSERT(name.getString().find(
'<') == string::npos);
12174 SgName templateName = generateTemplateNameFromTemplateNameWithTemplateArguments(name);
12175 printf (
"In buildClassDeclaration_nfi(): templateName = %s \n",templateName.str());
12190 printf (
"In buildClassDeclaration_nfi(): nameWithoutTemplateArguments = %s nameWithTemplateArguments = %s \n",nameWithoutTemplateArguments.str(),nameWithTemplateArguments.str());
12192 isSgTemplateInstantiationDecl(defdecl)->
set_templateName(nameWithoutTemplateArguments);
12194#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12198 printf (
"WARNING: In buildClassDeclaration_nfi(): nameWithTemplateArguments = %s is not using template syntax \n",nameWithTemplateArguments.str());
12207 ROSE_ASSERT(isSgTemplateInstantiationDecl(defdecl)->get_templateName().is_null() ==
false);
12210 if (isSgTemplateInstantiationDecl(defdecl)->get_templateName().getString().find(
'>') == string::npos)
12212#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12213 printf (
"WARNING: No template syntax present in name of template class instantiation (defdecl) \n");
12218 printf (
"Should we have set the template instantiation name at this point? \n");
12222 ROSE_ASSERT(defdecl->get_definition() != NULL);
12223 ROSE_ASSERT(isSgTemplateInstantiationDefn(defdecl->get_definition()) != NULL);
12228 printf (
"Building a SgClassDeclaration, but we might require a SgTemplateClassDeclaration \n");
12235 if (buildTemplateDeclaration ==
true)
12237 printf (
"In buildClassDeclaration_nfi(): I think we also want template specialization arguments to be more general: using nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
12243 ROSE_ASSERT(defdecl->get_type() == NULL);
12245 printf (
"Exiting afte test! \n");
12255 printf (
"In SageBuilder::buildClassDeclaration_nfi(): build a SgClassDeclaration: defdecl = %p \n",defdecl);
12259 ROSE_ASSERT(defdecl->get_type() == NULL);
12263 ROSE_ASSERT(defdecl->get_definition() != NULL);
12264 ROSE_ASSERT(isSgTemplateInstantiationDefn(defdecl->get_definition()) == NULL);
12266 ROSE_ASSERT(defdecl != NULL);
12269 printf (
"In buildClassDeclaration_nfi(): nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
12273 nondefdecl->set_definingDeclaration(defdecl);
12275 ROSE_ASSERT(nondefdecl->get_definingDeclaration() == defdecl);
12276 ROSE_ASSERT(nondefdecl->get_firstNondefiningDeclaration() != defdecl);
12282 classDef->set_declaration(defdecl);
12283 defdecl->set_definingDeclaration(defdecl);
12297 defdecl->set_firstNondefiningDeclaration(nondefdecl);
12299 if (buildTemplateInstantiation ==
true)
12306 ROSE_ASSERT(defdecl->get_type() == NULL);
12313 if (defdecl->get_type() != NULL)
12317 if (defdecl->get_type()->get_declaration() == isSgDeclarationStatement(defdecl))
12320 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12323 if (nondefdecl->get_type() != defdecl->get_type())
12326 printf (
"Deleting defdecl->get_type() = %p = %s (using type from nondefdecl = %p) \n",defdecl->get_type(),defdecl->get_type()->class_name().c_str(),nondefdecl);
12327 printf (
"Skipping delete of %p to maintain unique type pointers \n",defdecl->get_type());
12329 delete defdecl->get_type();
12332 defdecl->set_type(NULL);
12334 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());
12338 printf (
"Is this executed! \n");
12342 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12343 defdecl->set_type(nondefdecl->get_type());
12345 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());
12349 ROSE_ASSERT(classType != NULL);
12350 SgClassDeclaration* local_classDeclaration = isSgClassDeclaration(classType->get_declaration());
12351 ROSE_ASSERT (local_classDeclaration != NULL);
12352 printf (
"In buildClassDeclaration_nfi(): classType = %p local_classDeclaration = %p \n",classType,local_classDeclaration);
12361 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12362 defdecl->set_type(nondefdecl->get_type());
12364 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());
12367 ROSE_ASSERT (nondefdecl->get_firstNondefiningDeclaration() != NULL);
12371 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()))
12373 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");
12374 printf (
" --- nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
12375 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
12376 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl->get_firstNondefiningDeclaration(),nondefdecl->get_firstNondefiningDeclaration()->class_name().c_str());
12382 ROSE_ASSERT (nondefdecl->get_type()->get_declaration() == isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()));
12387 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12390 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12393 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl))
12395 printf (
"nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
12396 printf (
"nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
12397 printf (
"nondefdecl->get_type()->get_declaration() = %p = %s \n",nondefdecl->get_type()->get_declaration(),nondefdecl->get_type()->get_declaration()->class_name().c_str());
12398 printf (
"nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl->get_firstNondefiningDeclaration(),nondefdecl->get_firstNondefiningDeclaration()->class_name().c_str());
12402 ROSE_ASSERT (defdecl->get_type() != NULL);
12403 ROSE_ASSERT (defdecl->get_type()->get_declaration() != NULL);
12404 ROSE_ASSERT (defdecl->get_type()->get_declaration() != isSgDeclarationStatement(defdecl));
12405 ROSE_ASSERT (nondefdecl->get_firstNondefiningDeclaration() != NULL);
12406 ROSE_ASSERT (nondefdecl->get_firstNondefiningDeclaration() == nondefdecl);
12408 ROSE_ASSERT (nondefdecl->get_type()->get_declaration() == isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()));
12414 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()))
12416 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");
12417 printf (
" --- nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
12418 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
12419 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl->get_firstNondefiningDeclaration(),nondefdecl->get_firstNondefiningDeclaration()->class_name().c_str());
12422 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl))
12424 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");
12425 printf (
" --- nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
12426 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
12427 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
12435 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12438 defdecl->set_type(nondefdecl->get_type());
12441 printf (
"In buildClassDeclaration_nfi(): after calling set_type() again: defdecl = %p = %s defdecl->get_type() = %p = %s \n",
12442 defdecl,defdecl->class_name().c_str(),defdecl->get_type(),defdecl->get_type()->class_name().c_str());
12446 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12451 nondefdecl->setForward();
12456 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12462 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12467 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12471 ROSE_ASSERT(mysymbol);
12473 printf (
"@@@@@@@@@@@@@@ In buildClassDeclaration_nfi(): setting scope of defining and non-defining declaration to scope = %s \n",scope->
class_name().c_str());
12474 defdecl->set_scope(scope);
12475 nondefdecl->set_scope(scope);
12481 nondefdecl->set_parent(scope);
12484 defdecl->set_parent(scope);
12496 ROSE_ASSERT(defdecl->get_parent() == NULL);
12501 ROSE_ASSERT(defdecl->get_definingDeclaration() == defdecl);
12502 ROSE_ASSERT(defdecl->get_firstNondefiningDeclaration() != defdecl->get_definingDeclaration());
12508 SgClassDeclaration* temp_firstNondefiningDeclaration = isSgClassDeclaration(defdecl->get_firstNondefiningDeclaration());
12509 SgClassDeclaration* temp_definingDeclaration = isSgClassDeclaration(defdecl->get_definingDeclaration());
12510 ROSE_ASSERT(temp_firstNondefiningDeclaration != NULL);
12511 ROSE_ASSERT(temp_definingDeclaration != NULL);
12514 printf (
"Leaving buildClassDeclaration_nfi(): defdecl = %p = %s = %s \n",defdecl,defdecl->class_name().c_str(),defdecl->get_name().str());
12515 printf (
" --- defdecl->get_firstNondefiningDeclaration() = %p \n",defdecl->get_firstNondefiningDeclaration());
12516 printf (
" --- defdecl->get_definingDeclaration() = %p \n",defdecl->get_definingDeclaration());
12518 printf (
" --- defdecl->get_firstNondefiningDeclaration()->get_name() = %s \n",temp_firstNondefiningDeclaration->get_name().str());
12519 printf (
" --- defdecl->get_definingDeclaration()->get_name() = %s \n",temp_definingDeclaration->get_name().str());
12521 printf (
" --- defdecl->get_firstNondefiningDeclaration()->get_type() = %p = %s \n",
12522 temp_firstNondefiningDeclaration->get_type(),temp_firstNondefiningDeclaration->get_type()->
unparseToString().c_str());
12523 printf (
" --- defdecl->get_definingDeclaration()->get_type() = %p = %s \n",
12524 temp_definingDeclaration->get_type(),temp_definingDeclaration->get_type()->
unparseToString().c_str());
12526 printf (
" --- nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
12527 printf (
" --- nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
12530 printf (
"Leaving buildClassDeclaration_nfi(): defdecl: unparseNameToString() = %s \n",defdecl->unparseNameToString().c_str());
12535 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_name() == temp_definingDeclaration->get_name());
12536 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_type() == temp_definingDeclaration->get_type());
12541 if (definingDeclaration != NULL && nondefiningDeclaration != NULL)
12547 printf (
"NOTE: buildClassDeclaration_nfi(): Setting the templateDeclaration for the defining declaration = %p using the value = %p from the nondefiningDeclaration = %p \n",
12548 definingDeclaration,templateDeclaration,nondefiningDeclaration);
12558 if (definingDeclaration != NULL)
12563 printf (
"NOTE: buildClassDeclaration_nfi(): definingDeclaration->get_templateDeclaration() == NULL \n");
12570 printf (
"Leaving buildClassDeclaration_nfi(): defdecl = %p defdecl->unparseNameToString() = %s \n",defdecl,defdecl->unparseNameToString().c_str());
12575 printf (
"Leaving buildClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
12576 SgSymbol* test_symbol = nondefdecl->get_scope()->find_symbol_from_declaration(nondefdecl);
12579 printf (
"Leaving buildClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
12580 ROSE_ASSERT(nondefdecl->get_symbol_from_symbol_table() != NULL);
12605 ROSE_ASSERT(scope != NULL);
12607 ROSE_ASSERT(definingClassDeclaration != NULL);
12609 return definingClassDeclaration;
12628 ROSE_ASSERT(result);
12633 result->setCaseInsensitive(
true);
12652 printf(
"In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(XXX_name = %p):\n", XXX_name.str());
12659 ROSE_ASSERT(scope != NULL);
12662 printf (
"SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): XXX_name = %s scope = %p = %s \n",XXX_name.str(),scope,scope->
class_name().c_str());
12666 SgName nameWithoutTemplateArguments = XXX_name;
12670 printf (
"SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): nameWithTemplateSpecializationArguments = %s \n",nameWithTemplateSpecializationArguments.str());
12698 mysymbol = scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList);
12705 printf (
"Warning: In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): scope == NULL \n");
12708 printf (
"In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
12711 if (mysymbol != NULL)
12717 ROSE_ASSERT(classType != NULL);
12727 if (nondefdecl->get_type() != NULL)
12729 printf (
"Note: SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): nondefdecl->get_type() != NULL: name = %s \n",nondefdecl->get_name().str());
12734 ROSE_ASSERT(nondefdecl != NULL);
12737 ROSE_ASSERT(templateParameterList != NULL);
12738 nondefdecl->get_templateParameters() = *templateParameterList;
12749 nondefdecl->set_nonreal_decl_scope(nonreal_decl_scope);
12755 printf(
"In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(XXX_name = %p): nrscope = %p (new)\n", XXX_name.str(), nonreal_decl_scope);
12765 ROSE_ASSERT(templateSpecializationArgumentList != NULL);
12766 nondefdecl->get_templateSpecializationArguments() = *templateSpecializationArgumentList;
12769 if (nondefdecl->get_templateParameters().size() == 0)
12771#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12772 printf (
"WARNING: In buildNondefiningTemplateClassDeclaration_nfi(): (part 1) nondefdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations nondefdecl = %p \n",nondefdecl);
12792 nondefdecl->set_templateName(nameWithoutTemplateArguments);
12799 ROSE_ASSERT(nondefdecl != NULL);
12802 ROSE_ASSERT(templateParameterList != NULL);
12803 nondefdecl->get_templateParameters() = *templateParameterList;
12813 if (nondefdecl->get_templateParameters().size() == 0)
12815#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12816 printf (
"WARNING: In buildNondefiningTemplateClassDeclaration_nfi(): (part 2) nondefdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations nondefdecl = %p \n",nondefdecl);
12822 nondefdecl->set_templateName(nameWithoutTemplateArguments);
12826 if (nondefdecl->get_type() == NULL)
12833 ROSE_ASSERT(nondefdecl->get_type() != NULL);
12852 printf (
"In buildNondefiningTemplateClassDeclaration_nfi(): Commented out setting the parent to the scope. \n");
12862 if (nondefdecl->get_type() == NULL)
12869 ROSE_ASSERT(nondefdecl->get_type() != NULL);
12871 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());
12880 printf (
"Building a SgTemplateSymbol using nameWithTemplateSpecializationArguments = %s and nondefdecl = %p = %s \n",nameWithTemplateSpecializationArguments.str(),nondefdecl,nondefdecl->
class_name().c_str());
12886 ROSE_ASSERT(mysymbol != NULL);
12892 ROSE_ASSERT(scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList) == NULL);
12896 scope->
insert_symbol(nameWithTemplateSpecializationArguments, mysymbol);
12898 printf (
"SageBuilder::buildNondefiningTemplateClassDeclaration_nfi() (after building symbol): scope = %p = %s \n",scope,scope->
class_name().c_str());
12900 ROSE_ASSERT(nondefdecl->
get_scope() != NULL);
12907 ROSE_ASSERT(scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList) != NULL);
12926 ROSE_ASSERT(templateClassDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateClassDeclaration->get_templateParameters().size()));
12943 if (defdecl->get_type() != NULL)
12947 if (defdecl->get_type()->get_declaration() == isSgDeclarationStatement(defdecl) )
12949 delete defdecl->get_type();
12954 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12955 ROSE_ASSERT (nondefdecl->get_type()->get_declaration() == isSgDeclarationStatement(nondefdecl));
12956 defdecl->set_type(nondefdecl->get_type());
12959 ROSE_ASSERT(nondefdecl->get_type() != NULL);
12977 ROSE_ASSERT(defdecl->get_definingDeclaration() == defdecl);
12978 ROSE_ASSERT(defdecl->get_firstNondefiningDeclaration() != defdecl->get_definingDeclaration());
12980 ROSE_ASSERT(defdecl->get_scope() != NULL);
12984 ROSE_ASSERT(nondefdecl->
get_parent() == NULL);
12987 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
12993 printf (
"Leaving buildNondefiningTemplateClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
12995 SgSymbol* test_symbol = nondefdecl->
get_scope()->find_symbol_from_declaration(tmp_classDeclaration);
12998 printf (
"Leaving buildNondefiningTemplateClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
13007 SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateSpecializationArgumentList )
13016 SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateSpecializationArgumentList )
13025 printf (
"In buildTemplateClassDeclaration_nfi(): nonDefiningDecl = %p \n",nonDefiningDecl);
13026 if (nonDefiningDecl != NULL)
13029 printf (
"--- nonDefiningDecl->get_definingDeclaration() = %p \n",nonDefiningDecl->
get_definingDeclaration());
13034 ROSE_ASSERT(scope != NULL);
13037 SgName nameWithoutTemplateArguments = XXX_name;
13046 if (nonDefiningDecl != NULL)
13051 SgName templateString =
"template string";
13053 SgTemplateParameterPtrList templateParameters;
13070 printf (
"In buildTemplateClassDeclaration_nfi(): calling new SgTemplateClassDeclaration() name = %s \n",nameWithTemplateSpecializationArguments.str());
13085 if (nonDefiningDecl != NULL)
13093 ROSE_ASSERT(defdecl != NULL);
13095 printf (
"In buildTemplateClassDeclaration_nfi(): Reusing the defining declaration previously build: defdecl = %p = %s \n",defdecl,defdecl->get_name().str());
13101 printf (
"In buildTemplateClassDeclaration_nfi(): No defining declaration found, so we have to build one. \n");
13106 if (defdecl == NULL)
13109 printf (
"Building a defining declaration \n");
13114 ROSE_ASSERT(defdecl != NULL);
13117 printf (
"In buildTemplateClassDeclaration_nfi(): defdecl = %p = %s \n",defdecl,defdecl->
class_name().c_str());
13121 ROSE_ASSERT(templateParameterList != NULL);
13122 defdecl->get_templateParameters() = *templateParameterList;
13125 ROSE_ASSERT(templateSpecializationArgumentList != NULL);
13126 defdecl->get_templateSpecializationArguments() = *templateSpecializationArgumentList;
13132 if (defdecl->get_templateParameters().size() == 0)
13134#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
13135 printf (
"WARNING: In buildTemplateClassDeclaration_nfi(): defdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations defdecl = %p \n",defdecl);
13141 defdecl->set_templateName(nameWithoutTemplateArguments);
13144 printf (
"SageBuilder::buildTemplateClassDeclaration_nfi(): scope = %p = %s \n",scope,scope->
class_name().c_str());
13153 ROSE_ASSERT(classDef != NULL);
13160 classDef->set_declaration(defdecl);
13169 if (nondefdecl == NULL) {
13170 ROSE_ASSERT(scope != NULL);
13172 SgClassSymbol* mysymbol = scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList);
13174 printf (
"In buildTemplateClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
13177 if (mysymbol != NULL) {
13178 nondefdecl = isSgTemplateClassDeclaration(mysymbol->get_declaration());
13179 ROSE_ASSERT(nondefdecl != NULL);
13186 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
13193 printf(
" start build non-defn decl for %p\n",defdecl);
13197 ROSE_ASSERT(nondefdecl != NULL);
13202 printf(
" nondefdecl = %p\n",nondefdecl);
13209 nondefdecl->set_nonreal_decl_scope(nonreal_decl_scope);
13215 printf(
"In buildTemplateClassDeclaration_nfi(): nrscope = %p\n", nonreal_decl_scope);
13219 ROSE_ASSERT(templateParameterList != NULL);
13220 nondefdecl->get_templateParameters() = *templateParameterList;
13228 if (nondefdecl->get_templateParameters().size() == 0)
13230#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
13231 printf (
"WARNING: In buildTemplateClassDeclaration_nfi(): nondefdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations nondefdecl = %p \n",nondefdecl);
13236 printf(
" next 1\n");
13240 nondefdecl->set_templateName(nameWithoutTemplateArguments);
13243 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
13258 printf(
" next 2\n");
13261 if (nondefdecl->get_type() == NULL)
13265 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());
13269 printf(
" next 3\n");
13273 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
13284 ROSE_ASSERT(templateClassDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateClassDeclaration->get_templateParameters().size()));
13287 scope->
insert_symbol(nameWithTemplateSpecializationArguments, mysymbol);
13289 printf(
" end build non-defn decl\n");
13293 SgClassSymbol* mysymbol = scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList);
13294 if (mysymbol == NULL) {
13295 printf(
"WARNING: In buildTemplateClassDeclaration_nfi(): non-defining declaration was provided but cannot be located in the associated scope.\n");
13300 printf (
"In buildTemplateClassDeclaration_nfi(): Setting the firstNondefiningDeclaration to be nondefdecl = %p \n",nondefdecl);
13316 if (defdecl->get_type() != NULL)
13322 if (defdecl->get_type()->get_declaration() == isSgDeclarationStatement(defdecl) )
13324 delete defdecl->get_type();
13336 ROSE_ASSERT (nondefdecl->get_type() != NULL);
13340 if (isSgClassType(nondefdecl->get_type())->get_declaration() != isSgDeclarationStatement(nondefdecl))
13343 printf (
"In buildTemplateClassDeclaration_nfi(): detected isSgClassType(nondefdecl->get_type())->get_declaration() != isSgDeclarationStatement(nondefdecl) (problem with Boost code in ROSE compiling ROSE) \n");
13348 defdecl->set_type(nondefdecl->get_type());
13351 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());
13366 printf (
"***** WARNING *****: Commented out call to fixStructDeclaration() \n");
13374 ROSE_ASSERT(defdecl->
get_scope() != NULL);
13378 ROSE_ASSERT(defdecl->get_type() != NULL);
13381 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
13387#if PRINT_DEVELOPER_WARNINGS
13388 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());
13393 ROSE_ASSERT(defdecl->get_templateName().is_null() ==
false);
13396 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
13403 printf (
"Leaving buildTemplateClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
13405 SgSymbol* test_symbol = defdecl->
get_scope()->find_symbol_from_declaration(tmp_classDeclaration);
13408 printf (
"Leaving buildTemplateClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
13438 ASSERT_not_null(scope);
13449 SgEnumSymbol* existing_symbol = scope->lookup_enum_symbol(name);
13450 if (existing_symbol != NULL)
13452 enumType = isSgEnumType(existing_symbol->
get_type());
13453 first_nondefdecl = existing_symbol->get_declaration();
13454 ROSE_ASSERT(first_nondefdecl != NULL);
13463 ROSE_ASSERT(nondefdecl);
13467 if (first_nondefdecl)
13482 ASSERT_not_null(type);
13488 SgEnumSymbol* existing_symbol = scope->lookup_enum_symbol(name);
13490 if (existing_symbol)
13492 mysymbol = existing_symbol;
13493 first_nondefdecl = mysymbol->get_declaration();
13497 first_nondefdecl = nondefdecl;
13500 ASSERT_not_null(mysymbol);
13510 if (first_nondefdecl != nondefdecl)
13520 ASSERT_not_null(nondefdecl->
get_type());
13521 ASSERT_not_null(scope->lookup_enum_symbol(name));
13530 ROSE_ASSERT(scope != NULL);
13533 printf (
"In buildEnumDeclaration_nfi(): name = %s scope = %p = %s \n",name.str(),scope,scope->
class_name().c_str());
13541 SgEnumSymbol* existing_symbol = scope->lookup_enum_symbol(name);
13542 if (existing_symbol != NULL)
13544 enumType = isSgEnumType(existing_symbol->
get_type());
13549 printf (
"In buildEnumDeclaration_nfi(): name = %s building using enumType = %p \n",name.str(),enumType);
13554 ROSE_ASSERT(defdecl);
13557 printf (
"In buildEnumDeclaration_nfi(): built defining declaration = %p name = %s scope = %p = %s \n",defdecl,name.str(),scope,scope->
class_name().c_str());
13562 ROSE_ASSERT(type != NULL);
13569 printf (
"In buildEnumDeclaration_nfi(): name = %s \n",name.str());
13574 ROSE_ASSERT(scope != NULL);
13575 SgEnumSymbol* enumSymbol = scope->lookup_enum_symbol(name);
13578 if (enumSymbol != NULL)
13580 ROSE_ASSERT(enumSymbol->get_declaration() != NULL);
13581 nondefdecl = enumSymbol->get_declaration();
13582 ROSE_ASSERT(nondefdecl != NULL);
13589 printf (
"###### In buildEnumDeclaration_nfi(): built a non-defining declaration to support the symbol table: name = %s nondefdecl = %p \n",name.str(),nondefdecl);
13618 ROSE_ASSERT(mysymbol);
13638 printf (
"In buildEnumDeclaration_nfi(): name = %s defdecl = %p \n",name.str(),defdecl);
13642 ROSE_ASSERT(scope->lookup_enum_symbol(name) != NULL);
13654 ROSE_ASSERT(classDeclaration != NULL);
13655 ROSE_ASSERT(classDefinition != NULL);
13666 ROSE_ASSERT(baseclass != NULL);
13668 if (isVirtual ==
true)
13672 ROSE_ASSERT(baseclass->get_baseClassModifier() != NULL);
13673 baseclass->get_baseClassModifier()->setVirtual();
13685 classDefinition->append_inheritance(baseclass);
13694 ROSE_ASSERT(nrdecl != NULL);
13695 ROSE_ASSERT(classDefinition != NULL);
13698 ROSE_ASSERT(baseclass != NULL);
13700 if (isVirtual ==
true)
13702 baseclass->get_baseClassModifier()->setVirtual();
13707 classDefinition->append_inheritance(baseclass);
13717SageBuilder::buildAccessModifier (
unsigned int access )
13725 printf (
"In SageBuilder::set_access_modifiers(): Mark as public \n");
13732 printf (
"In SageBuilder::set_access_modifiers(): Mark as protected \n");
13739 printf (
"In SageBuilder::set_access_modifiers(): Mark as private \n");
13745 printf (
"Error: default reached in SageBuilder::set_access_modifiers() \n");
13760 ROSE_ASSERT(subtreeRoot != NULL);
13761 ROSE_ASSERT(newFileName !=
"");
13763#define DEBUG_FIXUP 0
13766 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): newFileName = %s \n",newFileName.c_str());
13767 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
13774 Traversal(
const std::string& tmp_newFileName,
int tmp_new_file_id,
int tmp_originalFileId)
13776 newFileName = tmp_newFileName;
13777 new_file_id = tmp_new_file_id;
13778 originalFileId = tmp_originalFileId;
13780 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): newFileName = %s new_file_id = %d originalFileId = %d \n",newFileName.c_str(),new_file_id,originalFileId);
13787 printf (
"In fixupSourcePositionFileSpecification visit(): node = %p = %s \n",node,node->
class_name().c_str());
13791 if (locatedNode != NULL)
13802 printf (
"Found SgLocatedNode marked as isShared() == true: locatedNode = %p = %s \n",locatedNode,locatedNode->
class_name().c_str());
13805 printf (
"Exiting as a test! \n");
13816 printf (
"locatedNode->get_startOfConstruct()->get_filename() = %s locatedNode->get_startOfConstruct()->get_physical_filename() = %s \n",
13818 printf (
"locatedNode->get_startOfConstruct()->get_file_id() = %d locatedNode->get_startOfConstruct()->get_physical_file_id() = %d \n",
13820 printf (
"locatedNode->get_startOfConstruct()->isShared() = %s \n",locatedNode->
get_startOfConstruct()->
isShared() ?
"true" :
"false");
13826 printf (
"NOT MATCHING: originalFileId = %d locatedNode->get_startOfConstruct()->get_file_id() = %d locatedNode->get_startOfConstruct()->get_physical_file_id() = %d \n",
13828 printf (
" ------------ originalFileId = %d locatedNode->get_endOfConstruct()->get_file_id() = %d locatedNode->get_endOfConstruct()->get_physical_file_id() = %d \n",
13836 if (initializedName != NULL)
13854 if (sourceFile != NULL)
13862 printf (
"sourceFile->get_endOfConstruct() == NULL: fixup endOfConstruct \n");
13876 printf (
"sourceFile->get_startOfConstruct()->get_file_id() = %d \n",sourceFile->
get_startOfConstruct()->get_file_id());
13877 printf (
"sourceFile->get_startOfConstruct()->get_physical_file_id() = %d \n",sourceFile->
get_startOfConstruct()->get_physical_file_id());
13886 printf (
"Unhandled: node = %p = %s \n",node,node->
class_name().c_str());
13893 if (expression != NULL)
13895 if (expression->get_operatorPosition()->get_physical_file_id() == originalFileId)
13897 expression->get_operatorPosition()->set_file_id(new_file_id);
13898 expression->get_operatorPosition()->set_physical_file_id(new_file_id);
13905 int originalFileId;
13906 string newFileName;
13910 SgFile* file = isSgFile(subtreeRoot);
13911 int new_file_id = -1;
13912 int originalFileId = -1;
13921 printf (
"originalFileId = %d \n",originalFileId);
13934 int new_file_id_2 = Sg_File_Info::getIDFromFilename(newFileName);
13936 printf (
"new_file_id = %d new_file_id_2 = %d \n",new_file_id,new_file_id_2);
13938 ROSE_ASSERT(new_file_id == new_file_id_2);
13940 string new_filename_2 = Sg_File_Info::getFilenameFromID(new_file_id);
13942 printf (
"newFileName = %s new_filename_2 = %s \n",newFileName.c_str(),new_filename_2.c_str());
13944 ROSE_ASSERT(newFileName == new_filename_2);
13948 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): file != NULL: newFileName = %s new_file_id = %d \n",newFileName.c_str(),new_file_id);
13953 SgLocatedNode* subtreeLocatedNode = isSgLocatedNode(subtreeRoot);
13954 if (subtreeLocatedNode != NULL)
13957 printf (
"subtreeLocatedNode->get_startOfConstruct()->get_file_id() = %d \n",subtreeLocatedNode->
get_startOfConstruct()->get_file_id());
13958 printf (
"subtreeLocatedNode->get_startOfConstruct()->get_physical_file_id() = %d \n",subtreeLocatedNode->
get_startOfConstruct()->get_physical_file_id());
13961 new_file_id = Sg_File_Info::getIDFromFilename(newFileName);
13963 printf (
"originalFileId = %d \n",originalFileId);
13964 printf (
"new_file_id = %d \n",new_file_id);
13967 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): subtreeLocatedNode = %s : originalFileId = %d newFileName = %s new_file_id = %d \n",
13968 subtreeLocatedNode->
class_name().c_str(),originalFileId,newFileName.c_str(),new_file_id);
13973 printf (
"Error: In SageBuilder::fixupSourcePositionFileSpecification(): subtree should be a SgFile or SgLocatedNode: subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
13978 printf (
"Error: In SageBuilder::fixupSourcePositionFileSpecification(): subtree should be a SgFile: subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
13983 ROSE_ASSERT(new_file_id >= 0);
13986 Traversal traversal (newFileName,new_file_id,originalFileId);
13991 traversal.traverse(subtreeRoot, preorder);
13994 printf (
"Exiting as a test in SageBuilder::fixupSourcePositionFileSpecification() \n");
14012 ROSE_ASSERT(subtreeRoot != NULL);
14013 ROSE_ASSERT(new_file_id >= 0);
14016 printf (
"In SageBuilder::fixupSharingSourcePosition(): subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
14017 printf (
"In SageBuilder::fixupSharingSourcePosition(): new_file_id = %d \n",new_file_id);
14024 Traversal(
int tmp_new_file_id)
14026 new_file_id = tmp_new_file_id;
14028 printf (
"In SageBuilder::fixupSharingSourcePosition(): new_file_id = %d \n",new_file_id);
14032 void visit (
SgNode* node)
14035 printf (
"In fixupSharingSourcePosition visit(): node = %p = %s new_file_id = %d \n",node,node->
class_name().c_str(),new_file_id);
14039 if (statement != NULL)
14044 printf (
"new_file_id = %d startOfConstruct->get_physical_file_id() = %d \n",new_file_id,startOfConstruct->get_physical_file_id());
14047 if (startOfConstruct->get_physical_file_id() == new_file_id)
14055 printf (
" --- adding entries for file_id and line number to support sharing: new_file_id = %d line = %d end line = %d \n",
14058 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == startOfConstruct->get_fileLineNumbersToUnparse().size());
14059 ROSE_ASSERT(endOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
14060 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
14063 startOfConstruct->get_fileIDsToUnparse().push_back(new_file_id);
14064 startOfConstruct->get_fileLineNumbersToUnparse().push_back(startOfConstruct->
get_line());
14066 endOfConstruct->get_fileIDsToUnparse().push_back(new_file_id);
14067 endOfConstruct->get_fileLineNumbersToUnparse().push_back(endOfConstruct->
get_line());
14069 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == startOfConstruct->get_fileLineNumbersToUnparse().size());
14070 ROSE_ASSERT(endOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
14071 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
14077 printf (
"Unhandled: node = %p = %s \n",node,node->
class_name().c_str());
14087 SgStatement* statement = isSgStatement(subtreeRoot);
14088 if (statement != NULL)
14091 printf (
"statement->get_startOfConstruct()->get_file_id() = %d \n",statement->
get_startOfConstruct()->get_file_id());
14092 printf (
"statement->get_startOfConstruct()->get_physical_file_id() = %d \n",statement->
get_startOfConstruct()->get_physical_file_id());
14095 printf (
"new_file_id = %d \n",new_file_id);
14098 printf (
"In SageBuilder::fixupSharingSourcePosition(): statement = %s : new_file_id = %d \n",statement->
class_name().c_str(),new_file_id);
14103 printf (
"Error: In SageBuilder::fixupSharingSourcePosition(): subtree should be a SgFile or SgLocatedNode: subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
14107 ROSE_ASSERT(new_file_id >= 0);
14110 Traversal traversal (new_file_id);
14115 traversal.traverse(subtreeRoot, preorder);
14118 printf (
"Exiting as a test in SageBuilder::fixupSharingSourcePosition() \n");
14135#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
14138 printf (
"In SageBuilder::buildFile(inputFileName = %s, outputFileName = %s, project = %p) \n",inputFileName.c_str(),outputFileName.c_str(),project);
14144 ROSE_ASSERT(project != NULL);
14147 if (tmp1_collectionOfModifiedLocatedNodes.size() > 0)
14149 printf (
"In Traversal::evaluateInheritedAttribute(): tmp1_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp1_collectionOfModifiedLocatedNodes.size());
14151 printf (
"Exiting as a test! \n");
14152 ROSE_ASSERT(
false);
14157 ROSE_ASSERT(inputFileName.size() != 0);
14162 string sourceFilename = inputFileName;
14166 printf (
"sourceFilename = %s \n",sourceFilename.c_str());
14172 if (project != NULL)
14174 SgGlobal* globalScopeAcrossFiles = project->get_globalScopeAcrossFiles();
14175 ROSE_ASSERT(globalScopeAcrossFiles != NULL);
14178 ROSE_ASSERT(globalScopeAcrossFiles->
get_symbol_table()->get_table() != NULL);
14181 printf (
"In SageBuilder::buildFile(): globalScopeAcrossFiles = %p \n",globalScopeAcrossFiles);
14182 printf (
" --- globalScopeAcrossFiles->get_declarations().size() = %zu \n",globalScopeAcrossFiles->
get_declarations().size());
14183 printf (
" --- globalScopeAcrossFiles->get_symbol_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->
size());
14184 printf (
" --- globalScopeAcrossFiles->get_symbol_table()->get_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->get_table()->size());
14187 printf (
"Removing all elements from the globalScopeAcrossFiles->get_symbol_table() \n");
14193 if (clear_globalScopeAcrossFiles ==
true)
14195 globalScopeAcrossFiles->
get_symbol_table()->get_table()->delete_elements();
14199 printf (
"After removing all symbols (alias symbols): globalScopeAcrossFiles->get_symbol_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->
size());
14200 printf (
"After removing all symbols (alias symbols): globalScopeAcrossFiles->get_symbol_table()->get_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->get_table()->size());
14207 Rose_STL_Container<std::string> arglist;
14208 int nextErrorCode = 0;
14211 bool set_header_file_unparsing_optimization =
false;
14215 bool isCopyOfExistingFile_testForSharedNodes =
false;
14216 SgFile* fileBeingCopied = NULL;
14218 if (project == NULL)
14223 printf (
"In SageBuilder::buildFile(): build the SgProject \n");
14226 ROSE_ASSERT(project);
14227 project->get_fileList().clear();
14229 arglist.push_back(
"cc");
14230 arglist.push_back(
"-c");
14238 SgFilePtrList & files = project->get_fileList();
14239 for (SgFilePtrList::iterator i = files.begin(); i != files.end(); i++)
14243 printf (
"file = %p = %s name = %s \n",file,file->
class_name().c_str(), file->
getFileName().c_str());
14245 printf (
"file->get_header_file_unparsing_optimization() = %s \n",file->get_header_file_unparsing_optimization() ?
"true" :
"false");
14246 printf (
"file->get_header_file_unparsing_optimization_source_file() = %s \n",file->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
14247 printf (
"file->get_header_file_unparsing_optimization_header_file() = %s \n",file->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
14252 printf (
"This is a copy of an existing file in the project: sourceFilename = %s \n",sourceFilename.c_str());
14255 isCopyOfExistingFile_testForSharedNodes =
true;
14256 fileBeingCopied = file;
14261 if (file->get_header_file_unparsing_optimization() ==
true)
14263 set_header_file_unparsing_optimization =
true;
14270 printf (
"Exiting as a test! \n");
14275 ifstream testfile(inputFileName.c_str());
14276 if (!testfile.is_open())
14282 ofstream outputfile(inputFileName.c_str(),ios::out);
14284 outputfile<<
"// Output file generated so that StringUtility::getAbsolutePathFromRelativePath() will see a vaild file ... unparsed file will have rose_ prefix "<<endl;
14285 outputfile.close();
14305 project->get_sourceFileNameList().push_back(inputFileName);
14307 Rose_STL_Container<string> sourceFilenames = project->get_sourceFileNameList();
14315 if (std::find(arglist.begin(), arglist.end(), sourceFilename) == arglist.end())
14317 arglist.push_back(sourceFilename);
14322 if (outputFileName.empty() ==
false)
14324 arglist.push_back(
"-rose:o");
14326 arglist.push_back(outputFileName);
14343 SgFile* result = determineFileType(arglist, nextErrorCode, project);
14344 ROSE_ASSERT(result != NULL);
14347 printf (
"In SageBuilder::buildFile(): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",project,project->get_fileList_ptr()->get_listOfFiles().size());
14351 if (sourceFile != NULL)
14353 SgGlobal* globalScope = sourceFile->get_globalScope();
14354 ROSE_ASSERT(globalScope != NULL);
14363 printf (
"In SageBuilder::buildFile(): globalScope->get_isModified() == true: reset to false \n");
14367 printf (
"In SageBuilder::buildFile(): Verify false setting: globalScope->get_isModified() = %s \n",globalScope->
get_isModified() ?
"true" :
"false");
14382 ROSE_ASSERT(project != NULL);
14385 if (tmp2_collectionOfModifiedLocatedNodes.size() > 0)
14387 printf (
"In Traversal::evaluateInheritedAttribute(): tmp2_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp2_collectionOfModifiedLocatedNodes.size());
14389 printf (
"Exiting as a test! \n");
14390 ROSE_ASSERT(
false);
14397 ROSE_ASSERT(project != NULL);
14400 if (tmp22_collectionOfModifiedLocatedNodes.size() > 0)
14402 printf (
"In Traversal::evaluateInheritedAttribute(): tmp22_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp22_collectionOfModifiedLocatedNodes.size());
14404 printf (
"Exiting as a test! \n");
14405 ROSE_ASSERT(
false);
14411 printf (
"Calling outputFileIds() \n");
14415 printf (
"DONE: Calling outputFileIds() \n");
14420 printf (
"In SageBuilder::buildFile(): file = %p = %s result->get_header_file_unparsing_optimization() = %s \n",
14421 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization() ?
"true" :
"false");
14425 printf (
"In SageBuilder::buildFile(): file = %p = %s result->get_header_file_unparsing_optimization_source_file() = %s \n",
14426 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
14427 printf (
"In SageBuilder::buildFile(): file = %p = %s result->get_header_file_unparsing_optimization_header_file() = %s \n",
14428 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
14440 if (set_header_file_unparsing_optimization ==
true)
14442 result->set_header_file_unparsing_optimization(
true);
14452 result->set_header_file_unparsing_optimization_header_file(
false);
14455 printf (
"In SageBuilder::buildFile(): set_header_file_unparsing_optimization == true: file = %p = %s result->get_header_file_unparsing_optimization() = %s \n",
14456 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization() ?
"true" :
"false");
14457 printf (
"In SageBuilder::buildFile(): set_header_file_unparsing_optimization == true: file = %p = %s result->get_header_file_unparsing_optimization_source_file() = %s \n",
14458 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
14459 printf (
"In SageBuilder::buildFile(): set_header_file_unparsing_optimization == true: file = %p = %s result->get_header_file_unparsing_optimization_header_file() = %s \n",
14460 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
14476 if (project->get_Java_only() ==
true)
14479 printf (
"WARNING: Java specific action to add new file to SgProject (using set_file()) (more uniform language handling symantics would avoid this problem) \n");
14491 printf (
"In SageBuilder::buildFile(): Outliner::use_dlopen = %s \n",Outliner::use_dlopen ?
"true" :
"false");
14496 ROSE_ASSERT(project != NULL);
14499 if (tmp23_collectionOfModifiedLocatedNodes.size() > 0)
14501 printf (
"In Traversal::evaluateInheritedAttribute(): tmp23_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp23_collectionOfModifiedLocatedNodes.size());
14503 printf (
"Exiting as a test! \n");
14504 ROSE_ASSERT(
false);
14511 ROSE_ASSERT(project != NULL);
14514 if (tmp24_collectionOfModifiedLocatedNodes.size() > 0)
14516 printf (
"In Traversal::evaluateInheritedAttribute(): tmp24_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp24_collectionOfModifiedLocatedNodes.size());
14518 printf (
"Exiting as a test! \n");
14519 ROSE_ASSERT(
false);
14529 if (!Outliner::use_dlopen)
14532 printf (
"In SageBuilder::buildFile(): (after test for (!Outliner::use_dlopen) == true: project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
14533 project,project->get_fileList_ptr()->get_listOfFiles().size());
14538 printf (
"In SageBuilder::buildFile(): (after 2nd project->set_file()): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
14539 project,project->get_fileList_ptr()->get_listOfFiles().size());
14545 printf (
"In SageBuilder::buildFile(): (after test for (!Outliner::use_dlopen) == false: project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
14546 project,project->get_fileList_ptr()->get_listOfFiles().size());
14561 SgFilePtrList& flist = project->get_fileList();
14562 flist.insert(flist.begin(),result);
14564 printf (
"In SageBuilder::buildFile(): (after flist.insert(flist.begin(),result)): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
14565 project,project->get_fileList_ptr()->get_listOfFiles().size());
14572 ROSE_ASSERT(project != NULL);
14575 if (tmp25_collectionOfModifiedLocatedNodes.size() > 0)
14577 printf (
"In Traversal::evaluateInheritedAttribute(): tmp25_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp25_collectionOfModifiedLocatedNodes.size());
14579 printf (
"Exiting as a test! \n");
14580 ROSE_ASSERT(
false);
14588 EDG_ROSE_Translation::suppress_detection_of_transformations =
true;
14591 printf (
"In SageBuilder::buildFile(): EDG_ROSE_Translation::suppress_detection_of_transformations = %s \n",EDG_ROSE_Translation::suppress_detection_of_transformations ?
"true" :
"false");
14595 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());
14618 ROSE_ASSERT(project != NULL);
14621 if (tmp251_collectionOfModifiedLocatedNodes.size() > 0)
14623 printf (
"In Traversal::evaluateInheritedAttribute(): tmp251_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp251_collectionOfModifiedLocatedNodes.size());
14625 printf (
"Exiting as a test! \n");
14626 ROSE_ASSERT(
false);
14634 result->runFrontend(nextErrorCode);
14637 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());
14641 printf (
"After result->runFrontend(): calling outputFileIds() \n");
14645 printf (
"DONE: After result->runFrontend(): calling outputFileIds() \n");
14660 ROSE_ASSERT(project != NULL);
14663 if (tmp26_collectionOfModifiedLocatedNodes.size() > 0)
14665 printf (
"In Traversal::evaluateInheritedAttribute(): tmp26_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp26_collectionOfModifiedLocatedNodes.size());
14667 printf (
"Exiting as a test! \n");
14668 ROSE_ASSERT(
false);
14675 printf (
"Generating a dot file... (SgFile only) \n");
14676 generateDOT ( *project );
14681 printf (
"In SageBuilder::buildFile(): Generate the dot output for multiple files (ROSE AST) \n");
14683 generateDOTforMultipleFile ( *project );
14684 printf (
"DONE: Generate the dot output of the SAGE III AST \n");
14690 const int MAX_NUMBER_OF_IR_NODES_TO_GRAPH_FOR_WHOLE_GRAPH = 8000;
14691 generateAstGraph(project,MAX_NUMBER_OF_IR_NODES_TO_GRAPH_FOR_WHOLE_GRAPH);
14696 printf (
"In SageBuilder::buildFile(): calling astPostProcessing() \n");
14699 AstPostProcessing(result);
14702 printf (
"In SageBuilder::buildFile(): DONE: calling astPostProcessing() \n");
14715 ROSE_ASSERT(project != NULL);
14718 if (tmp265_collectionOfModifiedLocatedNodes.size() > 0)
14720 printf (
"In Traversal::evaluateInheritedAttribute(): tmp265_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp265_collectionOfModifiedLocatedNodes.size());
14722 printf (
"Exiting as a test! \n");
14723 ROSE_ASSERT(
false);
14729 result->display(
"SageBuilder::buildFile()");
14732 ROSE_ASSERT(project != NULL);
14733 project->set_frontendErrorCode(max(project->get_frontendErrorCode(), nextErrorCode));
14748 printf (
"Exiting as a test! \n");
14754 ROSE_ASSERT(project != NULL);
14757 if (tmp27_collectionOfModifiedLocatedNodes.size() > 0)
14759 printf (
"In Traversal::evaluateInheritedAttribute(): tmp27_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp27_collectionOfModifiedLocatedNodes.size());
14761 printf (
"Exiting as a test! \n");
14762 ROSE_ASSERT(
false);
14768 if (isCopyOfExistingFile_testForSharedNodes ==
true)
14774 printf (
"Found isCopyOfExistingFile_testForSharedNodes == true \n");
14775 printf (
"fileBeingCopied = %p = %s \n",fileBeingCopied,fileBeingCopied->
getFileName().c_str());
14778 SgSourceFile* sourceFileBeingCopied = isSgSourceFile(fileBeingCopied);
14779 ROSE_ASSERT(sourceFileBeingCopied != NULL);
14782 ROSE_ASSERT(sourceResult != NULL);
14784 SgGlobal* fileBeingCopied_globalScope = sourceFileBeingCopied->get_globalScope();
14785 SgGlobal* result_globalScope = sourceResult->get_globalScope();
14787 printf (
"fileBeingCopied_globalScope = %p \n",fileBeingCopied_globalScope);
14788 printf (
"result_globalScope = %p \n",result_globalScope);
14790 ROSE_ASSERT(fileBeingCopied_globalScope != NULL);
14791 ROSE_ASSERT(result_globalScope != NULL);
14793 SgDeclarationStatementPtrList fileBeingCopied_declarationList = fileBeingCopied_globalScope->
get_declarations();
14794 SgDeclarationStatementPtrList result_declarationList = result_globalScope->
get_declarations();
14799 vector<SgDeclarationStatement*>::iterator it;
14800 SgDeclarationStatementPtrList v(fileBeingCopied_declarationList.size());
14803 std::sort(fileBeingCopied_declarationList.begin(),fileBeingCopied_declarationList.end());
14804 std::sort(result_declarationList.begin(),result_declarationList.end());
14808 it = std::set_intersection(fileBeingCopied_declarationList.begin(),fileBeingCopied_declarationList.end(),result_declarationList.begin(),result_declarationList.end(),v.begin());
14810 v.resize(it-v.begin());
14812 int fileBeingCopied_file_id = fileBeingCopied->
get_startOfConstruct()->get_physical_file_id();
14815 for (
size_t i = 0; i < v.size(); i++)
14820 printf (
" --- SageBuilder::buildFile() is sharing this node: %p %s \n",intersection_element,intersection_element->
class_name().c_str());
14826 printf (
"Exiting as a test! \n");
14833 ROSE_ASSERT(project != NULL);
14836 if (tmp28_collectionOfModifiedLocatedNodes.size() > 0)
14838 printf (
"In Traversal::evaluateInheritedAttribute(): tmp28_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp28_collectionOfModifiedLocatedNodes.size());
14840 printf (
"Exiting as a test! \n");
14841 ROSE_ASSERT(
false);
14853 std::vector<SgDeclarationStatementPtrList::iterator> removeList;
14854 SgDeclarationStatementPtrList::iterator i = fileBeingCopied_declarationList.begin();
14855 while (i != fileBeingCopied_declarationList.end())
14858 if (emptyDeclaration != NULL)
14860 removeList.push_back(i);
14870 for (std::vector<SgDeclarationStatementPtrList::iterator>::iterator i = removeList.begin(); i != removeList.end(); i++)
14872 fileBeingCopied_declarationList.erase(*i);
14877 if (fileBeingCopied_declarationList.size() != result_declarationList.size())
14879 printf (
"fileBeingCopied_declarationList.size() = %zu \n",fileBeingCopied_declarationList.size());
14880 printf (
"result_declarationList.size() = %zu \n",result_declarationList.size());
14882 ROSE_ASSERT(fileBeingCopied_declarationList.size() == result_declarationList.size());
14887 printf (
"Statements from global scope (size = %zu): \n",fileBeingCopied_declarationList.size());
14889 for (
size_t i = 0; i < fileBeingCopied_declarationList.size(); i++)
14894 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());
14896 if (fileBeingCopied_decl == result_decl)
14899 printf (
" --- SageBuilder::buildFile() is sharing this node: %p %s \n",fileBeingCopied_decl,fileBeingCopied_decl->
class_name().c_str());
14905 int fileBeingCopied_file_id = fileBeingCopied->
get_startOfConstruct()->get_physical_file_id();
14908 printf (
"Exiting as a test! \n");
14919 printf (
"exiting as a test! \n");
14929 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
14930 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
14931 printf (
"Leaving SageBuilder::buildFile(): (after result->runFrontend()): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
14932 project,project->get_fileList_ptr()->get_listOfFiles().size());
14933 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
14934 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
14944 ROSE_ASSERT(result->get_preprocessorDirectivesAndCommentsList() != NULL);
14948 ROSE_ASSERT(project != NULL);
14951 if (tmp3_collectionOfModifiedLocatedNodes.size() > 0)
14953 printf (
"In Traversal::evaluateInheritedAttribute(): tmp3_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp3_collectionOfModifiedLocatedNodes.size());
14955 printf (
"Exiting as a test! \n");
14956 ROSE_ASSERT(
false);
14984 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
14985 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
14986 printf (
"In SageBuilder::buildSourceFile(outputFileName = %s, project = %p) \n",outputFileName.c_str(),project);
14987 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
14988 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
14992 string inputFilePrefix =
"temp_dummy_file_";
14995 printf (
"In SageBuilder::buildSourceFile(const std::string& outputFileName, SgProject* project): calling buildFile() \n");
14998 SgFile* file =
buildFile(inputFilePrefix+outputFileName,outputFileName,project,clear_globalScopeAcrossFiles);
14999 ROSE_ASSERT(file != NULL);
15002 printf (
"DONE: In SageBuilder::buildSourceFile(): calling buildFile() \n");
15006 ROSE_ASSERT(sourceFile != NULL);
15008 ROSE_ASSERT(sourceFile->get_globalScope() != NULL);
15011 printf (
"call the unparser on the just built file \n");
15015 printf (
"Exiting as a test! \n");
15026 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
15027 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
15028 printf (
"In SageBuilder::buildSourceFile(const std::string& inputFileName,const std::string& outputFileName, SgProject* project): calling buildFile() \n");
15030 printf (
" --- inputFileName = %s \n",inputFileName.c_str());
15031 printf (
" --- outputFileName = %s \n",outputFileName.c_str());
15032 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
15033 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
15038 ROSE_ASSERT(project != NULL);
15041 if (tmp1_collectionOfModifiedLocatedNodes.size() > 0)
15043 printf (
"In Traversal::evaluateInheritedAttribute(): tmp1_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp1_collectionOfModifiedLocatedNodes.size());
15045 printf (
"Exiting as a test! \n");
15046 ROSE_ASSERT(
false);
15051 SgFile* file =
buildFile(inputFileName, outputFileName,project,clear_globalScopeAcrossFiles);
15052 ROSE_ASSERT(file != NULL);
15055 printf (
"DONE: In SageBuilder::buildSourceFile(): calling buildFile() \n");
15060 ROSE_ASSERT(project != NULL);
15063 if (tmp2_collectionOfModifiedLocatedNodes.size() > 0)
15065 printf (
"In Traversal::evaluateInheritedAttribute(): tmp2_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp2_collectionOfModifiedLocatedNodes.size());
15067 printf (
"Exiting as a test! \n");
15068 ROSE_ASSERT(
false);
15074 ROSE_ASSERT(sourceFile != NULL);
15076 ROSE_ASSERT(sourceFile->get_globalScope() != NULL);
15080 printf (
"Debugging the unparsing header file optimization \n");
15082 printf (
"sourceFile->get_header_file_unparsing_optimization() = %s \n",sourceFile->get_header_file_unparsing_optimization() ?
"true" :
"false");
15083 printf (
"sourceFile->get_header_file_unparsing_optimization_source_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
15084 printf (
"sourceFile->get_header_file_unparsing_optimization_header_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
15091 ROSE_ASSERT(sourceFile->get_header_file_unparsing_optimization() ==
true);
15092 ROSE_ASSERT(sourceFile->get_header_file_unparsing_optimization_source_file() ==
true);
15094 ROSE_ASSERT(sourceFile->get_header_file_unparsing_optimization_header_file() ==
false);
15100 SgFilePtrList & fileList = project->get_fileList();
15103 printf (
"Looking for file = %s \n",inputFileName.c_str());
15106 for (SgFilePtrList::iterator i = fileList.begin(); i != fileList.end(); i++)
15110 printf (
"temp_file = %p = %s name = %s \n",temp_file,temp_file->
class_name().c_str(),temp_file->
getFileName().c_str());
15112 if (temp_file != file)
15127 printf (
"sourceFile = %p = %s \n",sourceFile,sourceFile->
class_name().c_str());
15128 printf (
"sourceFile->get_header_file_unparsing_optimization() = %s \n",sourceFile->get_header_file_unparsing_optimization() ?
"true" :
"false");
15129 printf (
"sourceFile->get_header_file_unparsing_optimization_source_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
15130 printf (
"sourceFile->get_header_file_unparsing_optimization_header_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
15132 printf (
"temp_file = %p = %s \n",temp_file,temp_file->
class_name().c_str());
15133 printf (
"temp_file->get_header_file_unparsing_optimization() = %s \n",temp_file->get_header_file_unparsing_optimization() ?
"true" :
"false");
15134 printf (
"temp_file->get_header_file_unparsing_optimization_source_file() = %s \n",temp_file->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
15135 printf (
"temp_file->get_header_file_unparsing_optimization_header_file() = %s \n",temp_file->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
15154 printf (
"Sg_File_Info::get_nametofileid_map()[sourceFile->get_file_info()->get_filename()] = %d \n",filename_id);
15155 printf (
"Sg_File_Info::get_nametofileid_map()[sourceFile->get_file_info()->get_filename()] = %d \n",filename_physical_id);
15156 sourceFile->
get_file_info()->set_physical_file_id(filename_physical_id);
15158 printf (
"sourceFile->get_file_info()->get_physical_filename() = %s \n",sourceFile->
get_file_info()->get_physical_filename().c_str());
15159 printf (
"sourceFile->get_file_info()->get_physical_file_id() = %d \n",sourceFile->
get_file_info()->get_physical_file_id());
15163 printf (
"Exiting as a test! \n");
15175 if (sourceFile->get_preprocessorDirectivesAndCommentsList() == NULL)
15178 printf (
"Initialize NULL p_preprocessorDirectivesAndCommentsList to empty ROSEAttributesListContainer \n");
15181 sourceFile->set_preprocessorDirectivesAndCommentsList(tmp_preprocessorDirectivesAndCommentsList);
15186 printf (
"NOTE: p_preprocessorDirectivesAndCommentsList is already defined! \n");
15187 printf (
" --- inputFileName = %s \n",inputFileName.c_str());
15188 printf (
" --- outputFileName = %s \n",outputFileName.c_str());
15189 printf (
" --- sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size() = %zu \n",sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size());
15192 ROSE_ASSERT (sourceFile->get_preprocessorDirectivesAndCommentsList() != NULL);
15199 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");
15204 ROSE_ASSERT(filePreprocInfo != NULL);
15210 printf (
"In SageBuilder::buildSourceFile(const std::string& inputFileName,const std::string& outputFileName, SgProject* project): calling attachPreprocessingInfo() \n");
15211 printf (
" --- sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size() = %zu \n",sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size());
15216 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");
15217 printf (
" --- inputFileName = %s \n",inputFileName.c_str());
15218 printf (
" --- outputFileName = %s \n",outputFileName.c_str());
15219 printf (
"sourceFile = %p \n",sourceFile);
15220 printf (
"sourceFile->get_token_list.size() = %zu \n",sourceFile->get_token_list().size());
15221 printf (
"sourceFile->get_tokenSubsequenceMap().size() = %zu \n",sourceFile->get_tokenSubsequenceMap().size());
15229 attachPreprocessingInfo (sourceFile,outputFileName);
15236 printf (
"Exiting after test! processed first phase of collecting comments and CPP directives for source file) \n");
15237 ROSE_ASSERT(
false);
15241 printf (
"DONE: In SageBuilder::buildSourceFile(const std::string& inputFileName,const std::string& outputFileName, SgProject* project): calling attachPreprocessingInfo() \n");
15245 printf (
"call the unparser on the just built file \n");
15249 printf (
"In buildSourceFile(): AS A TEST: calling unparseFile(): filename = %s \n",sourceFile->
getFileName().c_str());
15268 printf (
"In SageBuilder::buildSourceFile(): changing the name of the file represented in sourceFile: \n");
15269 printf (
"inputFileName = %s \n",inputFileName.c_str());
15270 printf (
"outputFileName = %s \n",outputFileName.c_str());
15271 printf (
"sourceFile->getFileName() = %s \n",sourceFile->
getFileName().c_str());
15274 SgGlobal* globalScope = sourceFile->get_globalScope();
15277 printf (
"Leaving SageBuilder::buildSourceFile() sourceFile = %p globalScope = %p \n",sourceFile,sourceFile->get_globalScope());
15278 printf (
"sourceFile->get_file_info()->get_file_id() = %d \n",sourceFile->
get_file_info()->get_file_id());
15279 printf (
"sourceFile->get_file_info()->get_physical_file_id() = %d \n",sourceFile->
get_file_info()->get_physical_file_id());
15280 printf (
"sourceFile->get_token_list.size() = %zu \n",sourceFile->get_token_list().size());
15281 printf (
"sourceFile->get_tokenSubsequenceMap().size() = %zu \n",sourceFile->get_tokenSubsequenceMap().size());
15282 printf (
"inputFileName = %s \n",inputFileName.c_str());
15283 printf (
"outputFileName = %s \n",outputFileName.c_str());
15284 printf (
"sourceFile->getFileName() = %s \n",sourceFile->
getFileName().c_str());
15286 printf (
"sourceFile->get_globalScope() = %p \n",globalScope);
15287 printf (
"globalScope->get_isModified() = %s \n",globalScope->
get_isModified() ?
"true" :
"false");
15297 printf (
"globalScope->get_isModified() == true: reset to false \n");
15301 printf (
"Verify false setting: globalScope->get_isModified() = %s \n",globalScope->
get_isModified() ?
"true" :
"false");
15307 ROSE_ASSERT(project != NULL);
15310 if (tmp3_collectionOfModifiedLocatedNodes.size() > 0)
15312 printf (
"In Traversal::evaluateInheritedAttribute(): tmp3_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp3_collectionOfModifiedLocatedNodes.size());
15314 printf (
"Exiting as a test! \n");
15315 ROSE_ASSERT(
false);
15321 printf (
"Exiting as a test! \n");
15337 bool isSystemHeader)
15339 std::string content;
15340 if (isSystemHeader)
15341 content =
"#include <" + header_filename +
"> \n";
15343 content =
"#include \"" + header_filename +
"\" \n";
15345 content,
"Transformation generated",0, 0, 0, position);
15346 ROSE_ASSERT(result);
15355 ROSE_ASSERT(target != NULL);
15357 std::string content2 = content;
15358 boost::algorithm::trim(content2);
15359 string prefix =
"#define";
15360 string::size_type pos = content2.find(prefix, 0);
15361 ROSE_ASSERT (pos == 0);
15365 PreprocessingInfo::DirectiveType mytype = PreprocessingInfo::CpreprocessorDefineDeclaration;
15369 result =
new PreprocessingInfo (mytype,content,
"transformation-generated", 0, 0, 0, position);
15370 ROSE_ASSERT(result);
15371 target->addToAttachedPreprocessingInfo(result);
15377#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
15382 static std::map<SgNode*, AbstractHandle::abstract_handle *> handleMap;
15384 ROSE_ASSERT(n != NULL);
15389 ROSE_ASSERT(anode !=NULL );
15392 ROSE_ASSERT(ahandle != NULL);
15401 ROSE_ASSERT(exp1 != NULL);
15402 ROSE_ASSERT(exp2 != NULL);
15407 ROSE_ASSERT(equivalenceStatement->get_equivalence_set_list() == NULL);
15408 equivalenceStatement->set_equivalence_set_list(setList);
15409 ROSE_ASSERT(equivalenceStatement->get_equivalence_set_list() != NULL);
15412 return equivalenceStatement;
15425 typedef Rose_STL_Container<SgScopeStatement*> SgScopeStatementPtrList;
15426 SgScopeStatementPtrList snippet_scope_list;
15432 printf (
"First scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
15434 if (temp_classDefinition != NULL)
15437 SgName className = temp_classDeclaration->get_name();
15439 printf (
"Input snippet declaration's class name = %s \n",className.str());
15443 if (namespaceDefinitionStatement != NULL)
15448 snippet_scope_list.push_back(snippet_scope);
15449 while (snippet_scope != NULL && isSgGlobal(snippet_scope) == NULL)
15455 snippet_scope = snippet_scope->
get_scope();
15457 printf (
"snippet_scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
15459 snippet_scope_list.push_back(snippet_scope);
15463 printf (
"snippet_scope_list.size() = %" PRIuPTR
" \n",snippet_scope_list.size());
15466 SgGlobal* global_scope_in_target_ast = TransformationSupport::getGlobalScope(targetScope);
15467 SgScopeStatementPtrList::reverse_iterator i = snippet_scope_list.rbegin();
15472 ROSE_ASSERT(isSgGlobal(snippet_AST_scope) != NULL);
15477 while (i != snippet_scope_list.rend())
15481 printf (
"snippet_AST_scope list *i = %p = %s \n",*i,(*i)->class_name().c_str());
15488 if (classDefinition != NULL)
15491 SgName className = classDeclaration->get_name();
15493 printf (
"Found snippet class name = %s \n",className.str());
15495 SgClassSymbol* classSymbol = target_AST_scope->lookup_class_symbol(className);
15496 ROSE_ASSERT(classSymbol != NULL);
15497 ROSE_ASSERT(classSymbol->get_declaration() != NULL);
15499 printf (
"Associated symbol in taget AST: declaration = %p name = %s \n",classSymbol->get_declaration(),classSymbol->get_declaration()->get_name().str());
15502 returnSymbol = classSymbol;
15505 target_AST_scope = classDefinition;
15510 if (functionDefinition != NULL)
15512 printf (
"ERROR: Found an unusual case of SgFunctionDefinition in list of scopes holding a declaration for a type \n");
15517 if (namespaceDefinition != NULL)
15522 printf (
"Found snippet namespace name = %s \n",namespaceName.str());
15524 SgNamespaceSymbol* namespaceSymbol = target_AST_scope->lookup_namespace_symbol(namespaceName);
15525 ROSE_ASSERT(namespaceSymbol != NULL);
15531 returnSymbol = namespaceSymbol;
15534 target_AST_scope = namespaceDefinition;
15542 switch (snippet_declaration->
variantT())
15544 case V_SgClassDeclaration:
15546 SgClassDeclaration* snippet_classDeclaration = isSgClassDeclaration(snippet_declaration);
15547 ROSE_ASSERT(snippet_classDeclaration != NULL);
15549 SgName snippet_className = snippet_classDeclaration->get_name();
15551 printf (
"snippet snippet declaration's class name = %s \n",snippet_className.str());
15553 SgClassSymbol* target_symbol = target_AST_scope->lookup_class_symbol(snippet_className);
15554 ROSE_ASSERT(target_symbol != NULL);
15555 returnSymbol = target_symbol;
15557 SgClassSymbol* classSymbolInTargetAST = isSgClassSymbol(returnSymbol);
15558 ROSE_ASSERT(classSymbolInTargetAST != NULL);
15559 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
15560 ROSE_ASSERT(target_classDeclaration != NULL);
15562 printf (
"snippet: classDeclaration = %p = %s \n",snippet_classDeclaration,snippet_classDeclaration->get_name().str());
15563 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
15565 ROSE_ASSERT(snippet_classDeclaration->get_name() == target_classDeclaration->get_name());
15569 case V_SgTypedefDeclaration:
15571 SgTypedefDeclaration* snippet_typedefDeclaration = isSgTypedefDeclaration(snippet_declaration);
15572 ROSE_ASSERT(snippet_typedefDeclaration != NULL);
15574 SgName snippet_typedefName = snippet_typedefDeclaration->get_name();
15576 printf (
"snippet snippet declaration's typedef name = %s \n",snippet_typedefName.str());
15578 SgTypedefSymbol* target_symbol = target_AST_scope->lookup_typedef_symbol(snippet_typedefName);
15579 ROSE_ASSERT(target_symbol != NULL);
15580 returnSymbol = target_symbol;
15582 SgTypedefSymbol* typedefSymbolInTargetAST = isSgTypedefSymbol(returnSymbol);
15583 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
15584 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
15585 ROSE_ASSERT(target_typedefDeclaration != NULL);
15587 printf (
"snippet: typedefDeclaration = %p = %s \n",snippet_typedefDeclaration,snippet_typedefDeclaration->get_name().str());
15588 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
15590 ROSE_ASSERT(snippet_typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
15594 case V_SgEnumDeclaration:
15596 SgEnumDeclaration* snippet_enumDeclaration = isSgEnumDeclaration(snippet_declaration);
15597 ROSE_ASSERT(snippet_enumDeclaration != NULL);
15601 printf (
"snippet snippet declaration's enum name = %s \n",snippet_enumName.str());
15604 bool isUnNamed = snippet_enumDeclaration->get_isUnNamed();
15605 if (isUnNamed ==
false)
15609 if (target_symbol == NULL)
15613 printf (
"scope = %p = %s \n",scope,scope->
class_name().c_str());
15614 scope->
get_file_info()->display(
"case V_SgEnumDeclaration: target_symbol == NULL: scope: debug");
15616 ROSE_ASSERT(target_symbol != NULL);
15617 returnSymbol = target_symbol;
15619 SgEnumSymbol* enumSymbolInTargetAST = isSgEnumSymbol(returnSymbol);
15620 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
15621 SgEnumDeclaration* target_enumDeclaration = isSgEnumDeclaration(enumSymbolInTargetAST->get_declaration());
15622 ROSE_ASSERT(target_enumDeclaration != NULL);
15624 printf (
"snippet: enumDeclaration = %p = %s \n",snippet_enumDeclaration,snippet_enumDeclaration->
get_name().str());
15625 printf (
"target: enumDeclaration = %p = %s \n",target_enumDeclaration,target_enumDeclaration->
get_name().str());
15627 ROSE_ASSERT(snippet_enumDeclaration->
get_name() == target_enumDeclaration->
get_name());
15632 printf (
"Warning: can't handle unnamed enum declarations \n");
15633 ROSE_ASSERT(returnSymbol == NULL);
15639 case V_SgMemberFunctionDeclaration:
15640 case V_SgFunctionDeclaration:
15643 ROSE_ASSERT(snippet_functionDeclaration != NULL);
15645 printf (
"snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15647 SgName snippet_functionName = snippet_functionDeclaration->get_name();
15649 printf (
"snippet snippet declaration's function name = %s \n",snippet_functionName.str());
15650 printf (
" --- target_AST_scope = %p = %s \n",target_AST_scope,target_AST_scope->
class_name().c_str());
15652 SgFunctionSymbol* target_symbol = target_AST_scope->lookup_function_symbol(snippet_functionName);
15653 ROSE_ASSERT(target_symbol != NULL);
15654 returnSymbol = target_symbol;
15656 SgFunctionSymbol* functionSymbolInTargetAST = isSgFunctionSymbol(returnSymbol);
15657 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
15658 SgFunctionDeclaration* target_functionDeclaration = isSgFunctionDeclaration(functionSymbolInTargetAST->get_declaration());
15659 ROSE_ASSERT(target_functionDeclaration != NULL);
15661 printf (
"snippet: functionDeclaration = %p = %s \n",snippet_functionDeclaration,snippet_functionDeclaration->get_name().str());
15662 printf (
"target: functionDeclaration = %p = %s \n",target_functionDeclaration,target_functionDeclaration->get_name().str());
15664 ROSE_ASSERT(snippet_functionDeclaration->get_name() == target_functionDeclaration->get_name());
15670 printf (
"Error: default reached in switch: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15676 return returnSymbol;
15688#define DEBUG_FIND_ASSOCIATED_DECLARATION 0
15695#if DEBUG_FIND_ASSOCIATED_DECLARATION
15696 printf (
"isDefiningDeclaration = %s \n",isDefiningDeclaration ?
"true" :
"false");
15702 typedef Rose_STL_Container<SgScopeStatement*> SgScopeStatementPtrList;
15703 SgScopeStatementPtrList snippet_scope_list;
15708#if DEBUG_FIND_ASSOCIATED_DECLARATION
15709 printf (
"First scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
15711 if (temp_classDefinition != NULL)
15714 SgName className = temp_classDeclaration->get_name();
15715 printf (
"Input declaration's class name = %s \n",className.str());
15719 if (namespaceDefinitionStatement != NULL)
15723 printf (
"Input declaration's namespace name = %s \n",namespaceName.str());
15727 snippet_scope_list.push_back(snippet_scope);
15728 while (snippet_scope != NULL && isSgGlobal(snippet_scope) == NULL)
15734 snippet_scope = snippet_scope->
get_scope();
15736#if DEBUG_FIND_ASSOCIATED_DECLARATION
15737 printf (
"snippet_scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
15739 snippet_scope_list.push_back(snippet_scope);
15746#if DEBUG_FIND_ASSOCIATED_DECLARATION
15747 printf (
"snippet_scope_list.size() = %" PRIuPTR
" \n",snippet_scope_list.size());
15748 for (SgScopeStatementPtrList::iterator i = snippet_scope_list.begin(); i != snippet_scope_list.end(); i++)
15752 SgGlobal* global_scope_from_declarations_scope = TransformationSupport::getGlobalScope(scope);
15753 printf (
" --- --- global_scope_from_declarations_scope = %p \n",global_scope_from_declarations_scope);
15761 SgGlobal* global_scope_in_target_ast = TransformationSupport::getGlobalScope(targetScope);
15762 SgScopeStatementPtrList::reverse_iterator i = snippet_scope_list.rbegin();
15764#if DEBUG_FIND_ASSOCIATED_DECLARATION
15765 printf (
"global_scope_in_target_ast = %p = %s \n",global_scope_in_target_ast,global_scope_in_target_ast->
class_name().c_str());
15774 ROSE_ASSERT(isSgGlobal(snippet_AST_scope) != NULL);
15778#if DEBUG_FIND_ASSOCIATED_DECLARATION
15779 string otherASTnameFromGlobalScope = global_scope_in_target_ast->
get_file_info()->get_filenameString();
15780 SgSourceFile* otherSourceFile = SageInterface::getEnclosingNode<SgSourceFile>(targetScope,
true);
15781 string otherASTnameFromSourceFile = otherSourceFile->
getFileName();
15782 printf (
"Now traverse the list of scopes in reverse to find the declaration in the other AST: \n");
15783 printf (
"otherASTnameFromGlobalScope = %s \n",otherASTnameFromGlobalScope.c_str());
15784 printf (
"otherASTnameFromSourceFile = %s \n",otherASTnameFromSourceFile.c_str());
15791 while (i != snippet_scope_list.rend())
15797#if DEBUG_FIND_ASSOCIATED_DECLARATION
15798 printf (
"snippet_AST_scope list *i = %p = %s \n",*i,(*i)->class_name().c_str());
15800 printf (
" --- target_AST_scope = %p = %s \n",target_AST_scope,target_AST_scope ->class_name().c_str());
15807#if DEBUG_FIND_ASSOCIATED_DECLARATION
15808 SgSourceFile* otherSourceFile = SageInterface::getEnclosingNode<SgSourceFile>(targetScope,
true);
15809 string otherASTnameFromSourceFile = otherSourceFile->
getFileName();
15810 printf (
" --- otherASTnameFromSourceFile = %s \n",otherASTnameFromSourceFile.c_str());
15815 if (classDefinition != NULL)
15818 SgName className = classDeclaration->get_name();
15819#if DEBUG_FIND_ASSOCIATED_DECLARATION
15820 printf (
" --- Found snippet class name = %s \n",className.str());
15822 SgClassSymbol* classSymbol = target_AST_scope->lookup_class_symbol(className);
15823 ROSE_ASSERT(classSymbol != NULL);
15824 ROSE_ASSERT(classSymbol->get_declaration() != NULL);
15825#if DEBUG_FIND_ASSOCIATED_DECLARATION
15826 printf (
" --- Associated symbol in taget AST: declaration = %p name = %s \n",classSymbol->get_declaration(),classSymbol->get_declaration()->get_name().str());
15829 returnSymbol = classSymbol;
15832 SgClassDeclaration* temp_classDeclaration_in_target_ast = classSymbol->get_declaration();
15833 ROSE_ASSERT(temp_classDeclaration_in_target_ast != NULL);
15835 ROSE_ASSERT(classDeclaration_in_target_ast != NULL);
15836 SgClassDefinition* classDefinition_in_target_ast = classDeclaration_in_target_ast->get_definition();
15837 ROSE_ASSERT(classDefinition_in_target_ast != NULL);
15844 target_AST_scope = classDefinition_in_target_ast;
15852 if (functionDefinition != NULL)
15854 printf (
"ERROR: Found an unusual case of SgFunctionDefinition in list of scopes holding a declaration for a type \n");
15859 if (namespaceDefinition != NULL)
15863#if DEBUG_FIND_ASSOCIATED_DECLARATION
15864 printf (
" --- Found snippet namespace name = %s \n",namespaceName.str());
15866 SgNamespaceSymbol* namespaceSymbol = target_AST_scope->lookup_namespace_symbol(namespaceName);
15867 ROSE_ASSERT(namespaceSymbol != NULL);
15870#if DEBUG_FIND_ASSOCIATED_DECLARATION
15874 returnSymbol = namespaceSymbol;
15881 target_AST_scope = otherASTnamespaceDeclaration->
get_definition();
15890#if DEBUG_FIND_ASSOCIATED_DECLARATION
15891 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());
15894 SgSourceFile* otherSourceFile = SageInterface::getEnclosingNode<SgSourceFile>(target_AST_scope,
true);
15895 string otherASTnameFromSourceFile = otherSourceFile->
getFileName();
15896 printf (
" --- At base of loop: otherASTnameFromSourceFile = %s \n",otherASTnameFromSourceFile.c_str());
15903#if DEBUG_FIND_ASSOCIATED_DECLARATION
15904 printf (
"##### Now based on the kind of declaration, search for that same named declaration in the target_AST_scope = %p = %s \n",
15905 target_AST_scope,target_AST_scope->
class_name().c_str());
15911 switch (snippet_declaration->
variantT())
15913 case V_SgClassDeclaration:
15915 SgClassDeclaration* snippet_classDeclaration = isSgClassDeclaration(snippet_declaration);
15916 ROSE_ASSERT(snippet_classDeclaration != NULL);
15918 SgName snippet_className = snippet_classDeclaration->get_name();
15920#if DEBUG_FIND_ASSOCIATED_DECLARATION
15921 printf (
"snippet snippet declaration's class name = %s \n",snippet_className.str());
15923 SgClassSymbol* target_symbol = target_AST_scope->lookup_class_symbol(snippet_className);
15924 ROSE_ASSERT(target_symbol != NULL);
15925 returnSymbol = target_symbol;
15927 SgClassSymbol* classSymbolInTargetAST = isSgClassSymbol(returnSymbol);
15928 ROSE_ASSERT(classSymbolInTargetAST != NULL);
15929 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
15930 ROSE_ASSERT(target_classDeclaration != NULL);
15932#if DEBUG_FIND_ASSOCIATED_DECLARATION
15933 printf (
"snippet: classDeclaration = %p = %s \n",snippet_classDeclaration,snippet_classDeclaration->get_name().str());
15934 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
15936 ROSE_ASSERT(snippet_classDeclaration->get_name() == target_classDeclaration->get_name());
15940 case V_SgTypedefDeclaration:
15942 SgTypedefDeclaration* snippet_typedefDeclaration = isSgTypedefDeclaration(snippet_declaration);
15943 ROSE_ASSERT(snippet_typedefDeclaration != NULL);
15945 SgName snippet_typedefName = snippet_typedefDeclaration->get_name();
15947#if DEBUG_FIND_ASSOCIATED_DECLARATION
15948 printf (
"snippet snippet declaration's typedef name = %s \n",snippet_typedefName.str());
15950 SgTypedefSymbol* target_symbol = target_AST_scope->lookup_typedef_symbol(snippet_typedefName);
15951 ROSE_ASSERT(target_symbol != NULL);
15952 returnSymbol = target_symbol;
15954 SgTypedefSymbol* typedefSymbolInTargetAST = isSgTypedefSymbol(returnSymbol);
15955 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
15956 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
15957 ROSE_ASSERT(target_typedefDeclaration != NULL);
15959#if DEBUG_FIND_ASSOCIATED_DECLARATION
15960 printf (
"snippet: typedefDeclaration = %p = %s \n",snippet_typedefDeclaration,snippet_typedefDeclaration->get_name().str());
15961 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
15963 ROSE_ASSERT(snippet_typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
15967 case V_SgEnumDeclaration:
15969 SgEnumDeclaration* snippet_enumDeclaration = isSgEnumDeclaration(snippet_declaration);
15970 ROSE_ASSERT(snippet_enumDeclaration != NULL);
15974#if DEBUG_FIND_ASSOCIATED_DECLARATION
15975 printf (
"snippet snippet declaration's enum name = %s \n",snippet_enumName.str());
15978 bool isUnNamed = snippet_enumDeclaration->get_isUnNamed();
15979 if (isUnNamed ==
false)
15983 if (target_symbol == NULL)
15987 printf (
"scope = %p = %s \n",scope,scope->
class_name().c_str());
15988 scope->
get_file_info()->display(
"case V_SgEnumDeclaration: target_symbol == NULL: scope: debug");
15990 ROSE_ASSERT(target_symbol != NULL);
15991 returnSymbol = target_symbol;
15993 SgEnumSymbol* enumSymbolInTargetAST = isSgEnumSymbol(returnSymbol);
15994 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
15995 SgEnumDeclaration* target_enumDeclaration = isSgEnumDeclaration(enumSymbolInTargetAST->get_declaration());
15996 ROSE_ASSERT(target_enumDeclaration != NULL);
15998#if DEBUG_FIND_ASSOCIATED_DECLARATION
15999 printf (
"snippet: enumDeclaration = %p = %s \n",snippet_enumDeclaration,snippet_enumDeclaration->
get_name().str());
16000 printf (
"target: enumDeclaration = %p = %s \n",target_enumDeclaration,target_enumDeclaration->
get_name().str());
16002 ROSE_ASSERT(snippet_enumDeclaration->
get_name() == target_enumDeclaration->
get_name());
16007 printf (
"Warning: can't handle unnamed enum declarations \n");
16008 ROSE_ASSERT(returnSymbol == NULL);
16014 case V_SgTemplateMemberFunctionDeclaration:
16016 case V_SgTemplateFunctionDeclaration:
16018 case V_SgMemberFunctionDeclaration:
16019 case V_SgFunctionDeclaration:
16022 ROSE_ASSERT(snippet_functionDeclaration != NULL);
16024#if DEBUG_FIND_ASSOCIATED_DECLARATION
16025 printf (
"snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16027 SgName snippet_functionName = snippet_functionDeclaration->get_name();
16029#if DEBUG_FIND_ASSOCIATED_DECLARATION
16030 printf (
"snippet snippet declaration's function name = %s \n",snippet_functionName.str());
16031 printf (
" --- target_AST_scope = %p = %s \n",target_AST_scope,target_AST_scope->
class_name().c_str());
16033 SgFunctionSymbol* target_symbol = target_AST_scope->lookup_function_symbol(snippet_functionName);
16034 ROSE_ASSERT(target_symbol != NULL);
16035 returnSymbol = target_symbol;
16037 SgFunctionSymbol* functionSymbolInTargetAST = isSgFunctionSymbol(returnSymbol);
16038 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
16039 SgFunctionDeclaration* target_functionDeclaration = isSgFunctionDeclaration(functionSymbolInTargetAST->get_declaration());
16040 ROSE_ASSERT(target_functionDeclaration != NULL);
16042#if DEBUG_FIND_ASSOCIATED_DECLARATION
16043 printf (
"snippet: functionDeclaration = %p = %s \n",snippet_functionDeclaration,snippet_functionDeclaration->get_name().str());
16044 printf (
"target: functionDeclaration = %p = %s \n",target_functionDeclaration,target_functionDeclaration->get_name().str());
16045 printf (
"isDefiningDeclaration = %s \n",isDefiningDeclaration ?
"true" :
"false");
16047 if (isDefiningDeclaration ==
true)
16049#if DEBUG_FIND_ASSOCIATED_DECLARATION
16050 printf (
"get the defining declaration instead of the firstNondefining declaration from the function symbol \n");
16055 ROSE_ASSERT(snippet_functionDeclaration->get_name() == target_functionDeclaration->get_name());
16061 printf (
"Error: default reached in switch: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16066 ROSE_ASSERT(returnDeclaration != NULL);
16073 return returnDeclaration;
16081 SgType* returnType = NULL;
16083 ROSE_ASSERT(snippet_type != NULL);
16084 ROSE_ASSERT(targetScope != NULL);
16092 SgType* type_copy = snippet_type;
16093 printf (
"(before type_copy->getInternalTypes()): type_copy = %p = %s \n",type_copy,type_copy->
class_name().c_str());
16096 SgNamedType* namedType = isSgNamedType(snippet_type);
16097 if (namedType != NULL)
16101 ROSE_ASSERT(snippet_declaration != NULL);
16103 printf (
"Need to find the declaration in the target AST that is associated with the snippet_declaration in the snippet AST \n");
16104 printf (
" --- snippet_declaration = %p = %s = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str(),
SageInterface::get_name(snippet_declaration).c_str());
16109 case V_SgClassType:
16112 if (classDeclaration != NULL)
16115 if (classSymbolInTargetAST == NULL)
16122 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");
16123 printf (
" --- Looking for target AST match for class name = %s \n",classDeclaration->get_name().str());
16126 ROSE_ASSERT(symbol != NULL);
16128 classSymbolInTargetAST = isSgClassSymbol(symbol);
16131 ROSE_ASSERT(classSymbolInTargetAST != NULL);
16132 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
16133 ROSE_ASSERT(target_classDeclaration != NULL);
16135 printf (
"snippet: classDeclaration = %p = %s \n",classDeclaration,classDeclaration->get_name().str());
16136 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
16138 ROSE_ASSERT(classDeclaration->get_name() == target_classDeclaration->get_name());
16140 returnType = classSymbolInTargetAST->
get_type();
16145 case V_SgTypedefType:
16148 if (typedefDeclaration != NULL)
16155 if (typedefSymbolInTargetAST == NULL)
16158 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");
16159 printf (
" --- The target AST must have a valid typedef type (and associated declaration) to support resetting the SgTypedefType: %p \n",typedefDeclaration->get_type());
16164 ROSE_ASSERT(symbol != NULL);
16166 typedefSymbolInTargetAST = isSgTypedefSymbol(symbol);
16172 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
16173 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
16174 ROSE_ASSERT(target_typedefDeclaration != NULL);
16176 printf (
"snippet: typedefDeclaration = %p = %s \n",typedefDeclaration,typedefDeclaration->get_name().str());
16177 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
16179 ROSE_ASSERT(typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
16181 returnType = typedefSymbolInTargetAST->
get_type();
16189 if (enumDeclaration != NULL)
16191 ROSE_ASSERT(enumDeclaration->
get_name().is_null() ==
false);
16197 if (enumSymbolInTargetAST == NULL)
16199 printf (
"Error: It is an error to not have a enum type defined in the target AST! \n");
16200 printf (
" --- The target AST must have a valid enum type (and associated declaration) to support resetting the SgEnumType: %p \n",enumDeclaration->
get_type());
16203 returnType = snippet_type;
16210 returnType = enumSymbolInTargetAST->
get_type();
16217 case V_SgJavaParameterizedType:
16223 printf (
"In getTargetFileTypeSupport(): case V_SgJavaParameterizedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16227 if (classDeclaration != NULL)
16230 printf (
"Looking for classDeclaration = %s \n",classDeclaration->get_name().str());
16233 ROSE_ASSERT(javaParameterizedType != NULL);
16237 ROSE_ASSERT(templateParameterListNode != NULL);
16238 SgTemplateParameterPtrList* templateParameterList = &templateParameterListNode->get_args();
16246 printf (
"Calling lookupTemplateClassSymbolInParentScopes() name = %s \n",classDeclaration->get_name().str());
16251 printf (
"DONE: Calling lookupTemplateClassSymbolInParentScopes() \n");
16254 printf (
"targetScope->get_symbol_table()->size() = %d \n",targetScope->
get_symbol_table()->
size());
16255 if (templateClassSymbolInTargetAST == NULL)
16261 if (templateClassSymbolInTargetAST == NULL)
16264 printf (
"Calling findAssociatedSymbolInTargetAST \n");
16267 ROSE_ASSERT(symbol != NULL);
16269 templateClassSymbolInTargetAST = isSgClassSymbol(symbol);
16271 ROSE_ASSERT(templateClassSymbolInTargetAST != NULL);
16275 ROSE_ASSERT(templateClassSymbolInTargetAST != NULL);
16277 returnType = templateClassSymbolInTargetAST->
get_type();
16281 if (javaParameterizedType != NULL)
16285 returnType = javaParameterizedType;
16287 SgType* internal_type = javaParameterizedType->get_raw_type();
16288 ROSE_ASSERT(internal_type != NULL);
16292 printf (
"SgJavaParameterizedType not yet tested! \n");
16298 case V_SgJavaQualifiedType:
16309 printf (
"In getTargetFileTypeSupport(): case V_SgJavaQualifiedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16312 if (javaQualifiedType != NULL)
16315 returnType = javaQualifiedType;
16317 SgType* internal_type_1 = javaQualifiedType->get_parent_type();
16318 ROSE_ASSERT(internal_type_1 != NULL);
16319 SgType* internal_type_2 = javaQualifiedType->get_type();
16320 ROSE_ASSERT(internal_type_2 != NULL);
16323 printf (
"Case of SgJavaQualifiedType: not yet handled: commented out assertion! \n");
16328 case V_SgJavaWildcardType:
16337 printf (
"In getTargetFileTypeSupport(): case V_SgJavaWildcardType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16340 if (javaWildcardType != NULL)
16343 returnType = javaWildcardType;
16346 printf (
"SgJavaWildcardType not yet tested! \n");
16352 printf (
"Error: In getTargetFileTypeSupport(): default reached in switch: namedType = %p = %s \n",namedType,namedType->
class_name().c_str());
16357 ROSE_ASSERT(returnType != NULL);
16359 printf (
"Exiting as a test! \n");
16378 SgType* returnType = NULL;
16380 ROSE_ASSERT(snippet_type != NULL);
16381 ROSE_ASSERT(targetScope != NULL);
16385 SgType* type_copy = snippet_type;
16388 printf (
"(before type_copy->getInternalTypes()): type_copy = %p = %s \n",type_copy,type_copy->
class_name().c_str());
16395 for (
size_t i = 0; i < typeList.size(); i++)
16397 printf (
"Input type: typeList[i=%" PRIuPTR
"] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
16405 SgNamedType* namedType = isSgNamedType(snippet_type);
16409 if (namedType != NULL)
16413 ROSE_ASSERT(snippet_declaration != NULL);
16415 printf (
"Need to find the declaration in the target AST that is associated with the snippet_declaration in the snippet AST \n");
16416 printf (
" --- snippet_declaration = %p = %s = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str(),
SageInterface::get_name(snippet_declaration).c_str());
16421 case V_SgClassType:
16424 if (classDeclaration != NULL)
16427 if (classSymbolInTargetAST == NULL)
16434 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");
16435 printf (
" --- Looking for target AST match for class name = %s \n",classDeclaration->get_name().str());
16438 ROSE_ASSERT(symbol != NULL);
16440 classSymbolInTargetAST = isSgClassSymbol(symbol);
16443 ROSE_ASSERT(classSymbolInTargetAST != NULL);
16444 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
16445 ROSE_ASSERT(target_classDeclaration != NULL);
16447 printf (
"snippet: classDeclaration = %p = %s \n",classDeclaration,classDeclaration->get_name().str());
16448 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
16450 ROSE_ASSERT(classDeclaration->get_name() == target_classDeclaration->get_name());
16452 returnType = classSymbolInTargetAST->
get_type();
16457 case V_SgTypedefType:
16460 if (typedefDeclaration != NULL)
16467 if (typedefSymbolInTargetAST == NULL)
16470 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");
16471 printf (
" --- The target AST must have a valid typedef type (and associated declaration) to support resetting the SgTypedefType: %p \n",typedefDeclaration->get_type());
16476 ROSE_ASSERT(symbol != NULL);
16478 typedefSymbolInTargetAST = isSgTypedefSymbol(symbol);
16484 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
16485 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
16486 ROSE_ASSERT(target_typedefDeclaration != NULL);
16488 printf (
"snippet: typedefDeclaration = %p = %s \n",typedefDeclaration,typedefDeclaration->get_name().str());
16489 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
16491 ROSE_ASSERT(typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
16493 returnType = typedefSymbolInTargetAST->
get_type();
16501 if (enumDeclaration != NULL)
16503 ROSE_ASSERT(enumDeclaration->
get_name().is_null() ==
false);
16509 if (enumSymbolInTargetAST == NULL)
16511 printf (
"Error: It is an error to not have a enum type defined in the target AST! \n");
16512 printf (
" --- The target AST must have a valid enum type (and associated declaration) to support resetting the SgEnumType: %p \n",enumDeclaration->
get_type());
16515 returnType = snippet_type;
16522 returnType = enumSymbolInTargetAST->
get_type();
16529 case V_SgJavaParameterizedType:
16535 printf (
"In getTargetFileType(): case V_SgJavaParameterizedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16538 if (classDeclaration != NULL)
16540 SgTemplateParameterPtrList* templateParameterList = NULL;
16541 SgTemplateArgumentPtrList* templateSpecializationArgumentList = NULL;
16545 ROSE_ASSERT(templateClassSymbolInTargetAST != NULL);
16547 returnType = templateClassSymbolInTargetAST->
get_type();
16551 if (javaParameterizedType != NULL)
16554 returnType = javaParameterizedType;
16556 SgType* internal_type = javaParameterizedType->get_raw_type();
16557 ROSE_ASSERT(internal_type != NULL);
16560 printf (
"SgJavaParameterizedType not yet tested! \n");
16564 case V_SgJavaQualifiedType:
16571 printf (
"In getTargetFileType(): case V_SgJavaQualifiedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16574 if (javaQualifiedType != NULL)
16577 returnType = javaQualifiedType;
16579 SgType* internal_type_1 = javaQualifiedType->get_parent_type();
16580 ROSE_ASSERT(internal_type_1 != NULL);
16581 SgType* internal_type_2 = javaQualifiedType->get_type();
16582 ROSE_ASSERT(internal_type_2 != NULL);
16585 printf (
"SgJavaQualifiedType not yet tested! \n");
16589 case V_SgJavaWildcardType:
16598 printf (
"In getTargetFileType(): case V_SgJavaWildcardType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16601 if (javaWildcardType != NULL)
16604 returnType = javaWildcardType;
16606 SgType* internal_type_1 = javaWildcardType->get_bound_type();
16610 printf (
"SgJavaWildcardType not yet tested! \n");
16616 printf (
"Error: In getTargetFileType(): default reached in switch: namedType = %p = %s \n",namedType,namedType->
class_name().c_str());
16621 ROSE_ASSERT(returnType != NULL);
16623 printf (
"Exiting as a test! \n");
16636 SgType* new_type = returnType;
16640 if (new_type != NULL && typeList.size() > 1)
16642 int size = (int)typeList.size();
16643 for (
int i = size - 2; i >= 0; i--)
16646 printf (
"Rebuild type: typeList[i=%d] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
16649 switch(typeList[i]->variantT())
16651 case V_SgModifierType:
16654 ROSE_ASSERT(modifierType != NULL);
16655 if (modifierType->
get_typeModifier().get_constVolatileModifier().isConst() ==
true)
16657 ROSE_ASSERT(new_type != NULL);
16659 printf (
"Building a SgModifierType: calling buildConstType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
16666 printf (
"Modifier kind not handled (not implemented) check what sort of modifier this is: \n");
16673 case V_SgTypedefType:
16676 ROSE_ASSERT(typedefType != NULL);
16682 ROSE_ASSERT(new_typedefType != NULL);
16683 ROSE_ASSERT(isSgTypedefType(new_typedefType) != NULL);
16685 new_type = new_typedefType;
16687 printf (
"ERROSE: SgTypedefType kind not handled (not implemented) \n");
16693 case V_SgPointerType:
16696 ROSE_ASSERT(pointerType != NULL);
16698 printf (
"Building a SgPointerType: calling buildPointerType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
16700 ROSE_ASSERT(new_type != NULL);
16703 printf (
"ERROSE: SgPointerType kind not handled (not implemented) \n");
16711 printf (
"Error: default reached in evaluation of typelist: typeList[i] = %p = %s \n",typeList[i],typeList[i]->class_name().c_str());
16717 returnType = new_type;
16721 if (typeList.size() > 1)
16723 printf (
"Exiting as a test! \n");
16738 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());
16742 SgStatement* statement_copy = isSgStatement(node_copy);
16743 SgStatement* statement_original = isSgStatement(node_original);
16744 if (statement_copy != NULL)
16751 ROSE_ASSERT(statement_original != NULL);
16753 ROSE_ASSERT(scope_copy != NULL);
16754 ROSE_ASSERT(scope_original != NULL);
16761 printf (
"Warning: SgStatement: scope = %p = %s \n",scope_original,scope_original->
class_name().c_str());
16766 ROSE_ASSERT(snippetFile != NULL);
16767 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
16769 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
16772 if (failOnWarning ==
true)
16774 printf (
"Exit on warning! \n");
16779 SgNode* insertionPointScope = (insertionPointIsScope ==
true) ? insertionPoint : insertionPoint->get_parent();
16780 printf (
"insertionPointIsScope = %s insertionPointScope = %p = %s \n",insertionPointIsScope ?
"true" :
"false",insertionPointScope,insertionPointScope->
class_name().c_str());
16799 printf (
"SgClassDeclaration: Exiting as a test! \n");
16803 if (TransformationSupport::getFile(scope) != targetFile)
16805 printf (
"Warning: SgStatement: scope = %p = %s \n",scope,scope->
class_name().c_str());
16806 SgFile* snippetFile = TransformationSupport::getFile(scope);
16807 ROSE_ASSERT(snippetFile != NULL);
16808 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
16810 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
16820 if (declarationStatement_copy != NULL)
16830 if (snippetFile != NULL && snippetFile != targetFile)
16835 printf (
"Note: SgDeclarationStatement: firstNondefiningDeclaration_original is not in target file (allowed for merged ASTs) \n");
16838 if (failOnWarning ==
true)
16840 printf (
"Exit on warning! \n");
16847 if (snippetFile == NULL)
16849 printf (
"Note: firstNondefiningDeclaration_original = %p getEnclosingFileNode() returned NULL \n",firstNondefiningDeclaration_original);
16851 if (failOnWarning ==
true)
16853 printf (
"Exit on warning! \n");
16861 if (definingDeclaration_original != NULL)
16868 if (snippetFile != NULL && snippetFile != targetFile)
16871 printf (
"Warning: SgDeclarationStatement: definingDeclaration is not in target file \n");
16874 if (failOnWarning ==
true)
16876 printf (
"Exit on warning! \n");
16880 if (declarationStatement_original == definingDeclaration_original)
16889 if (snippetFile == NULL)
16891 printf (
"Note: definingDeclaration_original = %p getEnclosingFileNode() returned NULL \n",definingDeclaration_original);
16893 if (failOnWarning ==
true)
16895 printf (
"Exit on warning! \n");
16905 if (expression != NULL)
16915 ROSE_ASSERT(type != NULL);
16920 printf (
"Leaving errorCheckingTargetAST() \n");
16934 T* classDeclaration_copy_defining =
dynamic_cast<T*
>(classDeclaration_copy->get_definingDeclaration());
16935 T* classDeclaration_copy_nondefining =
dynamic_cast<T*
>(classDeclaration_copy->get_firstNondefiningDeclaration());
16936 T* classDeclaration_original_defining =
dynamic_cast<T*
>(classDeclaration_original->get_definingDeclaration());
16937 T* classDeclaration_original_nondefining =
dynamic_cast<T*
>(classDeclaration_original->get_firstNondefiningDeclaration());
16940 if (classDeclaration_copy_defining != NULL && classDeclaration_copy_defining->get_scope() == classDeclaration_original_defining->get_scope())
16943 printf (
"reset the scope of classDeclaration_copy_defining \n");
16945 classDeclaration_copy_defining->set_scope(targetScope);
16949 if (classDeclaration_copy_nondefining != NULL && classDeclaration_copy_nondefining->get_scope() == classDeclaration_original_nondefining->get_scope())
16952 printf (
"reset the scope of classDeclaration_copy_nondefining \n");
16954 classDeclaration_copy_nondefining->set_scope(targetScope);
16958 if (classDeclaration_copy_nondefining != NULL && classDeclaration_copy_nondefining->get_parent() == classDeclaration_original_nondefining->get_parent())
16961 printf (
"reset the parent of classDeclaration_copy_nondefining \n");
16963 classDeclaration_copy_nondefining->set_parent(classDeclaration_copy->get_parent());
16988 printf (
"In fixupCopyOfNodeFromSeperateFileInNewTargetAst: node_copy = %p = %s \n",node_copy,node_copy->
class_name().c_str());
16992 printf (
"Disabled fixupCopyOfNodeFromSeperateFileInNewTargetAst() \n");
17000 printf (
" --- targetFile = %p = %s \n",targetFile,targetFile->get_sourceFileNameWithPath().c_str());
17001 printf (
" --- insertionPointIsScope = %s \n",insertionPointIsScope ?
"true" :
"false");
17008 SgNode* insertionPointScope = (insertionPointIsScope ==
true) ? insertionPoint : insertionPoint->
get_parent();
17010 printf (
"insertionPointScope = %p = %s \n",insertionPointScope,insertionPointScope->class_name().c_str());
17013 ROSE_ASSERT(targetScope != NULL);
17025 SgStatement* statement_copy = isSgStatement(node_copy);
17026 SgStatement* statement_original = isSgStatement(node_original);
17027 if (statement_copy != NULL)
17035 ROSE_ASSERT(scope_copy != NULL);
17036 ROSE_ASSERT(scope_original != NULL);
17042 printf (
"Warning: SgStatement: scope = %p = %s \n",scope_original,scope_original->
class_name().c_str());
17046 ROSE_ASSERT(snippetFile != NULL);
17047 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
17049 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
17054 SgNode* insertionPointScope = (insertionPointIsScope ==
true) ? insertionPoint : insertionPoint->
get_parent();
17055 printf (
"insertionPointIsScope = %s insertionPointScope = %p = %s \n",insertionPointIsScope ?
"true" :
"false",insertionPointScope,insertionPointScope->
class_name().c_str());
17074 printf (
"SgClassDeclaration: Exiting as a test! \n");
17078 if (TransformationSupport::getFile(scope) != targetFile)
17080 printf (
"Warning: SgStatement: scope = %p = %s \n",scope,scope->
class_name().c_str());
17081 SgFile* snippetFile = TransformationSupport::getFile(scope);
17082 ROSE_ASSERT(snippetFile != NULL);
17083 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
17085 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
17097 if (declarationStatement_copy != NULL)
17104 if (snippetFile != NULL && snippetFile != targetFile)
17109 printf (
"Note: SgDeclarationStatement: firstNondefiningDeclaration_original is not in target file (allowed for merged ASTs) \n");
17116 if (snippetFile == NULL)
17118 printf (
"Note: firstNondefiningDeclaration_original = %p getEnclosingFileNode() returned NULL \n",firstNondefiningDeclaration_original);
17125 if (definingDeclaration_original != NULL)
17130 if (snippetFile != NULL && snippetFile != targetFile)
17133 printf (
"Warning: SgDeclarationStatement: definingDeclaration is not in target file \n");
17136 if (declarationStatement_original == definingDeclaration_original)
17145 if (snippetFile == NULL)
17147 printf (
"Note: definingDeclaration_original = %p getEnclosingFileNode() returned NULL \n",definingDeclaration_original);
17159 if (expression != NULL)
17169 ROSE_ASSERT(type != NULL);
17174 if (new_type != NULL)
17184 case V_SgInitializedName:
17187 SgInitializedName* initializedName_original = isSgInitializedName(node_original);
17194 SgStatement* enclosingStatement_copy = TransformationSupport::getStatement(initializedName_copy);
17196 printf (
"enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
17202 ROSE_ASSERT(scope_copy != NULL);
17203 ROSE_ASSERT(scope_original != NULL);
17209 ROSE_ASSERT(initializedName_copy != NULL);
17210 printf (
"initializedName_copy = %p = %s \n",initializedName_copy,initializedName_copy->get_name().str());
17211 ROSE_ASSERT(initializedName_original != NULL);
17212 printf (
"initializedName_original = %p = %s \n",initializedName_original,initializedName_original->get_name().str());
17213 SgType* initializedName_original_type = initializedName_original->get_type();
17214 printf (
"initializedName_original_type = %p = %s \n",initializedName_original_type,initializedName_original_type->
class_name().c_str());
17215 SgClassType* classType = isSgClassType(initializedName_original_type);
17217 if (classType != NULL)
17219 SgClassDeclaration* classDeclaration = isSgClassDeclaration(classType->get_declaration());
17220 ROSE_ASSERT(classDeclaration != NULL);
17221 printf (
"classDeclaration = %p = %s \n",classDeclaration,classDeclaration->get_name().str());
17225 printf (
"Warning: case V_SgInitializedName: scope_copy = %p = %s \n",scope_copy,scope_copy->
class_name().c_str());
17226 printf (
"Warning: case V_SgInitializedName: scope_original = %p = %s \n",scope_original,scope_original->
class_name().c_str());
17228 printf (
"Warning: case V_SgInitializedName: initializedName_copy->get_parent() = %p \n",initializedName_copy->
get_parent());
17229 printf (
"Warning: case V_SgInitializedName: initializedName_original->get_parent() = %p \n",initializedName_original->
get_parent());
17234 ROSE_ASSERT(snippetFile != NULL);
17235 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
17237 printf (
"Warning: case V_SgInitializedName: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
17243 SgType* type_copy = initializedName_copy->get_type();
17245 printf (
"(before type_copy->getInternalTypes()): type_copy = %p = %s \n",type_copy,type_copy->
class_name().c_str());
17255 for (
size_t i = 0; i < typeList.size(); i++)
17257 printf (
"Input type: typeList[i=%" PRIuPTR
"] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
17266 if (new_type != NULL && typeList.size() > 1)
17268 int size = (int)typeList.size();
17269 for (
int i = size - 2; i >= 0; i--)
17272 printf (
"Rebuild type: typeList[i=%d] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
17275 switch(typeList[i]->variantT())
17277 case V_SgModifierType:
17280 ROSE_ASSERT(modifierType != NULL);
17281 if (modifierType->
get_typeModifier().get_constVolatileModifier().isConst() ==
true)
17283 ROSE_ASSERT(new_type != NULL);
17285 printf (
"Building a SgModifierType: calling buildConstType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
17292 printf (
"Modifier kind not handled (not implemented) check what sort of modifier this is: \n");
17301 case V_SgTypedefType:
17304 ROSE_ASSERT(typedefType != NULL);
17308 ROSE_ASSERT(new_typedefType != NULL);
17309 ROSE_ASSERT(isSgTypedefType(new_typedefType) != NULL);
17311 new_type = new_typedefType;
17313 printf (
"ERROSE: SgTypedefType kind not handled (not implemented) \n");
17321 case V_SgPointerType:
17324 ROSE_ASSERT(pointerType != NULL);
17326 printf (
"Building a SgPointerType: calling buildPointerType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
17328 ROSE_ASSERT(new_type != NULL);
17331 printf (
"ERROSE: SgPointerType kind not handled (not implemented) \n");
17341 printf (
"Error: default reached in evaluation of typelist: typeList[i] = %p = %s \n",typeList[i],typeList[i]->class_name().c_str());
17348 if (typeList.size() > 1)
17350 printf (
"Exiting as a test! \n");
17364 printf (
"new_type = %p \n",new_type);
17366 if (new_type != NULL)
17370 printf (
"Reset type for initializedName_copy = %p from type = %p to type = %p \n",initializedName_copy,initializedName_copy->get_type(),new_type);
17372 SgType* original_type = initializedName_copy->get_type();
17373 SgNamedType* original_named_type = isSgNamedType(original_type);
17374 SgNamedType* new_named_type = isSgNamedType(new_type);
17375 if (original_named_type != NULL)
17377 ROSE_ASSERT(new_named_type != NULL);
17378 SgClassDeclaration* original_classDeclaration = isSgClassDeclaration(original_named_type->get_declaration());
17379 SgClassDeclaration* new_classDeclaration = isSgClassDeclaration(new_named_type->get_declaration());
17380 if (original_classDeclaration != NULL)
17382 ROSE_ASSERT(new_classDeclaration != NULL);
17384 printf (
"original_classDeclaration = %p = %s \n",original_classDeclaration,original_classDeclaration->get_name().str());
17385 printf (
"new_classDeclaration = %p = %s \n",new_classDeclaration,new_classDeclaration->get_name().str());
17388 ROSE_ASSERT(new_classDeclaration->get_name() == original_classDeclaration->get_name());
17392 SgType* old_type = initializedName_copy->get_type();
17393 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());
17395 initializedName_copy->set_type(new_type);
17398 printf (
"enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
17401 if (functionParameterList != NULL)
17408 ROSE_ASSERT(functionDeclaration != NULL);
17410 if (functionDefinition != NULL)
17412 ROSE_ASSERT(initializedName_copy->get_scope() == functionDefinition);
17418 ROSE_ASSERT(globalScope != NULL);
17419 if (initializedName_copy->get_scope() != globalScope)
17422 printf (
"Reset scope for initializedName_copy = %p = %s \n",initializedName_copy,initializedName_copy->get_name().str());
17424 initializedName_copy->set_scope(globalScope);
17426 ROSE_ASSERT(initializedName_copy->get_scope() == globalScope);
17432 printf (
"initializedName_copy->get_scope() = %p = %s \n",initializedName_copy->get_scope(),initializedName_copy->get_scope()->
class_name().c_str());
17434 SgEnumDeclaration* enumDeclaration = isSgEnumDeclaration(enclosingStatement_copy);
17435 if (enumDeclaration != NULL)
17445 SgName name = initializedName_copy->get_name();
17446 SgSymbol* symbol = initializedName_copy->get_scope()->lookup_enum_field_symbol(name);
17447 ROSE_ASSERT(symbol != NULL);
17450 ROSE_ASSERT(enumFieldSymbol != NULL);
17455 ROSE_ASSERT(new_enumFieldSymbol != NULL);
17461 initializedName_copy->set_scope(targetScope);
17463 printf (
"Exiting as a test! \n");
17470 printf (
"enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
17473 if (catchOptionStatement != NULL)
17476 ROSE_ASSERT(variableDeclaration != NULL);
17479 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(initializedName_original);
17480 ROSE_ASSERT(enclosingStatement_original != NULL);
17485 if (symbol == NULL)
17487 printf (
"ERROR: (symbol == NULL): initializedName_copy->get_name() = %s \n",initializedName_copy->get_name().str());
17490 ROSE_ASSERT(symbol != NULL);
17492 initializedName_copy->set_scope(targetScope);
17495 ROSE_ASSERT(new_variableSymbol != NULL);
17498 targetScope->
insert_symbol(initializedName_copy->get_name(),new_variableSymbol);
17504 if (javaForEachStatement != NULL)
17507 ROSE_ASSERT(variableDeclaration != NULL);
17509 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(initializedName_original);
17510 ROSE_ASSERT(enclosingStatement_original != NULL);
17514 if (symbol == NULL)
17516 printf (
"ERROR: (symbol == NULL): initializedName_copy->get_name() = %s \n",initializedName_copy->get_name().str());
17519 ROSE_ASSERT(symbol != NULL);
17521 initializedName_copy->set_scope(targetScope);
17524 ROSE_ASSERT(new_variableSymbol != NULL);
17527 targetScope->
insert_symbol(initializedName_copy->get_name(),new_variableSymbol);
17529 printf (
"Need to handle case of SgJavaForEachStatement \n");
17537 if (symbol == NULL)
17539 printf (
"ERROR: enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
17540 ROSE_ASSERT(enclosingStatement_copy->
get_parent() != NULL);
17541 printf (
"ERROR: enclosingStatement_copy->get_parent() = %p = %s \n",enclosingStatement_copy->
get_parent(),enclosingStatement_copy->
get_parent()->
class_name().c_str());
17542 printf (
"ERROR: (symbol == NULL): initializedName_copy->get_name() = %s \n",initializedName_copy->get_name().str());
17543 initializedName_original->
get_file_info()->display(
"ERROR: (symbol == NULL): debug");
17546 SgScopeStatement* initializedName_copy_scope = isSgScopeStatement(initializedName_copy->get_scope());
17547 ROSE_ASSERT(initializedName_copy_scope != NULL);
17548 SgVariableSymbol* variableSymbol = initializedName_copy_scope->lookup_variable_symbol(initializedName_copy->get_name());
17549 ROSE_ASSERT(variableSymbol != NULL);
17551 symbol = variableSymbol;
17553 ROSE_ASSERT(symbol != NULL);
17556 ROSE_ASSERT(variableSymbol != NULL);
17558 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());
17563 ROSE_ASSERT(new_variableSymbol != NULL);
17566 targetScope->
insert_symbol(initializedName_copy->get_name(),new_variableSymbol);
17569 initializedName_copy->set_scope(targetScope);
17571 SgName mangledName = variableSymbol->get_mangled_name();
17573 printf (
"initializedName_copy: mangledName = %s \n",mangledName.str());
17577 if (initializedName_copy->get_scope() != targetScope)
17579 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());
17581 printf (
"I think this should be an error! \n");
17592 case V_SgVariableDeclaration:
17597 ROSE_ASSERT(variableDeclaration != NULL);
17602#define DEBUG_FUNCTION_DECLARATION 0
17604 case V_SgFunctionDeclaration:
17616 SgFunctionType* functionType_copy = functionDeclaration_copy->get_type();
17617 SgFunctionType* functionType_original = functionDeclaration_original->get_type();
17618 ROSE_ASSERT(functionType_copy != NULL);
17619 ROSE_ASSERT(functionType_original != NULL);
17620 ROSE_ASSERT(functionType_copy == functionType_original);
17621#if DEBUG_FUNCTION_DECLARATION
17622 printf (
"case SgFunctionDeclaration: part 1: Calling functionDeclaration_copy->search_for_symbol_from_symbol_table() \n");
17626 ROSE_ASSERT(symbol_original != NULL);
17627 SgFunctionSymbol* functionSymbol_original = isSgFunctionSymbol(symbol_original);
17628 ROSE_ASSERT(functionSymbol_original != NULL);
17631 ROSE_ASSERT(snippetFile != NULL);
17632 if (snippetFile != targetFile)
17634#if DEBUG_FUNCTION_DECLARATION
17635 printf (
"Warning: case V_SgFunctionDeclaration: functionSymbol_original not in target file \n");
17639 ROSE_ASSERT(isSgMemberFunctionSymbol(symbol_original) == NULL);
17645 SgName name = functionDeclaration_copy->get_name();
17646 SgType* functionType = functionDeclaration_copy->get_type();
17647 ROSE_ASSERT(functionType != NULL);
17648#if DEBUG_FUNCTION_DECLARATION
17649 printf (
"case V_SgFunctionDeclaration: name = %s \n",name.str());
17650 printf (
"case V_SgFunctionDeclaration: functionType = %p \n",functionType);
17651 printf (
"case V_SgFunctionDeclaration: functionType_original = %p \n",functionType_original);
17652 printf (
"case V_SgFunctionDeclaration: functionType_copy = %p \n",functionType_copy);
17656 ROSE_ASSERT(targetScope != NULL);
17657 functionDeclaration_copy->
set_scope(targetScope);
17664 if (functionSymbolInTargetAST == NULL)
17666#if DEBUG_FUNCTION_DECLARATION
17667 printf (
"functionSymbolInTargetAST not found in targetScope = %p = %s \n",targetScope,targetScope->
class_name().c_str());
17671 ROSE_ASSERT(otherPossibleScope != NULL);
17672#if DEBUG_FUNCTION_DECLARATION
17673 printf (
"case V_SgFunctionDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope,otherPossibleScope->
class_name().c_str());
17677 functionSymbolInTargetAST = otherPossibleScope->lookup_function_symbol(name,functionType);
17679 if (functionSymbolInTargetAST == NULL)
17681 printf (
"function symbol not found in otherPossibleScope = %p = %s \n",otherPossibleScope,otherPossibleScope->
class_name().c_str());
17684 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
17685#if DEBUG_FUNCTION_DECLARATION
17686 printf (
"(building a new SgFunctionSymbol): functionSymbolInTargetAST->get_declaration() = %p \n",functionSymbolInTargetAST->get_declaration());
17694 ROSE_ASSERT(new_symbol != NULL);
17698 functionSymbolInTargetAST = new_symbol;
17709#if DEBUG_FUNCTION_DECLARATION
17710 printf (
"(using existing symbol found in target scope): functionSymbolInTargetAST->get_declaration() = %p \n",functionSymbolInTargetAST->get_declaration());
17712 functionDeclaration_copy_firstNondefining = isSgFunctionDeclaration(functionSymbolInTargetAST->get_declaration());
17715 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
17718 ROSE_ASSERT(functionDeclaration_copy_firstNondefining != NULL);
17727 ROSE_ASSERT(functionDeclaration_original_firstNondefining != NULL);
17728 printf (
"functionSymbolInTargetAST->get_declaration() = %p \n",functionSymbolInTargetAST->get_declaration());
17730 printf (
"functionDeclaration_original = %p = %s \n",functionDeclaration_original,functionDeclaration_original->
class_name().c_str());
17731 printf (
"functionDeclaration_copy = %p = %s \n",functionDeclaration_copy,functionDeclaration_copy->
class_name().c_str());
17732 printf (
"functionDeclaration_original_firstNondefining = %p \n",functionDeclaration_original_firstNondefining);
17733 printf (
"functionDeclaration_copy_firstNondefining = %p \n",functionDeclaration_copy_firstNondefining);
17734 printf (
"functionDeclaration_original_defining = %p \n",functionDeclaration_original_defining);
17735 printf (
"functionDeclaration_copy_defining = %p \n",functionDeclaration_copy_defining);
17737 printf (
"functionDeclaration_original->get_scope() = %p = %s \n",functionDeclaration_original->
get_scope(),functionDeclaration_original->
get_scope()->
class_name().c_str());
17738 printf (
"functionDeclaration_copy->get_scope() = %p = %s \n",functionDeclaration_copy->
get_scope(),functionDeclaration_copy->
get_scope()->
class_name().c_str());
17739 printf (
"functionDeclaration_original_firstNondefining->get_scope() = %p = %s \n",functionDeclaration_original_firstNondefining->
get_scope(),functionDeclaration_original_firstNondefining->
get_scope()->
class_name().c_str());
17740 printf (
"functionDeclaration_copy_firstNondefining->get_scope() = %p = %s \n",functionDeclaration_copy_firstNondefining->
get_scope(),functionDeclaration_copy_firstNondefining->
get_scope()->
class_name().c_str());
17741 printf (
"functionDeclaration_original_defining->get_scope() = %p = %s \n",functionDeclaration_original_defining->
get_scope(),functionDeclaration_original_defining->
get_scope()->
class_name().c_str());
17742 printf (
"functionDeclaration_copy_defining->get_scope() = %p = %s \n",functionDeclaration_copy_defining->
get_scope(),functionDeclaration_copy_defining->
get_scope()->
class_name().c_str());
17743 printf (
"functionSymbolInTargetAST = %p = %s \n",functionSymbolInTargetAST,functionSymbolInTargetAST->
class_name().c_str());
17746 ROSE_ASSERT(targetScope->lookup_function_symbol(name,functionType) != NULL);
17760 bool isDefiningDeclaration (functionDeclaration_original->get_declaration() != NULL);
17761 if (isDefiningDeclaration ==
true)
17766 ROSE_ASSERT(nondefiningDeclarationFile != NULL);
17767 if (nondefiningDeclarationFile == targetFile)
17784 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
17792 resetDeclaration(functionDeclaration_copy,functionDeclaration_original,targetScope);
17794 printf (
"SageBuilder::fixupCopyOfNodeFromSeperateFileInNewTargetAst(): Need to be able to fixup the SgFunctionDeclaration \n");
17800 case V_SgClassDeclaration:
17804 SgClassDeclaration* classDeclaration_original = isSgClassDeclaration(node_original);
17805 SgClassType* classType = classDeclaration_copy->get_type();
17806 ROSE_ASSERT(classType != NULL);
17808 printf (
"Need to handle named types from class declarations \n");
17819 printf (
"Warning: case V_SgClassDeclaration: assume getEnclosingFileNode(classDeclaration_copy) != targetFile \n");
17831 SgName name = classDeclaration_copy->get_name();
17834 printf (
"case V_SgClassDeclaration: targetScope = %p classSymbol_copy->get_name() = %s \n",targetScope,classSymbol_copy->get_name().str());
17839 if (classSymbolInTargetAST == NULL)
17843 ROSE_ASSERT(otherPossibleScope != NULL);
17845 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p \n",otherPossibleScope);
17849 ROSE_ASSERT(classSymbolInTargetAST != NULL);
17853 ROSE_ASSERT(classDeclaration != NULL);
17855 ROSE_ASSERT(scope != NULL);
17856 classDeclaration_copy->
set_scope(scope);
17859 classDeclaration_copy->
set_scope(targetScope);
17863 ROSE_ASSERT(classSymbol != NULL);
17864 classSymbolInTargetAST = classSymbol;
17874 ROSE_ASSERT(classDeclaration != NULL);
17876 ROSE_ASSERT(scope != NULL);
17877 classDeclaration_copy->
set_scope(scope);
17880 ROSE_ASSERT(classSymbolInTargetAST != NULL);
17887 SgClassType* new_class_type = isSgClassType(new_type);
17888 if (new_class_type != NULL)
17891 classDeclaration_copy->set_type(new_class_type);
17893 printf (
"case V_SgClassDeclaration: built class type: part 1: classDeclaration_copy->get_type() = %p = %s \n",
17894 classDeclaration_copy->get_type(),classDeclaration_copy->get_type()->
class_name().c_str());
17898 resetDeclaration(classDeclaration_copy,classDeclaration_original,targetScope);
17900 printf (
"SgClassDeclaration: Exiting as a test! \n");
17906 case V_SgEnumDeclaration:
17910 SgEnumDeclaration* enumDeclaration_original = isSgEnumDeclaration(node_original);
17920 printf (
"case V_SgEnumDeclaration: targetScope = %p enumSymbol_copy->get_name() = %s \n",targetScope,name.str());
17924 if (enumSymbolInTargetAST == NULL)
17928 ROSE_ASSERT(otherPossibleScope != NULL);
17930 printf (
"case V_SgEnumDeclaration: otherPossibleScope = %p \n",otherPossibleScope);
17934 printf (
"Since the symbol has not been inserted yet, what symbol are we looking for? \n");
17938 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
17940 ROSE_ASSERT(enumDeclaration != NULL);
17942 ROSE_ASSERT(enumDeclaration != enumDeclaration_original);
17949 ROSE_ASSERT(enumSymbol != NULL);
17950 enumSymbolInTargetAST = enumSymbol;
17957 ROSE_ASSERT(scope != NULL);
17958 enumDeclaration_copy->
set_scope(scope);
17960 printf (
"case V_SgEnumDeclaration: insert_symbol(): name = %s enumSymbolInTargetAST = %p \n",name.str(),enumSymbolInTargetAST);
17969 printf (
"Found an existing enum declaration: name = %s enumSymbolInTargetAST = %p \n",name.str(),enumSymbolInTargetAST);
17973 ROSE_ASSERT(enumDeclaration != NULL);
17976 ROSE_ASSERT(scope != NULL);
17977 ROSE_ASSERT(scope == targetScope);
17985 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
17988 printf (
"Exiting as a test 1! \n");
17992 ROSE_ASSERT(enumType != NULL);
17995 printf (
"Return type from getTargetFileType(): original enumType = %p new_type = %p \n",enumType,new_type);
17997 SgEnumType* new_enum_type = isSgEnumType(new_type);
17998 if (new_enum_type != NULL)
18002 printf (
"reset the type using the new enum type from the target AST \n");
18004 enumDeclaration_copy->
set_type(new_enum_type);
18007 printf (
"Exiting as a test 2! \n");
18011 resetDeclaration(enumDeclaration_copy,enumDeclaration_original,targetScope);
18016 case V_SgTemplateClassDeclaration:
18020 SgClassType* templateClassType = templateClassDeclaration->get_type();
18021 ROSE_ASSERT(templateClassType != NULL);
18025 SgClassType* new_templateClass_type = isSgClassType(new_type);
18026 if (new_templateClass_type != NULL)
18029 templateClassDeclaration->set_type(new_templateClass_type);
18031 printf (
"case V_SgTemplateClassDeclaration: built class type: part 1: templateClassDeclaration->get_type() = %p = %s \n",
18032 templateClassDeclaration->get_type(),templateClassDeclaration->get_type()->
class_name().c_str());
18039 case V_SgTypedefDeclaration:
18045 SgType* base_type = typedefDeclaration_copy->get_base_type();
18046 ROSE_ASSERT(base_type != NULL);
18048 if (new_base_type != NULL)
18051 typedefDeclaration_copy->set_base_type(new_base_type);
18056 SgName name = typedefDeclaration_copy->get_name();
18059 printf (
"case V_SgTypedefDeclaration: targetScope = %p typedefSymbol_copy->get_name() = %s \n",targetScope,name.str());
18063 if (typedefSymbolInTargetAST == NULL)
18067 ROSE_ASSERT(otherPossibleScope != NULL);
18069 printf (
"case V_SgTypedefDeclaration: otherPossibleScope = %p \n",otherPossibleScope);
18073 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
18075 ROSE_ASSERT(typedefDeclaration != NULL);
18078 ROSE_ASSERT(scope != NULL);
18079 typedefDeclaration_copy->
set_scope(scope);
18083 ROSE_ASSERT(typedefSymbol != NULL);
18084 typedefSymbolInTargetAST = typedefSymbol;
18086 printf (
"case V_SgTypedefDeclaration: insert_symbol(): name = %s typedefSymbolInTargetAST = %p \n",name.str(),typedefSymbolInTargetAST);
18095 printf (
"Found an existing typedef declaration: name = %s typedefSymbolInTargetAST = %p \n",name.str(),typedefSymbolInTargetAST);
18099 ROSE_ASSERT(typedefDeclaration != NULL);
18101 ROSE_ASSERT(scope != NULL);
18102 typedefDeclaration_copy->
set_scope(scope);
18105 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
18108 printf (
"Exiting as a test 1! \n");
18111 SgTypedefType* typedefType = typedefDeclaration_copy->get_type();
18112 ROSE_ASSERT(typedefType != NULL);
18114 SgTypedefType* new_typedef_type = isSgTypedefType(new_type);
18115 if (new_typedef_type != NULL)
18119 printf (
"reset the type using the new typedef type from the target AST \n");
18121 typedefDeclaration_copy->set_type(new_typedef_type);
18123 printf (
"case V_SgTypedefDeclaration: built class type: part 1: typedefDeclaration_copy->get_type() = %p = %s \n",
18124 typedefDeclaration_copy->get_type(),typedefDeclaration_copy->get_type()->
class_name().c_str());
18128 resetDeclaration(typedefDeclaration_copy,typedefDeclaration_original,targetScope);
18130 printf (
"Exiting as a test 2! \n");
18136 case V_SgVarRefExp:
18147 SgVarRefExp* varRefExp_copy = isSgVarRefExp(node_copy);
18148 SgVarRefExp* varRefExp_original = isSgVarRefExp(node_original);
18149 SgVariableSymbol* variableSymbol_copy = isSgVariableSymbol(varRefExp_copy->get_symbol());
18150 ROSE_ASSERT(variableSymbol_copy != NULL);
18155 printf (
"Warning: case V_SgVarRefExp: variableSymbol not in target file: name = %s \n",variableSymbol_copy->
get_name().str());
18158 printf (
"insertionPoint = %p = %s \n",insertionPoint,insertionPoint->
class_name().c_str());
18171 if (variableSymbolInTargetAST == NULL)
18177 printf (
"Error: The associated variable = %s should have been found in a parent scope of the target AST \n",variableSymbol_copy->
get_name().str());
18182 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(varRefExp_original);
18183 ROSE_ASSERT(enclosingStatement_original != NULL);
18185 printf (
"case V_SgVarRefExp: enclosingStatement_original = %p = %s \n",enclosingStatement_original,enclosingStatement_original->
class_name().c_str());
18188 ROSE_ASSERT(otherPossibleScope_original != NULL);
18191 ROSE_ASSERT(file != NULL);
18193 printf (
"enclosingStatement_original: associated file name = %s \n",file->get_sourceFileNameWithPath().c_str());
18196 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope_original,otherPossibleScope_original->
class_name().c_str());
18197 printf (
"case V_SgClassDeclaration: variableSymbol_copy->get_name() = %s \n",variableSymbol_copy->
get_name().str());
18200 if (variableSymbolInTargetAST == NULL)
18204 otherPossibleScope_original->
get_symbol_table()->
print(
"otherPossibleScope_original: symbol table");
18209 SgBinaryOp* parentBinaryOp = isSgBinaryOp(parentExpression);
18210 SgDotExp* parentDotExp = isSgDotExp(parentExpression);
18211 SgArrowExp* parentArrowExp = isSgArrowExp(parentExpression);
18212 if (parentDotExp != NULL || parentArrowExp != NULL)
18216 ROSE_ASSERT(lhs != NULL);
18220 ROSE_ASSERT(type != NULL);
18222 printf (
"type = %p = %s \n",type,type->
class_name().c_str());
18225 ROSE_ASSERT(namedType != NULL);
18227 ROSE_ASSERT(declaration != NULL);
18229 ROSE_ASSERT(classDeclaration != NULL);
18231 ROSE_ASSERT(definingClassDeclaration != NULL);
18232 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
18233 ROSE_ASSERT(classDefinition != NULL);
18235 printf (
"case V_SgClassDeclaration: classDefinition = %p = %s \n",classDefinition,classDefinition->
class_name().c_str());
18238 otherPossibleScope_original = classDefinition;
18244 ROSE_ASSERT(variableSymbolInTargetAST != NULL);
18245 SgInitializedName* initializedName = variableSymbolInTargetAST->get_declaration();
18246 ROSE_ASSERT(initializedName != NULL);
18248 ROSE_ASSERT(scope != NULL);
18251 initializedName->set_scope(scope);
18256 ROSE_ASSERT(variableSymbolInTargetAST != NULL);
18259 varRefExp_copy->set_symbol(variableSymbolInTargetAST);
18268 case V_SgFunctionRefExp:
18273 SgFunctionSymbol* functionSymbol_copy = isSgFunctionSymbol(functionRefExp_copy->get_symbol());
18274 ROSE_ASSERT(functionSymbol_copy != NULL);
18279 printf (
"Warning: case V_SgFunctionRefExp: functionSymbol_copy not in target file (find function = %s) \n",functionSymbol_copy->
get_name().str());
18283 printf (
"insertionPointIsScope = %s insertionPointScope = %p = %s \n",insertionPointIsScope ?
"true" :
"false",insertionPointScope,insertionPointScope->class_name().c_str());
18295 if (functionSymbolInTargetAST == NULL)
18306 fprintf (stderr,
"Error: The associated function = \"%s\" should have been found in a parent scope"
18307 " of the target AST\n", name.str());
18309 fprintf (stderr,
" targetScope = %p = %s \n",targetScope,targetScope->
class_name().c_str());
18310 SgGlobal* globalScope = TransformationSupport::getGlobalScope(targetScope);
18311 ROSE_ASSERT(globalScope != NULL);
18312 fprintf (stderr,
" globalScope = %p = %s \n",globalScope,globalScope->
class_name().c_str());
18314 targetScope->
get_file_info()->display(
"case V_SgFunctionRefExp: targetScope: debug");
18315 node_original->
get_file_info()->display(
"case V_SgFunctionRefExp: node_original: debug");
18321 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(functionRefExp_original);
18322 ROSE_ASSERT(enclosingStatement_original != NULL);
18324 printf (
"case V_SgFunctionRefExp: enclosingStatement_original = %p = %s \n",enclosingStatement_original,enclosingStatement_original->
class_name().c_str());
18327 ROSE_ASSERT(otherPossibleScope_original != NULL);
18330 ROSE_ASSERT(file != NULL);
18332 printf (
"enclosingStatement_original: associated file name = %s \n",file->get_sourceFileNameWithPath().c_str());
18335 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope_original,otherPossibleScope_original->
class_name().c_str());
18336 printf (
"case V_SgClassDeclaration: functionSymbol_copy->get_name() = %s \n",functionSymbol_copy->
get_name().str());
18340 if (functionSymbolInTargetAST == NULL)
18344 SgBinaryOp* parentBinaryOp = isSgBinaryOp(parentExpression);
18345 SgDotExp* parentDotExp = isSgDotExp(parentExpression);
18346 SgArrowExp* parentArrowExp = isSgArrowExp(parentExpression);
18347 if (parentDotExp != NULL || parentArrowExp != NULL)
18351 ROSE_ASSERT(lhs != NULL);
18352 ROSE_ASSERT(parentBinaryOp->
get_rhs_operand() == functionRefExp_copy);
18355 ROSE_ASSERT(type != NULL);
18357 printf (
"type = %p = %s \n",type,type->
class_name().c_str());
18360 ROSE_ASSERT(namedType != NULL);
18362 ROSE_ASSERT(declaration != NULL);
18364 ROSE_ASSERT(classDeclaration != NULL);
18366 ROSE_ASSERT(definingClassDeclaration != NULL);
18367 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
18368 ROSE_ASSERT(classDefinition != NULL);
18370 printf (
"case V_SgClassDeclaration: classDefinition = %p = %s \n",classDefinition,classDefinition->
class_name().c_str());
18373 otherPossibleScope_original = classDefinition;
18380 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
18382 ROSE_ASSERT(functionDeclaration != NULL);
18384 ROSE_ASSERT(scope != NULL);
18389 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
18394 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
18397 functionRefExp_copy->set_symbol(functionSymbolInTargetAST);
18399 printf (
"Exiting as a test! \n");
18407#define DEBUG_MEMBER_FUNCTION_REF_EXP 0
18409 case V_SgMemberFunctionRefExp:
18414 SgMemberFunctionSymbol* memberFunctionSymbol_copy = isSgMemberFunctionSymbol(memberFunctionRefExp_copy->get_symbol());
18415 ROSE_ASSERT(memberFunctionSymbol_copy != NULL);
18420#if DEBUG_MEMBER_FUNCTION_REF_EXP
18421 printf (
"Warning: case V_SgMemberFunctionRefExp: memberFunctionSymbol_copy not in target file (find member function = %s) \n",memberFunctionSymbol_copy->
get_name().str());
18425 if (memberFunctionSymbolInTargetAST == NULL)
18430#if DEBUG_MEMBER_FUNCTION_REF_EXP
18431 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());
18436 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(memberFunctionRefExp_original);
18437 ROSE_ASSERT(enclosingStatement_original != NULL);
18438#if DEBUG_MEMBER_FUNCTION_REF_EXP
18439 printf (
"case V_SgMemberFunctionRefExp: enclosingStatement_original = %p = %s \n",enclosingStatement_original,enclosingStatement_original->
class_name().c_str());
18442 ROSE_ASSERT(otherPossibleScope_original != NULL);
18445 ROSE_ASSERT(file != NULL);
18446#if DEBUG_MEMBER_FUNCTION_REF_EXP
18447 printf (
"enclosingStatement_original: associated file name = %s \n",file->get_sourceFileNameWithPath().c_str());
18450 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope_original,otherPossibleScope_original->
class_name().c_str());
18451 printf (
"case V_SgClassDeclaration: memberFunctionSymbol_copy->get_name() = %s \n",memberFunctionSymbol_copy->
get_name().str());
18454 if (memberFunctionSymbolInTargetAST == NULL)
18456#if DEBUG_MEMBER_FUNCTION_REF_EXP
18457 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");
18462 ROSE_ASSERT(parentExpression != NULL);
18463#if DEBUG_MEMBER_FUNCTION_REF_EXP
18464 printf (
"parentExpression = %p = %s \n",parentExpression,parentExpression->
class_name().c_str());
18466 bool handle_as_java =
false;
18468 if (functionCallExp != NULL)
18472 handle_as_java =
true;
18476 ROSE_ASSERT(parentOfFunctionCallExpression != NULL);
18477#if DEBUG_MEMBER_FUNCTION_REF_EXP
18478 printf (
"parentOfFunctionCallExpression = %p = %s \n",parentOfFunctionCallExpression,parentOfFunctionCallExpression->
class_name().c_str());
18480 parentExpression = parentOfFunctionCallExpression;
18483 SgBinaryOp* parentBinaryOp = isSgBinaryOp(parentExpression);
18484 SgDotExp* parentDotExp = isSgDotExp(parentExpression);
18485 SgArrowExp* parentArrowExp = isSgArrowExp(parentExpression);
18486#if DEBUG_MEMBER_FUNCTION_REF_EXP
18487 printf (
"parentBinaryOp = %p \n",parentBinaryOp);
18488 printf (
"parentDotExp = %p \n",parentDotExp);
18489 printf (
"parentArrowExp = %p \n",parentArrowExp);
18491 if (parentDotExp != NULL || parentArrowExp != NULL)
18495 ROSE_ASSERT(lhs != NULL);
18498 if (handle_as_java ==
true)
18506 ROSE_ASSERT(parentBinaryOp->
get_rhs_operand() == memberFunctionRefExp_copy);
18508#if DEBUG_MEMBER_FUNCTION_REF_EXP
18509 printf (
"lhs = %p = %s \n",lhs,lhs->
class_name().c_str());
18515 if (varRefExp != NULL)
18517 SgVariableSymbol* variableSymbol = isSgVariableSymbol(varRefExp->get_symbol());
18518 ROSE_ASSERT(variableSymbol != NULL);
18520 ROSE_ASSERT(initializedName != NULL);
18522 SgType* initializedName_type = initializedName->get_type();
18523#if DEBUG_MEMBER_FUNCTION_REF_EXP
18524 printf (
"initializedName = %p = %s \n",initializedName,initializedName->get_name().str());
18525 printf (
"initializedName_type = %p \n",initializedName_type);
18527 SgClassType* classType = isSgClassType(initializedName_type);
18528 if (classType != NULL)
18530 SgClassDeclaration* classDeclaration = isSgClassDeclaration(classType->get_declaration());
18531 ROSE_ASSERT(classDeclaration != NULL);
18533 ROSE_ASSERT(definingClassDeclaration != NULL);
18534 printf (
"definingClassDeclaration->get_name() = %s \n",definingClassDeclaration->get_name().str());
18536 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
18537 ROSE_ASSERT(classDefinition != NULL);
18538 SgType* memberFunctionType = memberFunctionSymbol_copy->
get_type();
18539 SgName memberFunctionName = memberFunctionSymbol_copy->
get_name();
18540 ROSE_ASSERT(memberFunctionType != NULL);
18541 SgFunctionSymbol *functionSymbol = classDefinition->lookup_function_symbol(memberFunctionName,memberFunctionType);
18542 if (functionSymbol == NULL)
18544 printf (
"Symbol not found: output symbol table (size = %d): \n",classDefinition->
get_symbol_table()->
size());
18545#if DEBUG_MEMBER_FUNCTION_REF_EXP
18546 classDefinition->
get_symbol_table()->
print(
"Symbol not found: output symbol table: SgClassDefinition");
18551 printf (
"\n*************************************************************** \n");
18552 printf (
"ERROR: target has not be properly setup to receive the snippet. \n");
18553 printf (
"*************************************************************** \n");
18555 ROSE_ASSERT(functionSymbol != NULL);
18557 ROSE_ASSERT(memberFunctionSymbol != NULL);
18559 memberFunctionSymbolInTargetAST = memberFunctionSymbol;
18561 printf (
"Exiting as a test! \n");
18571 if (valueExp != NULL)
18573 memberFunctionSymbolInTargetAST = memberFunctionSymbol_copy;
18574 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18577 if (memberFunctionSymbolInTargetAST == NULL)
18581 ROSE_ASSERT(type != NULL);
18582#if DEBUG_MEMBER_FUNCTION_REF_EXP
18583 printf (
"type = %p = %s \n",type,type->
class_name().c_str());
18586 ROSE_ASSERT(namedType != NULL);
18588 ROSE_ASSERT(declaration != NULL);
18590 ROSE_ASSERT(classDeclaration != NULL);
18592 ROSE_ASSERT(definingClassDeclaration != NULL);
18593 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
18594 ROSE_ASSERT(classDefinition != NULL);
18595#if DEBUG_MEMBER_FUNCTION_REF_EXP
18596 printf (
"case V_SgClassDeclaration: classDefinition = %p = %s \n",classDefinition,classDefinition->
class_name().c_str());
18599 otherPossibleScope_original = classDefinition;
18600#if DEBUG_MEMBER_FUNCTION_REF_EXP
18603#if DEBUG_MEMBER_FUNCTION_REF_EXP
18606 printf (
"associated_classDeclaration = %p name = %s \n",associated_classDeclaration,associated_classDeclaration->get_name().str());
18607 printf (
"functionSymbol = %p \n",functionSymbol);
18610 if (memberFunctionSymbolInTargetAST == NULL)
18613 printf (
"Error: (memberFunctionSymbolInTargetAST == NULL): memberFunctionSymbol_copy->get_name() = %s \n",memberFunctionSymbol_copy->
get_name().str());
18616 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18618 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18622 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18624 ROSE_ASSERT(functionDeclaration != NULL);
18626 ROSE_ASSERT(scope != NULL);
18631 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18634 memberFunctionRefExp_copy->set_symbol(memberFunctionSymbolInTargetAST);
18644 printf (
"Exiting as a test! (SgTryStmt) \n");
18651 case V_SgCatchStatementSeq:
18656 printf (
"Exiting as a test! (SgCatchStatementSeq) \n");
18663 case V_SgCatchOptionStmt:
18668 ROSE_ASSERT(catchOptionStatement_copy);
18670 printf (
"Need to check the symbol table of the SgCatchOptionStmt (which is a SgScopeStatement) \n");
18673 printf (
"Exiting as a test! (SgCatchOptionStmt) \n");
18680 case V_SgJavaPackageStatement:
18683 printf (
"Exiting as a test! (SgJavaPackageStatement) \n");
18693 printf (
"enum values contain a reference to the associated SgEnumDeclaration \n");
18695 SgEnumVal* enumVal_copy = isSgEnumVal(node_copy);
18696 SgEnumVal* enumVal_original = isSgEnumVal(node_original);
18698 printf (
" --- enumVal_original = %p = %d name = %s \n",enumVal_original,enumVal_original->get_value(),enumVal_original->get_name().str());
18700 SgEnumDeclaration* associatedEnumDeclaration_copy = isSgEnumDeclaration(enumVal_copy->get_declaration());
18701 SgEnumDeclaration* associatedEnumDeclaration_original = isSgEnumDeclaration(enumVal_original->get_declaration());
18704 bool isUnNamed = associatedEnumDeclaration_original->get_isUnNamed();
18705 if (isUnNamed ==
false)
18707 if (associatedEnumDeclaration_copy == associatedEnumDeclaration_original)
18710 printf (
" --- The stored reference to the enum declaration in the SgEnumVal must be reset \n");
18714 if (symbol == NULL)
18717 enumVal_original->
get_file_info()->display(
"case V_SgEnumVal: symbol == NULL: debug");
18719 ROSE_ASSERT(symbol != NULL);
18721 ROSE_ASSERT(enumSymbol != NULL);
18722 SgEnumDeclaration* new_associatedEnumDeclaration_copy = enumSymbol->get_declaration();
18723 ROSE_ASSERT(new_associatedEnumDeclaration_copy != NULL);
18726 ROSE_ASSERT(new_associatedEnumDeclaration_copy != associatedEnumDeclaration_original);
18728 ROSE_ASSERT(new_associatedEnumDeclaration_copy != associatedEnumDeclaration_original->
get_definingDeclaration());
18730 enumVal_copy->set_declaration(new_associatedEnumDeclaration_copy);
18732 printf (
"Exiting as a test! \n");
18741 printf (
"Warning: can't handle enum values from unnamed enum declarations \n");
18742 printf (
" --- enumVal_original = %p = %lld name = %s \n",enumVal_original,enumVal_original->get_value(),enumVal_original->get_name().str());
18776 ROSE_ASSERT(insertionPoint != NULL);
18777 ROSE_ASSERT(toInsert != NULL);
18778 ROSE_ASSERT(original_before_copy != NULL);
18782 SgSymbolTable::set_force_search_of_base_classes(
true);
18789 ROSE_ASSERT(targetFile != NULL);
18798 ROSE_ASSERT(snippetFile_of_copy == targetFile);
18803 ROSE_ASSERT(snippetFile_of_original != targetFile);
18806 printf (
" --- targetFile = %p = %s \n",targetFile,targetFile->get_sourceFileNameWithPath().c_str());
18807 printf (
" --- snippetFile_of_copy = %p = %s \n",snippetFile_of_copy,snippetFile_of_copy->get_sourceFileNameWithPath().c_str());
18808 printf (
" --- snippetFile_of_original = %p = %s \n",snippetFile_of_original,snippetFile_of_original->get_sourceFileNameWithPath().c_str());
18820 if (isStructurallyEquivalent ==
false)
18822 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");
18825 ROSE_ASSERT(isStructurallyEquivalent ==
true);
18835 RoseAst ast_of_copy(toInsert);
18836 RoseAst ast_of_original(original_before_copy);
18845 while (i_copy != ast_of_copy.
end())
18849 if ((*i_copy)->variantT() != (*i_original)->variantT())
18851 printf (
"ERROR: return from fixupCopyOfAstFromSeparateFileInNewTargetAst(): "
18852 "(*i_copy)->variantT() != (*i_original)->variantT() \n");
18854 printf (
"Making this an error! \n");
18867 ROSE_ASSERT(i_original != ast_of_original.
end());
18872 ROSE_ASSERT(i_copy == ast_of_copy.
end() && i_original == ast_of_original.
end());
18878 if (functionDeclaration != NULL)
18880 printf (
"functionDeclaration = %s \n",functionDeclaration->get_name().str());
18882 printf (
"Exiting as a test! \n");
18889 SgSymbolTable::set_force_search_of_base_classes(
false);
18899 ROSE_ASSERT (scope != NULL);
18909 ROSE_ASSERT(result != NULL);
18913 cerr<<
"Error. buildStatementFromString() cannot parse the input string:"<<s
18914 <<
"\n\t within the given scope:"<<scope->
class_name() <<endl;
18938 template <
class SgAstNode>
18941 static const bool explicitlySpecified =
true;
18959 res = createTemplateArg_(*isSgType(&n));
18960 else if (isSgExpression(&n))
18961 res = createTemplateArg_(*isSgExpression(&n));
18964 ROSE_ASSERT(isSgTemplateDeclaration(&n));
18965 res = createTemplateArg_(*isSgTemplateDeclaration(&n));
18972 SgName genTemplateName(
SgName base, Rose_STL_Container<SgNode*>& targs)
18974 Rose_STL_Container<SgNode*>::iterator aa = targs.begin();
18975 Rose_STL_Container<SgNode*>::iterator zz = targs.begin();
18976 std::string name(base.getString());
18979 for ( ; aa != zz; ++aa) name.append((*aa)->unparseToString());
18985 SgTemplateArgumentPtrList genTemplateArgumentList(Rose_STL_Container<SgNode*>& targs)
18987 Rose_STL_Container<SgNode*>::iterator aa = targs.begin();
18988 Rose_STL_Container<SgNode*>::iterator zz = targs.begin();
18989 SgTemplateArgumentPtrList lst;
18991 for ( ; aa != zz; ++aa)
18993 lst.push_back(createTemplateArg(**aa));
19001 ROSE_ASSERT(main_decl);
19007 ROSE_ASSERT(tdecl);
19013 ROSE_ASSERT(tclassdecl);
19034 ROSE_ASSERT(tdecl);
19039 struct TemplateArgumentParentSetter
19057Rose_STL_Container<SgNode *>& template_args)
19064Rose_STL_Container<SgNode *>& template_args)
19066 ROSE_ASSERT(template_decl);
19069 SgName name = template_decl->get_name();
19071 SgTemplateArgumentPtrList targs = genTemplateArgumentList(template_args);
19074 ROSE_ASSERT(tinst);
19078 ROSE_ASSERT(tclass);
19081 tinst->set_type(tclass);
19085 std::for_each(targs.begin(), targs.end(), TemplateArgumentParentSetter(tinst));
19091#ifdef ROSE_BUILD_JAVA_LANGUAGE_SUPPORT
19098 ROSE_ASSERT(Rose::Frontend::Java::lengthSymbol);
19110 if (parent_scope != NULL) {
19111 scope -> set_parent(parent_scope);
19141 pair -> set_value(value);
19142 value -> set_parent(pair);
19169 for (std::list<SgJavaMemberValuePair *>::iterator i = pair_list.begin(); i != pair_list.end(); i++) {
19171 member_value_pair -> set_parent(annotation);
19172 annotation -> append_value_pair(member_value_pair);
19195 return initialized_name;
19204 package_statement -> set_firstNondefiningDeclaration(package_statement);
19205 package_statement -> set_definingDeclaration(package_statement);
19206 return package_statement;
19215 import_statement -> set_firstNondefiningDeclaration(import_statement);
19216 import_statement -> set_definingDeclaration(import_statement);
19217 return import_statement;
19224 ROSE_ASSERT(scope);
19225 SgName class_name = name;
19226 ROSE_ASSERT(scope -> lookup_class_symbol(class_name) == NULL);
19229 bool buildTemplateInstantiation =
false;
19230 SgTemplateArgumentPtrList* templateArgumentsList = NULL;
19232 ROSE_ASSERT(class_declaration);
19233 class_declaration -> set_parent(scope);
19234 class_declaration -> set_scope(scope);
19237 ROSE_ASSERT(class_definition);
19241 class_definition -> setAttribute(
"extension_type_names",
new AstRegExAttribute());
19244 type_space -> set_parent(class_definition);
19246 class_declaration -> setAttribute(
"type_space",
new AstSgNodeAttribute(type_space));
19248 return class_declaration;
19257 string filename = directory_name +
"/" + type_name +
".java";
19258 ROSE_ASSERT((*project)[filename] == NULL);
19260 string command = string(
"touch ") + filename;
19261 int status = system(command.c_str());
19262 ROSE_ASSERT(status == 0);
19263 project -> get_sourceFileNameList().push_back(filename);
19264 Rose_STL_Container<std::string> arg_list = project -> get_originalCommandLineArgumentList();
19265 arg_list.push_back(filename);
19269 int error_code = 0;
19270 SgFile *file = determineFileType(arg_list, error_code, project);
19272 ROSE_ASSERT(sourcefile);
19273 sourcefile -> set_parent(project);
19274 project -> get_fileList_ptr() -> get_listOfFiles().push_back(sourcefile);
19275 ROSE_ASSERT(sourcefile == isSgSourceFile((*project)[filename]));
19281 ROSE_ASSERT(pkgDefDecl != NULL);
19283 package_statement->
set_parent(package_definition);
19284 sourcefile->set_package(package_statement);
19290 import_statement_list -> set_parent(sourcefile);
19291 sourcefile -> set_import_list(import_statement_list);
19297 class_declaration_list -> set_parent(package_definition);
19298 sourcefile -> set_class_list(class_declaration_list);
19308 ROSE_ASSERT(num_dimensions > 0);
19309 if (num_dimensions > 1) {
19313 ROSE_ASSERT(base_type != NULL);
19315 if (attribute == NULL) {
19317 array_type -> set_rank(num_dimensions);
19319 base_type -> setAttribute(
"array", attribute);
19322 return isSgArrayType(attribute -> getNode());
19333 generic_type -> setAttribute(
"parameterized types", attribute);
19335 ROSE_ASSERT(attribute);
19337 return attribute -> findOrInsertParameterizedType(new_args);
19348 type -> setAttribute(
"qualified types", attribute);
19350 ROSE_ASSERT(attribute);
19352 for (
int i = 0; i < attribute -> size(); i++) {
19354 ROSE_ASSERT(qualified_type);
19355 if (qualified_type -> get_parent_type() == parent_type && qualified_type -> get_type() == type) {
19356 return qualified_type;
19361 qualified_type -> set_parent_type(parent_type);
19362 qualified_type -> set_type(type);
19364 attribute -> addNode(qualified_type);
19366 return qualified_type;
19377 SgClassDeclaration *class_declaration = isSgClassDeclaration(Rose::Frontend::Java::ObjectClassType -> get_declaration());
19380 Rose::Frontend::Java::ObjectClassType -> setAttribute(
"unbound", attribute);
19383 return isSgJavaWildcardType(attribute -> getNode());
19396 ROSE_ASSERT(array_type || named_type);
19397 SgClassDeclaration *class_declaration = isSgClassDeclaration((array_type ? (
SgNamedType *) Rose::Frontend::Java::ObjectClassType : named_type) -> get_declaration());
19400 wildcard -> set_has_extends(
true);
19403 type -> setAttribute(
"extends", attribute);
19406 return isSgJavaWildcardType(attribute -> getNode());
19419 ROSE_ASSERT(array_type || named_type);
19420 SgClassDeclaration *class_declaration = isSgClassDeclaration((array_type ? (
SgNamedType *) Rose::Frontend::Java::ObjectClassType : named_type) -> get_declaration());
19423 wildcard -> set_has_super(
true);
19426 type -> setAttribute(
"super", attribute);
19429 return isSgJavaWildcardType(attribute -> getNode());
19439 namespace Builder {
19440 namespace Templates {
19443 ROSE_ASSERT(t !=
nullptr);
19449 ROSE_ASSERT(e !=
nullptr);
19469std::string strTemplateArgument(
int v) {
19470 std::ostringstream oss;
19475std::string strTemplateArgument(
bool v) {
19476 std::ostringstream oss;
19477 if (v) oss <<
"true";
19478 else oss <<
"false";
19482std::string strTemplateArgument(
SgNamedType * nt) {
19483 std::ostringstream oss;
19488std::string strTemplateArgument(
SgType * t) {
19489 std::ostringstream oss;
19495 std::ostringstream oss;
19500#define DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps 0
19504 std::vector<SgTemplateParameter *> & tpl_params,
19505 std::vector<SgTemplateArgument *> & tpl_args
19507#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19508 std::cout <<
"Rose::Builder::Templates::instantiateNonrealRefExps" << std::endl;
19509 std::cout <<
" expr = " << std::hex << expr <<
" : " << ( expr ? expr->
class_name() :
"" ) << std::endl;
19513 }
else if (isSgNonrealRefExp(expr)) {
19515 }
else if (isSgVarRefExp(expr)) {
19518 ROSE_ASSERT(iname);
19519#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19520 std::cout <<
" iname = " << std::hex << iname <<
" : " << ( iname ? iname->
class_name() :
"" ) << std::endl;
19521 std::cout <<
" iname->get_name() = " << iname->get_name() << std::endl;
19522 std::cout <<
" iname->get_initializer() = " << std::hex << iname->get_initializer() <<
" : " << ( iname->get_initializer() ? iname->get_initializer()->
class_name() :
"" ) << std::endl;
19528 for (
auto tpl_param: tpl_params) {
19529 if (tpl_param->get_initializedName()) {
19530#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19531 std::cout <<
" tpl_param->get_initializedName() = " << std::hex << tpl_param->get_initializedName() << std::endl;
19532 std::cout <<
" tpl_param->get_initializedName()->get_name() = " << tpl_param->get_initializedName()->get_name() << std::endl;
19534 if (tpl_param->get_initializedName()->get_name() == iname->get_name()) {
19535 iname = tpl_param->get_initializedName();
19542 if (pos < tpl_params.size() && pos < tpl_args.size()) {
19543 ROSE_ASSERT(tpl_args[pos]->get_expression());
19544 return tpl_args[pos]->get_expression();
19545 }
else if (pos < tpl_params.size()) {
19546 SgExpression * dft = tpl_params[pos]->get_defaultExpressionParameter();
19548 return instantiateNonrealRefExps(dft, tpl_params, tpl_args);
19552 }
else if (isSgValueExp(expr)) {
19554 }
else if (isSgConditionalExp(expr)) {
19560 }
else if (isSgSizeOfOp(expr)) {
19562 szo->set_operand_expr(instantiateNonrealRefExps(szo->get_operand_expr(), tpl_params, tpl_args));
19563 szo->set_operand_type(instantiateNonrealTypes(szo->get_operand_type(), tpl_params, tpl_args));
19565 }
else if (isSgCastExp(expr)) {
19568 cast->set_type(instantiateNonrealTypes(cast->
get_type(), tpl_params, tpl_args));
19570 }
else if (isSgUnaryOp(expr)) {
19574 }
else if (isSgBinaryOp(expr)) {
19580 std::cerr <<
"!!! expr = " << std::hex << expr <<
" : " << ( expr ? expr->
class_name() :
"" ) << std::endl;
19585#define DEBUG_Rose_Builder_Templates_instantiateNonrealTypes 0
19587SgType * instantiateNonrealTypes(
19589 std::vector<SgTemplateParameter *> & tpl_params,
19590 std::vector<SgTemplateArgument *> & tpl_args
19592#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19593 std::cout <<
"Rose::Builder::Templates::instantiateNonrealTypes" << std::endl;
19594 std::cout <<
" type = " << std::hex << type <<
" : " << ( type ? type->
class_name() :
"" ) << std::endl;
19598 }
else if (isSgNonrealType(type)) {
19600 SgNonrealDecl * nrdecl = isSgNonrealDecl(nrtype->get_declaration());
19601 ROSE_ASSERT(nrdecl !=
nullptr);
19602#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19603 std::cout <<
" nrdecl = " << std::hex << nrdecl <<
" : " << nrdecl->
class_name() << std::endl;
19604 std::cout <<
" ->get_tpl_args() = " << std::dec << nrdecl->get_tpl_args().size() << std::endl;
19605 std::cout <<
" ->get_tpl_params() = " << std::dec << nrdecl->get_tpl_params().size() << std::endl;
19606 std::cout <<
" ->get_is_class_member() = " << ( nrdecl->get_is_class_member() ?
"true" :
"false" ) << std::endl;
19607 std::cout <<
" ->get_is_template_param() = " << ( nrdecl->get_is_template_param() ?
"true" :
"false" ) << std::endl;
19608 std::cout <<
" ->get_is_template_template_param() = " << ( nrdecl->get_is_template_template_param() ?
"true" :
"false" ) << std::endl;
19609 std::cout <<
" ->get_is_nonreal_template() = " << ( nrdecl->get_is_nonreal_template() ?
"true" :
"false" ) << std::endl;
19610 std::cout <<
" ->get_is_nonreal_function() = " << ( nrdecl->get_is_nonreal_function() ?
"true" :
"false" ) << std::endl;
19613 if (tpldecl !=
nullptr) {
19614#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19615 std::cout <<
" tpldecl = " << std::hex << tpldecl <<
" : " << tpldecl->
class_name() << std::endl;
19619 if (xtpldecl !=
nullptr) {
19620#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19621 std::cout <<
" xtpldecl->get_name() = " << xtpldecl->get_name() << std::endl;
19623 std::vector<SgTemplateArgument *> inst_tpl_args;
19625 if (tplarg->get_type()) {
19626#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19627 std::cout <<
" tplarg->get_type() = " << std::hex << tplarg->get_type() <<
" : " << ( tplarg->get_type() ? tplarg->get_type()->class_name() :
"" ) << std::endl;
19629 auto inst_tplarg = instantiateNonrealTypes(tplarg->get_type(), tpl_params, tpl_args);
19631 inst_tpl_args.push_back(buildTemplateArgument(inst_tplarg));
19634 }
else if (tplarg->get_expression()) {
19635#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19636 std::cout <<
" tplarg->get_expression() = " << std::hex << tplarg->get_expression() <<
" : " << ( tplarg->get_expression() ? tplarg->get_expression()->class_name() :
"" ) << std::endl;
19637 std::cout <<
" ->unparseToString() = " << tplarg->get_expression()->unparseToString() << std::endl;
19640#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19641 std::cout <<
" inst_tplarg = " << std::hex << inst_tplarg <<
" : " << ( inst_tplarg ? inst_tplarg->class_name() :
"" ) << std::endl;
19642 std::cout <<
" inst_tplarg->unparseToString() = " << ( inst_tplarg ? inst_tplarg->unparseToString() :
"" ) << std::endl;
19645 inst_tpl_args.push_back(buildTemplateArgument(inst_tplarg));
19648 }
else if (tplarg->get_templateDeclaration()) {
19649#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19650 std::cout <<
" tplarg->get_templateDeclaration() = " << std::hex << tplarg->get_templateDeclaration() <<
" : " << ( tplarg->get_templateDeclaration() ? tplarg->get_templateDeclaration()->class_name() :
"" ) << std::endl;
19660 ROSE_ASSERT(inst_decl);
19661#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19662 std::cout <<
" inst_decl = " << std::hex << inst_decl <<
" : " << inst_decl->
class_name() << std::endl;
19664 std::cout <<
" inst_decl->get_definingDeclaration() = " << std::hex << inst_decl->
get_definingDeclaration() << std::endl;
19672 return inst_decl->get_type();
19676 }
else if (nrdecl->get_is_template_param()) {
19677#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19678 std::cout <<
" ->get_template_parameter_position() = " << std::dec << nrdecl->get_template_parameter_position() << std::endl;
19679 std::cout <<
" ->get_template_parameter_depth() = " << std::dec << nrdecl->get_template_parameter_depth() << std::endl;
19681 ROSE_ASSERT(nrdecl->get_template_parameter_position() > 0);
19682 if (nrdecl->get_template_parameter_position() <= tpl_args.size()) {
19683 return tpl_args[nrdecl->get_template_parameter_position()-1]->get_type();
19691 }
else if (isSgTypedefType(type) || isSgTypeUnsignedLong(type) || isSgTypeUnsignedInt(type)) {
19694 std::cerr <<
"!!! type = " << std::hex << type <<
" : " << ( type ? type->
class_name() :
"" ) << std::endl;
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
bool isLvalueReferenceFunc() const
L-value reference access/set/unset member functions and member function type.
bool isRvalueReferenceFunc() const
R-value reference access/set/unset member functions and member function type.
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
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 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 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
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'.
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 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 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 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 SgInitializedName * buildInitializedName_nfi(const SgName &name, SgType *type, SgInitializer *init)
Initialized names are tricky, their scope vary depending on context, so scope and symbol information ...
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 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.
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 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 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)
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 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))
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 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 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 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 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 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 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 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 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()).
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 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 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.