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;
798 case V_SgNamespaceAliasDeclarationStatement:
799 case V_SgNamespaceDeclarationStatement:
800 case V_SgEnumDeclaration:
801 case V_SgVariableDeclaration:
802 case V_SgTypedefDeclaration:
803 case V_SgProcedureHeaderStatement:
804 case V_SgJovialTableStatement:
805 case V_SgJavaPackageDeclaration:
806 case V_SgFunctionDeclaration:
807 case V_SgMemberFunctionDeclaration:
808 case V_SgClassDeclaration:
810 templateArgumentsList = NULL;
814 case V_SgTemplateInstantiationDecl:
820 case V_SgTemplateClassDeclaration:
822 templateArgumentsList = &(isSgTemplateClassDeclaration(decl)->get_templateSpecializationArguments());
826 case V_SgTemplateInstantiationFunctionDecl:
832 case V_SgTemplateFunctionDeclaration:
834 templateArgumentsList = &(isSgTemplateFunctionDeclaration(decl)->get_templateSpecializationArguments());
838 case V_SgTemplateInstantiationMemberFunctionDecl:
840 templateArgumentsList = &(isSgTemplateInstantiationMemberFunctionDecl(decl)->
get_templateArguments());
844 case V_SgTemplateMemberFunctionDeclaration:
846 templateArgumentsList = &(isSgTemplateMemberFunctionDeclaration(decl)->get_templateSpecializationArguments());
850 case V_SgTemplateVariableDeclaration:
852 templateArgumentsList = &(isSgTemplateVariableDeclaration(decl)->get_templateSpecializationArguments());
856 case V_SgTemplateVariableInstantiation:
858 templateArgumentsList = &(isSgTemplateVariableInstantiation(decl)->get_templateArguments());
862 case V_SgTemplateTypedefDeclaration:
864 templateArgumentsList = &(isSgTemplateTypedefDeclaration(decl)->get_templateSpecializationArguments());
868 case V_SgTemplateInstantiationTypedefDeclaration:
870 templateArgumentsList = &(isSgTemplateInstantiationTypedefDeclaration(decl)->get_templateArguments());
874 case V_SgTemplateDeclaration:
876 templateArgumentsList = NULL;
880 case V_SgNonrealDecl:
882 templateArgumentsList = &(isSgNonrealDecl(decl)->get_tpl_args());
888 printf (
"getTemplateArgumentList(): Default reached in switch: decl = %p = %s \n",decl,decl->
class_name().c_str());
893 return templateArgumentsList;
898SgTemplateParameterPtrList*
904 ROSE_ASSERT(decl != NULL);
906 SgTemplateParameterPtrList* templateParameterList = NULL;
910 case V_SgNamespaceAliasDeclarationStatement:
911 case V_SgNamespaceDeclarationStatement:
912 case V_SgEnumDeclaration:
913 case V_SgVariableDeclaration:
914 case V_SgTypedefDeclaration:
915 case V_SgProcedureHeaderStatement:
916 case V_SgJovialTableStatement:
917 case V_SgJavaPackageDeclaration:
918 case V_SgFunctionDeclaration:
919 case V_SgMemberFunctionDeclaration:
920 case V_SgClassDeclaration:
921 case V_SgTemplateInstantiationTypedefDeclaration:
922 case V_SgTemplateInstantiationFunctionDecl:
923 case V_SgTemplateInstantiationMemberFunctionDecl:
924 case V_SgTemplateVariableInstantiation:
925 case V_SgTemplateInstantiationDecl:
927 templateParameterList = NULL;
931 case V_SgTemplateClassDeclaration:
933 templateParameterList = &(isSgTemplateClassDeclaration(decl)->get_templateParameters());
937 case V_SgTemplateFunctionDeclaration:
939 templateParameterList = &(isSgTemplateFunctionDeclaration(decl)->get_templateParameters());
943 case V_SgTemplateMemberFunctionDeclaration:
945 templateParameterList = &(isSgTemplateMemberFunctionDeclaration(decl)->get_templateParameters());
949 case V_SgTemplateVariableDeclaration:
951 templateParameterList = &(isSgTemplateVariableDeclaration(decl)->get_templateParameters());
955 case V_SgTemplateTypedefDeclaration:
957 templateParameterList = &(isSgTemplateTypedefDeclaration(decl)->get_templateParameters());
961 case V_SgNonrealDecl:
963 templateParameterList = &(isSgNonrealDecl(decl)->get_tpl_params());
967 case V_SgTemplateDeclaration:
969 templateParameterList = &(isSgTemplateDeclaration(decl)->get_templateParameters());
975 printf (
"getTemplateParameterList(): Default reached in switch: decl = %p = %s \n",decl,decl->
class_name().c_str());
980 return templateParameterList;
990 ROSE_ASSERT(decl != NULL);
994 if (templateArgumentsList != NULL)
997 ROSE_ASSERT(first_decl != NULL);
999 SgTemplateArgumentPtrList::iterator i = templateArgumentsList->begin();
1000 while (i != templateArgumentsList->end())
1015 (*i)->set_parent(first_decl);
1020 if (declaration != NULL)
1022#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
1023 printf (
"In setTemplateArgumentParents(): Template argument already set to declaration = %p = %s \n",declaration,declaration->
class_name().c_str());
1028#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
1029 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());
1047 ROSE_ASSERT(decl != NULL);
1051 if (templateParameterList != NULL)
1054 ROSE_ASSERT(first_decl != NULL);
1056 SgTemplateParameterPtrList::iterator i = templateParameterList->begin();
1057 while (i != templateParameterList->end())
1071 (*i)->set_parent(first_decl);
1088 ROSE_ASSERT(decl != NULL);
1092 if (templateArgumentsList != NULL)
1094 SgTemplateArgumentPtrList::iterator i = templateArgumentsList->begin();
1095 while (i != templateArgumentsList->end())
1100 printf (
"Error: In testTemplateArgumentParents(): decl = %p = %s has template argument = %p with null parent \n",decl,decl->
class_name().c_str(),*i);
1102 ROSE_ASSERT(parent != NULL);
1121 ROSE_ASSERT(decl != NULL);
1125 if (templateParameterList != NULL)
1127 SgTemplateParameterPtrList::iterator i = templateParameterList->begin();
1128 while (i != templateParameterList->end())
1133 printf (
"Error: In testTemplateParameterParents(): decl = %p = %s has template argument = %p with null parent \n",decl,decl->
class_name().c_str(),*i);
1135 ROSE_ASSERT(parent != NULL);
1143 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());
1163 ROSE_ASSERT(templateArgumentsList_input != NULL);
1165 ROSE_ASSERT(decl->
variantT() == V_SgTemplateInstantiationDecl ||
1166 decl->
variantT() == V_SgTemplateInstantiationFunctionDecl ||
1167 decl->
variantT() == V_SgTemplateInstantiationMemberFunctionDecl ||
1168 decl->
variantT() == V_SgTemplateInstantiationTypedefDeclaration);
1172 if (templateArgumentsList_from_declaration != NULL)
1174 *templateArgumentsList_from_declaration = *templateArgumentsList_input;
1189 ROSE_ASSERT(templateSpecializationArgumentsList_input != NULL);
1191 ROSE_ASSERT(decl->
variantT() == V_SgTemplateClassDeclaration || decl->
variantT() == V_SgTemplateFunctionDeclaration ||
1192 decl->
variantT() == V_SgTemplateMemberFunctionDeclaration || decl->
variantT() == V_SgTemplateVariableDeclaration );
1194 SgTemplateArgumentPtrList* templateSpecializationArgumentsList_from_declaration =
getTemplateArgumentList(decl);
1196 if (templateSpecializationArgumentsList_from_declaration != NULL)
1198 *templateSpecializationArgumentsList_from_declaration = *templateSpecializationArgumentsList_input;
1212 ROSE_ASSERT(templateParameterList_input != NULL);
1214 ROSE_ASSERT(decl->
variantT() == V_SgTemplateClassDeclaration || decl->
variantT() == V_SgTemplateFunctionDeclaration ||
1215 decl->
variantT() == V_SgTemplateMemberFunctionDeclaration || decl->
variantT() == V_SgTemplateVariableDeclaration );
1219 if (templateParameterList_from_declaration != NULL)
1221 *templateParameterList_from_declaration = *templateParameterList_input;
1230#define DEBUG__buildInitializedName 0
1236#if DEBUG__buildInitializedName
1237 std::cout <<
"SageBuilder::buildInitializedName" << std::endl;
1238 std::cout <<
" name = " << name << std::endl;
1240 ASSERT_not_null(type);
1243 ROSE_ASSERT(initializedName);
1246 return initializedName;
1255 string var_name(name);
1260#if DEBUG__buildInitializedName
1261 std::cout <<
"SageBuilder::buildInitializedName_nfi" << std::endl;
1262 std::cout <<
" name = " << name << std::endl;
1264 ROSE_ASSERT(type != NULL);
1267 ROSE_ASSERT(initializedName != NULL);
1272 initializedName->set_declptr(declptr);
1277 return initializedName;
1290 ROSE_ASSERT(name.is_null() ==
false);
1291 ROSE_ASSERT(type != NULL);
1294 ROSE_ASSERT(varDecl);
1307 bool isFortranParameter =
false;
1315 if (v_symbol != NULL)
1319 ROSE_ASSERT (default_initName != NULL);
1321 ROSE_ASSERT (new_initName != NULL);
1322 ROSE_ASSERT (default_initName != new_initName);
1325 std::replace (n_list.begin(), n_list.end(),default_initName, new_initName );
1326 ROSE_ASSERT (varDecl->get_decl_item (name)==new_initName);
1330 ROSE_ASSERT (old_parent != NULL);
1331 ROSE_ASSERT (isSgFunctionParameterList(old_parent) != NULL);
1339 ROSE_ASSERT (var_def != NULL);
1342 new_initName->set_declptr(var_def);
1344 delete (default_initName);
1350 isFortranParameter =
true;
1354 if (! isFortranParameter)
1360 ROSE_ASSERT(initName != NULL);
1361 ROSE_ASSERT((initName->get_declptr())!=NULL);
1379 unsetNodesMarkedAsModified(varDecl);
1395#define DEBUG_BUILD_VARIABLE_DECLARATION 0
1397#if DEBUG_BUILD_VARIABLE_DECLARATION
1398 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): name = %s scope = %p varInit = %p \n",name.str(),scope,varInit);
1401 printf (
" --- scope = %p = %s \n",scope,scope->
class_name().c_str());
1407#if DEBUG_BUILD_VARIABLE_DECLARATION
1408 printf (
"Scope determined from the SageBuilder::topScopeStack() \n");
1413 ROSE_ASSERT (scope != NULL);
1414 ROSE_ASSERT(type != NULL);
1419#if DEBUG_BUILD_VARIABLE_DECLARATION
1420 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): variableSymbol = %p \n",variableSymbol);
1425 if (variableSymbol == NULL)
1428#if DEBUG_BUILD_VARIABLE_DECLARATION
1430 ROSE_ASSERT(tmp_initializedName != NULL);
1431 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): variableSymbol == NULL: varDecl = %p: initializedName = %p = %s \n",varDecl,tmp_initializedName,tmp_initializedName->get_name().str());
1432 printf (
" --- tmp_initializedName->get_initptr() = %p \n",tmp_initializedName->get_initptr());
1435 if (builtFromUseOnly ==
true)
1437#if DEBUG_BUILD_VARIABLE_DECLARATION
1438 printf (
"In buildVariableDeclaration_nfi(): this is the first reference to this variable: building a new SgVariableDeclaration: varDecl = %p name = %s \n",varDecl,name.str());
1440 varDecl->set_builtFromUseOnly(
true);
1446 ROSE_ASSERT(initializedName != NULL);
1450#if DEBUG_BUILD_VARIABLE_DECLARATION
1451 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): initializedName->get_parent() = %p \n",initializedName->
get_parent());
1454 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): initializedName->get_parent() = %p = %s \n",initializedName->
get_parent(),initializedName->
get_parent()->
class_name().c_str());
1456 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): associatedVariableDeclaration = %p \n",associatedVariableDeclaration);
1458#if DEBUG_BUILD_VARIABLE_DECLARATION
1461 if (associatedVariableDeclaration != NULL && associatedVariableDeclaration->
get_parent() != NULL)
1463 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): associatedVariableDeclaration->get_parent() = %p = %s \n",
1468#if DEBUG_BUILD_VARIABLE_DECLARATION
1469 printf (
"associatedVariableDeclaration = %p \n",associatedVariableDeclaration);
1470 if (associatedVariableDeclaration != NULL)
1472 printf (
"associatedVariableDeclaration->get_builtFromUseOnly() = %s \n",associatedVariableDeclaration->get_builtFromUseOnly() ?
"true" :
"false");
1477 bool reuseTheAssociatedVariableDeclaration = ((associatedVariableDeclaration != NULL) && (associatedVariableDeclaration->get_builtFromUseOnly() ==
true));
1478 if (reuseTheAssociatedVariableDeclaration ==
true)
1484 ROSE_ASSERT(associatedVariableDeclaration != NULL);
1487 varDecl = associatedVariableDeclaration;
1490 varDecl->set_builtFromUseOnly(
false);
1501#if DEBUG_BUILD_VARIABLE_DECLARATION
1502 if (
variable->get_initptr() != NULL)
1504 printf (
"Found initializer associated with variable declaration being reused: variable = %p name = %s \n",
variable,
variable->get_name().str());
1513 ROSE_ASSERT(reuseTheAssociatedVariableDeclaration ==
false);
1519 if (associatedVariableDeclaration == NULL)
1521 ROSE_ASSERT(initializedName->
get_parent() != NULL);
1523 if (scopeStatement != NULL)
1525#if DEBUG_BUILD_VARIABLE_DECLARATION
1526 printf (
"scopeStatement = %p = %s \n",scopeStatement,scopeStatement->
class_name().c_str());
1531#if DEBUG_BUILD_VARIABLE_DECLARATION
1543#if DEBUG_BUILD_VARIABLE_DECLARATION
1544 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): initializedName->get_scope() = %p = %s \n",initializedName->get_scope(),initializedName->get_scope()->
class_name().c_str());
1547 if (scopeStatement != NULL)
1549 additional_variable = initializedName;
1553 if (additional_variable->get_initptr() != NULL)
1555#if DEBUG_BUILD_VARIABLE_DECLARATION
1556 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): borrowed SgInitializedName is alread initialized \n");
1557 printf (
" --- additional_variable->get_initptr() = %p \n",additional_variable->get_initptr());
1558 printf (
" --- varInit = %p \n",varInit);
1565 additional_variable->set_initptr(varInit);
1568#if DEBUG_BUILD_VARIABLE_DECLARATION || 0
1569 printf (
" --- additional_variable->get_scope() = %p = %s \n",additional_variable->get_scope(),additional_variable->get_scope()->
class_name().c_str());
1570 printf (
" --- Reusing the SgInitializedName (not associated with a previous SgVariableDeclaration where the parent is a SgScopeStatement) \n");
1575#if DEBUG_BUILD_VARIABLE_DECLARATION
1576 printf (
" --- Building a new SgInitializedName \n");
1581#if DEBUG_BUILD_VARIABLE_DECLARATION
1582 ROSE_ASSERT(initializedName->get_scope() != NULL);
1586 if (additional_variable != initializedName)
1588 additional_variable->set_prev_decl_item(initializedName);
1593#if DEBUG_BUILD_VARIABLE_DECLARATION
1594 ROSE_ASSERT(initializedName->
get_parent() != NULL);
1596 ROSE_ASSERT(additional_variable->
get_parent() != NULL);
1597 printf (
"additional_variable->get_parent() = %p = %s \n",additional_variable->
get_parent(),additional_variable->
get_parent()->
class_name().c_str());
1602 ASSERT_not_null(initializedName->get_scope());
1605 if (additional_variable != initializedName)
1607 additional_variable->set_scope(initializedName->get_scope());
1611#if DEBUG_BUILD_VARIABLE_DECLARATION
1612 printf (
"In SageBuilder::buildVariableDeclaration_nfi(): After sharing the exisitng SgInitializedName: initializedName = %p = %s \n",initializedName,initializedName->get_name().str());
1613 printf (
" --- initializedName->get_initptr() = %p \n",initializedName->get_initptr());
1614 printf (
" --- additional_variable->get_initptr() = %p \n",additional_variable->get_initptr());
1624 ASSERT_not_null(varDecl);
1626 varDecl->get_declarationModifier().get_storageModifier().set_modifier(sm);
1647 ASSERT_not_null(initName);
1648 ASSERT_not_null(initName->get_declptr());
1650 if (initName->get_scope())
1653#if DEBUG_BUILD_VARIABLE_DECLARATION
1654 printf (
"WARNING: Note in buildVariableDeclaration_nfi(): initName->get_scope() == NULL \n");
1662 SgVariableDefinition* variableDefinition_original = isSgVariableDefinition(initName->get_declptr());
1663 ASSERT_not_null(variableDefinition_original);
1678 unsetNodesMarkedAsModified(varDecl);
1680 ASSERT_not_null(varDecl);
1682#if DEBUG_BUILD_VARIABLE_DECLARATION
1683 printf (
"Leaving buildVariableDeclaration_nfi(): varDecl = %p varDecl->get_parent() = %p \n",varDecl,varDecl->
get_parent());
1695 ROSE_ASSERT (decl!=NULL);
1696 ROSE_ASSERT (init_name !=NULL);
1700 if (!isSgFunctionType(init_name->get_type()))
1706 ROSE_ASSERT (copyOfFileInfo != NULL);
1710 ROSE_ASSERT (defn_stmt != NULL);
1728 ROSE_ASSERT(defn_stmt != NULL);
1747 ROSE_ASSERT (scope != NULL);
1748 ROSE_ASSERT(type != NULL);
1751 ROSE_ASSERT(varDecl);
1767 ROSE_ASSERT(initName);
1768 ROSE_ASSERT((initName->get_declptr())!=NULL);
1773 SgVariableDefinition* variableDefinition_original = isSgVariableDefinition(initName->get_declptr());
1774 ROSE_ASSERT(variableDefinition_original != NULL);
1786 SgTemplateArgumentPtrList & tpl_args
1793#define DEBUG__SageBuilder__buildTemplateVariableInstantiation_nfi 0
1799 SgTemplateArgumentPtrList & tpl_args
1801#if DEBUG__SageBuilder__buildTemplateVariableInstantiation_nfi
1802 std::cout <<
"SageBuilder::buildTemplateVariableInstantiation_nfi" << std::endl;
1803 std::cout <<
" name = " << name.getString() << std::endl;
1804 std::cout <<
" type = " << std::hex << type <<
" : " << ( type ? type->
class_name() :
"" ) << std::endl;
1805 std::cout <<
" scope = " << std::hex << scope <<
" : " << ( scope ? scope->
class_name() :
"" ) << std::endl;
1807 ROSE_ASSERT (type != NULL);
1809 SgName nameWithoutTemplateArguments = name;
1811#if DEBUG__SageBuilder__buildTemplateVariableInstantiation_nfi
1812 std::cout <<
" nameWithoutTemplateArguments = " << nameWithoutTemplateArguments.getString() << std::endl;
1813 std::cout <<
" nameWithTemplateArguments = " << nameWithTemplateArguments.getString() << std::endl;
1816 ROSE_ASSERT (scope != NULL);
1817 ROSE_ASSERT(type != NULL);
1820 ROSE_ASSERT(varDecl);
1821#if DEBUG__SageBuilder__buildTemplateVariableInstantiation_nfi
1822 std::cout <<
" varDecl = " << std::hex << varDecl <<
" : " << ( varDecl ? varDecl->
class_name() :
"" ) << std::endl;
1826 varDecl->get_templateArguments() = tpl_args;
1837 ROSE_ASSERT(initName);
1838 ROSE_ASSERT((initName->get_declptr()) !=
nullptr);
1839#if DEBUG__SageBuilder__buildTemplateVariableInstantiation_nfi
1840 std::cout <<
" initName = " << std::hex << initName <<
" : " << ( initName ? initName->
class_name() :
"" ) << std::endl;
1843 SgVariableDefinition* variableDefinition_original = isSgVariableDefinition(initName->get_declptr());
1844 ROSE_ASSERT(variableDefinition_original != NULL);
1881 ROSE_ASSERT (base_type != NULL);
1889 ASSERT_not_null(scope);
1895 ASSERT_not_null(stripedBaseType);
1897 SgNamedType* namedType = isSgNamedType(stripedBaseType);
1906 base_decl = namedType->get_declaration();
1909 ROSE_ASSERT(base_decl != NULL);
1916#ifndef ROSE_USE_CLANG_FRONTEND
1929 if (declaration && !isSgAdaDiscriminatedTypeDecl(declaration))
1931 mprintf (
"Found a valid declaration = %p = %s \n",declaration,declaration->
class_name().c_str());
1937 ROSE_ASSERT(parent_scope != NULL);
1944 ROSE_ASSERT(type_decl != NULL);
1964 SgClassDeclaration* def_class = isSgClassDeclaration(base_class->get_definingDeclaration());
1965 SgClassDeclaration* nondef_class = isSgClassDeclaration(base_class->get_firstNondefiningDeclaration());
1967 if (has_defining_base)
1969 if (def_class != NULL)
1975 if (nondef_class != NULL)
1984 ROSE_ASSERT(typedef_symbol);
1997 ROSE_ASSERT (base_type != NULL);
2005 ROSE_ASSERT(scope != NULL);
2018 if (declaration != NULL)
2023 ROSE_ASSERT(parent_scope != NULL);
2026 SgNamedType* namedType = isSgNamedType(base_type);
2030 if (namedType != NULL)
2035 ROSE_ASSERT(declarationStatement != NULL);
2036 if (declarationStatement != NULL)
2039 if (templateInstantiationDecl != NULL)
2041 SgName name = templateInstantiationDecl->get_name();
2043 if (scope->lookup_template_typedef_symbol(name) != NULL)
2045 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());
2047 ROSE_ASSERT(scope->lookup_template_typedef_symbol(name) == NULL);
2055 ROSE_ASSERT(type_decl != NULL);
2062 ROSE_ASSERT(type_decl->get_type() == NULL);
2065 ROSE_ASSERT(typedefType != NULL);
2068 type_decl->set_type(typedefType);
2071 ROSE_ASSERT(type_decl->get_type() != NULL);
2081 SgNamedType* namedType = isSgNamedType(base_type);
2085 if (namedType != NULL)
2090 ROSE_ASSERT(declarationStatement != NULL);
2091 if (declarationStatement != NULL)
2094 if (templateInstantiationDecl != NULL)
2096 SgName name = templateInstantiationDecl->get_name();
2098 if (scope->lookup_template_typedef_symbol(name) != NULL)
2100 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());
2102 ROSE_ASSERT(scope->lookup_template_typedef_symbol(name) == NULL);
2108 ROSE_ASSERT(typedef_symbol);
2113 ROSE_ASSERT(scope->lookup_template_typedef_symbol(name) != NULL);
2118#define DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi 0
2124 SgTemplateArgumentPtrList & templateArgumentsList
2126#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2127 std::cout <<
"SageBuilder::buildTemplateInstantiationTypedefDeclaration_nfi" << std::endl;
2128 std::cout <<
" name = " << name.getString() << std::endl;
2129 std::cout <<
" base_type = " << std::hex << base_type <<
" : " << ( base_type ? base_type->
class_name() :
"" ) << std::endl;
2131 ROSE_ASSERT (base_type != NULL);
2133 SgName nameWithoutTemplateArguments = name;
2135#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2136 std::cout <<
" nameWithoutTemplateArguments = " << nameWithoutTemplateArguments.getString() << std::endl;
2137 std::cout <<
" nameWithTemplateArguments = " << nameWithTemplateArguments.getString() << std::endl;
2141 ROSE_ASSERT(scope != NULL);
2153 if (declaration != NULL)
2158 ROSE_ASSERT(parent_scope != NULL);
2163 ROSE_ASSERT(templateTypedefDeclaration != NULL);
2165 SgTemplateTypedefSymbol* prexisting_template_typedef_symbol = scope->lookup_template_typedef_symbol(nameWithTemplateArguments);
2166 if (prexisting_template_typedef_symbol != NULL)
2169 ROSE_ASSERT(declarationStatement != NULL);
2170#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2171 std::cout <<
" declarationStatement = " << declarationStatement <<
" : " << declarationStatement->
class_name() << std::endl;
2174 ROSE_ASSERT(return_declaration != NULL);
2175 return return_declaration;
2177 ROSE_ASSERT(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) == NULL);
2184 ROSE_ASSERT(type_decl != NULL);
2185 ROSE_ASSERT(type_decl->get_base_type() == base_type);
2187#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2188 std::cout <<
" type_decl = " << std::hex << type_decl <<
" : " << ( type_decl ? type_decl->
class_name() :
"" ) << std::endl;
2189 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;
2194 ROSE_ASSERT(type_decl->get_type() == NULL);
2198 type_decl->set_templateName(nameWithoutTemplateArguments);
2200 ROSE_ASSERT(scope != NULL);
2205 ROSE_ASSERT(type_decl->get_name() == nameWithTemplateArguments);
2208 if (scope->lookup_template_typedef_symbol(nameWithTemplateArguments) != NULL)
2210 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());
2212 ROSE_ASSERT(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) == NULL);
2216 ROSE_ASSERT(type_decl->get_type() == NULL);
2219 ROSE_ASSERT(new_typedefType != NULL);
2221 type_decl->set_type(new_typedefType);
2222 ROSE_ASSERT(type_decl->get_type() != NULL);
2223 ROSE_ASSERT(type_decl->
get_scope() != NULL);
2230 SgName mangled_name = type_decl->get_mangled_name();
2237 ROSE_ASSERT(type_decl->get_type() != NULL);
2238 ROSE_ASSERT(scope != NULL);
2240#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2241 std::cout <<
" type_decl = " << std::hex << type_decl <<
" : " << ( type_decl ? type_decl->
class_name() :
"" ) << std::endl;
2242 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;
2247 if (scope->lookup_template_typedef_symbol(nameWithTemplateArguments) != NULL)
2249 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());
2251 ROSE_ASSERT(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) == NULL);
2254 ROSE_ASSERT(typedef_symbol);
2256 scope->
insert_symbol(nameWithTemplateArguments,typedef_symbol);
2259 ROSE_ASSERT(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) != NULL);
2262#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2263 std::cout <<
" type_decl = " << std::hex << type_decl <<
" : " << ( type_decl ? type_decl->
class_name() :
"" ) << std::endl;
2264 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;
2280 ROSE_ASSERT (parameterList);
2296 if (in10)
appendArg(parameterList, in10);
2298 return parameterList;
2304 ROSE_ASSERT (parameterList);
2310 return parameterList;
2317 ROSE_ASSERT (ctorInitList);
2323 return ctorInitList;
2332 if (paralist == NULL)
2334 printf (
"WARNING: In buildFunctionParameterTypeList(): Accepting NULL input and returning NULL pointer. \n");
2344 ROSE_ASSERT(typePtrList != NULL);
2346 SgInitializedNamePtrList args = paralist->
get_args();
2347 SgInitializedNamePtrList::const_iterator i;
2348 for(i = args.begin(); i != args.end(); i++)
2349 (typePtrList->
get_arguments()).push_back( (*i)->get_type() );
2360 if (expList ==NULL)
return NULL;
2361 SgExpressionPtrList expPtrList = expList->get_expressions();
2364 ROSE_ASSERT(typePtrList);
2366 SgExpressionPtrList::const_iterator i;
2367 for (i=expPtrList.begin();i!=expPtrList.end();i++)
2382 ROSE_ASSERT(typePtrList);
2386 if (type0 != NULL) types.push_back(type0);
2387 if (type1 != NULL) types.push_back(type1);
2388 if (type2 != NULL) types.push_back(type2);
2389 if (type3 != NULL) types.push_back(type3);
2390 if (type4 != NULL) types.push_back(type4);
2391 if (type5 != NULL) types.push_back(type5);
2392 if (type6 != NULL) types.push_back(type6);
2393 if (type7 != NULL) types.push_back(type7);
2405 ROSE_ASSERT(return_type != NULL);
2408 ROSE_ASSERT(typeList != NULL);
2411 ROSE_ASSERT(fTable);
2417 SgFunctionType* funcType = isSgFunctionType(fTable->lookup_function_type(typeName));
2419 if (funcType == NULL)
2423 ROSE_ASSERT(funcType);
2425 if (typeList != NULL)
2428 if (funcType->get_argument_list() != NULL)
2430 delete funcType->get_argument_list();
2431 funcType->set_argument_list(NULL);
2433 ROSE_ASSERT(funcType->get_argument_list() == NULL);
2435 funcType->set_argument_list(typeList);
2439 fTable->insert_function_type(typeName,funcType);
2459 ROSE_ASSERT(fTable != NULL);
2465 ROSE_ASSERT(typeList != NULL);
2469 SgType* typeInTable = fTable->lookup_function_type(typeName);
2472 printf (
"In buildMemberFunctionType(SgType*,SgFunctionParameterTypeList*,SgType*,int,int): fTable->lookup_function_type(typeName = %s) = %p \n",typeName.str(),typeInTable);
2473 printf (
" --- mfunc_specifier = %d ref_qualifiers = %d \n",mfunc_specifier,ref_qualifiers);
2478 if (ref_qualifiers > 0)
2480 printf (
"Exiting as a test! \n");
2486 if (typeInTable == NULL)
2488 bool has_ellipses =
false;
2492 ROSE_ASSERT(partialFunctionType != NULL);
2494 printf (
"Building a SgPartialFunctionType: partialFunctionType = %p \n",partialFunctionType);
2495 printf (
" --- partialFunctionType->isLvalueReferenceFunc() = %s \n",partialFunctionType->
isLvalueReferenceFunc() ?
"true" :
"false");
2496 printf (
" --- partialFunctionType->isRvalueReferenceFunc() = %s \n",partialFunctionType->
isRvalueReferenceFunc() ?
"true" :
"false");
2499 if (partialFunctionType->get_argument_list() != NULL)
2501 delete partialFunctionType->get_argument_list();
2502 partialFunctionType->set_argument_list(NULL);
2504 ROSE_ASSERT(partialFunctionType->get_argument_list() == NULL);
2511 partialFunctionType->set_argument_list(typeList);
2513 ROSE_ASSERT(partialFunctionType->get_argument_list() != NULL);
2522 partialFunctionType->set_argument_list(NULL);
2525 delete partialFunctionType;
2526 partialFunctionType = NULL;
2531 ROSE_ASSERT(funcType->get_argument_list() != NULL);
2534 if (typeInTable ==
nullptr)
2536 ASSERT_not_null(funcType);
2537 fTable->insert_function_type(typeName,funcType);
2543 ASSERT_require(typeInTable != funcType);
2547 funcType = isSgMemberFunctionType(typeInTable);
2548 ASSERT_not_null(funcType);
2568 ROSE_ASSERT(return_type != NULL);
2573 ROSE_ASSERT(struct_name != NULL);
2576 printf(
"In buildMemberFunctionType():\n");
2577 printf(
" - struct_name = %p (%s)\n", struct_name, struct_name->
class_name().c_str());
2582 printf (
"SageBuilder::buildMemberFunctionType(SgType*,SgFunctionParameterTypeList*,SgScopeStatement*,int,int): This function does not use the input ref_qualifiers = %x \n",ref_qualifiers);
2583 printf (
" --- mfunc_specifier = %d ref_qualifiers = %d \n",mfunc_specifier,ref_qualifiers);
2587 printf (
"Exiting as a test! \n");
2591 ROSE_ASSERT(struct_name->
get_parent() != NULL);
2595 printf(
"struct_name = %p ( %s )\n", struct_name, struct_name->
class_name().c_str());
2602 if (classDefinition == NULL && decl_scope == NULL)
2604 printf (
"Error: (classDefinition == NULL && decl_scope == NULL): struct_name = %p = %s name = %s \n",
2607 ROSE_ASSERT(classDefinition != NULL || decl_scope != NULL);
2610 if (classDefinition != NULL)
2614 else if (decl_scope != NULL)
2616 declaration = isSgDeclarationStatement(decl_scope->
get_parent());
2623 ROSE_ASSERT(declaration != NULL);
2625 if (typeList != NULL)
2629 for (SgTypePtrList::iterator i = typeListArgs.begin(); i != typeListArgs.end(); i++)
2631 printf (
" --- type argument = %p = %s \n",*i,(*i)->class_name().c_str());
2637 printf (
"WARNING: typeList == NULL \n");
2644 ROSE_ASSERT(classDeclaration != NULL || nrdecl != NULL);
2651 SgType* classType = NULL;
2652 if (classDeclaration != NULL)
2654 classType = classDeclaration->get_type();
2656 else if (decl_scope != NULL)
2658 classType = nrdecl->get_type();
2665 ROSE_ASSERT(classType != NULL);
2668 printf (
"In buildMemberFunctionType(): Calling refactored function: buildMemberFunctionType(...,classType = %p,...) \n",classType);
2675 printf (
"In buildMemberFunctionType(): DONE: Calling refactored function: buildMemberFunctionType(...,classType = %p,...) \n",classType);
2685 ROSE_ASSERT(base_type != NULL);
2687 ROSE_ASSERT(classType != NULL);
2689 return pointerToMemberType;
2707 if (type_symbol == NULL)
2710 ROSE_ASSERT(type_decl);
2716 ROSE_ASSERT(type_symbol);
2732 type_decl = type_symbol->get_declaration();
2733 result = type_decl->get_type();
2735 ROSE_ASSERT(result);
2745 ASSERT_not_null(argList);
2750 if (func_type->get_argument_list() != typeList)
2767 if (isSgMemberFunctionDeclaration(func) != NULL)
2769#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
2770 printf (
"WARNING: setting parent of function to match scope by default \n");
2774 ROSE_ASSERT(scope != NULL);
2776 if (isSgTemplateInstantiationMemberFunctionDecl(func) != NULL)
2784#if !ENFORCE_NO_FUNCTION_TEMPLATE_DECLARATIONS_IN_TEMPLATE_CLASS_INSTANTIATIONS
2791 if (isSgTemplateFunctionDeclaration(func) != NULL)
2793 if (isSgTemplateInstantiationMemberFunctionDecl(func) != NULL)
2795 ROSE_ASSERT(isSgTemplateClassDefinition(scope) != NULL);
2807template <
class actualFunction>
2809SageBuilder::buildNondefiningFunctionDeclaration_T (
2812 SgTemplateArgumentPtrList* templateArgumentsList, SgTemplateParameterPtrList* templateParameterList,
2823 if (scope ==
nullptr)
2827 ASSERT_not_null(scope);
2829 if (XXX_name.is_null() ==
true)
2832 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");
2835 SgName nameWithoutTemplateArguments = XXX_name;
2836 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
2838 bool buildTemplateInstantiation = ((VariantT)actualFunction::static_variant == V_SgTemplateInstantiationFunctionDecl || (VariantT)actualFunction::static_variant == V_SgTemplateInstantiationMemberFunctionDecl);
2841 bool buildTemplateDeclaration = ((VariantT)actualFunction::static_variant == V_SgTemplateFunctionDeclaration || (VariantT)actualFunction::static_variant == V_SgTemplateMemberFunctionDeclaration);
2845 if (buildTemplateInstantiation ==
true)
2847 ASSERT_not_null(templateArgumentsList);
2852 if (nameWithTemplateArguments.is_null() ==
true)
2856 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");
2859 if (nameWithoutTemplateArguments.is_null() ==
true)
2863 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");
2866 ASSERT_not_null(return_type);
2867 ASSERT_not_null(paralist);
2873#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
2874 printf (
"Warning: In buildNondefiningFunctionDeclaration_T(): nameWithoutTemplateArguments = %s nameWithTemplateArguments = %s \n",nameWithoutTemplateArguments.str(),nameWithTemplateArguments.str());
2884 if (isMemberFunction ==
true)
2894 ASSERT_not_null(func_type);
2897 actualFunction* func =
nullptr;
2915 func_symbol = scope->find_symbol_by_type_of_function<actualFunction>(nameWithTemplateArguments,func_type,templateParameterList,templateArgumentsList);
2918 printf (
"In buildNondefiningFunctionDeclaration_T(): func_symbol from scope->find_symbol_by_type_of_function<actualFunction>(name = %s) = %p \n",nameWithTemplateArguments.str(),func_symbol);
2919 if (func_symbol != NULL) {
2920 printf (
"In buildNondefiningFunctionDeclaration_T(): func_symbol->get_declaration() = %p \n", func_symbol->get_declaration());
2925 if (func_symbol == NULL)
2928 ROSE_ASSERT(func_type != NULL);
2933 if (func_symbol != NULL)
2935 switch((VariantT)actualFunction::static_variant)
2937 case V_SgFunctionDeclaration:
2938 case V_SgProcedureHeaderStatement:
2939 case V_SgTemplateInstantiationFunctionDecl:
2941 ROSE_ASSERT(isSgFunctionSymbol(func_symbol) != NULL);
2944 case V_SgMemberFunctionDeclaration:
2945 case V_SgTemplateInstantiationMemberFunctionDecl:
2947 ROSE_ASSERT(isSgMemberFunctionSymbol(func_symbol) != NULL);
2950 case V_SgTemplateFunctionDeclaration:
2952 ROSE_ASSERT(isSgTemplateFunctionSymbol(func_symbol) != NULL);
2955 case V_SgTemplateMemberFunctionDeclaration:
2957 ROSE_ASSERT(isSgTemplateMemberFunctionSymbol(func_symbol) != NULL);
2963 printf (
"default reach in buildNondefiningFunctionDeclaration_T(): variantT(actualFunction::static_variant) = %d \n",actualFunction::static_variant);
2970 ROSE_ASSERT(scope != NULL);
2971 if ( isSgGlobal(scope) != NULL
2972 && scope != func_symbol->get_scope()
2974 && !scope->symbol_exists(nameWithTemplateArguments, func_symbol) )
2976 scope->
insert_symbol(nameWithTemplateArguments, func_symbol);
2980 if (func_symbol == NULL)
2982 func =
new actualFunction (nameWithTemplateArguments,func_type,NULL);
2983 ROSE_ASSERT(func != NULL);
2986 func->get_declarationModifier().get_storageModifier().set_modifier(sm);
2989 ROSE_ASSERT(func->get_file_info() == NULL);
2992 func->set_scope(scope);
2995 checkThatNoTemplateInstantiationIsDeclaredInTemplateDefinitionScope(func,scope);
2998 ROSE_ASSERT(func->get_parameterList() != NULL);
3006 if (isSgMemberFunctionDeclaration(func))
3011 if (isSgTemplateMemberFunctionDeclaration(func) != NULL)
3016 ROSE_ASSERT(memberFunctionDeclaration != NULL);
3020 ROSE_ASSERT(func_symbol != NULL);
3021 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
3026 if (isSgTemplateFunctionDeclaration(func))
3032 ROSE_ASSERT(templatedeclaration != NULL);
3034 ROSE_ASSERT(template_symbol != NULL);
3035 ROSE_ASSERT(template_symbol->get_symbol_basis() != NULL);
3036 func_symbol = template_symbol;
3041 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
3045 ROSE_ASSERT(func_symbol != NULL);
3046 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
3047 scope->
insert_symbol(nameWithTemplateArguments, func_symbol);
3050 ROSE_ASSERT(func->get_symbol_from_symbol_table() != NULL);
3052 if (isSgFunctionDeclaration(func) == NULL)
3058 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3066 ROSE_ASSERT(buildTemplateDeclaration ==
false || templateParameterList != NULL);
3072 ROSE_ASSERT(scope->lookup_function_symbol(nameWithTemplateArguments) != NULL ||
3073 scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL ||
3074 scope->lookup_template_member_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3076#if BUILDER_MAKE_REDUNDANT_CALLS_TO_SYMBOL_TABLE_LOOKUP
3080 if (scope->lookup_function_symbol(nameWithTemplateArguments,templateArgumentList) == NULL || scope->lookup_template_symbol(nameWithTemplateArguments,templateParameterList,NULL) != NULL)
3083 printf (
"Need to make sure this is a template function declaration... \n");
3089 ROSE_ASSERT(func->get_scope() != NULL);
3091 if (isSgFunctionDeclaration(func) == NULL)
3097 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3099 func->set_firstNondefiningDeclaration(func);
3100 func->set_definingDeclaration(NULL);
3103 ROSE_ASSERT(func->get_firstNondefiningDeclaration() == func);
3105 ROSE_ASSERT(func->get_definingDeclaration() == NULL);
3109 if (testMemberDecl != NULL)
3111 ROSE_ASSERT(testMemberDecl->
get_scope() != NULL);
3112 ROSE_ASSERT(testMemberDecl->get_class_scope() != NULL);
3113 ROSE_ASSERT(testMemberDecl->get_associatedClassDeclaration() != NULL);
3118 ROSE_ASSERT(func_symbol != NULL);
3120 ROSE_ASSERT(scope != NULL);
3128 SgNode* associatedSymbolBasis = func_symbol->get_symbol_basis();
3129 ROSE_ASSERT(associatedSymbolBasis != NULL);
3132 ROSE_ASSERT(associatedDeclaration != NULL);
3136 if (functionDeclaration != NULL)
3138 func_type = functionDeclaration->get_type();
3142 if (templateFunctionDeclaration != NULL)
3147 printf (
"This code should not be reachable! \n");
3150 func_type = templateFunctionDeclaration->get_type();
3158 ROSE_ASSERT(func_type != NULL);
3160 func =
new actualFunction(nameWithTemplateArguments,func_type,NULL);
3161 ROSE_ASSERT(func != NULL);
3163#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3170 func->set_scope(scope);
3173 ROSE_ASSERT(func->get_symbol_from_symbol_table() == NULL);
3176 checkThatNoTemplateInstantiationIsDeclaredInTemplateDefinitionScope(func,scope);
3182 if (functionDeclaration != NULL)
3184 prevDecl = functionDeclaration;
3188 ROSE_ASSERT(templateFunctionDeclaration != NULL);
3189 prevDecl = templateFunctionDeclaration;
3192 ROSE_ASSERT(prevDecl != NULL);
3199 printf (
"WARNING: Switching declaration in functionSymbol to point to the non-defining declaration \n");
3200 function_symbol->set_declaration(isSgFunctionDeclaration(func));
3201 ROSE_ASSERT(function_symbol->get_declaration() != NULL);
3206 if (nondefiningDeclaration == NULL)
3208 nondefiningDeclaration = func;
3211 ROSE_ASSERT(nondefiningDeclaration != NULL);
3212 ROSE_ASSERT(func != NULL);
3213 ROSE_ASSERT(prevDecl != NULL);
3215 func->set_firstNondefiningDeclaration(nondefiningDeclaration);
3219 ROSE_ASSERT(func->get_firstNondefiningDeclaration()->get_symbol_from_symbol_table() != NULL);
3223 if (func->get_symbol_from_symbol_table() == NULL)
3225 ROSE_ASSERT(nondefiningDeclaration != NULL);
3226 ROSE_ASSERT(func->get_firstNondefiningDeclaration() == nondefiningDeclaration);
3230 ROSE_ASSERT(scope != NULL);
3231 ROSE_ASSERT(func->get_scope() != NULL);
3232 ROSE_ASSERT(func->get_scope() == scope);
3236 if (testMemberDecl != NULL)
3238 ROSE_ASSERT(testMemberDecl->
get_scope() != NULL);
3239 ROSE_ASSERT(testMemberDecl->get_associatedClassDeclaration() != NULL);
3243 if (isSgFunctionDeclaration(func) == NULL)
3254 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3258 ROSE_ASSERT(func != NULL);
3260 ROSE_ASSERT(func->get_file_info() == NULL);
3263 ROSE_ASSERT(func->get_firstNondefiningDeclaration() != NULL);
3264 ROSE_ASSERT(func_symbol != NULL);
3265 ROSE_ASSERT(func_symbol->get_symbol_basis() == func->get_firstNondefiningDeclaration());
3266 ROSE_ASSERT(func->get_symbol_from_symbol_table() != NULL || func->get_firstNondefiningDeclaration()->get_symbol_from_symbol_table() != NULL);
3269 ROSE_ASSERT(func->get_parameterList() != NULL);
3270 delete func->get_parameterList();
3271 func->set_parameterList(NULL);
3274 if (buildTemplateInstantiation ==
true)
3280 if (buildTemplateDeclaration ==
true)
3286 ROSE_ASSERT(templateFunctionDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateFunctionDeclaration->get_templateParameters().size()));
3289 ROSE_ASSERT(templateMemberFunctionDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateMemberFunctionDeclaration->get_templateParameters().size()));
3298 i_name->set_scope(scope);
3303 printf (
"In buildNondefiningFunctionDeclaration_T(): setting the source position information (calling setTransformation()) \n");
3311 printf (
"In buildNondefiningFunctionDeclaration_T(): DONE: setting the source position information (calling setTransformation()) \n");
3314#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3316 if (SourcePositionClassificationMode != e_sourcePositionTransformation)
3318 detectTransformations_local(paralist);
3322 ASSERT_not_null(scope);
3323 ASSERT_not_null(func->get_scope());
3324 ASSERT_require(func->get_scope() == scope);
3332#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
3333 printf (
"Warning: SageBuilder::buildNondefiningFunctionDeclaration_T(): scope parameter may not be the same as the topScopeStack() (e.g. for member functions) \n");
3338 func->set_parent(scope);
3339 ASSERT_not_null(func->get_firstNondefiningDeclaration());
3344 ROSE_ASSERT(func->get_file_info() == NULL);
3349 ROSE_ASSERT(func->get_file_info() != NULL);
3351#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3353 if (SourcePositionClassificationMode != e_sourcePositionTransformation)
3355 detectTransformations_local(func);
3365 ROSE_ASSERT (f_func != NULL);
3379 ROSE_ASSERT(func->get_firstNondefiningDeclaration() != NULL);
3380 SgSymbol* symbol_from_first_nondefining_function = func->get_firstNondefiningDeclaration()->get_symbol_from_symbol_table();
3381 ROSE_ASSERT(symbol_from_first_nondefining_function != NULL);
3384 if (func != func->get_firstNondefiningDeclaration())
3386 SgSymbol* symbol_from_nondefining_function = func->get_symbol_from_symbol_table();
3387 ROSE_ASSERT(symbol_from_nondefining_function == NULL);
3391 if (isSgFunctionDeclaration(func) == NULL)
3397 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3403#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3405 if (SourcePositionClassificationMode !=e_sourcePositionTransformation)
3407 detectTransformations_local(func);
3412 if (functionConstVolatileFlags & SgMemberFunctionType::e_restrict)
3414 func->get_declarationModifier().get_typeModifier().setRestrict();
3422 unsetNodesMarkedAsModified(func);
3433 ROSE_ASSERT(funcdecl!=NULL);
3434 SgName name=funcdecl->get_name();
3436 SgType* return_type = funcType->get_return_type();
3441 ROSE_ASSERT(funcType== ref_funcType);
3446 returnFunction->set_linkage(funcdecl->get_linkage());
3447 if (funcdecl->get_declarationModifier().get_storageModifier().
isExtern() ==
true)
3449 returnFunction->get_declarationModifier().get_storageModifier().
setExtern();
3452 ROSE_ASSERT (returnFunction->get_linkage() == funcdecl->get_linkage());
3453 ROSE_ASSERT (returnFunction->get_declarationModifier().get_storageModifier().
isExtern() ==
3454 funcdecl->get_declarationModifier().get_storageModifier().
isExtern());
3463 return returnFunction;
3472 result = buildNondefiningFunctionDeclaration_T <SgProcedureHeaderStatement> (name,return_type,paralist,
false, scope, decoratorList,
false, NULL, NULL, sm);
3477 if (buildTemplateInstantiation ==
true)
3479 result = buildNondefiningFunctionDeclaration_T <SgTemplateInstantiationFunctionDecl> (name,return_type,paralist,
false, scope, decoratorList,
false, templateArgumentsList, NULL, sm);
3483 result = buildNondefiningFunctionDeclaration_T <SgFunctionDeclaration> (name,return_type,paralist,
false, scope, decoratorList,
false, NULL, NULL, sm);
3496 unsigned int memberFunctionModifiers = 0;
3510 unsigned int memberFunctionModifiers = 0;
3517 if (member_func_symbol != NULL)
3519 nondefining_decl = member_func_symbol->get_declaration();
3543 ROSE_ASSERT(result != NULL);
3563 ROSE_ASSERT(first_nondefining_declaration != NULL);
3570 SgTemplateFunctionDeclaration* result = buildDefiningFunctionDeclaration_T <SgTemplateFunctionDeclaration> (name,return_type,paralist,
false, scope, decoratorList, 0, first_nondefining_declaration, NULL);
3582 SgTemplateMemberFunctionDeclaration* result = buildDefiningFunctionDeclaration_T <SgTemplateMemberFunctionDeclaration> (name,return_type,paralist,
true, scope, decoratorList, functionConstVolatileFlags, first_nondefining_declaration, NULL);
3583 ROSE_ASSERT(result != NULL);
3585 ROSE_ASSERT(result->get_definition() != NULL);
3592 SgExprListExp* decoratorList,
unsigned int functionConstVolatileFlags,
bool buildTemplateInstantiation, SgTemplateArgumentPtrList* templateArgumentsList)
3599 if (buildTemplateInstantiation ==
true)
3602 result = buildNondefiningFunctionDeclaration_T <SgTemplateInstantiationMemberFunctionDecl> (name,return_type,paralist,
true,scope,decoratorList,functionConstVolatileFlags,templateArgumentsList,NULL,
SgStorageModifier::e_default);
3607 result = buildNondefiningFunctionDeclaration_T <SgMemberFunctionDeclaration> (name,return_type,paralist,
true,scope,decoratorList,functionConstVolatileFlags,NULL,NULL,
SgStorageModifier::e_default);
3609 ROSE_ASSERT(result != NULL);
3613 ROSE_ASSERT(ctor != NULL);
3620 ROSE_ASSERT(result->get_associatedClassDeclaration() != NULL);
3622 if (result->get_associatedClassDeclaration() == NULL)
3624 printf (
"Warning, must set the SgMemberFunctionDeclaration::associatedClassDeclaration \n");
3626 ROSE_ASSERT(scope != NULL);
3628 ROSE_ASSERT(classDefinition != NULL);
3630 ROSE_ASSERT(associatedDeclaration != NULL);
3631 SgClassDeclaration* associatedClassDeclaration = isSgClassDeclaration(associatedDeclaration);
3652 ROSE_ASSERT(result != NULL);
3654#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3658 detectTransformations_local(result);
3665 SgSymbol* associatedSymbol = scope->lookup_template_member_function_symbol(name,result->get_type(),templateParameterList);
3666 if (associatedSymbol == NULL)
3668 printf (
"ERROR: associatedSymbol == NULL \n");
3669 printf (
" --- result = %p = %s \n",result,result->
class_name().c_str());
3670 printf (
" --- scope = %p = %s \n",scope,scope->
class_name().c_str());
3671 printf (
" --- name = %s \n",name.str());
3672 printf (
" --- result->get_type() = %p = %s \n",result->get_type(),result->get_type()->
class_name().c_str());
3673 printf (
" --- result->get_type()->get_mangled() = %s \n",result->get_type()->get_mangled().str());
3675 ROSE_ASSERT(associatedSymbol != NULL);
3678 ROSE_ASSERT(ctor != NULL);
3686 ROSE_ASSERT(symbol_from_first_nondefining_function != NULL);
3692 ROSE_ASSERT(symbol_from_nondefining_function == NULL);
3695#if BUILDER_MAKE_REDUNDANT_CALLS_TO_SYMBOL_TABLE_LOOKUP
3698 if (scope->lookup_template_member_function_symbol(name,result->get_type(),templateParameterList) == NULL)
3700 printf (
"Error: scope->lookup_template_member_function_symbol(name,result->get_type()) == NULL (investigate this) \n");
3701 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());
3702 scope->
get_symbol_table()->
print(
"Error: scope->lookup_template_member_function_symbol(name,result->get_type()) == NULL (investigate this)");
3705 ROSE_ASSERT(scope->lookup_template_member_function_symbol(name,result->get_type(),templateParameterList) != NULL);
3707#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3711 detectTransformations_local(result);
3723 if (buildTemplateInstantiation ==
true)
3726 ROSE_ASSERT(templateInstantiationMemberFunctionDecl != NULL);
3730 ROSE_ASSERT(templateArgumentsList != NULL);
3731 string nameWithoutTemplateArguments = name;
3733 SgMemberFunctionType* func_type = isSgMemberFunctionType(first_nondefining_declaration->get_type());
3734 ROSE_ASSERT(func_type != NULL);
3738 if (func_symbol == NULL)
3740 printf (
"ERROR caught in SageBuilder::buildDefiningMemberFunctionDeclaration(): nameWithTemplateArguments = %s buildTemplateInstantiation = %s \n",nameWithTemplateArguments.c_str(),buildTemplateInstantiation ?
"true:" :
"false");
3741 printf (
"ERROR caught in SageBuilder::buildDefiningMemberFunctionDeclaration(): func_symbol == NULL for first_nondefining_declaration = %p = %s and func_type = %p = %s \n",
3742 templateInstantiationMemberFunctionDecl,templateInstantiationMemberFunctionDecl->
class_name().c_str(),func_type,func_type->
class_name().c_str());
3746 result = buildDefiningFunctionDeclaration_T <SgTemplateInstantiationMemberFunctionDecl> (name, return_type, paralist,
true, scope, decoratorList, functionConstVolatileFlags, templateInstantiationMemberFunctionDecl, templateArgumentsList);
3747 ROSE_ASSERT(isSgTemplateInstantiationMemberFunctionDecl(result) != NULL);
3748 ROSE_ASSERT(isSgTemplateInstantiationMemberFunctionDecl(result)->get_templateName().is_null() ==
false);
3752 ROSE_ASSERT(first_nondefining_declaration != NULL);
3758 result = buildDefiningFunctionDeclaration_T <SgMemberFunctionDeclaration> (name,return_type,paralist,
true,scope,decoratorList,functionConstVolatileFlags,first_nondefining_declaration, NULL);
3761 ROSE_ASSERT(result != NULL);
3765 ROSE_ASSERT(ctor != NULL);
3772 ROSE_ASSERT(result->get_associatedClassDeclaration() != NULL);
3782template <
class actualFunction>
3791#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
3792 printf (
"WARNING: This function for building defining function declarations has different semantics from that of the function to build defining class declarations. \n");
3795 ASSERT_not_null(first_nondefining_declaration);
3796 ASSERT_require(first_nondefining_declaration->get_firstNondefiningDeclaration() == first_nondefining_declaration);
3798 if (scope ==
nullptr)
3803 ASSERT_require(XXX_name.is_null() ==
false);
3804 ASSERT_not_null(scope);
3805 ASSERT_not_null(return_type);
3807 SgName nameWithoutTemplateArguments = XXX_name;
3808 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
3810 bool buildTemplateInstantiation = ((VariantT)actualFunction::static_variant == V_SgTemplateInstantiationFunctionDecl || (VariantT)actualFunction::static_variant == V_SgTemplateInstantiationMemberFunctionDecl);
3813 bool buildTemplateDeclaration = ((VariantT)actualFunction::static_variant == V_SgTemplateFunctionDeclaration || (VariantT)actualFunction::static_variant == V_SgTemplateMemberFunctionDeclaration);
3816 if (buildTemplateInstantiation ==
true)
3818 ASSERT_not_null(templateArgumentsList);
3820 SgTemplateArgumentPtrList & templateArgumentsList_from_first_nondefining_declaration = (isMemberFunction ==
false) ?
3822 isSgTemplateInstantiationMemberFunctionDecl(first_nondefining_declaration)->
get_templateArguments();
3824 ASSERT_not_null(templateArgumentsList);
3826 ASSERT_require(templateArgumentListsAreEquivalent ==
true);
3829 SgTemplateParameterPtrList* templateParameterList =
nullptr;
3830 if (buildTemplateDeclaration ==
true)
3833 templateParameterList = (isMemberFunction ==
false) ?
3834 &(isSgTemplateFunctionDeclaration(first_nondefining_declaration)->get_templateParameters()) :
3835 &(isSgTemplateMemberFunctionDeclaration(first_nondefining_declaration)->get_templateParameters());
3837 ASSERT_require(templateArgumentsList ==
nullptr);
3838 ASSERT_not_null(templateParameterList);
3841 if (buildTemplateInstantiation ==
true)
3843 ASSERT_not_null(templateArgumentsList);
3846 if (nameWithTemplateArguments ==
"insert < __normal_iterator< SgInitializedName ** , __type > > ")
3848 printf (
"In buildDefiningFunctionDeclaration_T(): Found function nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
3852 ASSERT_require(nameWithoutTemplateArguments.is_null() ==
false);
3853 ASSERT_require(nameWithTemplateArguments.is_null() ==
false);
3854 ASSERT_not_null(paralist);
3862 actualFunction* defining_func =
nullptr;
3868 ASSERT_not_null(first_nondefining_declaration);
3885 func_type = first_nondefining_declaration->get_type();
3886 ASSERT_not_null(func_type);
3889 ASSERT_require(func_type == first_nondefining_declaration->get_type());
3894 SgSymbol* func_symbol = scope->find_symbol_by_type_of_function<actualFunction>(nameWithTemplateArguments,func_type,templateParameterList,templateArgumentsList);
3897 ASSERT_not_null(func_symbol);
3899 if (func_symbol ==
nullptr)
3904 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");
3918 if (temp_function_sym !=
nullptr)
3920 func_type = temp_function_sym->get_declaration()->get_type();
3926 ASSERT_not_null(temp_template_sym);
3929 ASSERT_not_null(firstNondefiningFunctionDeclaration);
3932 defining_func =
new actualFunction(nameWithTemplateArguments,func_type,
nullptr);
3933 ASSERT_not_null(defining_func);
3935 ASSERT_not_null(firstNondefiningFunctionDeclaration);
3936 defining_func->set_firstNondefiningDeclaration(firstNondefiningFunctionDeclaration);
3942 if (decoratorList !=
nullptr)
3944 defining_func->set_decoratorList(decoratorList);
3949 defining_func->set_definingDeclaration(defining_func);
3953 ASSERT_not_null(func_body);
3959 if (templateFunctionDeclaration ==
nullptr)
3962 ASSERT_not_null(functionDeclaration);
3967 ASSERT_not_null(templateFunctionDeclaration);
3970 ASSERT_not_null(func_def);
3974 func_def->setCaseInsensitive(
true);
3975 func_body->setCaseInsensitive(
true);
3988 i_name->set_scope(func_def);
3991 ASSERT_not_null(variableSymbol);
3992 func_def->
insert_symbol(i_name->get_name(), variableSymbol);
3995 SgArrayType* arrayType = isSgArrayType(i_name->get_type());
3996 if (arrayType !=
nullptr)
4000 SgExpression* indexExpression = arrayType->get_index();
4002 if (indexExpression !=
nullptr)
4006 vector<SgVarRefExp* > varRefList;
4009 for (
size_t i = 0; i < varRefList.size(); i++)
4013 ASSERT_not_null(dimension_variableSymbol);
4014 ASSERT_require(dimension_variableSymbol != variableSymbol);
4017 SgSymbol* symbolFromLookup = func_def->lookup_symbol(dimension_variableSymbol->
get_name());
4018 if (symbolFromLookup !=
nullptr)
4020 SgVariableSymbol* variableSymbolFromLookup = isSgVariableSymbol(symbolFromLookup);
4021 ASSERT_not_null(variableSymbolFromLookup);
4023 varRefList[i]->set_symbol(variableSymbolFromLookup);
4024 ASSERT_require(dimension_variableSymbol != variableSymbol);
4035 defining_func->set_parent(scope);
4036 defining_func->set_scope(scope);
4038 ASSERT_not_null(defining_func->get_scope());
4040 checkThatNoTemplateInstantiationIsDeclaredInTemplateDefinitionScope(defining_func,scope);
4046 if (isMemberFunction ==
true)
4048 ASSERT_not_null(isSgMemberFunctionDeclaration(defining_func));
4055 if (buildTemplateInstantiation ==
true)
4061 if (buildTemplateDeclaration ==
true)
4067 ROSE_ASSERT(templateFunctionDeclaration ==
nullptr || (templateParameterList !=
nullptr && templateParameterList->size() == templateFunctionDeclaration->get_templateParameters().size()));
4069 ROSE_ASSERT(templateMemberFunctionDeclaration ==
nullptr || (templateParameterList !=
nullptr && templateParameterList->size() == templateMemberFunctionDeclaration->get_templateParameters().size()));
4073 if (functionConstVolatileFlags & SgMemberFunctionType::e_restrict)
4075 defining_func->get_declarationModifier().get_typeModifier().setRestrict();
4082 unsetNodesMarkedAsModified(defining_func);
4084 return defining_func;
4094 bool isTemplateInstantition = (templateInstantiationFunctionDecl != NULL) || (templateInstantiationMemberFunctionDecl != NULL);
4095 if (isTemplateInstantition ==
true)
4099 SgName templateNameWithoutArguments = name;
4105 bool isMemberFunction = (templateInstantiationMemberFunctionDecl != NULL);
4106 if (isMemberFunction ==
true)
4108 ROSE_ASSERT(templateInstantiationMemberFunctionDecl != NULL);
4109 ROSE_ASSERT(templateInstantiationFunctionDecl == NULL);
4111 if (templateInstantiationMemberFunctionDecl->
get_templateName().is_null() ==
true)
4115 templateInstantiationMemberFunctionDecl->
set_templateName(templateNameWithoutArguments);
4119 ROSE_ASSERT(templateInstantiationMemberFunctionDecl->
get_templateName().is_null() ==
false);
4123 ROSE_ASSERT(templateInstantiationFunctionDecl != NULL);
4124 ROSE_ASSERT(templateInstantiationMemberFunctionDecl == NULL);
4126 if (templateInstantiationFunctionDecl->
get_templateName().is_null() ==
true)
4130 templateInstantiationFunctionDecl->
set_templateName(templateNameWithoutArguments);
4135 ROSE_ASSERT(templateInstantiationFunctionDecl->
get_templateName().is_null() ==
false);
4145 if (buildTemplateInstantiation ==
true)
4149 ROSE_ASSERT(first_nondefining_declaration != NULL);
4151 func = buildDefiningFunctionDeclaration_T<SgTemplateInstantiationFunctionDecl>(name,return_type,paralist,
false,scope,decoratorList,0,templateInstantiationFunctionDecl, templateArgumentsList);
4153 ROSE_ASSERT(isSgTemplateInstantiationFunctionDecl(func) != NULL);
4154 ROSE_ASSERT(isSgTemplateInstantiationFunctionDecl(func)->get_templateName().is_null() ==
false);
4158 ROSE_ASSERT(first_nondefining_declaration != NULL);
4160 func = buildDefiningFunctionDeclaration_T<SgFunctionDeclaration>(name,return_type,paralist,
false,scope,decoratorList,0,first_nondefining_declaration, NULL);
4162 ROSE_ASSERT(isSgFunctionDeclaration(func) != NULL);
4177 ROSE_ASSERT(return_type != NULL);
4178 ROSE_ASSERT(parameter_list != NULL);
4194 if (func_symbol != NULL)
4196 nondefiningDeclaration = func_symbol->get_declaration();
4203 ROSE_ASSERT(nondefiningDeclaration != NULL);
4215 ASSERT_not_null(return_type);
4216 ASSERT_not_null(param_list);
4220 if (scope ==
nullptr) {
4226 nondef_decl = buildNondefiningFunctionDeclaration_T <SgProcedureHeaderStatement>
4227 ( name, return_type, param_list,
false, scope,
nullptr,
4230 ASSERT_not_null(isSgProcedureHeaderStatement(nondef_decl));
4233 nondef_decl->set_subprogram_kind(kind);
4242 ASSERT_not_null(return_type);
4243 ASSERT_not_null(parameter_list);
4247 if (scope ==
nullptr) {
4253 if (func_symbol ==
nullptr)
4255 nondef_decl = buildNondefiningFunctionDeclaration_T <SgProcedureHeaderStatement>
4256 ( name, return_type, parameter_list,
false, scope,
4261 nondef_decl = func_symbol->get_declaration();
4265 ASSERT_not_null(proc_header_stmt);
4278 ASSERT_not_null(firstNondefDecl);
4286 mlog[ERROR] <<
"unhandled subprogram kind for Fortran (or Jovial) function declaration:"
4291 func = buildDefiningFunctionDeclaration_T<SgProcedureHeaderStatement>(
SgName(name), returnType, params,
false,
4292 scope,
nullptr, 0U, firstNondefDecl,
nullptr);
4293 ASSERT_not_null(func);
4294 func->set_subprogram_kind(kind);
4305 ROSE_ASSERT(boolValue);
4316 ROSE_ASSERT(boolValue);
4324 ROSE_ASSERT(nullptrValue);
4326 return nullptrValue;
4332 ROSE_ASSERT(nullptrValue);
4334 return nullptrValue;
4340 ROSE_ASSERT(voidValue);
4348 ROSE_ASSERT(voidValue);
4356 ROSE_ASSERT(result);
4364 ROSE_ASSERT(result);
4372 ROSE_ASSERT(result);
4380 ROSE_ASSERT(result);
4389 ROSE_ASSERT(result);
4397 ROSE_ASSERT(result);
4406 ROSE_ASSERT(result);
4414 ROSE_ASSERT(result);
4423 ROSE_ASSERT(result);
4426 if (real_value != NULL)
4429 if (imaginary_value != NULL)
4432 ROSE_ASSERT(real_value == NULL || real_value->
get_parent() != NULL);
4433 ROSE_ASSERT(imaginary_value == NULL || imaginary_value->
get_parent() != NULL);
4441 ROSE_ASSERT(imaginary_value != NULL);
4443 ROSE_ASSERT(result != NULL);
4446 if (real_value != NULL)
4449 if (imaginary_value != NULL)
4452 ROSE_ASSERT(real_value == NULL || real_value->
get_parent() != NULL);
4453 ROSE_ASSERT(imaginary_value == NULL || imaginary_value->
get_parent() != NULL);
4462 ROSE_ASSERT(result);
4465 result->get_imaginary_value()->
set_parent(result);
4466 ROSE_ASSERT(result->get_imaginary_value()->
get_parent() != NULL);
4474 ROSE_ASSERT(imaginary_value != NULL);
4477 ROSE_ASSERT(result);
4481 ROSE_ASSERT(imaginary_value->
get_parent() != NULL);
4489 ROSE_ASSERT(imaginary_value != NULL);
4493 ROSE_ASSERT(result);
4496 ROSE_ASSERT(imaginary_value->
get_parent() != NULL);
4521 ROSE_ASSERT(result);
4529 ROSE_ASSERT(result);
4537 ROSE_ASSERT(result);
4552 ASSERT_not_null(intValue);
4560 ASSERT_not_null(intValue);
4568 ASSERT_not_null(intValue);
4576 ASSERT_not_null(intValue);
4589 ASSERT_not_null(intValue);
4597 ASSERT_not_null(intValue);
4605 ASSERT_not_null(intValue);
4613 ASSERT_not_null(intValue);
4621 ASSERT_not_null(enumVal);
4630 ASSERT_not_null(enumVal);
4637 ROSE_ASSERT(init_name != NULL);
4639 ROSE_ASSERT(assign_init != NULL);
4640 SgEnumVal * enum_val = isSgEnumVal(assign_init->get_operand_i());
4641 ROSE_ASSERT(enum_val != NULL);
4649 ASSERT_not_null(result);
4657 ASSERT_not_null(result);
4665 ASSERT_not_null(result);
4673 ASSERT_not_null(result);
4681 ASSERT_not_null(result);
4689 ASSERT_not_null(result);
4697 ASSERT_not_null(result);
4705 ASSERT_not_null(result);
4713 ASSERT_not_null(result);
4721 ASSERT_not_null(result);
4729 ASSERT_not_null(result);
4737 ASSERT_not_null(result);
4745 ASSERT_not_null(result);
4753 ASSERT_not_null(result);
4761 ASSERT_not_null(result);
4769 ASSERT_not_null(result);
4777 ASSERT_not_null(result);
4785 ASSERT_not_null(result);
4793 ASSERT_not_null(result);
4801 ASSERT_not_null(result);
4809 ASSERT_not_null(result);
4817 ASSERT_not_null(result);
4825 ASSERT_not_null(result);
4833 ASSERT_not_null(result);
4841 ASSERT_not_null(result);
4849 ASSERT_not_null(result);
4857 ASSERT_not_null(result);
4865 ASSERT_not_null(result);
4873 ASSERT_not_null(result);
4880 SgJovialBitVal* result =
new SgJovialBitVal(str);
4881 ASSERT_not_null(result);
4889 ASSERT_not_null (result);
4898 ROSE_ASSERT (result);
4906 ROSE_ASSERT(templateParameterValue);
4910 ROSE_ASSERT(templateParameterValue->
get_parent() == NULL);
4912 return templateParameterValue;
4918 ROSE_ASSERT(templateParameterValue);
4922 ROSE_ASSERT(templateParameterValue->
get_parent() == NULL);
4924 return templateParameterValue;
4927#define DEBUG_BUILD_NONREAL_DECL 0
4930 ROSE_ASSERT(scope != NULL);
4931#if DEBUG_BUILD_NONREAL_DECL
4932 printf(
"ENTER SageBuilder::buildNonrealDecl\n");
4933 printf(
" --- name = %s\n", name.str());
4934 printf(
" --- scope = %p (%s)\n", scope, scope->
class_name().c_str());
4942#if DEBUG_BUILD_NONREAL_DECL
4943 printf(
" --- nrdecl = %p (%s)\n", nrdecl, nrdecl->
class_name().c_str());
4948#if DEBUG_BUILD_NONREAL_DECL
4949 printf(
" --- symbol = %p (%s)\n", symbol, symbol->
class_name().c_str());
4953 type->set_declaration(nrdecl);
4955 nrdecl->set_type(type);
4957#if DEBUG_BUILD_NONREAL_DECL
4958 printf(
" --- type = %p (%s)\n", type, type->
class_name().c_str());
4961 if (child_scope == NULL) {
4963#if DEBUG_BUILD_NONREAL_DECL
4964 printf(
" --- child_scope = %p (new)\n", name.str(), child_scope);
4970#if DEBUG_BUILD_NONREAL_DECL
4971 printf(
" --- child_scope = %p (provided)\n", name.str(), child_scope);
4976 nrdecl->set_nonreal_decl_scope(child_scope);
4978#if DEBUG_BUILD_NONREAL_DECL
4979 printf(
"LEAVE SageBuilder::buildNonrealDecl\n");
4989 ROSE_ASSERT(result);
4998 ROSE_ASSERT(result);
5007 ROSE_ASSERT(result);
5016 ROSE_ASSERT(result);
5024 ROSE_ASSERT(result);
5032 ROSE_ASSERT(result);
5040 ROSE_ASSERT(result);
5048 ROSE_ASSERT(result);
5056 ROSE_ASSERT(result);
5064 ROSE_ASSERT(result);
5160#define BUILD_UNARY_DEF(suffix) \
5161 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix##_nfi(SgExpression* op) \
5163 return SageBuilder::buildUnaryExpression_nfi<Sg##suffix>(op); \
5165 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix(SgExpression* op) \
5167 return SageBuilder::buildUnaryExpression<Sg##suffix>(op); \
5170BUILD_UNARY_DEF(AddressOfOp)
5171BUILD_UNARY_DEF(BitComplementOp)
5172BUILD_UNARY_DEF(MinusOp)
5173BUILD_UNARY_DEF(NotOp)
5174BUILD_UNARY_DEF(PointerDerefExp)
5175BUILD_UNARY_DEF(UnaryAddOp)
5176BUILD_UNARY_DEF(AbsOp)
5177BUILD_UNARY_DEF(MinusMinusOp)
5178BUILD_UNARY_DEF(PlusPlusOp)
5179BUILD_UNARY_DEF(RealPartOp)
5180BUILD_UNARY_DEF(ImagPartOp)
5181BUILD_UNARY_DEF(ConjugateOp)
5182BUILD_UNARY_DEF(VarArgStartOneOperandOp)
5183BUILD_UNARY_DEF(VarArgEndOp)
5185BUILD_UNARY_DEF(MatrixTransposeOp)
5187#undef BUILD_UNARY_DEF
5190 SgType * expression_type,
5194 ROSE_ASSERT(result);
5195 if (operand_i) {operand_i->
set_parent(result); markLhsValues(result);}
5206 short int need_global_specifier,
5210 SgNewExp* result =
new SgNewExp(specified_type, placement_args, constructor_args, builtin_args, need_global_specifier, newOperatorDeclaration);
5211 ROSE_ASSERT(result);
5219 short need_global_specifier,
5223 need_global_specifier, deleteOperatorDeclaration);
5224 ROSE_ASSERT(result);
5234 ROSE_ASSERT(result != NULL);
5242 ROSE_ASSERT(result);
5243 if (operand_i) {operand_i->
set_parent(result); markLhsValues(result);}
5250 ROSE_ASSERT(result);
5251 if (operand_i) {operand_i->
set_parent(result); markLhsValues(result);}
5258 SgMinusMinusOp* result = buildUnaryExpression<SgMinusMinusOp>(operand_i);
5259 ROSE_ASSERT(result);
5266 SgMinusMinusOp* result = buildUnaryExpression_nfi<SgMinusMinusOp>(operand_i);
5267 ROSE_ASSERT(result);
5274 SgMinusOp* result = buildUnaryExpression<SgMinusOp>(operand_i);
5275 ROSE_ASSERT(result);
5282 SgMinusOp* result = buildUnaryExpression_nfi<SgMinusOp>(operand_i);
5283 ROSE_ASSERT(result);
5290 SgPlusPlusOp* result = buildUnaryExpression<SgPlusPlusOp>(operand_i);
5291 ROSE_ASSERT(result);
5299 SgPlusPlusOp* result = buildUnaryExpression_nfi<SgPlusPlusOp>(operand_i);
5300 ROSE_ASSERT(result);
5314 markLhsValues(result);
5320 operand_i -> set_parent(result);
5322 ROSE_ASSERT(result);
5329#define BUILD_BINARY_DEF(suffix) \
5330 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix##_nfi(SgExpression* lhs, SgExpression* rhs) \
5332 return buildBinaryExpression_nfi<Sg##suffix>(lhs, rhs); \
5334 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix(SgExpression* lhs, SgExpression* rhs) \
5336 return buildBinaryExpression<Sg##suffix>(lhs, rhs); \
5339BUILD_BINARY_DEF(AddOp)
5340BUILD_BINARY_DEF(AndAssignOp)
5341BUILD_BINARY_DEF(AndOp)
5342BUILD_BINARY_DEF(ArrowExp)
5343BUILD_BINARY_DEF(ArrowStarOp)
5344BUILD_BINARY_DEF(AssignOp)
5345BUILD_BINARY_DEF(AtOp)
5346BUILD_BINARY_DEF(BitAndOp)
5347BUILD_BINARY_DEF(BitOrOp)
5348BUILD_BINARY_DEF(BitXorOp)
5350BUILD_BINARY_DEF(CommaOpExp)
5351BUILD_BINARY_DEF(ConcatenationOp)
5352BUILD_BINARY_DEF(DivAssignOp)
5353BUILD_BINARY_DEF(DivideOp)
5354BUILD_BINARY_DEF(DotExp)
5355BUILD_BINARY_DEF(DotStarOp)
5356BUILD_BINARY_DEF(EqualityOp)
5358BUILD_BINARY_DEF(ExponentiationOp)
5359BUILD_BINARY_DEF(ExponentiationAssignOp)
5360BUILD_BINARY_DEF(GreaterOrEqualOp)
5361BUILD_BINARY_DEF(GreaterThanOp)
5362BUILD_BINARY_DEF(IntegerDivideOp)
5363BUILD_BINARY_DEF(IntegerDivideAssignOp)
5364BUILD_BINARY_DEF(IorAssignOp)
5365BUILD_BINARY_DEF(IsOp)
5366BUILD_BINARY_DEF(IsNotOp)
5368BUILD_BINARY_DEF(LessOrEqualOp)
5369BUILD_BINARY_DEF(LessThanOp)
5370BUILD_BINARY_DEF(LshiftAssignOp)
5371BUILD_BINARY_DEF(LshiftOp)
5373BUILD_BINARY_DEF(MembershipOp)
5374BUILD_BINARY_DEF(MinusAssignOp)
5375BUILD_BINARY_DEF(ModAssignOp)
5376BUILD_BINARY_DEF(ModOp)
5377BUILD_BINARY_DEF(MultAssignOp)
5378BUILD_BINARY_DEF(MultiplyOp)
5380BUILD_BINARY_DEF(NotEqualOp)
5381BUILD_BINARY_DEF(NonMembershipOp)
5382BUILD_BINARY_DEF(OrOp)
5383BUILD_BINARY_DEF(PlusAssignOp)
5384BUILD_BINARY_DEF(PntrArrRefExp)
5385BUILD_BINARY_DEF(RemOp)
5386BUILD_BINARY_DEF(RshiftAssignOp)
5387BUILD_BINARY_DEF(JavaUnsignedRshiftAssignOp)
5389BUILD_BINARY_DEF(RshiftOp)
5390BUILD_BINARY_DEF(JavaUnsignedRshiftOp)
5391BUILD_BINARY_DEF(ScopeOp)
5392BUILD_BINARY_DEF(SubtractOp)
5393BUILD_BINARY_DEF(XorAssignOp)
5395BUILD_BINARY_DEF(VarArgCopyOp)
5396BUILD_BINARY_DEF(VarArgStartOp)
5399BUILD_BINARY_DEF(ReplicationOp);
5402BUILD_BINARY_DEF(PowerOp);
5403BUILD_BINARY_DEF(ElementwisePowerOp);
5404BUILD_BINARY_DEF(ElementwiseMultiplyOp);
5405BUILD_BINARY_DEF(ElementwiseDivideOp);
5406BUILD_BINARY_DEF(LeftDivideOp);
5407BUILD_BINARY_DEF(ElementwiseLeftDivideOp);
5408BUILD_BINARY_DEF(ElementwiseAddOp);
5409BUILD_BINARY_DEF(ElementwiseSubtractOp);
5412BUILD_BINARY_DEF(SpaceshipOp)
5414#undef BUILD_BINARY_DEF
5422 ROSE_ASSERT(base_type != NULL);
5426 if (dim_info == NULL)
5437 ROSE_ASSERT(array_type);
5438 ROSE_ASSERT(array_type->get_dim_info() == NULL);
5443 array_type->set_dim_info(dim_info);
5444 array_type->set_rank(dim_info->get_expressions().size());
5452 ASSERT_not_null(result);
5454 if (index !=
nullptr) {
5475 if (a) {a->
set_parent(result); markLhsValues(a);}
5476 if (b) {b->
set_parent(result); markLhsValues(b);}
5484 ROSE_ASSERT(result);
5504 ASSERT_not_null(expr);
5518 ROSE_ASSERT(result);
5519 if (operand_i!=NULL)
5523 markLhsValues(result);
5532 ASSERT_not_null(result);
5537 markLhsValues(result);
5550 ROSE_ASSERT(result);
5551 if (initializers!=NULL)
5555 result->set_need_explicit_braces(
true);
5564 ROSE_ASSERT(result);
5565 if (initializers!=NULL)
5569 result->set_need_explicit_braces(
true);
5578 ROSE_ASSERT(result);
5579 if (initializers!=NULL)
5591 ROSE_ASSERT(result);
5592 if (initializers!=NULL)
5607 bool need_qualifier ,
5608 bool need_parenthesis_after_name ,
5609 bool associated_class_unknown )
5616 ROSE_ASSERT(declaration == NULL || declaration->get_associatedClassDeclaration() != NULL);
5619 need_qualifier, need_parenthesis_after_name, associated_class_unknown );
5620 ROSE_ASSERT(result != NULL);
5639 bool need_qualifier ,
5640 bool need_parenthesis_after_name ,
5641 bool associated_class_unknown )
5647 ROSE_ASSERT(declaration == NULL || declaration->get_associatedClassDeclaration() != NULL);
5650 ROSE_ASSERT(result != NULL);
5675 ROSE_ASSERT(result);
5676 if (initializers!=NULL)
5687 ROSE_ASSERT(result);
5688 if (initializers!=NULL)
5705 ROSE_ASSERT(result);
5709 markLhsValues(result);
5723 ROSE_ASSERT(result);
5727 markLhsValues(result);
5738 ROSE_ASSERT(result);
5748 ROSE_ASSERT(result);
5760 ROSE_ASSERT(result);
5764 markLhsValues(result);
5777 ROSE_ASSERT(result);
5781 markLhsValues(result);
5794 ROSE_ASSERT(result);
5798 markLhsValues(result);
5812 ROSE_ASSERT(result);
5816 markLhsValues(result);
5827 ROSE_ASSERT(result);
5836 ROSE_ASSERT(result);
5845 ROSE_ASSERT(expList);
5867 ROSE_ASSERT(expList);
5870 for (
size_t i = 0; i < exprs.size(); ++i) {
5879 ROSE_ASSERT(expList);
5888 ROSE_ASSERT(expList != NULL);
5891 for (
size_t i = 0; i < exprs.size(); ++i)
5897 testAstForUniqueNodes(expList);
5905 if (lower_bound == NULL)
5914 ROSE_ASSERT(lower_bound);
5915 ROSE_ASSERT(upper_bound);
5916 ROSE_ASSERT(stride);
5919 ROSE_ASSERT(subscript);
5933 ROSE_ASSERT(initname);
5940 if (initname->get_scope()!=NULL)
5945 varRef =
new SgVarRefExp(isSgVariableSymbol(symbol));
5947 ROSE_ASSERT(varRef);
5992 varSymbol = isSgVariableSymbol(symbol);
6000 name1->set_scope(scope);
6006 if (varSymbol == NULL)
6008 printf (
"Error: varSymbol == NULL for name = %s \n",name.str());
6010 ROSE_ASSERT(varSymbol != NULL);
6014 ROSE_ASSERT(varRef != NULL);
6016 ROSE_ASSERT (isSgVariableSymbol(varRef->get_symbol())->get_declaration()!=NULL);
6026 ROSE_ASSERT(symbol);
6036 ROSE_ASSERT(varRef);
6047 ROSE_ASSERT(varRef);
6058 ROSE_ASSERT(refexp != NULL);
6073 ROSE_ASSERT(scope != NULL);
6084 ROSE_ASSERT(isSgVariableSymbol(symbol));
6110 ROSE_ASSERT(compoundLiteral != NULL);
6114 return compoundLiteral;
6123 ROSE_ASSERT(compoundLiteral != NULL);
6127 return compoundLiteral;
6135 ROSE_ASSERT (s!= NULL);
6137 ROSE_ASSERT (result != NULL);
6146 if (paraTypeList==NULL)
return paraList;
6149 SgTypePtrList::iterator i;
6150 for (i=typeList.begin();i!=typeList.end();i++)
6163 ROSE_ASSERT (paraList);
6165 SgTypePtrList::iterator i;
6166 for (i=typeList.begin();i!=typeList.end();i++)
6178 ASSERT_not_null(funcType);
6180 ASSERT_not_null(func_type);
6182 bool isMemberFunc = isSgMemberFunctionType(func_type);
6184 if (scope ==
nullptr) {
6187 ASSERT_not_null(scope);
6189 if (symbol ==
nullptr)
6192 SgType* return_type = func_type->get_return_type();
6198 ASSERT_require(isMemberFunc ==
false);
6204 funcDecl = buildNondefiningFunctionDeclaration_T
6209 funcDecl = buildNondefiningFunctionDeclaration_T
6213 funcDecl->get_declarationModifier().get_storageModifier().
setExtern();
6216 ASSERT_not_null(symbol);
6221 ASSERT_not_null(func_ref);
6236 ROSE_ASSERT(func_decl != NULL);
6240 if (nondef_func != NULL)
6242 ROSE_ASSERT(nondef_func!= NULL);
6244 ROSE_ASSERT( symbol != NULL);
6247 else if (def_func != NULL)
6253 std::cerr<<
"Fatal error: SageBuilder::buildFunctionRefExp():defining and nondefining declarations for a function cannot be both NULL"<<std::endl;
6256 ROSE_ASSERT( symbol != NULL);
6267 ROSE_ASSERT(func_ref);
6277 ROSE_ASSERT(func_ref);
6286 ROSE_ASSERT(sym != NULL);
6289 ROSE_ASSERT(func_ref != NULL);
6294 ROSE_ASSERT(func_ref->get_symbol() != NULL);
6305 ROSE_ASSERT(func_ref);
6315 ROSE_ASSERT(func_ref);
6325 ROSE_ASSERT(func_ref);
6335 ROSE_ASSERT(class_ref);
6344 ROSE_ASSERT(class_ref);
6354 ROSE_ASSERT(scope != NULL);
6368 printf (
"Error: buildFunctionRefExp(): This function should not be used! \n");
6379 funcDecl->get_declarationModifier().get_storageModifier().
setExtern();
6382 ROSE_ASSERT(symbol);
6388 ROSE_ASSERT(func_ref);
6404 ROSE_ASSERT(expStmt);
6414 ROSE_ASSERT(expStmt);
6425 ROSE_ASSERT(expStmt);
6437 ROSE_ASSERT(expStmt);
6447 if (scope ==
nullptr) {
6450 ASSERT_not_null(scope);
6452 if (parameters ==
nullptr) {
6463 ASSERT_not_null(func_call_expr);
6465 return func_call_expr;
6473 ROSE_ASSERT (sym != NULL);
6474 if (parameters == NULL)
6476 ROSE_ASSERT (parameters != NULL);
6483 if (memberFunctionSymbol != NULL)
6486 bool virtual_call =
false;
6489 bool need_qualifier =
false;
6507 ROSE_ASSERT(func_call_expr);
6508 return func_call_expr;
6514 ROSE_ASSERT(f != NULL);
6516 ROSE_ASSERT(func_call_expr != NULL);
6521 if (parameters != NULL) {
6526 return func_call_expr;
6532 ROSE_ASSERT(f != NULL);
6534 ROSE_ASSERT(func_call_expr != NULL);
6537 if (parameters) parameters->
set_parent(func_call_expr);
6540 return func_call_expr;
6551 ROSE_ASSERT(scope != NULL);
6577 std::string functionName,
6583 ROSE_ASSERT(classSymbol);
6587 ROSE_ASSERT(classDeclaration != NULL);
6590 ROSE_ASSERT(classDefinition);
6594 ROSE_ASSERT(functionSymbol);
6617 ROSE_ASSERT(builtin_func_call_expr != NULL);
6619 SgNodePtrList & args = builtin_func_call_expr->get_args();
6620 for (SgNodePtrList::iterator it = parameters.begin(); it != parameters.end(); ++it) {
6621 args.push_back(*it);
6622 (*it)->set_parent(builtin_func_call_expr);
6625 return builtin_func_call_expr;
6632 ROSE_ASSERT(kernel);
6633 ROSE_ASSERT(parameters);
6634 ROSE_ASSERT(config);
6639 if (func_ref_exp == NULL && template_func_ref_exp == NULL)
6641 std::cerr <<
"SgCudaKernelCallExp accept only direct reference to a function. Got, " <<
typeid(*kernel).name()
6648 else if ( (func_ref_exp != NULL && func_ref_exp->get_symbol_i()->get_declaration()->get_functionModifier().isCudaKernel() ==
false) &&
6649 (template_func_ref_exp != NULL && template_func_ref_exp->get_symbol_i()->get_declaration()->get_functionModifier().isCudaKernel() ==
false) )
6651 std::cerr <<
"To build a SgCudaKernelCallExp the callee needs to be a kernel (having \"__global__\" attribute)." << std::endl;
6663 ROSE_ASSERT(kernel_call_expr);
6665 return kernel_call_expr;
6670 if (!grid || !blocks) {
6671 std::cerr <<
"SgCudaKernelExecConfig need fields 'grid' and 'blocks' to be set." << std::endl;
6688 ROSE_ASSERT(config);
6697 ROSE_ASSERT(lhs != NULL);
6698 ROSE_ASSERT(rhs != NULL);
6703 ROSE_ASSERT(assignOp);
6724 ROSE_ASSERT(lhs != NULL);
6725 ROSE_ASSERT(rhs != NULL);
6730 ROSE_ASSERT(assignOp);
6757 ROSE_ASSERT(labelstmt);
6777 ASSERT_not_null(labelStmt);
6780 if (stmt !=
nullptr) {
6794 ROSE_ASSERT(conditional);
6795 ROSE_ASSERT(true_body);
6797 ROSE_ASSERT(ifstmt);
6802 ifstmt->setCaseInsensitive(
true);
6807 if (false_body != NULL) false_body->
set_parent(ifstmt);
6817 if (isSgBasicBlock(true_body)|| isSgFortranDo(true_body)|| isSgIfStmt(true_body))
6830 ROSE_ASSERT(ifstmt);
6845 ASSERT_not_null(result);
6848 result->setCaseInsensitive(
true);
6855 increment->set_parent(result);
6869 ASSERT_not_null(result);
6872 result->setCaseInsensitive(
true);
6879 increment->set_parent(result);
6902 ROSE_ASSERT(forInit != NULL);
6904 ROSE_ASSERT(statement != NULL);
6905 forInit->append_init_stmt(statement);
6919 (*it)->set_parent(result);
6934 (*it)->set_parent(result);
6948 ROSE_ASSERT(result);
6951 result->setCaseInsensitive(
true);
6959 increment->set_parent(result);
6963 result->set_else_body(else_body);
6978 for_init_stmt->set_parent(result);
6983 ROSE_ASSERT(init_stmt);
6997 if (initialize_stmt)
6999 init_stmt->append_init_stmt(initialize_stmt);
7002 if (isSgVariableDeclaration(initialize_stmt))
7020 ROSE_ASSERT(result);
7025 result->setCaseInsensitive(
true);
7029 if (loop_body) loop_body->
set_parent(result);
7030 if (increment) increment->set_parent(result);
7031 if (else_body) else_body->
set_parent(result);
7033 result->set_else_body(else_body);
7035 if (initialize_stmt != NULL)
7038 ROSE_ASSERT(init_stmt);
7040 init_stmt->append_init_stmt(initialize_stmt);
7052 ROSE_ASSERT(result != NULL);
7068 ROSE_ASSERT(result != NULL);
7077 if (result->get_test() != NULL && test != result->get_test())
7079 delete result->get_test();
7080 result->set_test(NULL);
7083 if (result->get_increment() != NULL && increment != result->get_increment())
7085 delete result->get_increment();
7086 result->set_increment(NULL);
7095 if (result->get_else_body() != NULL && else_body != result->get_else_body())
7097 delete result->get_else_body();
7098 result->set_else_body(NULL);
7102 result->set_test(test);
7103 result->set_increment(increment);
7107 result->setCaseInsensitive(
true);
7111 if (loop_body) loop_body->
set_parent(result);
7112 if (increment) increment->set_parent(result);
7113 if (init_stmt) init_stmt->
set_parent(result);
7114 if (else_body) else_body->
set_parent(result);
7116 result->set_else_body(else_body);
7119 ROSE_ASSERT(result->get_test() != NULL);
7120 ROSE_ASSERT(result->get_increment() != NULL);
7144 ROSE_ASSERT(result != NULL);
7148 if (initializer != NULL) initializer->
set_parent(result);
7149 if (range != NULL) range->
set_parent(result);
7151 if (begin_declaration != NULL) begin_declaration->
set_parent(result);
7152 if (end_declaration != NULL) end_declaration->
set_parent(result);
7154 if (not_equal_expression != NULL) not_equal_expression->
set_parent(result);
7155 if (increment_expression != NULL) increment_expression->
set_parent(result);
7171 ASSERT_not_null(result);
7172 ASSERT_not_null(body);
7173 ASSERT_not_null(condition);
7175 ASSERT_require(result->
get_body() ==
nullptr);
7186 ASSERT_not_null(result->
get_body());
7200 ROSE_ASSERT(result);
7203 if (loop_body) loop_body->
set_parent(result);
7204 if (increment) increment->set_parent(result);
7207 if (initialize_stmt != NULL) {
7209 ROSE_ASSERT(init_stmt);
7211 init_stmt->append_init_stmt(initialize_stmt);
7222 ROSE_ASSERT(result);
7227 result->setCaseInsensitive(
true);
7231 if (loop_body) loop_body->
set_parent(result);
7232 if (increment) increment->set_parent(result);
7234 if (init_stmt) init_stmt->
set_parent(result);
7297 ROSE_ASSERT(condition);
7300 ROSE_ASSERT(result);
7305 result->setCaseInsensitive(
true);
7312 if (else_body != NULL) {
7313 result->set_else_body(else_body);
7325 ROSE_ASSERT(result);
7330 result->setCaseInsensitive(
true);
7333 if (condition) condition->
set_parent(result);
7337 if (else_body != NULL)
7339 result->set_else_body(else_body);
7353 ROSE_ASSERT(expr != NULL && body != NULL);
7364 ROSE_ASSERT(expr != NULL && body != NULL);
7375 ROSE_ASSERT(condition);
7378 ROSE_ASSERT(result);
7388 ROSE_ASSERT(result);
7390 if (condition) condition->
set_parent(result);
7400 ROSE_ASSERT(result != NULL);
7411 ROSE_ASSERT(result);
7419 ROSE_ASSERT(result);
7427 ASSERT_not_null(result);
7435 ASSERT_not_null(result);
7443 ASSERT_not_null(result);
7451 ASSERT_not_null(result);
7459 ROSE_ASSERT(result);
7467 ROSE_ASSERT(result);
7474 SgDeleteExp *result =
new SgDeleteExp(target, is_array, need_global_specifier, deleteOperatorDeclaration);
7475 target->set_parent(result);
7482 SgDeleteExp *result =
new SgDeleteExp(target, is_array, need_global_specifier, deleteOperatorDeclaration);
7483 target->set_parent(result);
7491 ROSE_ASSERT(test != NULL);
7504 ROSE_ASSERT(result);
7508 markLhsValues(result);
7518 ROSE_ASSERT(test != NULL);
7520 if (exceptionArgument != NULL) {
7521 result -> set_exception_argument(exceptionArgument);
7531 ROSE_ASSERT(test != NULL);
7539 ROSE_ASSERT(value != NULL);
7548 ROSE_ASSERT(value != NULL);
7557 ROSE_ASSERT(key != NULL && datum != NULL);
7567 ROSE_ASSERT(key != NULL && datum != NULL);
7578 ROSE_ASSERT(result);
7579 for (
size_t i = 0; i < pairs.size(); ++i)
7580 result->append_pair(pairs[i]);
7588 ROSE_ASSERT(result);
7589 for (
size_t i = 0; i < pairs.size(); ++i)
7590 result->append_pair(pairs[i]);
7598 ROSE_ASSERT(target != NULL);
7599 ROSE_ASSERT(iter != NULL);
7601 ROSE_ASSERT(result);
7603 target->set_parent(result);
7614 ROSE_ASSERT(target != NULL);
7615 ROSE_ASSERT(iter != NULL);
7617 ROSE_ASSERT(result);
7618 target->set_parent(result);
7628 ROSE_ASSERT(elt != NULL);
7629 ROSE_ASSERT(generators != NULL);
7640 ROSE_ASSERT(elt != NULL);
7641 ROSE_ASSERT(generators != NULL);
7652 ROSE_ASSERT(elt != NULL);
7653 ROSE_ASSERT(generators != NULL);
7664 ROSE_ASSERT(elt != NULL);
7665 ROSE_ASSERT(generators != NULL);
7676 ROSE_ASSERT(kd_pair != NULL);
7677 ROSE_ASSERT(generators != NULL);
7688 ROSE_ASSERT(kd_pair != NULL);
7689 ROSE_ASSERT(generators != NULL);
7699 ROSE_ASSERT(arg != NULL);
7708 ROSE_ASSERT(arg != NULL);
7722 ROSE_ASSERT(pragma);
7727 ROSE_ASSERT(result);
7749 ROSE_ASSERT(result);
7759 ROSE_ASSERT(emptyDeclaration != NULL);
7772 ROSE_ASSERT(emptyDeclaration->
get_parent() != NULL);
7775 return emptyDeclaration;
7782 ROSE_ASSERT(result);
7787 result->setCaseInsensitive(
true);
7807 ROSE_ASSERT(result);
7813 result->setCaseInsensitive(
true);
7819 printf (
"In buildBasicBlock_nfi(): returning result = %p \n",result);
7831 printf (
"In buildBasicBlock_nfi(const vector<SgStatement*>& stmts): returning result = %p \n",result);
7835 printf (
"Exiting as a test! \n");
7858 ROSE_ASSERT(result);
7867 ROSE_ASSERT (symbol != NULL);
7873 result->set_label_expression(l_exp);
7878 ROSE_ASSERT (l_stmt != NULL);
7881 ROSE_ASSERT(result);
7889 ROSE_ASSERT(result);
7900 result->set_selector_expression(label_expression);
7901 ROSE_ASSERT(result);
7913 if (expression == NULL)
7918 ROSE_ASSERT(result);
7919 if (expression != NULL) expression->
set_parent(result);
7928 ROSE_ASSERT(result);
7929 if (expression != NULL) expression->
set_parent(result);
7937 ROSE_ASSERT(result);
7947 ROSE_ASSERT(result);
7957 ROSE_ASSERT(result);
7962 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7963 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7964 printf (
"SageBuilder::buildDefaultOptionStmt() body = %p \n",body);
7965 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7966 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7975 ROSE_ASSERT(result);
7980 static int count = 0;
7982 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7983 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7984 printf (
"SageBuilder::buildDefaultOptionStmt_nfi() body = %p \n",body);
7985 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7986 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7990 printf (
"Exiting as a test! \n");
8002 ROSE_ASSERT(result);
8007 result->setCaseInsensitive(
true);
8010 if (item_selector) item_selector->
set_parent(result);
8019 ROSE_ASSERT(result);
8024 result->setCaseInsensitive(
true);
8027 if (item_selector) item_selector->
set_parent(result);
8042 ROSE_ASSERT(result);
8052 ROSE_ASSERT(result);
8061 if (locals != NULL && globals == NULL)
8062 ROSE_ASSERT(!
"buildExecStatement with non-NULL locals requires non-NULL globals");
8063 ROSE_ASSERT(executable != NULL);
8067 if (globals != NULL) globals->
set_parent(result);
8068 if (locals != NULL) locals->
set_parent(result);
8078 if (locals != NULL && globals == NULL)
8079 ROSE_ASSERT(!
"buildExecStatement with non-NULL locals requires non-NULL globals");
8080 ROSE_ASSERT(executable != NULL);
8084 if (globals != NULL) globals->
set_parent(result);
8085 if (locals != NULL) locals->
set_parent(result);
8094 ROSE_ASSERT(body != NULL);
8096 ROSE_ASSERT(async_stmt);
8106 ROSE_ASSERT(body != NULL);
8108 ROSE_ASSERT(finish_stmt);
8118 ROSE_ASSERT(expression);
8131 ROSE_ASSERT(body != NULL);
8133 ROSE_ASSERT(atomic_stmt);
8143 ROSE_ASSERT(expression);
8156 ROSE_ASSERT(expression);
8169 ROSE_ASSERT(expression);
8201 ROSE_ASSERT(body != NULL);
8220 if (catch0 != NULL) try_stmt->append_catch_statement(catch0);
8221 if (catch1 != NULL) try_stmt->append_catch_statement(catch1);
8222 if (catch2 != NULL) try_stmt->append_catch_statement(catch2);
8223 if (catch3 != NULL) try_stmt->append_catch_statement(catch3);
8224 if (catch4 != NULL) try_stmt->append_catch_statement(catch4);
8241 ROSE_ASSERT(try_body != NULL);
8243 try_body -> set_parent(try_stmt);
8249 try_stmt -> set_finally_body(finally_body);
8250 finally_body -> set_parent(try_stmt);
8264 if (catch_option_stmt) {
8265 catch_statement_sequence -> append_catch_statement(catch_option_stmt);
8266 catch_option_stmt -> set_parent(catch_statement_sequence);
8269 return catch_statement_sequence;
8276 if (condition) condition->
set_parent(result);
8284 ROSE_ASSERT(expression);
8299 ROSE_ASSERT(throw_stmt);
8311 ROSE_ASSERT(foreach_stmt);
8313 if (collection) collection -> set_parent(foreach_stmt);
8314 if (body) body -> set_parent(foreach_stmt);
8316 return foreach_stmt;
8322 ROSE_ASSERT(label_stmt);
8326 stmt -> set_parent(label_stmt);
8332 ROSE_ASSERT(lsymbol);
8333 label_stmt -> insert_symbol(lsymbol ->
get_name(), lsymbol);
8383 ROSE_ASSERT(result);
8384 result->set_assemblyCode(s);
8395 ROSE_ASSERT(result);
8396 result->set_assemblyCode(s);
8406#define NOP_1_BYTE_STRING "nop"
8407#define NOP_2_BYTE_STRING ".byte 0x66,0x90"
8408#define NOP_3_BYTE_STRING "nopl (%eax)"
8409#define NOP_4_BYTE_STRING "nopl 0x01(%eax)"
8410#define NOP_5_BYTE_STRING ".byte 0x0f,0x1f,0x44,0x00,0x00"
8411#define NOP_6_BYTE_STRING ".byte 0x66,0x0f,0x1f,0x44,0x00,0x00"
8412#define NOP_7_BYTE_STRING ".byte 0x0f,0x1f,0x80,0x00,0x00,0x00,0x00"
8413#define NOP_8_BYTE_STRING ".byte 0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00"
8414#define NOP_9_BYTE_STRING ".byte 0x66,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00"
8434 printf (
"Only supporting values of multi-byte nop's up to 9 bytes long. \n");
8439 return nopStatement;
8446 ROSE_ASSERT(condition != NULL);
8449 ROSE_ASSERT(result != NULL);
8466 ROSE_ASSERT(result != NULL);
8498 if (isSgReferenceType (base_type))
8500 cerr<<
"Error in SageBuilder::buildPointerType(): trying to build a pointer to a reference type! This is not allowed in C++."<<endl;
8505 ROSE_ASSERT(result != NULL);
8519 ROSE_ASSERT(result != NULL);
8526 ROSE_ASSERT(base_type != NULL);
8528 ROSE_ASSERT(result != NULL);
8535 ROSE_ASSERT(base_expression != NULL);
8539 if (isSgFunctionParameterRefExp(base_expression) != NULL)
8542 result->set_base_type(base_type);
8549 ROSE_ASSERT(result != NULL);
8562#define DEBUG_TYPEOF_TYPE 0
8564#if DEBUG_TYPEOF_TYPE
8565 printf (
"In SageBuilder::buildTypeOfType(): base_expression = %p = %s \n",base_expression,base_expression != NULL ? base_expression->
class_name().c_str() :
"NULL");
8566 printf (
" ------------------------------- base_type = %p = %s \n",base_type,base_type != NULL ? base_type->
class_name().c_str() :
"NULL");
8570 if (isSgFunctionParameterRefExp(base_expression) != NULL)
8572#if DEBUG_TYPEOF_TYPE
8573 printf (
"In SageBuilder::buildTypeOfType(): isSgFunctionParameterRefExp(base_expression) != NULL: calling new SgTypeOfType(base_expression,NULL) \n");
8578 ROSE_ASSERT(result != NULL);
8579#if DEBUG_TYPEOF_TYPE
8580 printf (
"In buildTypeOfType(): test 1: result = %p = %s \n",result,result->class_name().c_str());
8582 result->set_base_type(base_type);
8586 if (base_expression != NULL)
8588#if DEBUG_TYPEOF_TYPE
8589 printf (
"In SageBuilder::buildTypeOfType(): isSgFunctionParameterRefExp(base_expression) == NULL: base_expression != NULL: calling SgTypeOfType::createType(base_expression,NULL) \n");
8594 ROSE_ASSERT(result != NULL);
8595#if DEBUG_TYPEOF_TYPE
8596 printf (
"In buildTypeOfType(): test 2: result = %p = %s \n",result,result->class_name().c_str());
8601 ROSE_ASSERT(base_type != NULL);
8603#if DEBUG_TYPEOF_TYPE
8604 printf (
"In SageBuilder::buildTypeOfType(): isSgFunctionParameterRefExp(base_expression) == NULL: base_expression == NULL: calling SgTypeOfType::createType(base_type,NULL) \n");
8609 ROSE_ASSERT(result != NULL);
8611#if DEBUG_TYPEOF_TYPE
8612 printf (
"In buildTypeOfType(): test 3: result = %p = %s \n",result,result->class_name().c_str());
8615 if (result->get_base_type() != base_type)
8617 ROSE_ASSERT(result->get_base_type() != NULL);
8618#if DEBUG_TYPEOF_TYPE
8619 printf (
"result->get_base_type() = %p = %s \n",result->get_base_type(),result->get_base_type()->class_name().c_str());
8621 ROSE_ASSERT(base_type != NULL);
8622#if DEBUG_TYPEOF_TYPE
8623 printf (
"base_type = %p = %s \n",base_type,base_type->
class_name().c_str());
8629 ROSE_ASSERT(result != NULL);
8631 if (base_expression != NULL)
8637 ROSE_ASSERT(result != NULL);
8639#if DEBUG_TYPEOF_TYPE
8640 printf (
"In buildTypeOfType(): test 4: result = %p = %s \n",result,result->class_name().c_str());
8654 printf (
"Error: this function SageBuilder::buildModifierType() should not be called! (call the buildConst() function (or whatever other function is required) directly \n");
8661 ROSE_ASSERT(result != NULL);
8666 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
8675 ROSE_ASSERT(result);
8676 if (kind_expr != NULL) kind_expr->
set_parent(result);
8686 ROSE_ASSERT(result);
8693 ROSE_ASSERT(result);
8698#define BUILD_SGTYPE_DEF(item) \
8699 SgType##item * SageBuilder::build##itemType() { \
8700 SgType##item * result =SgType##item::createType(); \
8701 ROSE_ASSERT(result); \
8705 BUILD_SGTYPE_DEF(Bool)
8706 BUILD_SGTYPE_DEF(Char)
8707 BUILD_SGTYPE_DEF(Double)
8708 BUILD_SGTYPE_DEF(Float)
8709 BUILD_SGTYPE_DEF(Int)
8710 BUILD_SGTYPE_DEF(Long)
8711 BUILD_SGTYPE_DEF(LongDouble)
8712 BUILD_SGTYPE_DEF(LongLong)
8713 BUILD_SGTYPE_DEF(Short)
8714 BUILD_SGTYPE_DEF(Void)
8716 BUILD_SGTYPE_DEF(Wchar)
8719 BUILD_SGTYPE_DEF(Char16)
8720 BUILD_SGTYPE_DEF(Char32)
8722 BUILD_SGTYPE_DEF(SignedChar)
8723 BUILD_SGTYPE_DEF(SignedInt)
8724 BUILD_SGTYPE_DEF(SignedLong)
8725 BUILD_SGTYPE_DEF(SignedShort)
8726 BUILD_SGTYPE_DEF(UnsignedChar)
8727 BUILD_SGTYPE_DEF(UnsignedInt)
8728 BUILD_SGTYPE_DEF(UnsignedLong)
8729 BUILD_SGTYPE_DEF(UnsignedLongLong)
8730 BUILD_SGTYPE_DEF(UnsignedShort)
8731#undef BUILD_SGTYPE_DEF
8736 ROSE_ASSERT(result);
8743 ROSE_ASSERT(result);
8750 ROSE_ASSERT(result);
8757 ROSE_ASSERT(result);
8765 ROSE_ASSERT(result);
8766 if (kind_expr != NULL) kind_expr->
set_parent(result);
8777 ROSE_ASSERT(result);
8783 ROSE_ASSERT(result);
8789 ROSE_ASSERT(result);
8796 ROSE_ASSERT(result);
8803 ROSE_ASSERT(result);
8810 ROSE_ASSERT(result);
8817 ROSE_ASSERT(result);
8825 ROSE_ASSERT(result);
8832 ROSE_ASSERT(result);
8841 ROSE_ASSERT(result);
8849 ROSE_ASSERT(result);
8857 ROSE_ASSERT(result);
8865 ROSE_ASSERT(result);
8872 ROSE_ASSERT(result);
8879 ROSE_ASSERT(result);
8886 ROSE_ASSERT(result);
8893 ROSE_ASSERT(result);
8900 ROSE_ASSERT(result);
8907 ROSE_ASSERT(result);
8919 ROSE_ASSERT(result != NULL);
8934 SgTypeString* result = SgTypeString::createType(stringLengthExpression);
8935 ASSERT_not_null(result);
8943 if (kind_expr != NULL)
8952 ASSERT_not_null(result);
8963 ROSE_ASSERT(result);
8971 if (kind_expr != NULL)
8980 ASSERT_not_null(result);
8986 ASSERT_not_null(result);
8994 ROSE_ASSERT(result);
9017 ROSE_ASSERT(base_type != NULL);
9021 ROSE_ASSERT(result != NULL);
9024 ROSE_ASSERT(result != base_type);
9029 SgModifierType* result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9031 if (result != result2)
9034 printf (
"WARNING: In SageBuilder::buildModifierType(): using previously build SgModifierType from global type table: result2 = %p = %s \n",result2,result2->
class_name().c_str());
9039 ROSE_ASSERT(result2 != base_type);
9048 ROSE_ASSERT(base_type != NULL);
9052 ROSE_ASSERT(result!=NULL);
9058 SgModifierType *result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9060 if (result != result2)
9066 ROSE_ASSERT(result2 != base_type);
9076 ROSE_ASSERT(base_type != NULL);
9079 ROSE_ASSERT(result != NULL);
9081 result->set_type_kind(kindExpression);
9084 printf (
"In SageBuilder::buildFortranKindType(): 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);
9089 if (result != result2)
9093 printf (
"(debugging) In SageBuilder::buildFortranKindType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9107 ROSE_ASSERT(base_type != NULL);
9110 ROSE_ASSERT(result!=NULL);
9115 printf (
"In SageBuilder::buildVolatileType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9121 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9122 if (result != result2)
9126 printf (
"(debugging) In SageBuilder::buildVolatileType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9140 ROSE_ASSERT(base_type != NULL);
9143 ROSE_ASSERT(result!=NULL);
9149 printf (
"In SageBuilder::buildConstVolatileType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9155 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9156 if (result != result2)
9160 printf (
"(debugging) In SageBuilder::buildConstVolatileType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9170generate_type_list (
SgType* type)
9173 string returnString;
9175 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);
9177 SgType* currentType = type;
9186 while (currentType != NULL)
9190 printf (
"In generate_type_list(): returnString = %s \n",returnString.c_str());
9192 if ( (bit_array & SgType::STRIP_MODIFIER_TYPE) && (modType = isSgModifierType(currentType)) )
9194 currentType = modType->get_base_type();
9196 else if ( (bit_array & SgType::STRIP_REFERENCE_TYPE) && (refType = isSgReferenceType(currentType)) )
9198 currentType = refType->get_base_type();
9200 else if ( (bit_array & SgType::STRIP_RVALUE_REFERENCE_TYPE) && (rRefType = isSgRvalueReferenceType(currentType)) )
9202 currentType = rRefType->get_base_type();
9204 else if ( (bit_array & SgType::STRIP_POINTER_TYPE) && (pointType = isSgPointerType(currentType)) )
9206 currentType = pointType->get_base_type();
9208 else if ( (bit_array & SgType::STRIP_ARRAY_TYPE) && (arrayType = isSgArrayType(currentType)) )
9210 currentType = arrayType->get_base_type();
9212 else if ( (bit_array & SgType::STRIP_TYPEDEF_TYPE) && (typedefType = isSgTypedefType(currentType)) )
9222 returnString +=
" , ";
9225 return returnString;
9232 ROSE_ASSERT(base_type != NULL);
9239 if (!isSgPointerType(base_type) && !isSgReferenceType(base_type) && !isSgArrayType(base_type) && !isSgTypedefType(base_type) && !isSgModifierType(base_type))
9241 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());
9242 printf (
" --- generate_type_list() = %s \n",generate_type_list(base_type).c_str());
9247 ROSE_ASSERT(result!=NULL);
9252 printf (
"In SageBuilder::buildRestrictType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9258 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9259 if (result != result2)
9263 printf (
"(debugging) In SageBuilder::buildRestrictType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9279 ASSERT_not_null(base_type);
9283 setModifiers(result);
9285 SgModifierType* result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9286 if (result != result2)
delete result;
9297 return _buildModifierType(base_type, op);
9304 return _buildModifierType(base_type, op);
9313 ROSE_ASSERT(base_type != NULL);
9316 ROSE_ASSERT(result!=NULL);
9321 printf (
"In SageBuilder::buildUpcStrictType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9327 SgModifierType *result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9328 if (result != result2)
9332 printf (
"(debugging) In SageBuilder::buildUpcStrictType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9346 ROSE_ASSERT(base_type != NULL);
9349 ROSE_ASSERT(result!=NULL);
9354 printf (
"In SageBuilder::buildUpcRelaxedType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9360 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9361 if (result != result2)
9365 printf (
"(debugging) In SageBuilder::buildUpcRelaxedType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9379 ROSE_ASSERT(base_type != NULL);
9382 ROSE_ASSERT(result!=NULL);
9391 printf (
"In SageBuilder::buildUpcSharedType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9397 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9398 if (result != result2)
9402 printf (
"(debugging) In SageBuilder::buildUpcSharedType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9416 ROSE_ASSERT(base_type != NULL);
9419 ROSE_ASSERT(result!=NULL);
9424 printf (
"In SageBuilder::buildUpcBlockIndefiniteType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9430 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
9440 ROSE_ASSERT(base_type != NULL);
9443 ROSE_ASSERT(result!=NULL);
9448 printf (
"In SageBuilder::buildUpcBlockStarType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9454 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
9464 ROSE_ASSERT(base_type != NULL);
9467 ROSE_ASSERT(result!=NULL);
9472 printf (
"In SageBuilder::buildUpcBlockNumberType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9478 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
9489 ROSE_ASSERT(base_type != NULL);
9492 ROSE_ASSERT(result!=NULL);
9500 ROSE_ASSERT(base_type != NULL);
9503 ROSE_ASSERT(result!=NULL);
9511 ROSE_ASSERT(result != NULL);
9519 ROSE_ASSERT(result != NULL);
9521 if(t1) result->append_type(t1);
9522 if(t2) result->append_type(t2);
9523 if(t3) result->append_type(t3);
9524 if(t4) result->append_type(t4);
9525 if(t5) result->append_type(t5);
9526 if(t6) result->append_type(t6);
9527 if(t7) result->append_type(t7);
9528 if(t8) result->append_type(t8);
9529 if(t9) result->append_type(t9);
9530 if(t10) result->append_type(t10);
9541 nrdecl->set_is_template_param (
true);
9542 return nrdecl->get_type();
9549 ROSE_ASSERT(result != NULL);
9551 result->append(start);
9559 ROSE_ASSERT(result != NULL);
9561 result->set_start(start);
9564 result->set_end(end);
9567 result->set_stride(stride);
9578 result->append_expression(firstRow);
9579 ROSE_ASSERT(result != NULL);
9589 ROSE_ASSERT(result != NULL);
9599 ROSE_ASSERT (result != NULL);
9600 result->set_modifier (mtype);
9633 ROSE_ASSERT(expr != NULL);
9645 ROSE_ASSERT(expr != NULL);
9656 ROSE_ASSERT(expr != NULL);
9659 if (lambda_capture_list != NULL)
9664 if (lambda_closure_class != NULL)
9669 if (lambda_function != NULL)
9674 if (lambda_closure_class != NULL)
9676 lambda_function->
set_parent(lambda_closure_class);
9680 printf (
"Warning: In SageBuilder::buildLambdaExp(): lambda_closure_class == NULL: lambda_function parent not set! \n");
9693 ROSE_ASSERT(expr != NULL);
9696 if (lambda_capture_list != NULL)
9701 if (lambda_closure_class != NULL)
9706 if (lambda_function != NULL)
9711 if (lambda_closure_class != NULL)
9713 lambda_function->
set_parent(lambda_closure_class);
9717 printf (
"Warning: In SageBuilder::buildLambdaExp(): lambda_closure_class == NULL: lambda_function parent not set! \n");
9731 ROSE_ASSERT(lambdaCapture != NULL);
9734 return lambdaCapture;
9741 ROSE_ASSERT(lambdaCapture != NULL);
9744 return lambdaCapture;
9751 ROSE_ASSERT(lambdaCapture != NULL);
9754 return lambdaCapture;
9761 ROSE_ASSERT(lambdaCapture != NULL);
9764 return lambdaCapture;
9772 ROSE_ASSERT(lambdaCaptureList != NULL);
9775 return lambdaCaptureList;
9782 ROSE_ASSERT(lambdaCaptureList != NULL);
9785 return lambdaCaptureList;
9793 ROSE_ASSERT(result != NULL);
9803 ROSE_ASSERT(result != NULL);
9814 ROSE_ASSERT(result != NULL);
9823 ROSE_ASSERT(result != NULL);
9834 ROSE_ASSERT(result != NULL);
9844 ROSE_ASSERT(result != NULL);
9866 ROSE_ASSERT(result);
9879 return nonreal_decl_scope;
9890 ROSE_ASSERT(buildTemplateInstantiation ==
false || isSgTemplateInstantiationDecl(d) != NULL);
9899 ROSE_ASSERT(result);
9905 result->setCaseInsensitive(
true);
9923 ROSE_ASSERT(buildTemplateInstantiation ==
false || isSgTemplateInstantiationDecl(d) != NULL);
9932 ROSE_ASSERT(result);
9937 result->setCaseInsensitive(
true);
9947 SgName nameWithoutTemplateArguments = XXX_name;
9949 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
9954#define DEBUG_NONDEFINING_CLASS_DECLARATION 0
9957#if DEBUG_NONDEFINING_CLASS_DECLARATION
9958 printf (
"Building a SgClassDeclaration: buildNondefiningClassDeclaration_nfi() nameWithoutTemplateArguments = %s buildTemplateInstantiation = %s \n",nameWithoutTemplateArguments.str(),buildTemplateInstantiation ?
"true:" :
"false");
9959 printf (
" --- scope = %p = %s \n",scope,(scope != NULL) ? scope->
class_name().c_str() :
"null");
9966 if (buildTemplateInstantiation ==
true)
9968 ROSE_ASSERT(templateArgumentsList != NULL);
9971#if DEBUG_NONDEFINING_CLASS_DECLARATION
9972 printf (
"Building a SgClassDeclaration: buildNondefiningClassDeclaration_nfi() nameWithTemplateArguments = %s buildTemplateInstantiation = %s \n",nameWithTemplateArguments.str(),buildTemplateInstantiation ?
"true:" :
"false");
9976 SgTemplateArgumentPtrList emptyList;
9979#if DEBUG_NONDEFINING_CLASS_DECLARATION
9980 printf (
"In buildNondefiningClassDeclaration_nfi(): built new SgTemplateInstantiationDecl: nondefdecl = %p \n",nondefdecl);
9982 ROSE_ASSERT(nondefdecl->get_type() == NULL);
9983 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl) != NULL);
9984#if DEBUG_NONDEFINING_CLASS_DECLARATION
9985 printf (
"In buildNondefiningClassDeclaration_nfi(): nondefdecl->get_name() = %s nondefdecl->get_templateName() = %s \n",
9986 nondefdecl->get_name().str(),isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().str());
9989 ROSE_ASSERT(templateArgumentsList != NULL);
9991#if DEBUG_NONDEFINING_CLASS_DECLARATION
9992 printf (
"nondefdecl->get_name() = %s \n",nondefdecl->get_name().str());
9993 printf (
"nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
9994 printf (
"Output templateArgumentsList: \n");
9995 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
9997 printf (
" --- --- templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
10003 ROSE_ASSERT(nondefdecl->get_name() == nameWithTemplateArguments);
10020 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
10024 ROSE_ASSERT((*templateArgumentsList)[i]->get_parent() != NULL);
10034 (*templateArgumentsList)[i]->set_parent(nondefdecl);
10038 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().is_null() ==
true);
10039 isSgTemplateInstantiationDecl(nondefdecl)->
set_templateName(nameWithoutTemplateArguments);
10045#if DEBUG_NONDEFINING_CLASS_DECLARATION
10046 printf (
"In buildNondefiningClassDeclaration_nfi(): built new SgClassDeclaration: nondefdecl = %p \n",nondefdecl);
10051 ROSE_ASSERT(nameWithoutTemplateArguments == nameWithTemplateArguments);
10054 ROSE_ASSERT(nondefdecl != NULL);
10057 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
10061 ROSE_ASSERT(nondefdecl->get_type() == NULL);
10066 if (nondefdecl->get_type() == NULL)
10073 printf (
"SageBuilder::buildNondefiningClassDeclaration_nfi(): (and setting source position) nondefdecl = %p \n",nondefdecl);
10098 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10105 ROSE_ASSERT(mysymbol != NULL);
10120 SgClassSymbol* mysymbol = scope->lookup_nontemplate_class_symbol(nameWithTemplateArguments,templateArgumentsList);
10122#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10123 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): mysymbol = %p = %s \n",mysymbol,(mysymbol != NULL) ? mysymbol->
class_name().c_str() :
"null");
10125 if (mysymbol != NULL)
10127 firstNondefdecl = isSgClassDeclaration(mysymbol->get_declaration());
10128 ROSE_ASSERT(firstNondefdecl != NULL);
10131 ROSE_ASSERT(firstNondefdecl->get_type() != NULL);
10134 ROSE_ASSERT(nondefdecl->get_type() == NULL);
10136 if (nondefdecl->get_type() == NULL)
10138#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10139 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);
10142#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10143 printf (
"NOTE: Call nondefdecl->set_type(firstNondefdecl->get_type()); instead of nondefdecl->set_type(SgClassType::createType(firstNondefdecl)); \n");
10148 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10150 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());
10153#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10154 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str());
10157 ROSE_ASSERT(nondefdecl->get_type() == firstNondefdecl->get_type());
10160#if (REUSE_CLASS_DECLARATION_FROM_SYMBOL == 0)
10161 ROSE_ASSERT(nondefdecl != NULL);
10162 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10168 printf (
"ERROR: In SgDeclarationStatement::set_firstNondefiningDeclaration(): nondefdecl = %p = %s IS NOT THE SAME AS firstNondefiningDeclaration = %p = %s \n",
10169 nondefdecl,nondefdecl->
class_name().c_str(),firstNondefdecl,firstNondefdecl->
class_name().c_str());
10171 nondefdecl->
get_file_info()->display(
"ERROR: In SgDeclarationStatement::set_firstNondefiningDeclaration(): nondefdecl: debug");
10173 firstNondefdecl->
get_file_info()->display(
"ERROR: In SgDeclarationStatement::set_firstNondefiningDeclaration(): firstNondefdecl: debug");
10185 ROSE_ASSERT(firstNondefdecl != NULL);
10186 ROSE_ASSERT(firstNondefdecl->get_type() != NULL);
10192 if (buildTemplateInstantiation ==
true)
10198 ROSE_ASSERT (nondefdecl->get_type() == firstNondefdecl->get_type());
10201 if (nondefdecl->get_type() != firstNondefdecl->get_type())
10204 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());
10205 printf (
"Skipping delete of %p so we can maintain unique type pointers \n",nondefdecl->get_type());
10207 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());
10208 nondefdecl->set_type(firstNondefdecl->get_type());
10211 printf (
"Unclear if this code is executed \n");
10218 ROSE_ASSERT(nondefdecl == NULL);
10225#if REUSE_CLASS_DECLARATION_FROM_SYMBOL
10234 ROSE_ASSERT(nondefdecl != NULL);
10235 if (nondefdecl->get_type() == NULL)
10238 printf (
"SageBuilder::buildNondefiningClassDeclaration_nfi(): nondefdecl = %p \n",nondefdecl);
10250 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
10253 firstNondefdecl = nondefdecl;
10256 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
10257 ROSE_ASSERT(mysymbol->get_declaration()->get_definition() == NULL);
10264 if (buildTemplateInstantiation ==
true)
10268#if DEBUG_NONDEFINING_CLASS_DECLARATION
10269 printf (
"BEFORE scope->insert_symbol(): scope = %p = %s nameWithTemplateArguments = %s mysymbol = %p = %s \n",
10270 scope,scope->
class_name().c_str(),nameWithTemplateArguments.str(),mysymbol,mysymbol->
class_name().c_str());
10277 ROSE_ASSERT(nondefdecl->get_type() == NULL);
10278 if (nondefdecl->get_type() == NULL)
10281 printf (
"In buildNondefiningClassDeclaration_nfi(): nondefdecl = %p = %s \n",nondefdecl,nondefdecl->
class_name().c_str());
10282 printf (
"In buildNondefiningClassDeclaration_nfi(): nondefdecl->get_firstNondefiningDeclaration() = %p \n",nondefdecl->
get_firstNondefiningDeclaration());
10286 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): built class type: part 2: nondefdecl->get_type() = %p = %s = %s \n",
10287 nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str(),nondefdecl->get_type()->
unparseToString().c_str());
10291#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10292 printf (
"NOTE: In buildNondefiningClassDeclaration_nfi(): 2nd time this is a performance issue (maybe) to call the lookup_nontemplate_class_symbol() again \n");
10302 SgClassSymbol* temp_classSymbol = nondefdecl->
get_scope()->lookup_nontemplate_class_symbol(nameWithTemplateArguments,templateArgumentsList);
10303#if DEBUG_NONDEFINING_CLASS_DECLARATION
10305 printf (
"In buildNondefiningClassDeclaration_nfi(): temp_classSymbol = %p \n",temp_classSymbol);
10306 printf (
"In buildNondefiningClassDeclaration_nfi(): nondefdecl->get_scope() = %p = %s scope = %p \n",nondefdecl->
get_scope(),nondefdecl->
get_scope()->
class_name().c_str(),scope);
10308 printf (
"In buildNondefiningClassDeclaration_nfi(): nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
10309 if (templateArgumentsList != NULL)
10311 printf (
" --- templateArgumentsList elements: \n");
10312 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
10314 printf (
" --- --- templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
10315 printf (
" --- --- templateArgumentsList->[%zu] = %s \n",i,templateArgumentsList->operator[](i)->class_name().c_str());
10316 templateArgumentsList->operator[](i)->
display(
"In SageBuilder::buildNondefiningClassDeclaration_nfi()");
10321 ROSE_ASSERT(nondefdecl->
get_scope()->lookup_class_symbol(nameWithTemplateArguments,templateArgumentsList) != NULL);
10322 ROSE_ASSERT(nondefdecl->
get_scope() == scope);
10326 ROSE_ASSERT(temp_classSymbol == NULL || temp_classSymbol->get_declaration()->get_definition() == NULL);
10329 ROSE_ASSERT(mysymbol != NULL);
10330 ROSE_ASSERT(firstNondefdecl != NULL);
10343 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10345 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10347#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10348 printf (
"NOTE: In buildNondefiningClassDeclaration_nfi(): 3rd time this is a performance issue (maybe) to call the lookup_nontemplate_class_symbol() again \n");
10358 SgClassSymbol* temp_classSymbol = nondefdecl->
get_scope()->lookup_nontemplate_class_symbol(nameWithTemplateArguments,templateArgumentsList);
10360 ROSE_ASSERT(temp_classSymbol == NULL || temp_classSymbol->get_declaration()->get_definition() == NULL);
10363 ROSE_ASSERT(nondefdecl != NULL);
10364 ROSE_ASSERT(nondefdecl->get_name() == nameWithTemplateArguments);
10367 if (isSgTemplateInstantiationDecl(nondefdecl) != NULL)
10371 ROSE_ASSERT(finalName == nameWithTemplateArguments);
10372 ROSE_ASSERT(finalName == nondefdecl->get_name());
10375#if DEBUG_NONDEFINING_CLASS_DECLARATION
10376 printf (
"Leaving buildNondefiningClassDeclaration_nfi(): nondefdecl = %p nondefdecl->unparseNameToString() = %s \n",nondefdecl,nondefdecl->unparseNameToString().c_str());
10377 printf (
" --- nondefdecl = %p = %s \n",nondefdecl,nondefdecl->
class_name().c_str());
10380#if DEBUG_NONDEFINING_CLASS_DECLARATION
10382 printf (
"Leaving buildNondefiningClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
10383 SgSymbol* test_symbol = nondefdecl->
get_scope()->find_symbol_from_declaration(nondefdecl);
10385 printf (
"test_symbol = %p \n",test_symbol);
10388 printf (
"Leaving buildNondefiningClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
10397 ROSE_ASSERT(stmt != NULL);
10409 ROSE_ASSERT(stmt != NULL);
10423 std::string directive_string(name);
10427 ROSE_ASSERT(scope);
10429 if (params.length() > 0)
10430 directive_string +=
" " + params;
10432 directive_string +=
" " + def_string;
10435 ROSE_ASSERT(define_decl);
10442 return define_decl;
10455 ASSERT_not_null(forStmt);
10461 forStmt->setCaseInsensitive(
true);
10480 ROSE_ASSERT(defdecl);
10483 classDef->set_declaration(defdecl);
10488 ROSE_ASSERT(nondefdecl);
10506 bool buildTemplateInstantiation =
false;
10526 SgDerivedTypeStatement* type_decl = buildClassDeclarationStatement_nfi <SgDerivedTypeStatement> (name, kind, scope);
10539 SgModuleStatement* module_stmt = buildClassDeclarationStatement_nfi <SgModuleStatement> (name, kind, scope);
10545 return module_stmt;
10553 SgJovialTableStatement* table_decl = buildClassDeclarationStatement_nfi <SgJovialTableStatement> (name, kind, scope);
10565 std::string type_name(name);
10568 type_name =
"_table_of_" + type_name;
10570 if (dim_info->get_expressions().size() > 0) {
10571 std::ostringstream address;
10572 address << (
void const *)dim_info;
10573 type_name +=
"_" + address.str();
10578 SgJovialTableStatement* table_decl = buildClassDeclarationStatement_nfi <SgJovialTableStatement> (type_name, kind, scope);
10586 ROSE_ASSERT(nondef_decl != NULL);
10590 ROSE_ASSERT(table_type != NULL);
10592 table_type->set_base_type(base_type);
10593 table_type->set_dim_info(dim_info);
10594 table_type->set_rank(dim_info->get_expressions().size());
10597 nondef_decl->set_type(table_type);
10603template <
class DeclClass> DeclClass *
10632 mysymbol = scope->lookup_class_symbol(name);
10634 if (mysymbol == NULL)
10637 if (nonDefiningDecl != NULL)
10641 ROSE_ASSERT(temp_mysymbol != NULL);
10643 mysymbol = isSgClassSymbol(temp_mysymbol);
10644 ROSE_ASSERT(mysymbol != NULL);
10647 ROSE_ASSERT(scope == nonDefiningDecl->
get_scope());
10652 if (mysymbol != NULL)
10654 nondefdecl = (mysymbol->get_declaration() == NULL)
10655 ? NULL : dynamic_cast<DeclClass*>(mysymbol->get_declaration());
10656 ROSE_ASSERT(nondefdecl != NULL);
10661 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
10666 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10667 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10672 DeclClass* nondefining_classDeclaration = (nondefdecl == NULL) ? NULL : dynamic_cast<DeclClass*>(nondefdecl);
10673 ROSE_ASSERT(nondefining_classDeclaration != NULL);
10675 ? NULL : dynamic_cast<DeclClass*>(nondefdecl->get_definingDeclaration());
10676 ROSE_ASSERT(defining_classDeclaration != NULL);
10678 return defining_classDeclaration;
10683 ROSE_ASSERT(nondefdecl == NULL);
10686 nondefdecl =
new DeclClass(name, kind, NULL, NULL);
10687 ROSE_ASSERT(nondefdecl != NULL);
10699 ROSE_ASSERT(scope != NULL);
10706 ROSE_ASSERT(nondefdecl->
get_scope() != NULL);
10707 ROSE_ASSERT(nondefdecl->get_type() == NULL);
10709 if (nondefdecl->get_type() == NULL)
10725 ROSE_ASSERT(class_type != NULL);
10727 nondefdecl->set_type(class_type);
10729 SgClassDeclaration* tmp_classDeclarationFromType = isSgClassDeclaration(class_type->get_declaration());
10730 ROSE_ASSERT(tmp_classDeclarationFromType != NULL);
10734 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10735 if (nondefdecl->get_type()->get_declaration() != nondefdecl)
10737 printf (
"ERROR: nondefdecl = %p = %s \n",nondefdecl,nondefdecl->
class_name().c_str());
10738 printf (
"ERROR: nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str());
10739 printf (
"ERROR: nondefdecl->get_type()->get_declaration() = %p = %s \n",nondefdecl->get_type()->get_declaration(),nondefdecl->get_type()->get_declaration()->
class_name().c_str());
10741 SgClassDeclaration* classDeclarationFromType = isSgClassDeclaration(nondefdecl->get_type()->get_declaration());
10742 ROSE_ASSERT(classDeclarationFromType != NULL);
10744 printf (
"nondefdecl->get_name() = %s \n",nondefdecl->get_name().str());
10745 printf (
"nondefdecl->get_type()->get_name() = %s \n",nondefdecl->get_type()->
get_name().str());
10746 printf (
"nondefdecl->get_type()->get_declaration()->get_name() = %s \n",classDeclarationFromType->get_name().str());
10748 printf (
"nondefdecl->get_mangled_name() = %s \n",nondefdecl->get_mangled_name().getString().c_str());
10749 printf (
"nondefdecl->get_type()->get_mangled() = %s \n",nondefdecl->get_type()->
get_mangled().getString().c_str());
10750 printf (
"nondefdecl->get_type()->get_declaration()->get_mangled_name() = %s \n",classDeclarationFromType->get_mangled_name().getString().c_str());
10753 printf (
"nondefdecl->get_type()->get_declaration()->get_firstNondefiningDeclaration() = %s \n",classDeclarationFromType->
get_firstNondefiningDeclaration() ?
"true" :
"false");
10763 ROSE_ASSERT(nondefdecl->get_type()->get_declaration() == nondefdecl);
10773#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
10775 if (SourcePositionClassificationMode != e_sourcePositionTransformation)
10777 detectTransformations(nondefdecl);
10788 ROSE_ASSERT(nondefdecl->
get_scope() == scope);
10801 DeclClass* defdecl =
new DeclClass(name,kind,NULL,classDef);
10802 ROSE_ASSERT(defdecl != NULL);
10803 ROSE_ASSERT(defdecl->get_type() == NULL);
10806 ROSE_ASSERT(defdecl->get_definition() != NULL);
10807 ROSE_ASSERT(defdecl != NULL);
10817 classDef->set_declaration(defdecl);
10818 defdecl->set_definingDeclaration(defdecl);
10820 defdecl->set_firstNondefiningDeclaration(nondefdecl);
10823 ROSE_ASSERT(defdecl->get_type() == NULL);
10830 if (defdecl->get_type() != NULL)
10837 ROSE_ASSERT (nondefdecl->get_type() != NULL);
10838 defdecl->set_type(nondefdecl->get_type());
10844 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10847 ROSE_ASSERT (nondefdecl->get_type() != NULL);
10850 ROSE_ASSERT (defdecl->get_type() != NULL);
10851 ROSE_ASSERT (defdecl->get_type()->get_declaration() != NULL);
10852 ROSE_ASSERT (defdecl->get_type()->get_declaration() != isSgDeclarationStatement(defdecl));
10857 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10867 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10873 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10878 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10888 ROSE_ASSERT(defdecl->get_parent() == NULL);
10893 ROSE_ASSERT(defdecl->get_definingDeclaration() == defdecl);
10894 ROSE_ASSERT(defdecl->get_firstNondefiningDeclaration() != defdecl->get_definingDeclaration());
10897 SgClassDeclaration* temp_firstNondefiningDeclaration = isSgClassDeclaration(defdecl->get_firstNondefiningDeclaration());
10898 SgClassDeclaration* temp_definingDeclaration = isSgClassDeclaration(defdecl->get_definingDeclaration());
10899 ROSE_ASSERT(temp_firstNondefiningDeclaration != NULL);
10900 ROSE_ASSERT(temp_definingDeclaration != NULL);
10903 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_name() == temp_definingDeclaration->get_name());
10904 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_type() == temp_definingDeclaration->get_type());
10908 printf (
"Leaving buildClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
10909 SgSymbol* test_symbol = nondefdecl->
get_scope()->find_symbol_from_declaration(nondefdecl);
10912 printf (
"Leaving buildClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
10947 ROSE_ASSERT(scope != NULL);
10958 ROSE_ASSERT(defdecl != NULL);
10962 printf (
"#################### SageBuilder::buildNamespaceDeclaration_nfi(): defdecl = %p = %s namespaceDef = %p \n",defdecl,defdecl->
get_name().str(),namespaceDef);
10969 namespaceDef->set_namespaceDeclaration(defdecl);
10984 mysymbol = scope->lookup_namespace_symbol(name);
10990 printf (
"Warning: In SageBuilder::buildNamespaceDeclaration_nfi(): scope == NULL \n");
10994 printf (
"In SageBuilder::buildNamespaceDeclaration_nfi(): mysymbol = %p \n",mysymbol);
10997 if (mysymbol != NULL)
11001 ROSE_ASSERT(namespaceDeclaration != NULL);
11002 nondefdecl = isSgNamespaceDeclarationStatement(namespaceDeclaration);
11004 ROSE_ASSERT(nondefdecl != NULL);
11005 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
11015 if (namespaceDeclaration->
get_definition()->get_global_definition() == NULL)
11017 printf (
"ERROR: namespaceDeclaration->get_definition()->get_global_definition() == NULL: namespaceDeclaration = %p = %s namespaceDeclaration->get_definition() = %p \n",
11020 ROSE_ASSERT(namespaceDeclaration->
get_definition()->get_global_definition() != NULL);
11021 namespaceDef->set_global_definition(namespaceDeclaration->
get_definition()->get_global_definition());
11022 ROSE_ASSERT(namespaceDef->get_global_definition() != NULL);
11025 ROSE_ASSERT(namespaceDef->get_global_definition() == namespaceDef->get_global_definition()->get_global_definition());
11027 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
11029 ROSE_ASSERT(nondefdecl->
get_definition()->get_previousNamespaceDefinition() == NULL);
11033 ROSE_ASSERT(i != NULL);
11034 while (i != NULL && i->get_nextNamespaceDefinition() != NULL)
11036 i = i->get_nextNamespaceDefinition();
11037 ROSE_ASSERT(i->get_previousNamespaceDefinition() != NULL);
11040 ROSE_ASSERT(i != NULL);
11041 i->set_nextNamespaceDefinition(namespaceDef);
11042 namespaceDef->set_previousNamespaceDefinition(i);
11050 nondefdecl = defdecl;
11051 ROSE_ASSERT(nondefdecl != NULL);
11053 ROSE_ASSERT(namespaceDef->get_namespaceDeclaration() != NULL);
11064 ROSE_ASSERT(nondefdecl != NULL);
11066 printf (
"In SageBuilder::buildNamespaceDeclaration_nfi(): Built namespace definition for nondefdecl = %p = %s definition = %p \n",nondefdecl,nondefdecl->
get_name().str(),namespaceDef);
11069 ROSE_ASSERT(namespaceDef->get_namespaceDeclaration() == NULL);
11070 namespaceDef->set_namespaceDeclaration(nondefdecl);
11071 ROSE_ASSERT(namespaceDef->get_namespaceDeclaration() != NULL);
11076 namespaceDef->set_global_definition(global_definition_namespaceDef);
11077 ROSE_ASSERT(namespaceDef->get_global_definition() != NULL);
11080 global_definition_namespaceDef->set_global_definition(global_definition_namespaceDef);
11082 global_definition_namespaceDef->set_isUnionOfReentrantNamespaceDefinitions(
true);
11085 ROSE_ASSERT(global_definition_namespaceDef->
get_parent() == NULL);
11086 global_definition_namespaceDef->
set_parent(defdecl);
11087 ROSE_ASSERT(global_definition_namespaceDef->
get_parent() != NULL);
11090 ROSE_ASSERT(global_definition_namespaceDef->get_namespaceDeclaration() == NULL);
11091 global_definition_namespaceDef->set_namespaceDeclaration(nondefdecl);
11092 ROSE_ASSERT(global_definition_namespaceDef->get_namespaceDeclaration() != NULL);
11095 global_definition_namespaceDef->set_namespaceDeclaration(nondefdecl);
11096 ROSE_ASSERT(global_definition_namespaceDef->get_namespaceDeclaration() != NULL);
11099 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() == NULL);
11101 defdecl->
get_definition()->set_global_definition(global_definition_namespaceDef);
11104 printf (
"In SageBuilder::buildNamespaceDeclaration_nfi(): defdecl->get_definition()->get_global_definition() = %p \n",defdecl->
get_definition()->get_global_definition());
11108 defdecl->
get_definition()->set_global_definition(global_definition_namespaceDef);
11112 ROSE_ASSERT(global_definition_namespaceDef == global_definition_namespaceDef->get_global_definition());
11114 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
11115 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() == namespaceDef->get_global_definition());
11117 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());
11150 printf (
"Warning: no scope provided to support symbol table entry! \n");
11154 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
11156 ROSE_ASSERT(nondefdecl->
get_definition()->get_previousNamespaceDefinition() == NULL);
11157 ROSE_ASSERT(nondefdecl->
get_definition()->get_nextNamespaceDefinition() == NULL);
11160 ROSE_ASSERT(nondefdecl != NULL);
11182 ROSE_ASSERT(mysymbol);
11215 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
11221 defdecl->
get_file_info()->display(
"In buildNamespaceDeclaration_nfi(): namespaceDeclaration: debug");
11234 result->get_operands().push_back(lhs);
11245 result->get_operands().push_back(lhs);
11256 result->get_operands().push_back(lhs);
11267 result->get_operands().push_back(lhs);
11307 printf (
"In buildNondefiningClassDeclaration(): name = %s scope = %p = %s \n",name.str(),scope,scope != NULL ? scope->
class_name().c_str() :
"NULL");
11322 mysymbol = scope->lookup_class_symbol(name,NULL);
11333 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
11336 if (mysymbol != NULL)
11338 nondefdecl = isSgClassDeclaration(mysymbol->get_declaration());
11340 ROSE_ASSERT(nondefdecl != NULL);
11349 ROSE_ASSERT(nondefdecl->get_type() != NULL);
11360 ROSE_ASSERT(nondefdecl != NULL);
11361 if (nondefdecl->get_type() == NULL)
11365 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());
11389 ROSE_ASSERT(nondefdecl->
get_scope() == NULL);
11394 ROSE_ASSERT(nondefdecl->
get_scope() != NULL);
11398 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());
11411 ROSE_ASSERT(nondefdecl->get_type() != NULL);
11414 ROSE_ASSERT(scope == NULL || (scope != NULL && nondefdecl->
get_scope() != NULL));
11417 ROSE_ASSERT(nondefdecl != NULL);
11430 printf (
"WARNING: This function for building defining class declarations has different semantics from that of the function to build defining function declarations. \n");
11433 printf (
"In buildDefiningClassDeclaration(): name = %s scope = %p = %s \n",name.str(),scope,scope != NULL ? scope->
class_name().c_str() :
"NULL");
11444 ROSE_ASSERT(nondefiningClassDeclaration != NULL);
11447 ROSE_ASSERT(definingClassDefinition != NULL);
11450 SgClassType* classType = nondefiningClassDeclaration->get_type();
11451 ROSE_ASSERT(classType != NULL);
11458 ROSE_ASSERT(definingClassDeclaration != NULL);
11465 definingClassDefinition->set_declaration(definingClassDeclaration);
11475 ROSE_ASSERT(definingClassDeclaration->get_definition() != NULL);
11477 ROSE_ASSERT(definingClassDeclaration->
get_scope() == NULL);
11480 definingClassDeclaration->
set_scope(scope);
11481 ROSE_ASSERT(definingClassDeclaration->
get_scope() != NULL);
11482 ROSE_ASSERT(nondefiningClassDeclaration->
get_scope() != NULL);
11485 ROSE_ASSERT(definingClassDeclaration->get_definition()->
get_parent() != NULL);
11488 ROSE_ASSERT(definingClassDeclaration->get_type() != NULL);
11490 return definingClassDeclaration;
11497 ROSE_ASSERT(scope != NULL);
11499 ROSE_ASSERT(definingClassDeclaration != NULL);
11501 return definingClassDeclaration;
11518#define DEBUG_CLASS_DECLARATION 0
11522 printf (
"WARNING: In SageBuilder::buildClassDeclaration_nfi(): the nonDefiningDecl pointer = %p (input parameter) does not appear to be used. \n",nonDefiningDecl);
11528 if (nonDefiningDecl != NULL)
11530 ROSE_ASSERT(nonDefiningDecl->get_type() != NULL);
11531 ROSE_ASSERT(nonDefiningDecl->get_type()->get_declaration() != NULL);
11532 printf (
"nonDefiningDecl->get_type() = %p = %s \n",nonDefiningDecl->get_type(),nonDefiningDecl->get_type()->
class_name().c_str());
11533 printf (
"nonDefiningDecl->get_type()->get_declaration() = %p = %s \n",nonDefiningDecl->get_type()->get_declaration(),nonDefiningDecl->get_type()->get_declaration()->
class_name().c_str());
11535 printf (
"In buildClassDeclaration_nfi(): nonDefiningDecl: unparseNameToString() = %s \n",nonDefiningDecl->unparseNameToString().c_str());
11546 bool buildTemplateDeclaration = (isSgTemplateClassDeclaration(nonDefiningDecl) != NULL);
11549 if (buildTemplateDeclaration ==
true)
11552 printf (
"ERROR: If buildTemplateDeclaration == true, then we should have called a different function to build the associated SgTemplateClassDeclaration \n");
11554 ROSE_ASSERT(buildTemplateDeclaration ==
false);
11557 printf (
"In SageBuilder::buildClassDeclaration_nfi(): XXX_name = %s \n",XXX_name.str());
11558 printf (
"In SageBuilder::buildClassDeclaration_nfi(): the nonDefiningDecl pointer = %p = %s \n",nonDefiningDecl,nonDefiningDecl != NULL ? nonDefiningDecl->
class_name().c_str() :
"null");
11559 printf (
"In SageBuilder::buildClassDeclaration_nfi(): buildTemplateDeclaration = %s \n",buildTemplateDeclaration ?
"true" :
"false");
11560 printf (
" --- templateArgumentsList = %p \n",templateArgumentsList);
11561 if (templateArgumentsList != NULL)
11563 printf (
" --- templateArgumentsList.size() = %zu \n",templateArgumentsList->size());
11564 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
11566 printf (
" --- --- argument pointer: templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
11575 printf (
"In SageBuilder::buildClassDeclaration_nfi(): no scope was provided so using the SageBuilder::topScopeStack() = %p = %s \n",scope,scope->
class_name().c_str());
11581 printf (
"In SageBuilder::buildClassDeclaration_nfi(): scope was provided scope = %p = %s \n",scope,scope->
class_name().c_str());
11586 printf (
"Building a SgClassDeclaration: buildClassDeclaration_nfi() XXX_name = %s buildTemplateInstantiation = %s \n",XXX_name.str(),buildTemplateInstantiation ?
"true" :
"false");
11596 SgName nameWithoutTemplateArguments = XXX_name;
11597 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
11598 if (buildTemplateInstantiation ==
true)
11600 ROSE_ASSERT(templateArgumentsList != NULL);
11604#if DEBUG_CLASS_DECLARATION
11605 printf (
"In SageBuilder::buildClassDeclaration_nfi():\n");
11606 printf (
" -- nameWithoutTemplateArguments = %s\n", nameWithoutTemplateArguments.str());
11607 printf (
" -- nameWithTemplateArguments = %s\n", nameWithTemplateArguments.str());
11620#if DEBUG_CLASS_DECLARATION
11621 printf (
"Looking up the SgClassSymbol in scope = %p = %s nameWithTemplateArguments = %s \n",scope,scope->
class_name().c_str(),nameWithTemplateArguments.str());
11632 printf (
"This was a redundant call to lookup_class_symbol \n");
11637 if (buildTemplateDeclaration ==
true)
11639#if DEBUG_CLASS_DECLARATION
11640 printf (
"Note: In SageBuilder::buildClassDeclaration_nfi(): Need to look up a template symbol \n");
11642 ROSE_ASSERT(nonDefiningDecl != NULL);
11644 SgTemplateParameterPtrList templateParameterList;
11645 SgTemplateArgumentPtrList templateSpecializationArgumentList;
11647 ROSE_ASSERT(scope->lookup_template_class_symbol(nameWithTemplateArguments,&templateParameterList,&templateSpecializationArgumentList) != NULL);
11649 mysymbol = scope->lookup_template_class_symbol(nameWithTemplateArguments,&templateParameterList,&templateSpecializationArgumentList);
11651 ROSE_ASSERT(mysymbol != NULL);
11653 printf (
"ERROR: Need to look up a template symbol \n");
11659#if DEBUG_CLASS_DECLARATION
11660 printf (
"In SageBuilder::buildClassDeclaration_nfi(): calling lookup_class_symbol(nameWithTemplateArguments = %s,templateArgumentsList->size() = %zu \n",
11661 nameWithTemplateArguments.str(),(templateArgumentsList != NULL) ? templateArgumentsList->size() : 999);
11662 if (templateArgumentsList != NULL)
11664 printf (
" --- templateArgumentsList elements: \n");
11665 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
11667 printf (
" --- --- templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
11668 printf (
" --- --- templateArgumentsList->[%zu] = %s \n",i,templateArgumentsList->operator[](i)->class_name().c_str());
11669 templateArgumentsList->operator[](i)->
display(
"In SageBuilder::buildClassDeclaration_nfi()");
11673 mysymbol = scope->lookup_class_symbol(nameWithTemplateArguments,templateArgumentsList);
11674#if DEBUG_CLASS_DECLARATION
11675 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
11678 if (mysymbol == NULL)
11680#if DEBUG_CLASS_DECLARATION
11681 printf (
"WARNING: scope->lookup_class_symbol(nameWithTemplateArguments = %s,templateArgumentsList->size() = %zu) == NULL \n",nameWithTemplateArguments.str(),templateArgumentsList->size());
11686#if DEBUG_CLASS_DECLARATION
11687 printf (
"Checking lookup_class_symbol() using nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
11689 ROSE_ASSERT(scope->lookup_class_symbol(nameWithoutTemplateArguments,templateArgumentsList) == NULL);
11691#if DEBUG_CLASS_DECLARATION
11692 printf (
"nonDefiningDecl = %p \n",nonDefiningDecl);
11694 if (nonDefiningDecl != NULL)
11696#if DEBUG_CLASS_DECLARATION
11697 printf (
"nonDefiningDecl = %p = %s \n",nonDefiningDecl,nonDefiningDecl->
class_name().c_str());
11701 ROSE_ASSERT(temp_mysymbol != NULL);
11703 mysymbol = isSgClassSymbol(temp_mysymbol);
11704 ROSE_ASSERT(mysymbol != NULL);
11707 ROSE_ASSERT(scope == nonDefiningDecl->
get_scope());
11715 if (mysymbol != NULL)
11717 SgClassDeclaration* symbol_declaration = isSgClassDeclaration(mysymbol->get_declaration());
11718 ROSE_ASSERT(symbol_declaration != NULL);
11719 ROSE_ASSERT(symbol_declaration->
get_scope() == scope);
11721 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Testing scope->get_symbol_table()->exists(mysymbol) == true (expensive) \n");
11735#if DEBUG_CLASS_DECLARATION
11736 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
11739 if (mysymbol != NULL)
11741 nondefdecl = isSgClassDeclaration(mysymbol->get_declaration());
11743 ROSE_ASSERT(nondefdecl != NULL);
11745#if DEBUG_CLASS_DECLARATION
11746 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol->get_declaration(): nondefdecl = %p = %s nondefdecl->get_definition() = %p = %s \n",
11747 nondefdecl,nondefdecl->class_name().c_str(),nondefdecl->get_definition(),
11748 nondefdecl->get_definition() != NULL ? nondefdecl->get_definition()->class_name().c_str() :
"NULL");
11753 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
11756 ROSE_ASSERT(nondefdecl == nondefdecl->get_firstNondefiningDeclaration());
11761#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11763 detectTransformations(nondefdecl);
11767 ROSE_ASSERT(nondefdecl->get_type() != NULL);
11770 if (nondefdecl->get_parent() == NULL)
11772#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11773 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Note that nondefdecl->get_parent() == NULL, this might be OK. \n");
11782 if (nondefdecl->get_definingDeclaration() != NULL)
11784#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11785 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",
11786 nondefdecl,nondefdecl->class_name().c_str(),nondefdecl->get_definingDeclaration(),nondefdecl->get_definingDeclaration()->class_name().c_str());
11788 SgClassDeclaration* nondefining_classDeclaration = isSgClassDeclaration(nondefdecl);
11789 ROSE_ASSERT(nondefining_classDeclaration != NULL);
11790 SgClassDeclaration* defining_classDeclaration = isSgClassDeclaration(nondefdecl->get_definingDeclaration());
11791 ROSE_ASSERT(defining_classDeclaration != NULL);
11793#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11794 printf (
"In SageBuilder::buildClassDeclaration_nfi(): nondefining_classDeclaration: scope = %p = %s name = %s \n",
11795 nondefining_classDeclaration->
get_scope(),nondefining_classDeclaration->
get_scope()->
class_name().c_str(),nondefining_classDeclaration->get_name().str());
11796 printf (
"In SageBuilder::buildClassDeclaration_nfi(): defining_classDeclaration: scope = %p = %s name = %s \n",
11797 defining_classDeclaration->
get_scope(),defining_classDeclaration->
get_scope()->
class_name().c_str(),defining_classDeclaration->get_name().str());
11798 defining_classDeclaration->
get_file_info()->display(
"already has a defining declaration");
11801 printf (
"Error: In SageBuilder::buildClassDeclaration_nfi(): exiting as part of test \n");
11805#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11806 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);
11811 printf (
"Exiting as a test! \n");
11814 return defining_classDeclaration;
11821 ROSE_ASSERT(nondefdecl->get_definingDeclaration() == defdecl);
11822 ROSE_ASSERT(nondefdecl->get_firstNondefiningDeclaration() != defdecl);
11827#if DEBUG_CLASS_DECLARATION
11828 printf (
"In SageBuilder::buildClassDeclaration_nfi(): building a nondefining declaration since it does not exist \n");
11831 ROSE_ASSERT(nondefdecl == NULL);
11835 if (buildTemplateInstantiation ==
true)
11838#if DEBUG_CLASS_DECLARATION
11839 printf (
"************************************************************************* \n");
11840 printf (
"Building SgTemplateInstantiationDecl with empty SgTemplateArgumentPtrList \n");
11841 printf (
" --- using nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
11842 printf (
"************************************************************************* \n");
11844 SgTemplateArgumentPtrList emptyList;
11847 ROSE_ASSERT(nondefdecl != NULL);
11848#if DEBUG_CLASS_DECLARATION
11849 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Build SgTemplateInstantiationDecl: nondefdecl = %p \n",nondefdecl);
11853 ROSE_ASSERT(nondefdecl->get_type() == NULL);
11854 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl) != NULL);
11856 printf (
"In buildClassDeclaration_nfi(): nondefdecl->get_name() = %s nondefdecl->get_templateName() = %s \n",nondefdecl->get_name().str(),isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().str());
11858#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11867 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().is_null() ==
true);
11870 ROSE_ASSERT(templateArgumentsList != NULL);
11880 if (templateArgumentsList->size() == 0)
11882 printf (
"Warning: In SageBuilder::buildClassDeclaration_nfi(): templateArgumentsList->size() == 0 \n");
11886 nondefdecl->set_firstNondefiningDeclaration(nondefdecl);
11903#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11904 printf (
"Warning: In buildClassDeclaration_nfi(): calling set_templateName(nameWithTemplateArguments = %s) for nondefining declaration \n",nameWithTemplateArguments.str());
11909 isSgTemplateInstantiationDecl(nondefdecl)->
set_templateName(nameWithoutTemplateArguments);
11916 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().is_null() ==
false);
11922 if (
hasTemplateSyntax(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName()) ==
false)
11924#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11925 printf (
"WARNING: No template syntax present in name of template class instantiation (nondefdecl) \n");
11930#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11935 ROSE_ASSERT(nondefdecl->get_file_info() == NULL);
11940#if DEBUG_CLASS_DECLARATION
11941 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);
11942 printf (
" --- nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
11947 ROSE_ASSERT(nondefdecl != NULL);
11948#if DEBUG_CLASS_DECLARATION
11949 printf (
"In buildClassDeclaration_nfi(): (no file info set): nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
11954 ROSE_ASSERT(nameWithoutTemplateArguments == nameWithTemplateArguments);
11956#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11962 nondefdecl->set_firstNondefiningDeclaration(nondefdecl);
11967 ROSE_ASSERT(nondefdecl->get_file_info() == NULL);
11970 ROSE_ASSERT(nondefdecl != NULL);
11974 ROSE_ASSERT(nondefdecl == nondefdecl->get_firstNondefiningDeclaration());
11983 ROSE_ASSERT(scope != NULL);
11985#if DEBUG_CLASS_DECLARATION
11986 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Set the scope of the new non-defining declaration to %p = %s \n",scope,scope->
class_name().c_str());
11988 nondefdecl->set_scope(scope);
11989 ROSE_ASSERT(nondefdecl->get_scope() != NULL);
11998 printf (
"In buildClassDeclaration_nfi(): setting the parent of the non defining declaration to be the scope by default) \n");
12005 ROSE_ASSERT(nondefdecl->get_type() == NULL);
12007 if (nondefdecl->get_type() == NULL)
12009#if DEBUG_CLASS_DECLARATION
12011 printf (
"Calling scope->get_type_table()->lookup_type(): nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
12013 printf (
"WE NEED THE MANGLED NAME FOR THIS TO BE RELEVANT! \n");
12019#if DEBUG_CLASS_DECLARATION
12020 printf (
"In SageBuilder::buildClassDeclaration_nfi(): kind == SgClassDeclaration::e_java_parameter = %s \n",(kind ==
SgClassDeclaration::e_java_parameter) ?
"true" :
"false");
12025#if DEBUG_CLASS_DECLARATION
12026 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());
12028 nondefdecl->set_type(class_type);
12029#if DEBUG_CLASS_DECLARATION
12030 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());
12032 SgClassDeclaration* tmp_classDeclarationFromType = isSgClassDeclaration(class_type->get_declaration());
12033 ROSE_ASSERT(tmp_classDeclarationFromType != NULL);
12034#if DEBUG_CLASS_DECLARATION
12036 printf (
"tmp_classDeclarationFromType: scope = %p = %s \n",scope,scope->
class_name().c_str());
12037 printf (
"tmp_classDeclarationFromType = %p = %s \n",tmp_classDeclarationFromType,tmp_classDeclarationFromType->
class_name().c_str());
12038 printf (
"tmp_classDeclarationFromType name = %s \n",tmp_classDeclarationFromType->get_name().str());
12041 tmp_classDeclarationFromType->
get_file_info()->display(
"tmp_classDeclarationFromType: debug");
12047 ROSE_ASSERT(nondefdecl->get_type() != NULL);
12048 if (nondefdecl->get_type()->get_declaration() != nondefdecl)
12050 printf (
"ERROR: nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
12051 printf (
"ERROR: nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
12052 printf (
"ERROR: nondefdecl->get_type()->get_declaration() = %p = %s \n",nondefdecl->get_type()->get_declaration(),nondefdecl->get_type()->get_declaration()->class_name().c_str());
12054 SgClassDeclaration* classDeclarationFromType = isSgClassDeclaration(nondefdecl->get_type()->get_declaration());
12055 ROSE_ASSERT(classDeclarationFromType != NULL);
12057 printf (
"nondefdecl->get_name() = %s \n",nondefdecl->get_name().str());
12058 printf (
"nondefdecl->get_type()->get_name() = %s \n",nondefdecl->get_type()->get_name().str());
12059 printf (
"nondefdecl->get_type()->get_declaration()->get_name() = %s \n",classDeclarationFromType->get_name().str());
12061 printf (
"nondefdecl->get_mangled_name() = %s \n",nondefdecl->get_mangled_name().getString().c_str());
12062 printf (
"nondefdecl->get_type()->get_mangled() = %s \n",nondefdecl->get_type()->get_mangled().getString().c_str());
12063 printf (
"nondefdecl->get_type()->get_declaration()->get_mangled_name() = %s \n",classDeclarationFromType->get_mangled_name().getString().c_str());
12066 printf (
"nondefdecl->get_type()->get_declaration()->get_firstNondefiningDeclaration() = %s \n",classDeclarationFromType->
get_firstNondefiningDeclaration() ?
"true" :
"false");
12067 printf (
"nondefdecl->get_firstNondefiningDeclaration() = %s \n",nondefdecl->get_firstNondefiningDeclaration() ?
"true" :
"false");
12073 if (parent != NULL)
12075 printf (
"nondefdecl->get_parent() = %p = %s \n",parent,parent->
class_name().c_str());
12080#if DEBUG_CLASS_DECLARATION
12081 nondefdecl->get_type()->get_declaration()->get_file_info()->display(
"nondefdecl->get_type()->get_declaration()");
12088 if (nondefdecl->get_file_info() == NULL)
12090 printf (
"ERROR: In SageBuilder::buildClassDeclaration_nfi(): nondefdecl = %p = %s does not have its source position information setup \n",nondefdecl,nondefdecl->class_name().c_str());
12091 printf (
" --- nondefdecl = %s \n",nondefdecl->get_name().str());
12092 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p \n",nondefdecl->get_firstNondefiningDeclaration());
12093 printf (
" --- nondefdecl->get_definingDeclaration() = %p \n",nondefdecl->get_definingDeclaration());
12094 printf (
" --- nondefdecl->get_type() = %p \n",nondefdecl->get_type());
12095 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
12096 printf (
"The real error is: (nondefdecl->get_type()->get_declaration() != nondefdecl) \n");
12100 ROSE_ASSERT(nondefdecl->get_file_info() != NULL);
12101 nondefdecl->get_file_info()->display(
"nondefdecl");
12105 ROSE_ASSERT(nondefdecl->get_type()->get_declaration() == nondefdecl);
12108 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());
12119 ROSE_ASSERT (nondefdecl->get_startOfConstruct() != NULL);
12121#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
12125 detectTransformations(nondefdecl);
12133 nondefdecl->setForward();
12139 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");
12148 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());
12154 ROSE_ASSERT(nondefdecl->get_scope() == scope);
12161 printf (
"Warning: no scope provided to support symbol table entry! \n");
12174 if (buildTemplateInstantiation ==
true)
12177 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
12181 ROSE_ASSERT((*templateArgumentsList)[i]->get_parent() != NULL);
12191 (*templateArgumentsList)[i]->set_parent(nondefdecl);
12206 printf (
"Building a SgClassDeclaration: buildClassDeclaration_nfi() buildTemplateInstantiation = %s \n",buildTemplateInstantiation ?
"true:" :
"false");
12211 if (buildTemplateInstantiation ==
true)
12214 SgTemplateArgumentPtrList emptyList;
12220 ROSE_ASSERT(defdecl->get_type() == NULL);
12221 ROSE_ASSERT(isSgTemplateInstantiationDecl(defdecl) != NULL);
12223 printf (
"In buildClassDeclaration_nfi(): defdecl->get_name() = %s defdecl->get_templateName() = %s \n",defdecl->get_name().str(),isSgTemplateInstantiationDecl(defdecl)->get_templateName().str());
12227 ROSE_ASSERT(isSgTemplateInstantiationDecl(defdecl)->get_templateName().is_null() ==
true);
12230 printf (
"Warning: In buildClassDeclaration_nfi(): calling set_templateName(name = %s) for defining declaration \n",name.str());
12239 ROSE_ASSERT(name.getString().find(
'<') == string::npos);
12242 SgName templateName = generateTemplateNameFromTemplateNameWithTemplateArguments(name);
12243 printf (
"In buildClassDeclaration_nfi(): templateName = %s \n",templateName.str());
12258 printf (
"In buildClassDeclaration_nfi(): nameWithoutTemplateArguments = %s nameWithTemplateArguments = %s \n",nameWithoutTemplateArguments.str(),nameWithTemplateArguments.str());
12260 isSgTemplateInstantiationDecl(defdecl)->
set_templateName(nameWithoutTemplateArguments);
12262#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12266 printf (
"WARNING: In buildClassDeclaration_nfi(): nameWithTemplateArguments = %s is not using template syntax \n",nameWithTemplateArguments.str());
12275 ROSE_ASSERT(isSgTemplateInstantiationDecl(defdecl)->get_templateName().is_null() ==
false);
12278 if (isSgTemplateInstantiationDecl(defdecl)->get_templateName().getString().find(
'>') == string::npos)
12280#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12281 printf (
"WARNING: No template syntax present in name of template class instantiation (defdecl) \n");
12286 printf (
"Should we have set the template instantiation name at this point? \n");
12290 ROSE_ASSERT(defdecl->get_definition() != NULL);
12291 ROSE_ASSERT(isSgTemplateInstantiationDefn(defdecl->get_definition()) != NULL);
12296 printf (
"Building a SgClassDeclaration, but we might require a SgTemplateClassDeclaration \n");
12303 if (buildTemplateDeclaration ==
true)
12305 printf (
"In buildClassDeclaration_nfi(): I think we also want template specialization arguments to be more general: using nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
12311 ROSE_ASSERT(defdecl->get_type() == NULL);
12313 printf (
"Exiting afte test! \n");
12323 printf (
"In SageBuilder::buildClassDeclaration_nfi(): build a SgClassDeclaration: defdecl = %p \n",defdecl);
12327 ROSE_ASSERT(defdecl->get_type() == NULL);
12331 ROSE_ASSERT(defdecl->get_definition() != NULL);
12332 ROSE_ASSERT(isSgTemplateInstantiationDefn(defdecl->get_definition()) == NULL);
12334 ROSE_ASSERT(defdecl != NULL);
12337 printf (
"In buildClassDeclaration_nfi(): nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
12341 nondefdecl->set_definingDeclaration(defdecl);
12343 ROSE_ASSERT(nondefdecl->get_definingDeclaration() == defdecl);
12344 ROSE_ASSERT(nondefdecl->get_firstNondefiningDeclaration() != defdecl);
12350 classDef->set_declaration(defdecl);
12351 defdecl->set_definingDeclaration(defdecl);
12365 defdecl->set_firstNondefiningDeclaration(nondefdecl);
12367 if (buildTemplateInstantiation ==
true)
12374 ROSE_ASSERT(defdecl->get_type() == NULL);
12381 if (defdecl->get_type() != NULL)
12385 if (defdecl->get_type()->get_declaration() == isSgDeclarationStatement(defdecl))
12388 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12391 if (nondefdecl->get_type() != defdecl->get_type())
12394 printf (
"Deleting defdecl->get_type() = %p = %s (using type from nondefdecl = %p) \n",defdecl->get_type(),defdecl->get_type()->class_name().c_str(),nondefdecl);
12395 printf (
"Skipping delete of %p to maintain unique type pointers \n",defdecl->get_type());
12397 delete defdecl->get_type();
12400 defdecl->set_type(NULL);
12402 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());
12406 printf (
"Is this executed! \n");
12410 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12411 defdecl->set_type(nondefdecl->get_type());
12413 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());
12417 ROSE_ASSERT(classType != NULL);
12418 SgClassDeclaration* local_classDeclaration = isSgClassDeclaration(classType->get_declaration());
12419 ROSE_ASSERT (local_classDeclaration != NULL);
12420 printf (
"In buildClassDeclaration_nfi(): classType = %p local_classDeclaration = %p \n",classType,local_classDeclaration);
12429 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12430 defdecl->set_type(nondefdecl->get_type());
12432 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());
12435 ROSE_ASSERT (nondefdecl->get_firstNondefiningDeclaration() != NULL);
12439 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()))
12441 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");
12442 printf (
" --- nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
12443 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
12444 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl->get_firstNondefiningDeclaration(),nondefdecl->get_firstNondefiningDeclaration()->class_name().c_str());
12450 ROSE_ASSERT (nondefdecl->get_type()->get_declaration() == isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()));
12455 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12458 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12461 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl))
12463 printf (
"nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
12464 printf (
"nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
12465 printf (
"nondefdecl->get_type()->get_declaration() = %p = %s \n",nondefdecl->get_type()->get_declaration(),nondefdecl->get_type()->get_declaration()->class_name().c_str());
12466 printf (
"nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl->get_firstNondefiningDeclaration(),nondefdecl->get_firstNondefiningDeclaration()->class_name().c_str());
12470 ROSE_ASSERT (defdecl->get_type() != NULL);
12471 ROSE_ASSERT (defdecl->get_type()->get_declaration() != NULL);
12472 ROSE_ASSERT (defdecl->get_type()->get_declaration() != isSgDeclarationStatement(defdecl));
12473 ROSE_ASSERT (nondefdecl->get_firstNondefiningDeclaration() != NULL);
12474 ROSE_ASSERT (nondefdecl->get_firstNondefiningDeclaration() == nondefdecl);
12476 ROSE_ASSERT (nondefdecl->get_type()->get_declaration() == isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()));
12482 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()))
12484 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");
12485 printf (
" --- nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
12486 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
12487 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl->get_firstNondefiningDeclaration(),nondefdecl->get_firstNondefiningDeclaration()->class_name().c_str());
12490 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl))
12492 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");
12493 printf (
" --- nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
12494 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
12495 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
12503 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12506 defdecl->set_type(nondefdecl->get_type());
12509 printf (
"In buildClassDeclaration_nfi(): after calling set_type() again: defdecl = %p = %s defdecl->get_type() = %p = %s \n",
12510 defdecl,defdecl->class_name().c_str(),defdecl->get_type(),defdecl->get_type()->class_name().c_str());
12514 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12519 nondefdecl->setForward();
12524 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12530 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12535 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12539 ROSE_ASSERT(mysymbol);
12541 printf (
"@@@@@@@@@@@@@@ In buildClassDeclaration_nfi(): setting scope of defining and non-defining declaration to scope = %s \n",scope->
class_name().c_str());
12542 defdecl->set_scope(scope);
12543 nondefdecl->set_scope(scope);
12549 nondefdecl->set_parent(scope);
12552 defdecl->set_parent(scope);
12564 ROSE_ASSERT(defdecl->get_parent() == NULL);
12569 ROSE_ASSERT(defdecl->get_definingDeclaration() == defdecl);
12570 ROSE_ASSERT(defdecl->get_firstNondefiningDeclaration() != defdecl->get_definingDeclaration());
12576 SgClassDeclaration* temp_firstNondefiningDeclaration = isSgClassDeclaration(defdecl->get_firstNondefiningDeclaration());
12577 SgClassDeclaration* temp_definingDeclaration = isSgClassDeclaration(defdecl->get_definingDeclaration());
12578 ROSE_ASSERT(temp_firstNondefiningDeclaration != NULL);
12579 ROSE_ASSERT(temp_definingDeclaration != NULL);
12582 printf (
"Leaving buildClassDeclaration_nfi(): defdecl = %p = %s = %s \n",defdecl,defdecl->class_name().c_str(),defdecl->get_name().str());
12583 printf (
" --- defdecl->get_firstNondefiningDeclaration() = %p \n",defdecl->get_firstNondefiningDeclaration());
12584 printf (
" --- defdecl->get_definingDeclaration() = %p \n",defdecl->get_definingDeclaration());
12586 printf (
" --- defdecl->get_firstNondefiningDeclaration()->get_name() = %s \n",temp_firstNondefiningDeclaration->get_name().str());
12587 printf (
" --- defdecl->get_definingDeclaration()->get_name() = %s \n",temp_definingDeclaration->get_name().str());
12589 printf (
" --- defdecl->get_firstNondefiningDeclaration()->get_type() = %p = %s \n",
12590 temp_firstNondefiningDeclaration->get_type(),temp_firstNondefiningDeclaration->get_type()->
unparseToString().c_str());
12591 printf (
" --- defdecl->get_definingDeclaration()->get_type() = %p = %s \n",
12592 temp_definingDeclaration->get_type(),temp_definingDeclaration->get_type()->
unparseToString().c_str());
12594 printf (
" --- nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
12595 printf (
" --- nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
12598 printf (
"Leaving buildClassDeclaration_nfi(): defdecl: unparseNameToString() = %s \n",defdecl->unparseNameToString().c_str());
12603 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_name() == temp_definingDeclaration->get_name());
12604 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_type() == temp_definingDeclaration->get_type());
12609 if (definingDeclaration != NULL && nondefiningDeclaration != NULL)
12615 printf (
"NOTE: buildClassDeclaration_nfi(): Setting the templateDeclaration for the defining declaration = %p using the value = %p from the nondefiningDeclaration = %p \n",
12616 definingDeclaration,templateDeclaration,nondefiningDeclaration);
12626 if (definingDeclaration != NULL)
12631 printf (
"NOTE: buildClassDeclaration_nfi(): definingDeclaration->get_templateDeclaration() == NULL \n");
12638 printf (
"Leaving buildClassDeclaration_nfi(): defdecl = %p defdecl->unparseNameToString() = %s \n",defdecl,defdecl->unparseNameToString().c_str());
12643 printf (
"Leaving buildClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
12644 SgSymbol* test_symbol = nondefdecl->get_scope()->find_symbol_from_declaration(nondefdecl);
12647 printf (
"Leaving buildClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
12648 ROSE_ASSERT(nondefdecl->get_symbol_from_symbol_table() != NULL);
12673 ROSE_ASSERT(scope != NULL);
12675 ROSE_ASSERT(definingClassDeclaration != NULL);
12677 return definingClassDeclaration;
12696 ROSE_ASSERT(result);
12701 result->setCaseInsensitive(
true);
12720 printf(
"In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(XXX_name = %p):\n", XXX_name.str());
12727 ROSE_ASSERT(scope != NULL);
12730 printf (
"SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): XXX_name = %s scope = %p = %s \n",XXX_name.str(),scope,scope->
class_name().c_str());
12734 SgName nameWithoutTemplateArguments = XXX_name;
12738 printf (
"SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): nameWithTemplateSpecializationArguments = %s \n",nameWithTemplateSpecializationArguments.str());
12766 mysymbol = scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList);
12773 printf (
"Warning: In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): scope == NULL \n");
12776 printf (
"In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
12779 if (mysymbol != NULL)
12785 ROSE_ASSERT(classType != NULL);
12795 if (nondefdecl->get_type() != NULL)
12797 printf (
"Note: SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): nondefdecl->get_type() != NULL: name = %s \n",nondefdecl->get_name().str());
12802 ROSE_ASSERT(nondefdecl != NULL);
12805 ROSE_ASSERT(templateParameterList != NULL);
12806 nondefdecl->get_templateParameters() = *templateParameterList;
12817 nondefdecl->set_nonreal_decl_scope(nonreal_decl_scope);
12823 printf(
"In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(XXX_name = %p): nrscope = %p (new)\n", XXX_name.str(), nonreal_decl_scope);
12833 ROSE_ASSERT(templateSpecializationArgumentList != NULL);
12834 nondefdecl->get_templateSpecializationArguments() = *templateSpecializationArgumentList;
12837 if (nondefdecl->get_templateParameters().size() == 0)
12839#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12840 printf (
"WARNING: In buildNondefiningTemplateClassDeclaration_nfi(): (part 1) nondefdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations nondefdecl = %p \n",nondefdecl);
12860 nondefdecl->set_templateName(nameWithoutTemplateArguments);
12867 ROSE_ASSERT(nondefdecl != NULL);
12870 ROSE_ASSERT(templateParameterList != NULL);
12871 nondefdecl->get_templateParameters() = *templateParameterList;
12881 if (nondefdecl->get_templateParameters().size() == 0)
12883#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12884 printf (
"WARNING: In buildNondefiningTemplateClassDeclaration_nfi(): (part 2) nondefdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations nondefdecl = %p \n",nondefdecl);
12890 nondefdecl->set_templateName(nameWithoutTemplateArguments);
12894 if (nondefdecl->get_type() == NULL)
12901 ROSE_ASSERT(nondefdecl->get_type() != NULL);
12920 printf (
"In buildNondefiningTemplateClassDeclaration_nfi(): Commented out setting the parent to the scope. \n");
12930 if (nondefdecl->get_type() == NULL)
12937 ROSE_ASSERT(nondefdecl->get_type() != NULL);
12939 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());
12948 printf (
"Building a SgTemplateSymbol using nameWithTemplateSpecializationArguments = %s and nondefdecl = %p = %s \n",nameWithTemplateSpecializationArguments.str(),nondefdecl,nondefdecl->
class_name().c_str());
12954 ROSE_ASSERT(mysymbol != NULL);
12960 ROSE_ASSERT(scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList) == NULL);
12964 scope->
insert_symbol(nameWithTemplateSpecializationArguments, mysymbol);
12966 printf (
"SageBuilder::buildNondefiningTemplateClassDeclaration_nfi() (after building symbol): scope = %p = %s \n",scope,scope->
class_name().c_str());
12968 ROSE_ASSERT(nondefdecl->
get_scope() != NULL);
12975 ROSE_ASSERT(scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList) != NULL);
12994 ROSE_ASSERT(templateClassDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateClassDeclaration->get_templateParameters().size()));
13011 if (defdecl->get_type() != NULL)
13015 if (defdecl->get_type()->get_declaration() == isSgDeclarationStatement(defdecl) )
13017 delete defdecl->get_type();
13022 ROSE_ASSERT (nondefdecl->get_type() != NULL);
13023 ROSE_ASSERT (nondefdecl->get_type()->get_declaration() == isSgDeclarationStatement(nondefdecl));
13024 defdecl->set_type(nondefdecl->get_type());
13027 ROSE_ASSERT(nondefdecl->get_type() != NULL);
13045 ROSE_ASSERT(defdecl->get_definingDeclaration() == defdecl);
13046 ROSE_ASSERT(defdecl->get_firstNondefiningDeclaration() != defdecl->get_definingDeclaration());
13048 ROSE_ASSERT(defdecl->get_scope() != NULL);
13052 ROSE_ASSERT(nondefdecl->
get_parent() == NULL);
13055 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
13061 printf (
"Leaving buildNondefiningTemplateClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
13063 SgSymbol* test_symbol = nondefdecl->
get_scope()->find_symbol_from_declaration(tmp_classDeclaration);
13066 printf (
"Leaving buildNondefiningTemplateClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
13075 SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateSpecializationArgumentList )
13084 SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateSpecializationArgumentList )
13093 printf (
"In buildTemplateClassDeclaration_nfi(): nonDefiningDecl = %p \n",nonDefiningDecl);
13094 if (nonDefiningDecl != NULL)
13097 printf (
"--- nonDefiningDecl->get_definingDeclaration() = %p \n",nonDefiningDecl->
get_definingDeclaration());
13102 ROSE_ASSERT(scope != NULL);
13105 SgName nameWithoutTemplateArguments = XXX_name;
13114 if (nonDefiningDecl != NULL)
13119 SgName templateString =
"template string";
13121 SgTemplateParameterPtrList templateParameters;
13138 printf (
"In buildTemplateClassDeclaration_nfi(): calling new SgTemplateClassDeclaration() name = %s \n",nameWithTemplateSpecializationArguments.str());
13153 if (nonDefiningDecl != NULL)
13161 ROSE_ASSERT(defdecl != NULL);
13163 printf (
"In buildTemplateClassDeclaration_nfi(): Reusing the defining declaration previously build: defdecl = %p = %s \n",defdecl,defdecl->get_name().str());
13169 printf (
"In buildTemplateClassDeclaration_nfi(): No defining declaration found, so we have to build one. \n");
13174 if (defdecl == NULL)
13177 printf (
"Building a defining declaration \n");
13182 ROSE_ASSERT(defdecl != NULL);
13185 printf (
"In buildTemplateClassDeclaration_nfi(): defdecl = %p = %s \n",defdecl,defdecl->
class_name().c_str());
13189 ROSE_ASSERT(templateParameterList != NULL);
13190 defdecl->get_templateParameters() = *templateParameterList;
13193 ROSE_ASSERT(templateSpecializationArgumentList != NULL);
13194 defdecl->get_templateSpecializationArguments() = *templateSpecializationArgumentList;
13200 if (defdecl->get_templateParameters().size() == 0)
13202#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
13203 printf (
"WARNING: In buildTemplateClassDeclaration_nfi(): defdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations defdecl = %p \n",defdecl);
13209 defdecl->set_templateName(nameWithoutTemplateArguments);
13212 printf (
"SageBuilder::buildTemplateClassDeclaration_nfi(): scope = %p = %s \n",scope,scope->
class_name().c_str());
13221 ROSE_ASSERT(classDef != NULL);
13228 classDef->set_declaration(defdecl);
13237 if (nondefdecl == NULL) {
13238 ROSE_ASSERT(scope != NULL);
13240 SgClassSymbol* mysymbol = scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList);
13242 printf (
"In buildTemplateClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
13245 if (mysymbol != NULL) {
13246 nondefdecl = isSgTemplateClassDeclaration(mysymbol->get_declaration());
13247 ROSE_ASSERT(nondefdecl != NULL);
13254 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
13261 printf(
" start build non-defn decl for %p\n",defdecl);
13265 ROSE_ASSERT(nondefdecl != NULL);
13270 printf(
" nondefdecl = %p\n",nondefdecl);
13277 nondefdecl->set_nonreal_decl_scope(nonreal_decl_scope);
13283 printf(
"In buildTemplateClassDeclaration_nfi(): nrscope = %p\n", nonreal_decl_scope);
13287 ROSE_ASSERT(templateParameterList != NULL);
13288 nondefdecl->get_templateParameters() = *templateParameterList;
13296 if (nondefdecl->get_templateParameters().size() == 0)
13298#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
13299 printf (
"WARNING: In buildTemplateClassDeclaration_nfi(): nondefdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations nondefdecl = %p \n",nondefdecl);
13304 printf(
" next 1\n");
13308 nondefdecl->set_templateName(nameWithoutTemplateArguments);
13311 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
13326 printf(
" next 2\n");
13329 if (nondefdecl->get_type() == NULL)
13333 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());
13337 printf(
" next 3\n");
13341 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
13352 ROSE_ASSERT(templateClassDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateClassDeclaration->get_templateParameters().size()));
13355 scope->
insert_symbol(nameWithTemplateSpecializationArguments, mysymbol);
13357 printf(
" end build non-defn decl\n");
13361 SgClassSymbol* mysymbol = scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList);
13362 if (mysymbol == NULL) {
13363 printf(
"WARNING: In buildTemplateClassDeclaration_nfi(): non-defining declaration was provided but cannot be located in the associated scope.\n");
13368 printf (
"In buildTemplateClassDeclaration_nfi(): Setting the firstNondefiningDeclaration to be nondefdecl = %p \n",nondefdecl);
13384 if (defdecl->get_type() != NULL)
13390 if (defdecl->get_type()->get_declaration() == isSgDeclarationStatement(defdecl) )
13392 delete defdecl->get_type();
13404 ROSE_ASSERT (nondefdecl->get_type() != NULL);
13408 if (isSgClassType(nondefdecl->get_type())->get_declaration() != isSgDeclarationStatement(nondefdecl))
13411 printf (
"In buildTemplateClassDeclaration_nfi(): detected isSgClassType(nondefdecl->get_type())->get_declaration() != isSgDeclarationStatement(nondefdecl) (problem with Boost code in ROSE compiling ROSE) \n");
13416 defdecl->set_type(nondefdecl->get_type());
13419 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());
13434 printf (
"***** WARNING *****: Commented out call to fixStructDeclaration() \n");
13442 ROSE_ASSERT(defdecl->
get_scope() != NULL);
13446 ROSE_ASSERT(defdecl->get_type() != NULL);
13449 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
13455#if PRINT_DEVELOPER_WARNINGS
13456 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());
13461 ROSE_ASSERT(defdecl->get_templateName().is_null() ==
false);
13464 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
13471 printf (
"Leaving buildTemplateClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
13473 SgSymbol* test_symbol = defdecl->
get_scope()->find_symbol_from_declaration(tmp_classDeclaration);
13476 printf (
"Leaving buildTemplateClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
13506 ASSERT_not_null(scope);
13517 SgEnumSymbol* existing_symbol = scope->lookup_enum_symbol(name);
13518 if (existing_symbol != NULL)
13520 enumType = isSgEnumType(existing_symbol->
get_type());
13521 first_nondefdecl = existing_symbol->get_declaration();
13522 ROSE_ASSERT(first_nondefdecl != NULL);
13531 ROSE_ASSERT(nondefdecl);
13535 if (first_nondefdecl)
13550 ASSERT_not_null(type);
13556 SgEnumSymbol* existing_symbol = scope->lookup_enum_symbol(name);
13558 if (existing_symbol)
13560 mysymbol = existing_symbol;
13561 first_nondefdecl = mysymbol->get_declaration();
13565 first_nondefdecl = nondefdecl;
13568 ASSERT_not_null(mysymbol);
13578 if (first_nondefdecl != nondefdecl)
13588 ASSERT_not_null(nondefdecl->
get_type());
13589 ASSERT_not_null(scope->lookup_enum_symbol(name));
13598 ROSE_ASSERT(scope != NULL);
13601 printf (
"In buildEnumDeclaration_nfi(): name = %s scope = %p = %s \n",name.str(),scope,scope->
class_name().c_str());
13609 SgEnumSymbol* existing_symbol = scope->lookup_enum_symbol(name);
13610 if (existing_symbol != NULL)
13612 enumType = isSgEnumType(existing_symbol->
get_type());
13617 printf (
"In buildEnumDeclaration_nfi(): name = %s building using enumType = %p \n",name.str(),enumType);
13622 ROSE_ASSERT(defdecl);
13625 printf (
"In buildEnumDeclaration_nfi(): built defining declaration = %p name = %s scope = %p = %s \n",defdecl,name.str(),scope,scope->
class_name().c_str());
13630 ROSE_ASSERT(type != NULL);
13637 printf (
"In buildEnumDeclaration_nfi(): name = %s \n",name.str());
13642 ROSE_ASSERT(scope != NULL);
13643 SgEnumSymbol* enumSymbol = scope->lookup_enum_symbol(name);
13646 if (enumSymbol != NULL)
13648 ROSE_ASSERT(enumSymbol->get_declaration() != NULL);
13649 nondefdecl = enumSymbol->get_declaration();
13650 ROSE_ASSERT(nondefdecl != NULL);
13657 printf (
"###### In buildEnumDeclaration_nfi(): built a non-defining declaration to support the symbol table: name = %s nondefdecl = %p \n",name.str(),nondefdecl);
13686 ROSE_ASSERT(mysymbol);
13706 printf (
"In buildEnumDeclaration_nfi(): name = %s defdecl = %p \n",name.str(),defdecl);
13710 ROSE_ASSERT(scope->lookup_enum_symbol(name) != NULL);
13722 ROSE_ASSERT(classDeclaration != NULL);
13723 ROSE_ASSERT(classDefinition != NULL);
13734 ROSE_ASSERT(baseclass != NULL);
13736 if (isVirtual ==
true)
13740 ROSE_ASSERT(baseclass->get_baseClassModifier() != NULL);
13741 baseclass->get_baseClassModifier()->setVirtual();
13753 classDefinition->append_inheritance(baseclass);
13762 ROSE_ASSERT(nrdecl != NULL);
13763 ROSE_ASSERT(classDefinition != NULL);
13766 ROSE_ASSERT(baseclass != NULL);
13768 if (isVirtual ==
true)
13770 baseclass->get_baseClassModifier()->setVirtual();
13775 classDefinition->append_inheritance(baseclass);
13785SageBuilder::buildAccessModifier (
unsigned int access )
13793 printf (
"In SageBuilder::set_access_modifiers(): Mark as public \n");
13800 printf (
"In SageBuilder::set_access_modifiers(): Mark as protected \n");
13807 printf (
"In SageBuilder::set_access_modifiers(): Mark as private \n");
13813 printf (
"Error: default reached in SageBuilder::set_access_modifiers() \n");
13828 ROSE_ASSERT(subtreeRoot != NULL);
13829 ROSE_ASSERT(newFileName !=
"");
13831#define DEBUG_FIXUP 0
13834 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): newFileName = %s \n",newFileName.c_str());
13835 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
13842 Traversal(
const std::string& tmp_newFileName,
int tmp_new_file_id,
int tmp_originalFileId)
13844 newFileName = tmp_newFileName;
13845 new_file_id = tmp_new_file_id;
13846 originalFileId = tmp_originalFileId;
13848 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): newFileName = %s new_file_id = %d originalFileId = %d \n",newFileName.c_str(),new_file_id,originalFileId);
13855 printf (
"In fixupSourcePositionFileSpecification visit(): node = %p = %s \n",node,node->
class_name().c_str());
13859 if (locatedNode != NULL)
13870 printf (
"Found SgLocatedNode marked as isShared() == true: locatedNode = %p = %s \n",locatedNode,locatedNode->
class_name().c_str());
13873 printf (
"Exiting as a test! \n");
13884 printf (
"locatedNode->get_startOfConstruct()->get_filename() = %s locatedNode->get_startOfConstruct()->get_physical_filename() = %s \n",
13886 printf (
"locatedNode->get_startOfConstruct()->get_file_id() = %d locatedNode->get_startOfConstruct()->get_physical_file_id() = %d \n",
13888 printf (
"locatedNode->get_startOfConstruct()->isShared() = %s \n",locatedNode->
get_startOfConstruct()->
isShared() ?
"true" :
"false");
13894 printf (
"NOT MATCHING: originalFileId = %d locatedNode->get_startOfConstruct()->get_file_id() = %d locatedNode->get_startOfConstruct()->get_physical_file_id() = %d \n",
13896 printf (
" ------------ originalFileId = %d locatedNode->get_endOfConstruct()->get_file_id() = %d locatedNode->get_endOfConstruct()->get_physical_file_id() = %d \n",
13904 if (initializedName != NULL)
13922 if (sourceFile != NULL)
13930 printf (
"sourceFile->get_endOfConstruct() == NULL: fixup endOfConstruct \n");
13944 printf (
"sourceFile->get_startOfConstruct()->get_file_id() = %d \n",sourceFile->
get_startOfConstruct()->get_file_id());
13945 printf (
"sourceFile->get_startOfConstruct()->get_physical_file_id() = %d \n",sourceFile->
get_startOfConstruct()->get_physical_file_id());
13954 printf (
"Unhandled: node = %p = %s \n",node,node->
class_name().c_str());
13961 if (expression != NULL)
13963 if (expression->get_operatorPosition()->get_physical_file_id() == originalFileId)
13965 expression->get_operatorPosition()->set_file_id(new_file_id);
13966 expression->get_operatorPosition()->set_physical_file_id(new_file_id);
13973 int originalFileId;
13974 string newFileName;
13978 SgFile* file = isSgFile(subtreeRoot);
13979 int new_file_id = -1;
13980 int originalFileId = -1;
13989 printf (
"originalFileId = %d \n",originalFileId);
14002 int new_file_id_2 = Sg_File_Info::getIDFromFilename(newFileName);
14004 printf (
"new_file_id = %d new_file_id_2 = %d \n",new_file_id,new_file_id_2);
14006 ROSE_ASSERT(new_file_id == new_file_id_2);
14008 string new_filename_2 = Sg_File_Info::getFilenameFromID(new_file_id);
14010 printf (
"newFileName = %s new_filename_2 = %s \n",newFileName.c_str(),new_filename_2.c_str());
14012 ROSE_ASSERT(newFileName == new_filename_2);
14016 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): file != NULL: newFileName = %s new_file_id = %d \n",newFileName.c_str(),new_file_id);
14021 SgLocatedNode* subtreeLocatedNode = isSgLocatedNode(subtreeRoot);
14022 if (subtreeLocatedNode != NULL)
14025 printf (
"subtreeLocatedNode->get_startOfConstruct()->get_file_id() = %d \n",subtreeLocatedNode->
get_startOfConstruct()->get_file_id());
14026 printf (
"subtreeLocatedNode->get_startOfConstruct()->get_physical_file_id() = %d \n",subtreeLocatedNode->
get_startOfConstruct()->get_physical_file_id());
14029 new_file_id = Sg_File_Info::getIDFromFilename(newFileName);
14031 printf (
"originalFileId = %d \n",originalFileId);
14032 printf (
"new_file_id = %d \n",new_file_id);
14035 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): subtreeLocatedNode = %s : originalFileId = %d newFileName = %s new_file_id = %d \n",
14036 subtreeLocatedNode->
class_name().c_str(),originalFileId,newFileName.c_str(),new_file_id);
14041 printf (
"Error: In SageBuilder::fixupSourcePositionFileSpecification(): subtree should be a SgFile or SgLocatedNode: subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
14046 printf (
"Error: In SageBuilder::fixupSourcePositionFileSpecification(): subtree should be a SgFile: subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
14051 ROSE_ASSERT(new_file_id >= 0);
14054 Traversal traversal (newFileName,new_file_id,originalFileId);
14059 traversal.traverse(subtreeRoot, preorder);
14062 printf (
"Exiting as a test in SageBuilder::fixupSourcePositionFileSpecification() \n");
14080 ROSE_ASSERT(subtreeRoot != NULL);
14081 ROSE_ASSERT(new_file_id >= 0);
14084 printf (
"In SageBuilder::fixupSharingSourcePosition(): subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
14085 printf (
"In SageBuilder::fixupSharingSourcePosition(): new_file_id = %d \n",new_file_id);
14092 Traversal(
int tmp_new_file_id)
14094 new_file_id = tmp_new_file_id;
14096 printf (
"In SageBuilder::fixupSharingSourcePosition(): new_file_id = %d \n",new_file_id);
14100 void visit (
SgNode* node)
14103 printf (
"In fixupSharingSourcePosition visit(): node = %p = %s new_file_id = %d \n",node,node->
class_name().c_str(),new_file_id);
14107 if (statement != NULL)
14112 printf (
"new_file_id = %d startOfConstruct->get_physical_file_id() = %d \n",new_file_id,startOfConstruct->get_physical_file_id());
14115 if (startOfConstruct->get_physical_file_id() == new_file_id)
14123 printf (
" --- adding entries for file_id and line number to support sharing: new_file_id = %d line = %d end line = %d \n",
14126 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == startOfConstruct->get_fileLineNumbersToUnparse().size());
14127 ROSE_ASSERT(endOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
14128 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
14131 startOfConstruct->get_fileIDsToUnparse().push_back(new_file_id);
14132 startOfConstruct->get_fileLineNumbersToUnparse().push_back(startOfConstruct->
get_line());
14134 endOfConstruct->get_fileIDsToUnparse().push_back(new_file_id);
14135 endOfConstruct->get_fileLineNumbersToUnparse().push_back(endOfConstruct->
get_line());
14137 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == startOfConstruct->get_fileLineNumbersToUnparse().size());
14138 ROSE_ASSERT(endOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
14139 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
14145 printf (
"Unhandled: node = %p = %s \n",node,node->
class_name().c_str());
14155 SgStatement* statement = isSgStatement(subtreeRoot);
14156 if (statement != NULL)
14159 printf (
"statement->get_startOfConstruct()->get_file_id() = %d \n",statement->
get_startOfConstruct()->get_file_id());
14160 printf (
"statement->get_startOfConstruct()->get_physical_file_id() = %d \n",statement->
get_startOfConstruct()->get_physical_file_id());
14163 printf (
"new_file_id = %d \n",new_file_id);
14166 printf (
"In SageBuilder::fixupSharingSourcePosition(): statement = %s : new_file_id = %d \n",statement->
class_name().c_str(),new_file_id);
14171 printf (
"Error: In SageBuilder::fixupSharingSourcePosition(): subtree should be a SgFile or SgLocatedNode: subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
14175 ROSE_ASSERT(new_file_id >= 0);
14178 Traversal traversal (new_file_id);
14183 traversal.traverse(subtreeRoot, preorder);
14186 printf (
"Exiting as a test in SageBuilder::fixupSharingSourcePosition() \n");
14203#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
14206 printf (
"In SageBuilder::buildFile(inputFileName = %s, outputFileName = %s, project = %p) \n",inputFileName.c_str(),outputFileName.c_str(),project);
14212 ROSE_ASSERT(project != NULL);
14215 if (tmp1_collectionOfModifiedLocatedNodes.size() > 0)
14217 printf (
"In Traversal::evaluateInheritedAttribute(): tmp1_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp1_collectionOfModifiedLocatedNodes.size());
14219 printf (
"Exiting as a test! \n");
14220 ROSE_ASSERT(
false);
14225 ROSE_ASSERT(inputFileName.size() != 0);
14230 string sourceFilename = inputFileName;
14234 printf (
"sourceFilename = %s \n",sourceFilename.c_str());
14240 if (project != NULL)
14242 SgGlobal* globalScopeAcrossFiles = project->get_globalScopeAcrossFiles();
14243 ROSE_ASSERT(globalScopeAcrossFiles != NULL);
14246 ROSE_ASSERT(globalScopeAcrossFiles->
get_symbol_table()->get_table() != NULL);
14249 printf (
"In SageBuilder::buildFile(): globalScopeAcrossFiles = %p \n",globalScopeAcrossFiles);
14250 printf (
" --- globalScopeAcrossFiles->get_declarations().size() = %zu \n",globalScopeAcrossFiles->
get_declarations().size());
14251 printf (
" --- globalScopeAcrossFiles->get_symbol_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->
size());
14252 printf (
" --- globalScopeAcrossFiles->get_symbol_table()->get_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->get_table()->size());
14255 printf (
"Removing all elements from the globalScopeAcrossFiles->get_symbol_table() \n");
14261 if (clear_globalScopeAcrossFiles ==
true)
14263 globalScopeAcrossFiles->
get_symbol_table()->get_table()->delete_elements();
14267 printf (
"After removing all symbols (alias symbols): globalScopeAcrossFiles->get_symbol_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->
size());
14268 printf (
"After removing all symbols (alias symbols): globalScopeAcrossFiles->get_symbol_table()->get_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->get_table()->size());
14275 Rose_STL_Container<std::string> arglist;
14276 int nextErrorCode = 0;
14279 bool set_header_file_unparsing_optimization =
false;
14283 bool isCopyOfExistingFile_testForSharedNodes =
false;
14284 SgFile* fileBeingCopied = NULL;
14286 if (project == NULL)
14291 printf (
"In SageBuilder::buildFile(): build the SgProject \n");
14294 ROSE_ASSERT(project);
14295 project->get_fileList().clear();
14297 arglist.push_back(
"cc");
14298 arglist.push_back(
"-c");
14306 SgFilePtrList & files = project->get_fileList();
14307 for (SgFilePtrList::iterator i = files.begin(); i != files.end(); i++)
14311 printf (
"file = %p = %s name = %s \n",file,file->
class_name().c_str(), file->
getFileName().c_str());
14313 printf (
"file->get_header_file_unparsing_optimization() = %s \n",file->get_header_file_unparsing_optimization() ?
"true" :
"false");
14314 printf (
"file->get_header_file_unparsing_optimization_source_file() = %s \n",file->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
14315 printf (
"file->get_header_file_unparsing_optimization_header_file() = %s \n",file->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
14320 printf (
"This is a copy of an existing file in the project: sourceFilename = %s \n",sourceFilename.c_str());
14323 isCopyOfExistingFile_testForSharedNodes =
true;
14324 fileBeingCopied = file;
14329 if (file->get_header_file_unparsing_optimization() ==
true)
14331 set_header_file_unparsing_optimization =
true;
14338 printf (
"Exiting as a test! \n");
14343 ifstream testfile(inputFileName.c_str());
14344 if (!testfile.is_open())
14350 ofstream outputfile(inputFileName.c_str(),ios::out);
14352 outputfile<<
"// Output file generated so that StringUtility::getAbsolutePathFromRelativePath() will see a vaild file ... unparsed file will have rose_ prefix "<<endl;
14353 outputfile.close();
14373 project->get_sourceFileNameList().push_back(inputFileName);
14375 Rose_STL_Container<string> sourceFilenames = project->get_sourceFileNameList();
14383 if (std::find(arglist.begin(), arglist.end(), sourceFilename) == arglist.end())
14385 arglist.push_back(sourceFilename);
14390 if (outputFileName.empty() ==
false)
14392 arglist.push_back(
"-rose:o");
14394 arglist.push_back(outputFileName);
14411 SgFile* result = determineFileType(arglist, nextErrorCode, project);
14412 ROSE_ASSERT(result != NULL);
14415 printf (
"In SageBuilder::buildFile(): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",project,project->get_fileList_ptr()->get_listOfFiles().size());
14419 if (sourceFile != NULL)
14421 SgGlobal* globalScope = sourceFile->get_globalScope();
14422 ROSE_ASSERT(globalScope != NULL);
14431 printf (
"In SageBuilder::buildFile(): globalScope->get_isModified() == true: reset to false \n");
14435 printf (
"In SageBuilder::buildFile(): Verify false setting: globalScope->get_isModified() = %s \n",globalScope->
get_isModified() ?
"true" :
"false");
14450 ROSE_ASSERT(project != NULL);
14453 if (tmp2_collectionOfModifiedLocatedNodes.size() > 0)
14455 printf (
"In Traversal::evaluateInheritedAttribute(): tmp2_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp2_collectionOfModifiedLocatedNodes.size());
14457 printf (
"Exiting as a test! \n");
14458 ROSE_ASSERT(
false);
14465 ROSE_ASSERT(project != NULL);
14468 if (tmp22_collectionOfModifiedLocatedNodes.size() > 0)
14470 printf (
"In Traversal::evaluateInheritedAttribute(): tmp22_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp22_collectionOfModifiedLocatedNodes.size());
14472 printf (
"Exiting as a test! \n");
14473 ROSE_ASSERT(
false);
14479 printf (
"Calling outputFileIds() \n");
14483 printf (
"DONE: Calling outputFileIds() \n");
14488 printf (
"In SageBuilder::buildFile(): file = %p = %s result->get_header_file_unparsing_optimization() = %s \n",
14489 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization() ?
"true" :
"false");
14493 printf (
"In SageBuilder::buildFile(): file = %p = %s result->get_header_file_unparsing_optimization_source_file() = %s \n",
14494 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
14495 printf (
"In SageBuilder::buildFile(): file = %p = %s result->get_header_file_unparsing_optimization_header_file() = %s \n",
14496 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
14508 if (set_header_file_unparsing_optimization ==
true)
14510 result->set_header_file_unparsing_optimization(
true);
14520 result->set_header_file_unparsing_optimization_header_file(
false);
14523 printf (
"In SageBuilder::buildFile(): set_header_file_unparsing_optimization == true: file = %p = %s result->get_header_file_unparsing_optimization() = %s \n",
14524 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization() ?
"true" :
"false");
14525 printf (
"In SageBuilder::buildFile(): set_header_file_unparsing_optimization == true: file = %p = %s result->get_header_file_unparsing_optimization_source_file() = %s \n",
14526 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
14527 printf (
"In SageBuilder::buildFile(): set_header_file_unparsing_optimization == true: file = %p = %s result->get_header_file_unparsing_optimization_header_file() = %s \n",
14528 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
14544 if (project->get_Java_only() ==
true)
14547 printf (
"WARNING: Java specific action to add new file to SgProject (using set_file()) (more uniform language handling symantics would avoid this problem) \n");
14559 printf (
"In SageBuilder::buildFile(): Outliner::use_dlopen = %s \n",Outliner::use_dlopen ?
"true" :
"false");
14564 ROSE_ASSERT(project != NULL);
14567 if (tmp23_collectionOfModifiedLocatedNodes.size() > 0)
14569 printf (
"In Traversal::evaluateInheritedAttribute(): tmp23_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp23_collectionOfModifiedLocatedNodes.size());
14571 printf (
"Exiting as a test! \n");
14572 ROSE_ASSERT(
false);
14579 ROSE_ASSERT(project != NULL);
14582 if (tmp24_collectionOfModifiedLocatedNodes.size() > 0)
14584 printf (
"In Traversal::evaluateInheritedAttribute(): tmp24_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp24_collectionOfModifiedLocatedNodes.size());
14586 printf (
"Exiting as a test! \n");
14587 ROSE_ASSERT(
false);
14597 if (!Outliner::use_dlopen)
14600 printf (
"In SageBuilder::buildFile(): (after test for (!Outliner::use_dlopen) == true: project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
14601 project,project->get_fileList_ptr()->get_listOfFiles().size());
14606 printf (
"In SageBuilder::buildFile(): (after 2nd project->set_file()): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
14607 project,project->get_fileList_ptr()->get_listOfFiles().size());
14613 printf (
"In SageBuilder::buildFile(): (after test for (!Outliner::use_dlopen) == false: project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
14614 project,project->get_fileList_ptr()->get_listOfFiles().size());
14629 SgFilePtrList& flist = project->get_fileList();
14630 flist.insert(flist.begin(),result);
14632 printf (
"In SageBuilder::buildFile(): (after flist.insert(flist.begin(),result)): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
14633 project,project->get_fileList_ptr()->get_listOfFiles().size());
14640 ROSE_ASSERT(project != NULL);
14643 if (tmp25_collectionOfModifiedLocatedNodes.size() > 0)
14645 printf (
"In Traversal::evaluateInheritedAttribute(): tmp25_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp25_collectionOfModifiedLocatedNodes.size());
14647 printf (
"Exiting as a test! \n");
14648 ROSE_ASSERT(
false);
14656 EDG_ROSE_Translation::suppress_detection_of_transformations =
true;
14659 printf (
"In SageBuilder::buildFile(): EDG_ROSE_Translation::suppress_detection_of_transformations = %s \n",EDG_ROSE_Translation::suppress_detection_of_transformations ?
"true" :
"false");
14663 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());
14686 ROSE_ASSERT(project != NULL);
14689 if (tmp251_collectionOfModifiedLocatedNodes.size() > 0)
14691 printf (
"In Traversal::evaluateInheritedAttribute(): tmp251_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp251_collectionOfModifiedLocatedNodes.size());
14693 printf (
"Exiting as a test! \n");
14694 ROSE_ASSERT(
false);
14702 result->runFrontend(nextErrorCode);
14705 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());
14709 printf (
"After result->runFrontend(): calling outputFileIds() \n");
14713 printf (
"DONE: After result->runFrontend(): calling outputFileIds() \n");
14728 ROSE_ASSERT(project != NULL);
14731 if (tmp26_collectionOfModifiedLocatedNodes.size() > 0)
14733 printf (
"In Traversal::evaluateInheritedAttribute(): tmp26_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp26_collectionOfModifiedLocatedNodes.size());
14735 printf (
"Exiting as a test! \n");
14736 ROSE_ASSERT(
false);
14743 printf (
"Generating a dot file... (SgFile only) \n");
14744 generateDOT ( *project );
14749 printf (
"In SageBuilder::buildFile(): Generate the dot output for multiple files (ROSE AST) \n");
14751 generateDOTforMultipleFile ( *project );
14752 printf (
"DONE: Generate the dot output of the SAGE III AST \n");
14758 const int MAX_NUMBER_OF_IR_NODES_TO_GRAPH_FOR_WHOLE_GRAPH = 8000;
14759 generateAstGraph(project,MAX_NUMBER_OF_IR_NODES_TO_GRAPH_FOR_WHOLE_GRAPH);
14764 printf (
"In SageBuilder::buildFile(): calling astPostProcessing() \n");
14767 if (!project->get_skip_post_processing()) AstPostProcessing(result);
14770 printf (
"In SageBuilder::buildFile(): DONE: calling astPostProcessing() \n");
14783 ROSE_ASSERT(project != NULL);
14786 if (tmp265_collectionOfModifiedLocatedNodes.size() > 0)
14788 printf (
"In Traversal::evaluateInheritedAttribute(): tmp265_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp265_collectionOfModifiedLocatedNodes.size());
14790 printf (
"Exiting as a test! \n");
14791 ROSE_ASSERT(
false);
14797 result->display(
"SageBuilder::buildFile()");
14800 ROSE_ASSERT(project != NULL);
14801 project->set_frontendErrorCode(max(project->get_frontendErrorCode(), nextErrorCode));
14816 printf (
"Exiting as a test! \n");
14822 ROSE_ASSERT(project != NULL);
14825 if (tmp27_collectionOfModifiedLocatedNodes.size() > 0)
14827 printf (
"In Traversal::evaluateInheritedAttribute(): tmp27_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp27_collectionOfModifiedLocatedNodes.size());
14829 printf (
"Exiting as a test! \n");
14830 ROSE_ASSERT(
false);
14836 if (isCopyOfExistingFile_testForSharedNodes ==
true)
14842 printf (
"Found isCopyOfExistingFile_testForSharedNodes == true \n");
14843 printf (
"fileBeingCopied = %p = %s \n",fileBeingCopied,fileBeingCopied->
getFileName().c_str());
14846 SgSourceFile* sourceFileBeingCopied = isSgSourceFile(fileBeingCopied);
14847 ROSE_ASSERT(sourceFileBeingCopied != NULL);
14850 ROSE_ASSERT(sourceResult != NULL);
14852 SgGlobal* fileBeingCopied_globalScope = sourceFileBeingCopied->get_globalScope();
14853 SgGlobal* result_globalScope = sourceResult->get_globalScope();
14855 printf (
"fileBeingCopied_globalScope = %p \n",fileBeingCopied_globalScope);
14856 printf (
"result_globalScope = %p \n",result_globalScope);
14858 ROSE_ASSERT(fileBeingCopied_globalScope != NULL);
14859 ROSE_ASSERT(result_globalScope != NULL);
14861 SgDeclarationStatementPtrList fileBeingCopied_declarationList = fileBeingCopied_globalScope->
get_declarations();
14862 SgDeclarationStatementPtrList result_declarationList = result_globalScope->
get_declarations();
14867 vector<SgDeclarationStatement*>::iterator it;
14868 SgDeclarationStatementPtrList v(fileBeingCopied_declarationList.size());
14871 std::sort(fileBeingCopied_declarationList.begin(),fileBeingCopied_declarationList.end());
14872 std::sort(result_declarationList.begin(),result_declarationList.end());
14876 it = std::set_intersection(fileBeingCopied_declarationList.begin(),fileBeingCopied_declarationList.end(),result_declarationList.begin(),result_declarationList.end(),v.begin());
14878 v.resize(it-v.begin());
14880 int fileBeingCopied_file_id = fileBeingCopied->
get_startOfConstruct()->get_physical_file_id();
14883 for (
size_t i = 0; i < v.size(); i++)
14888 printf (
" --- SageBuilder::buildFile() is sharing this node: %p %s \n",intersection_element,intersection_element->
class_name().c_str());
14894 printf (
"Exiting as a test! \n");
14901 ROSE_ASSERT(project != NULL);
14904 if (tmp28_collectionOfModifiedLocatedNodes.size() > 0)
14906 printf (
"In Traversal::evaluateInheritedAttribute(): tmp28_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp28_collectionOfModifiedLocatedNodes.size());
14908 printf (
"Exiting as a test! \n");
14909 ROSE_ASSERT(
false);
14921 std::vector<SgDeclarationStatementPtrList::iterator> removeList;
14922 SgDeclarationStatementPtrList::iterator i = fileBeingCopied_declarationList.begin();
14923 while (i != fileBeingCopied_declarationList.end())
14926 if (emptyDeclaration != NULL)
14928 removeList.push_back(i);
14938 for (std::vector<SgDeclarationStatementPtrList::iterator>::iterator i = removeList.begin(); i != removeList.end(); i++)
14940 fileBeingCopied_declarationList.erase(*i);
14945 if (fileBeingCopied_declarationList.size() != result_declarationList.size())
14947 printf (
"fileBeingCopied_declarationList.size() = %zu \n",fileBeingCopied_declarationList.size());
14948 printf (
"result_declarationList.size() = %zu \n",result_declarationList.size());
14950 ROSE_ASSERT(fileBeingCopied_declarationList.size() == result_declarationList.size());
14955 printf (
"Statements from global scope (size = %zu): \n",fileBeingCopied_declarationList.size());
14957 for (
size_t i = 0; i < fileBeingCopied_declarationList.size(); i++)
14962 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());
14964 if (fileBeingCopied_decl == result_decl)
14967 printf (
" --- SageBuilder::buildFile() is sharing this node: %p %s \n",fileBeingCopied_decl,fileBeingCopied_decl->
class_name().c_str());
14973 int fileBeingCopied_file_id = fileBeingCopied->
get_startOfConstruct()->get_physical_file_id();
14976 printf (
"Exiting as a test! \n");
14987 printf (
"exiting as a test! \n");
14997 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
14998 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
14999 printf (
"Leaving SageBuilder::buildFile(): (after result->runFrontend()): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
15000 project,project->get_fileList_ptr()->get_listOfFiles().size());
15001 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
15002 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
15012 ROSE_ASSERT(result->get_preprocessorDirectivesAndCommentsList() != NULL);
15016 ROSE_ASSERT(project != NULL);
15019 if (tmp3_collectionOfModifiedLocatedNodes.size() > 0)
15021 printf (
"In Traversal::evaluateInheritedAttribute(): tmp3_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp3_collectionOfModifiedLocatedNodes.size());
15023 printf (
"Exiting as a test! \n");
15024 ROSE_ASSERT(
false);
15052 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
15053 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
15054 printf (
"In SageBuilder::buildSourceFile(outputFileName = %s, project = %p) \n",outputFileName.c_str(),project);
15055 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
15056 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
15060 string inputFilePrefix =
"temp_dummy_file_";
15063 printf (
"In SageBuilder::buildSourceFile(const std::string& outputFileName, SgProject* project): calling buildFile() \n");
15066 SgFile* file =
buildFile(inputFilePrefix+outputFileName,outputFileName,project,clear_globalScopeAcrossFiles);
15067 ROSE_ASSERT(file != NULL);
15070 printf (
"DONE: In SageBuilder::buildSourceFile(): calling buildFile() \n");
15074 ROSE_ASSERT(sourceFile != NULL);
15076 ROSE_ASSERT(sourceFile->get_globalScope() != NULL);
15079 printf (
"call the unparser on the just built file \n");
15083 printf (
"Exiting as a test! \n");
15094 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
15095 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
15096 printf (
"In SageBuilder::buildSourceFile(const std::string& inputFileName,const std::string& outputFileName, SgProject* project): calling buildFile() \n");
15098 printf (
" --- inputFileName = %s \n",inputFileName.c_str());
15099 printf (
" --- outputFileName = %s \n",outputFileName.c_str());
15100 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
15101 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
15106 ROSE_ASSERT(project != NULL);
15109 if (tmp1_collectionOfModifiedLocatedNodes.size() > 0)
15111 printf (
"In Traversal::evaluateInheritedAttribute(): tmp1_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp1_collectionOfModifiedLocatedNodes.size());
15113 printf (
"Exiting as a test! \n");
15114 ROSE_ASSERT(
false);
15119 SgFile* file =
buildFile(inputFileName, outputFileName,project,clear_globalScopeAcrossFiles);
15120 ROSE_ASSERT(file != NULL);
15123 printf (
"DONE: In SageBuilder::buildSourceFile(): calling buildFile() \n");
15128 ROSE_ASSERT(project != NULL);
15131 if (tmp2_collectionOfModifiedLocatedNodes.size() > 0)
15133 printf (
"In Traversal::evaluateInheritedAttribute(): tmp2_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp2_collectionOfModifiedLocatedNodes.size());
15135 printf (
"Exiting as a test! \n");
15136 ROSE_ASSERT(
false);
15142 ROSE_ASSERT(sourceFile != NULL);
15144 ROSE_ASSERT(sourceFile->get_globalScope() != NULL);
15148 printf (
"Debugging the unparsing header file optimization \n");
15150 printf (
"sourceFile->get_header_file_unparsing_optimization() = %s \n",sourceFile->get_header_file_unparsing_optimization() ?
"true" :
"false");
15151 printf (
"sourceFile->get_header_file_unparsing_optimization_source_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
15152 printf (
"sourceFile->get_header_file_unparsing_optimization_header_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
15159 ROSE_ASSERT(sourceFile->get_header_file_unparsing_optimization() ==
true);
15160 ROSE_ASSERT(sourceFile->get_header_file_unparsing_optimization_source_file() ==
true);
15162 ROSE_ASSERT(sourceFile->get_header_file_unparsing_optimization_header_file() ==
false);
15168 SgFilePtrList & fileList = project->get_fileList();
15171 printf (
"Looking for file = %s \n",inputFileName.c_str());
15174 for (SgFilePtrList::iterator i = fileList.begin(); i != fileList.end(); i++)
15178 printf (
"temp_file = %p = %s name = %s \n",temp_file,temp_file->
class_name().c_str(),temp_file->
getFileName().c_str());
15180 if (temp_file != file)
15195 printf (
"sourceFile = %p = %s \n",sourceFile,sourceFile->
class_name().c_str());
15196 printf (
"sourceFile->get_header_file_unparsing_optimization() = %s \n",sourceFile->get_header_file_unparsing_optimization() ?
"true" :
"false");
15197 printf (
"sourceFile->get_header_file_unparsing_optimization_source_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
15198 printf (
"sourceFile->get_header_file_unparsing_optimization_header_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
15200 printf (
"temp_file = %p = %s \n",temp_file,temp_file->
class_name().c_str());
15201 printf (
"temp_file->get_header_file_unparsing_optimization() = %s \n",temp_file->get_header_file_unparsing_optimization() ?
"true" :
"false");
15202 printf (
"temp_file->get_header_file_unparsing_optimization_source_file() = %s \n",temp_file->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
15203 printf (
"temp_file->get_header_file_unparsing_optimization_header_file() = %s \n",temp_file->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
15222 printf (
"Sg_File_Info::get_nametofileid_map()[sourceFile->get_file_info()->get_filename()] = %d \n",filename_id);
15223 printf (
"Sg_File_Info::get_nametofileid_map()[sourceFile->get_file_info()->get_filename()] = %d \n",filename_physical_id);
15224 sourceFile->
get_file_info()->set_physical_file_id(filename_physical_id);
15226 printf (
"sourceFile->get_file_info()->get_physical_filename() = %s \n",sourceFile->
get_file_info()->get_physical_filename().c_str());
15227 printf (
"sourceFile->get_file_info()->get_physical_file_id() = %d \n",sourceFile->
get_file_info()->get_physical_file_id());
15231 printf (
"Exiting as a test! \n");
15243 if (sourceFile->get_preprocessorDirectivesAndCommentsList() == NULL)
15246 printf (
"Initialize NULL p_preprocessorDirectivesAndCommentsList to empty ROSEAttributesListContainer \n");
15249 sourceFile->set_preprocessorDirectivesAndCommentsList(tmp_preprocessorDirectivesAndCommentsList);
15254 printf (
"NOTE: p_preprocessorDirectivesAndCommentsList is already defined! \n");
15255 printf (
" --- inputFileName = %s \n",inputFileName.c_str());
15256 printf (
" --- outputFileName = %s \n",outputFileName.c_str());
15257 printf (
" --- sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size() = %zu \n",sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size());
15260 ROSE_ASSERT (sourceFile->get_preprocessorDirectivesAndCommentsList() != NULL);
15267 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");
15272 ROSE_ASSERT(filePreprocInfo != NULL);
15278 printf (
"In SageBuilder::buildSourceFile(const std::string& inputFileName,const std::string& outputFileName, SgProject* project): calling attachPreprocessingInfo() \n");
15279 printf (
" --- sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size() = %zu \n",sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size());
15284 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");
15285 printf (
" --- inputFileName = %s \n",inputFileName.c_str());
15286 printf (
" --- outputFileName = %s \n",outputFileName.c_str());
15287 printf (
"sourceFile = %p \n",sourceFile);
15288 printf (
"sourceFile->get_token_list.size() = %zu \n",sourceFile->get_token_list().size());
15289 printf (
"sourceFile->get_tokenSubsequenceMap().size() = %zu \n",sourceFile->get_tokenSubsequenceMap().size());
15297 attachPreprocessingInfo (sourceFile,outputFileName);
15304 printf (
"Exiting after test! processed first phase of collecting comments and CPP directives for source file) \n");
15305 ROSE_ASSERT(
false);
15309 printf (
"DONE: In SageBuilder::buildSourceFile(const std::string& inputFileName,const std::string& outputFileName, SgProject* project): calling attachPreprocessingInfo() \n");
15313 printf (
"call the unparser on the just built file \n");
15317 printf (
"In buildSourceFile(): AS A TEST: calling unparseFile(): filename = %s \n",sourceFile->
getFileName().c_str());
15336 printf (
"In SageBuilder::buildSourceFile(): changing the name of the file represented in sourceFile: \n");
15337 printf (
"inputFileName = %s \n",inputFileName.c_str());
15338 printf (
"outputFileName = %s \n",outputFileName.c_str());
15339 printf (
"sourceFile->getFileName() = %s \n",sourceFile->
getFileName().c_str());
15342 SgGlobal* globalScope = sourceFile->get_globalScope();
15345 printf (
"Leaving SageBuilder::buildSourceFile() sourceFile = %p globalScope = %p \n",sourceFile,sourceFile->get_globalScope());
15346 printf (
"sourceFile->get_file_info()->get_file_id() = %d \n",sourceFile->
get_file_info()->get_file_id());
15347 printf (
"sourceFile->get_file_info()->get_physical_file_id() = %d \n",sourceFile->
get_file_info()->get_physical_file_id());
15348 printf (
"sourceFile->get_token_list.size() = %zu \n",sourceFile->get_token_list().size());
15349 printf (
"sourceFile->get_tokenSubsequenceMap().size() = %zu \n",sourceFile->get_tokenSubsequenceMap().size());
15350 printf (
"inputFileName = %s \n",inputFileName.c_str());
15351 printf (
"outputFileName = %s \n",outputFileName.c_str());
15352 printf (
"sourceFile->getFileName() = %s \n",sourceFile->
getFileName().c_str());
15354 printf (
"sourceFile->get_globalScope() = %p \n",globalScope);
15355 printf (
"globalScope->get_isModified() = %s \n",globalScope->
get_isModified() ?
"true" :
"false");
15365 printf (
"globalScope->get_isModified() == true: reset to false \n");
15369 printf (
"Verify false setting: globalScope->get_isModified() = %s \n",globalScope->
get_isModified() ?
"true" :
"false");
15375 ROSE_ASSERT(project != NULL);
15378 if (tmp3_collectionOfModifiedLocatedNodes.size() > 0)
15380 printf (
"In Traversal::evaluateInheritedAttribute(): tmp3_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp3_collectionOfModifiedLocatedNodes.size());
15382 printf (
"Exiting as a test! \n");
15383 ROSE_ASSERT(
false);
15389 printf (
"Exiting as a test! \n");
15405 bool isSystemHeader)
15407 std::string content;
15408 if (isSystemHeader)
15409 content =
"#include <" + header_filename +
"> \n";
15411 content =
"#include \"" + header_filename +
"\" \n";
15413 content,
"Transformation generated",0, 0, 0, position);
15414 ROSE_ASSERT(result);
15423 ROSE_ASSERT(target != NULL);
15425 std::string content2 = content;
15426 boost::algorithm::trim(content2);
15427 string prefix =
"#define";
15428 string::size_type pos = content2.find(prefix, 0);
15429 ROSE_ASSERT (pos == 0);
15433 PreprocessingInfo::DirectiveType mytype = PreprocessingInfo::CpreprocessorDefineDeclaration;
15437 result =
new PreprocessingInfo (mytype,content,
"transformation-generated", 0, 0, 0, position);
15438 ROSE_ASSERT(result);
15439 target->addToAttachedPreprocessingInfo(result);
15445#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
15450 static std::map<SgNode*, AbstractHandle::abstract_handle *> handleMap;
15452 ROSE_ASSERT(n != NULL);
15457 ROSE_ASSERT(anode !=NULL );
15460 ROSE_ASSERT(ahandle != NULL);
15469 ROSE_ASSERT(exp1 != NULL);
15470 ROSE_ASSERT(exp2 != NULL);
15475 ROSE_ASSERT(equivalenceStatement->get_equivalence_set_list() == NULL);
15476 equivalenceStatement->set_equivalence_set_list(setList);
15477 ROSE_ASSERT(equivalenceStatement->get_equivalence_set_list() != NULL);
15480 return equivalenceStatement;
15493 typedef Rose_STL_Container<SgScopeStatement*> SgScopeStatementPtrList;
15494 SgScopeStatementPtrList snippet_scope_list;
15500 printf (
"First scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
15502 if (temp_classDefinition != NULL)
15505 SgName className = temp_classDeclaration->get_name();
15507 printf (
"Input snippet declaration's class name = %s \n",className.str());
15511 if (namespaceDefinitionStatement != NULL)
15516 snippet_scope_list.push_back(snippet_scope);
15517 while (snippet_scope != NULL && isSgGlobal(snippet_scope) == NULL)
15523 snippet_scope = snippet_scope->
get_scope();
15525 printf (
"snippet_scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
15527 snippet_scope_list.push_back(snippet_scope);
15531 printf (
"snippet_scope_list.size() = %" PRIuPTR
" \n",snippet_scope_list.size());
15534 SgGlobal* global_scope_in_target_ast = TransformationSupport::getGlobalScope(targetScope);
15535 SgScopeStatementPtrList::reverse_iterator i = snippet_scope_list.rbegin();
15540 ROSE_ASSERT(isSgGlobal(snippet_AST_scope) != NULL);
15545 while (i != snippet_scope_list.rend())
15549 printf (
"snippet_AST_scope list *i = %p = %s \n",*i,(*i)->class_name().c_str());
15556 if (classDefinition != NULL)
15559 SgName className = classDeclaration->get_name();
15561 printf (
"Found snippet class name = %s \n",className.str());
15563 SgClassSymbol* classSymbol = target_AST_scope->lookup_class_symbol(className);
15564 ROSE_ASSERT(classSymbol != NULL);
15565 ROSE_ASSERT(classSymbol->get_declaration() != NULL);
15567 printf (
"Associated symbol in taget AST: declaration = %p name = %s \n",classSymbol->get_declaration(),classSymbol->get_declaration()->get_name().str());
15570 returnSymbol = classSymbol;
15573 target_AST_scope = classDefinition;
15578 if (functionDefinition != NULL)
15580 printf (
"ERROR: Found an unusual case of SgFunctionDefinition in list of scopes holding a declaration for a type \n");
15585 if (namespaceDefinition != NULL)
15590 printf (
"Found snippet namespace name = %s \n",namespaceName.str());
15592 SgNamespaceSymbol* namespaceSymbol = target_AST_scope->lookup_namespace_symbol(namespaceName);
15593 ROSE_ASSERT(namespaceSymbol != NULL);
15599 returnSymbol = namespaceSymbol;
15602 target_AST_scope = namespaceDefinition;
15610 switch (snippet_declaration->
variantT())
15612 case V_SgClassDeclaration:
15614 SgClassDeclaration* snippet_classDeclaration = isSgClassDeclaration(snippet_declaration);
15615 ROSE_ASSERT(snippet_classDeclaration != NULL);
15617 SgName snippet_className = snippet_classDeclaration->get_name();
15619 printf (
"snippet snippet declaration's class name = %s \n",snippet_className.str());
15621 SgClassSymbol* target_symbol = target_AST_scope->lookup_class_symbol(snippet_className);
15622 ROSE_ASSERT(target_symbol != NULL);
15623 returnSymbol = target_symbol;
15625 SgClassSymbol* classSymbolInTargetAST = isSgClassSymbol(returnSymbol);
15626 ROSE_ASSERT(classSymbolInTargetAST != NULL);
15627 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
15628 ROSE_ASSERT(target_classDeclaration != NULL);
15630 printf (
"snippet: classDeclaration = %p = %s \n",snippet_classDeclaration,snippet_classDeclaration->get_name().str());
15631 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
15633 ROSE_ASSERT(snippet_classDeclaration->get_name() == target_classDeclaration->get_name());
15637 case V_SgTypedefDeclaration:
15639 SgTypedefDeclaration* snippet_typedefDeclaration = isSgTypedefDeclaration(snippet_declaration);
15640 ROSE_ASSERT(snippet_typedefDeclaration != NULL);
15642 SgName snippet_typedefName = snippet_typedefDeclaration->get_name();
15644 printf (
"snippet snippet declaration's typedef name = %s \n",snippet_typedefName.str());
15646 SgTypedefSymbol* target_symbol = target_AST_scope->lookup_typedef_symbol(snippet_typedefName);
15647 ROSE_ASSERT(target_symbol != NULL);
15648 returnSymbol = target_symbol;
15650 SgTypedefSymbol* typedefSymbolInTargetAST = isSgTypedefSymbol(returnSymbol);
15651 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
15652 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
15653 ROSE_ASSERT(target_typedefDeclaration != NULL);
15655 printf (
"snippet: typedefDeclaration = %p = %s \n",snippet_typedefDeclaration,snippet_typedefDeclaration->get_name().str());
15656 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
15658 ROSE_ASSERT(snippet_typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
15662 case V_SgEnumDeclaration:
15664 SgEnumDeclaration* snippet_enumDeclaration = isSgEnumDeclaration(snippet_declaration);
15665 ROSE_ASSERT(snippet_enumDeclaration != NULL);
15669 printf (
"snippet snippet declaration's enum name = %s \n",snippet_enumName.str());
15672 bool isUnNamed = snippet_enumDeclaration->get_isUnNamed();
15673 if (isUnNamed ==
false)
15677 if (target_symbol == NULL)
15681 printf (
"scope = %p = %s \n",scope,scope->
class_name().c_str());
15682 scope->
get_file_info()->display(
"case V_SgEnumDeclaration: target_symbol == NULL: scope: debug");
15684 ROSE_ASSERT(target_symbol != NULL);
15685 returnSymbol = target_symbol;
15687 SgEnumSymbol* enumSymbolInTargetAST = isSgEnumSymbol(returnSymbol);
15688 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
15689 SgEnumDeclaration* target_enumDeclaration = isSgEnumDeclaration(enumSymbolInTargetAST->get_declaration());
15690 ROSE_ASSERT(target_enumDeclaration != NULL);
15692 printf (
"snippet: enumDeclaration = %p = %s \n",snippet_enumDeclaration,snippet_enumDeclaration->
get_name().str());
15693 printf (
"target: enumDeclaration = %p = %s \n",target_enumDeclaration,target_enumDeclaration->
get_name().str());
15695 ROSE_ASSERT(snippet_enumDeclaration->
get_name() == target_enumDeclaration->
get_name());
15700 printf (
"Warning: can't handle unnamed enum declarations \n");
15701 ROSE_ASSERT(returnSymbol == NULL);
15707 case V_SgMemberFunctionDeclaration:
15708 case V_SgFunctionDeclaration:
15711 ROSE_ASSERT(snippet_functionDeclaration != NULL);
15713 printf (
"snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15715 SgName snippet_functionName = snippet_functionDeclaration->get_name();
15717 printf (
"snippet snippet declaration's function name = %s \n",snippet_functionName.str());
15718 printf (
" --- target_AST_scope = %p = %s \n",target_AST_scope,target_AST_scope->
class_name().c_str());
15720 SgFunctionSymbol* target_symbol = target_AST_scope->lookup_function_symbol(snippet_functionName);
15721 ROSE_ASSERT(target_symbol != NULL);
15722 returnSymbol = target_symbol;
15724 SgFunctionSymbol* functionSymbolInTargetAST = isSgFunctionSymbol(returnSymbol);
15725 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
15726 SgFunctionDeclaration* target_functionDeclaration = isSgFunctionDeclaration(functionSymbolInTargetAST->get_declaration());
15727 ROSE_ASSERT(target_functionDeclaration != NULL);
15729 printf (
"snippet: functionDeclaration = %p = %s \n",snippet_functionDeclaration,snippet_functionDeclaration->get_name().str());
15730 printf (
"target: functionDeclaration = %p = %s \n",target_functionDeclaration,target_functionDeclaration->get_name().str());
15732 ROSE_ASSERT(snippet_functionDeclaration->get_name() == target_functionDeclaration->get_name());
15738 printf (
"Error: default reached in switch: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15744 return returnSymbol;
15756#define DEBUG_FIND_ASSOCIATED_DECLARATION 0
15763#if DEBUG_FIND_ASSOCIATED_DECLARATION
15764 printf (
"isDefiningDeclaration = %s \n",isDefiningDeclaration ?
"true" :
"false");
15770 typedef Rose_STL_Container<SgScopeStatement*> SgScopeStatementPtrList;
15771 SgScopeStatementPtrList snippet_scope_list;
15776#if DEBUG_FIND_ASSOCIATED_DECLARATION
15777 printf (
"First scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
15779 if (temp_classDefinition != NULL)
15782 SgName className = temp_classDeclaration->get_name();
15783 printf (
"Input declaration's class name = %s \n",className.str());
15787 if (namespaceDefinitionStatement != NULL)
15791 printf (
"Input declaration's namespace name = %s \n",namespaceName.str());
15795 snippet_scope_list.push_back(snippet_scope);
15796 while (snippet_scope != NULL && isSgGlobal(snippet_scope) == NULL)
15802 snippet_scope = snippet_scope->
get_scope();
15804#if DEBUG_FIND_ASSOCIATED_DECLARATION
15805 printf (
"snippet_scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
15807 snippet_scope_list.push_back(snippet_scope);
15814#if DEBUG_FIND_ASSOCIATED_DECLARATION
15815 printf (
"snippet_scope_list.size() = %" PRIuPTR
" \n",snippet_scope_list.size());
15816 for (SgScopeStatementPtrList::iterator i = snippet_scope_list.begin(); i != snippet_scope_list.end(); i++)
15820 SgGlobal* global_scope_from_declarations_scope = TransformationSupport::getGlobalScope(scope);
15821 printf (
" --- --- global_scope_from_declarations_scope = %p \n",global_scope_from_declarations_scope);
15829 SgGlobal* global_scope_in_target_ast = TransformationSupport::getGlobalScope(targetScope);
15830 SgScopeStatementPtrList::reverse_iterator i = snippet_scope_list.rbegin();
15832#if DEBUG_FIND_ASSOCIATED_DECLARATION
15833 printf (
"global_scope_in_target_ast = %p = %s \n",global_scope_in_target_ast,global_scope_in_target_ast->
class_name().c_str());
15842 ROSE_ASSERT(isSgGlobal(snippet_AST_scope) != NULL);
15846#if DEBUG_FIND_ASSOCIATED_DECLARATION
15847 string otherASTnameFromGlobalScope = global_scope_in_target_ast->
get_file_info()->get_filenameString();
15848 SgSourceFile* otherSourceFile = SageInterface::getEnclosingNode<SgSourceFile>(targetScope,
true);
15849 string otherASTnameFromSourceFile = otherSourceFile->
getFileName();
15850 printf (
"Now traverse the list of scopes in reverse to find the declaration in the other AST: \n");
15851 printf (
"otherASTnameFromGlobalScope = %s \n",otherASTnameFromGlobalScope.c_str());
15852 printf (
"otherASTnameFromSourceFile = %s \n",otherASTnameFromSourceFile.c_str());
15859 while (i != snippet_scope_list.rend())
15865#if DEBUG_FIND_ASSOCIATED_DECLARATION
15866 printf (
"snippet_AST_scope list *i = %p = %s \n",*i,(*i)->class_name().c_str());
15868 printf (
" --- target_AST_scope = %p = %s \n",target_AST_scope,target_AST_scope ->class_name().c_str());
15875#if DEBUG_FIND_ASSOCIATED_DECLARATION
15876 SgSourceFile* otherSourceFile = SageInterface::getEnclosingNode<SgSourceFile>(targetScope,
true);
15877 string otherASTnameFromSourceFile = otherSourceFile->
getFileName();
15878 printf (
" --- otherASTnameFromSourceFile = %s \n",otherASTnameFromSourceFile.c_str());
15883 if (classDefinition != NULL)
15886 SgName className = classDeclaration->get_name();
15887#if DEBUG_FIND_ASSOCIATED_DECLARATION
15888 printf (
" --- Found snippet class name = %s \n",className.str());
15890 SgClassSymbol* classSymbol = target_AST_scope->lookup_class_symbol(className);
15891 ROSE_ASSERT(classSymbol != NULL);
15892 ROSE_ASSERT(classSymbol->get_declaration() != NULL);
15893#if DEBUG_FIND_ASSOCIATED_DECLARATION
15894 printf (
" --- Associated symbol in taget AST: declaration = %p name = %s \n",classSymbol->get_declaration(),classSymbol->get_declaration()->get_name().str());
15897 returnSymbol = classSymbol;
15900 SgClassDeclaration* temp_classDeclaration_in_target_ast = classSymbol->get_declaration();
15901 ROSE_ASSERT(temp_classDeclaration_in_target_ast != NULL);
15903 ROSE_ASSERT(classDeclaration_in_target_ast != NULL);
15904 SgClassDefinition* classDefinition_in_target_ast = classDeclaration_in_target_ast->get_definition();
15905 ROSE_ASSERT(classDefinition_in_target_ast != NULL);
15912 target_AST_scope = classDefinition_in_target_ast;
15920 if (functionDefinition != NULL)
15922 printf (
"ERROR: Found an unusual case of SgFunctionDefinition in list of scopes holding a declaration for a type \n");
15927 if (namespaceDefinition != NULL)
15931#if DEBUG_FIND_ASSOCIATED_DECLARATION
15932 printf (
" --- Found snippet namespace name = %s \n",namespaceName.str());
15934 SgNamespaceSymbol* namespaceSymbol = target_AST_scope->lookup_namespace_symbol(namespaceName);
15935 ROSE_ASSERT(namespaceSymbol != NULL);
15938#if DEBUG_FIND_ASSOCIATED_DECLARATION
15942 returnSymbol = namespaceSymbol;
15949 target_AST_scope = otherASTnamespaceDeclaration->
get_definition();
15958#if DEBUG_FIND_ASSOCIATED_DECLARATION
15959 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());
15962 SgSourceFile* otherSourceFile = SageInterface::getEnclosingNode<SgSourceFile>(target_AST_scope,
true);
15963 string otherASTnameFromSourceFile = otherSourceFile->
getFileName();
15964 printf (
" --- At base of loop: otherASTnameFromSourceFile = %s \n",otherASTnameFromSourceFile.c_str());
15971#if DEBUG_FIND_ASSOCIATED_DECLARATION
15972 printf (
"##### Now based on the kind of declaration, search for that same named declaration in the target_AST_scope = %p = %s \n",
15973 target_AST_scope,target_AST_scope->
class_name().c_str());
15979 switch (snippet_declaration->
variantT())
15981 case V_SgClassDeclaration:
15983 SgClassDeclaration* snippet_classDeclaration = isSgClassDeclaration(snippet_declaration);
15984 ROSE_ASSERT(snippet_classDeclaration != NULL);
15986 SgName snippet_className = snippet_classDeclaration->get_name();
15988#if DEBUG_FIND_ASSOCIATED_DECLARATION
15989 printf (
"snippet snippet declaration's class name = %s \n",snippet_className.str());
15991 SgClassSymbol* target_symbol = target_AST_scope->lookup_class_symbol(snippet_className);
15992 ROSE_ASSERT(target_symbol != NULL);
15993 returnSymbol = target_symbol;
15995 SgClassSymbol* classSymbolInTargetAST = isSgClassSymbol(returnSymbol);
15996 ROSE_ASSERT(classSymbolInTargetAST != NULL);
15997 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
15998 ROSE_ASSERT(target_classDeclaration != NULL);
16000#if DEBUG_FIND_ASSOCIATED_DECLARATION
16001 printf (
"snippet: classDeclaration = %p = %s \n",snippet_classDeclaration,snippet_classDeclaration->get_name().str());
16002 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
16004 ROSE_ASSERT(snippet_classDeclaration->get_name() == target_classDeclaration->get_name());
16008 case V_SgTypedefDeclaration:
16010 SgTypedefDeclaration* snippet_typedefDeclaration = isSgTypedefDeclaration(snippet_declaration);
16011 ROSE_ASSERT(snippet_typedefDeclaration != NULL);
16013 SgName snippet_typedefName = snippet_typedefDeclaration->get_name();
16015#if DEBUG_FIND_ASSOCIATED_DECLARATION
16016 printf (
"snippet snippet declaration's typedef name = %s \n",snippet_typedefName.str());
16018 SgTypedefSymbol* target_symbol = target_AST_scope->lookup_typedef_symbol(snippet_typedefName);
16019 ROSE_ASSERT(target_symbol != NULL);
16020 returnSymbol = target_symbol;
16022 SgTypedefSymbol* typedefSymbolInTargetAST = isSgTypedefSymbol(returnSymbol);
16023 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
16024 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
16025 ROSE_ASSERT(target_typedefDeclaration != NULL);
16027#if DEBUG_FIND_ASSOCIATED_DECLARATION
16028 printf (
"snippet: typedefDeclaration = %p = %s \n",snippet_typedefDeclaration,snippet_typedefDeclaration->get_name().str());
16029 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
16031 ROSE_ASSERT(snippet_typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
16035 case V_SgEnumDeclaration:
16037 SgEnumDeclaration* snippet_enumDeclaration = isSgEnumDeclaration(snippet_declaration);
16038 ROSE_ASSERT(snippet_enumDeclaration != NULL);
16042#if DEBUG_FIND_ASSOCIATED_DECLARATION
16043 printf (
"snippet snippet declaration's enum name = %s \n",snippet_enumName.str());
16046 bool isUnNamed = snippet_enumDeclaration->get_isUnNamed();
16047 if (isUnNamed ==
false)
16051 if (target_symbol == NULL)
16055 printf (
"scope = %p = %s \n",scope,scope->
class_name().c_str());
16056 scope->
get_file_info()->display(
"case V_SgEnumDeclaration: target_symbol == NULL: scope: debug");
16058 ROSE_ASSERT(target_symbol != NULL);
16059 returnSymbol = target_symbol;
16061 SgEnumSymbol* enumSymbolInTargetAST = isSgEnumSymbol(returnSymbol);
16062 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
16063 SgEnumDeclaration* target_enumDeclaration = isSgEnumDeclaration(enumSymbolInTargetAST->get_declaration());
16064 ROSE_ASSERT(target_enumDeclaration != NULL);
16066#if DEBUG_FIND_ASSOCIATED_DECLARATION
16067 printf (
"snippet: enumDeclaration = %p = %s \n",snippet_enumDeclaration,snippet_enumDeclaration->
get_name().str());
16068 printf (
"target: enumDeclaration = %p = %s \n",target_enumDeclaration,target_enumDeclaration->
get_name().str());
16070 ROSE_ASSERT(snippet_enumDeclaration->
get_name() == target_enumDeclaration->
get_name());
16075 printf (
"Warning: can't handle unnamed enum declarations \n");
16076 ROSE_ASSERT(returnSymbol == NULL);
16082 case V_SgTemplateMemberFunctionDeclaration:
16084 case V_SgTemplateFunctionDeclaration:
16086 case V_SgMemberFunctionDeclaration:
16087 case V_SgFunctionDeclaration:
16090 ROSE_ASSERT(snippet_functionDeclaration != NULL);
16092#if DEBUG_FIND_ASSOCIATED_DECLARATION
16093 printf (
"snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16095 SgName snippet_functionName = snippet_functionDeclaration->get_name();
16097#if DEBUG_FIND_ASSOCIATED_DECLARATION
16098 printf (
"snippet snippet declaration's function name = %s \n",snippet_functionName.str());
16099 printf (
" --- target_AST_scope = %p = %s \n",target_AST_scope,target_AST_scope->
class_name().c_str());
16101 SgFunctionSymbol* target_symbol = target_AST_scope->lookup_function_symbol(snippet_functionName);
16102 ROSE_ASSERT(target_symbol != NULL);
16103 returnSymbol = target_symbol;
16105 SgFunctionSymbol* functionSymbolInTargetAST = isSgFunctionSymbol(returnSymbol);
16106 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
16107 SgFunctionDeclaration* target_functionDeclaration = isSgFunctionDeclaration(functionSymbolInTargetAST->get_declaration());
16108 ROSE_ASSERT(target_functionDeclaration != NULL);
16110#if DEBUG_FIND_ASSOCIATED_DECLARATION
16111 printf (
"snippet: functionDeclaration = %p = %s \n",snippet_functionDeclaration,snippet_functionDeclaration->get_name().str());
16112 printf (
"target: functionDeclaration = %p = %s \n",target_functionDeclaration,target_functionDeclaration->get_name().str());
16113 printf (
"isDefiningDeclaration = %s \n",isDefiningDeclaration ?
"true" :
"false");
16115 if (isDefiningDeclaration ==
true)
16117#if DEBUG_FIND_ASSOCIATED_DECLARATION
16118 printf (
"get the defining declaration instead of the firstNondefining declaration from the function symbol \n");
16123 ROSE_ASSERT(snippet_functionDeclaration->get_name() == target_functionDeclaration->get_name());
16129 printf (
"Error: default reached in switch: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16134 ROSE_ASSERT(returnDeclaration != NULL);
16141 return returnDeclaration;
16149 SgType* returnType = NULL;
16151 ROSE_ASSERT(snippet_type != NULL);
16152 ROSE_ASSERT(targetScope != NULL);
16160 SgType* type_copy = snippet_type;
16161 printf (
"(before type_copy->getInternalTypes()): type_copy = %p = %s \n",type_copy,type_copy->
class_name().c_str());
16164 SgNamedType* namedType = isSgNamedType(snippet_type);
16165 if (namedType != NULL)
16169 ROSE_ASSERT(snippet_declaration != NULL);
16171 printf (
"Need to find the declaration in the target AST that is associated with the snippet_declaration in the snippet AST \n");
16172 printf (
" --- snippet_declaration = %p = %s = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str(),
SageInterface::get_name(snippet_declaration).c_str());
16177 case V_SgClassType:
16180 if (classDeclaration != NULL)
16183 if (classSymbolInTargetAST == NULL)
16190 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");
16191 printf (
" --- Looking for target AST match for class name = %s \n",classDeclaration->get_name().str());
16194 ROSE_ASSERT(symbol != NULL);
16196 classSymbolInTargetAST = isSgClassSymbol(symbol);
16199 ROSE_ASSERT(classSymbolInTargetAST != NULL);
16200 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
16201 ROSE_ASSERT(target_classDeclaration != NULL);
16203 printf (
"snippet: classDeclaration = %p = %s \n",classDeclaration,classDeclaration->get_name().str());
16204 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
16206 ROSE_ASSERT(classDeclaration->get_name() == target_classDeclaration->get_name());
16208 returnType = classSymbolInTargetAST->
get_type();
16213 case V_SgTypedefType:
16216 if (typedefDeclaration != NULL)
16223 if (typedefSymbolInTargetAST == NULL)
16226 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");
16227 printf (
" --- The target AST must have a valid typedef type (and associated declaration) to support resetting the SgTypedefType: %p \n",typedefDeclaration->get_type());
16232 ROSE_ASSERT(symbol != NULL);
16234 typedefSymbolInTargetAST = isSgTypedefSymbol(symbol);
16240 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
16241 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
16242 ROSE_ASSERT(target_typedefDeclaration != NULL);
16244 printf (
"snippet: typedefDeclaration = %p = %s \n",typedefDeclaration,typedefDeclaration->get_name().str());
16245 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
16247 ROSE_ASSERT(typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
16249 returnType = typedefSymbolInTargetAST->
get_type();
16257 if (enumDeclaration != NULL)
16259 ROSE_ASSERT(enumDeclaration->
get_name().is_null() ==
false);
16265 if (enumSymbolInTargetAST == NULL)
16267 printf (
"Error: It is an error to not have a enum type defined in the target AST! \n");
16268 printf (
" --- The target AST must have a valid enum type (and associated declaration) to support resetting the SgEnumType: %p \n",enumDeclaration->
get_type());
16271 returnType = snippet_type;
16278 returnType = enumSymbolInTargetAST->
get_type();
16285 case V_SgJavaParameterizedType:
16291 printf (
"In getTargetFileTypeSupport(): case V_SgJavaParameterizedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16295 if (classDeclaration != NULL)
16298 printf (
"Looking for classDeclaration = %s \n",classDeclaration->get_name().str());
16301 ROSE_ASSERT(javaParameterizedType != NULL);
16305 ROSE_ASSERT(templateParameterListNode != NULL);
16306 SgTemplateParameterPtrList* templateParameterList = &templateParameterListNode->get_args();
16314 printf (
"Calling lookupTemplateClassSymbolInParentScopes() name = %s \n",classDeclaration->get_name().str());
16319 printf (
"DONE: Calling lookupTemplateClassSymbolInParentScopes() \n");
16322 printf (
"targetScope->get_symbol_table()->size() = %d \n",targetScope->
get_symbol_table()->
size());
16323 if (templateClassSymbolInTargetAST == NULL)
16329 if (templateClassSymbolInTargetAST == NULL)
16332 printf (
"Calling findAssociatedSymbolInTargetAST \n");
16335 ROSE_ASSERT(symbol != NULL);
16337 templateClassSymbolInTargetAST = isSgClassSymbol(symbol);
16339 ROSE_ASSERT(templateClassSymbolInTargetAST != NULL);
16343 ROSE_ASSERT(templateClassSymbolInTargetAST != NULL);
16345 returnType = templateClassSymbolInTargetAST->
get_type();
16349 if (javaParameterizedType != NULL)
16353 returnType = javaParameterizedType;
16355 SgType* internal_type = javaParameterizedType->get_raw_type();
16356 ROSE_ASSERT(internal_type != NULL);
16360 printf (
"SgJavaParameterizedType not yet tested! \n");
16366 case V_SgJavaQualifiedType:
16377 printf (
"In getTargetFileTypeSupport(): case V_SgJavaQualifiedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16380 if (javaQualifiedType != NULL)
16383 returnType = javaQualifiedType;
16385 SgType* internal_type_1 = javaQualifiedType->get_parent_type();
16386 ROSE_ASSERT(internal_type_1 != NULL);
16387 SgType* internal_type_2 = javaQualifiedType->get_type();
16388 ROSE_ASSERT(internal_type_2 != NULL);
16391 printf (
"Case of SgJavaQualifiedType: not yet handled: commented out assertion! \n");
16396 case V_SgJavaWildcardType:
16405 printf (
"In getTargetFileTypeSupport(): case V_SgJavaWildcardType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16408 if (javaWildcardType != NULL)
16411 returnType = javaWildcardType;
16414 printf (
"SgJavaWildcardType not yet tested! \n");
16420 printf (
"Error: In getTargetFileTypeSupport(): default reached in switch: namedType = %p = %s \n",namedType,namedType->
class_name().c_str());
16425 ROSE_ASSERT(returnType != NULL);
16427 printf (
"Exiting as a test! \n");
16446 SgType* returnType = NULL;
16448 ROSE_ASSERT(snippet_type != NULL);
16449 ROSE_ASSERT(targetScope != NULL);
16453 SgType* type_copy = snippet_type;
16456 printf (
"(before type_copy->getInternalTypes()): type_copy = %p = %s \n",type_copy,type_copy->
class_name().c_str());
16463 for (
size_t i = 0; i < typeList.size(); i++)
16465 printf (
"Input type: typeList[i=%" PRIuPTR
"] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
16473 SgNamedType* namedType = isSgNamedType(snippet_type);
16477 if (namedType != NULL)
16481 ROSE_ASSERT(snippet_declaration != NULL);
16483 printf (
"Need to find the declaration in the target AST that is associated with the snippet_declaration in the snippet AST \n");
16484 printf (
" --- snippet_declaration = %p = %s = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str(),
SageInterface::get_name(snippet_declaration).c_str());
16489 case V_SgClassType:
16492 if (classDeclaration != NULL)
16495 if (classSymbolInTargetAST == NULL)
16502 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");
16503 printf (
" --- Looking for target AST match for class name = %s \n",classDeclaration->get_name().str());
16506 ROSE_ASSERT(symbol != NULL);
16508 classSymbolInTargetAST = isSgClassSymbol(symbol);
16511 ROSE_ASSERT(classSymbolInTargetAST != NULL);
16512 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
16513 ROSE_ASSERT(target_classDeclaration != NULL);
16515 printf (
"snippet: classDeclaration = %p = %s \n",classDeclaration,classDeclaration->get_name().str());
16516 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
16518 ROSE_ASSERT(classDeclaration->get_name() == target_classDeclaration->get_name());
16520 returnType = classSymbolInTargetAST->
get_type();
16525 case V_SgTypedefType:
16528 if (typedefDeclaration != NULL)
16535 if (typedefSymbolInTargetAST == NULL)
16538 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");
16539 printf (
" --- The target AST must have a valid typedef type (and associated declaration) to support resetting the SgTypedefType: %p \n",typedefDeclaration->get_type());
16544 ROSE_ASSERT(symbol != NULL);
16546 typedefSymbolInTargetAST = isSgTypedefSymbol(symbol);
16552 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
16553 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
16554 ROSE_ASSERT(target_typedefDeclaration != NULL);
16556 printf (
"snippet: typedefDeclaration = %p = %s \n",typedefDeclaration,typedefDeclaration->get_name().str());
16557 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
16559 ROSE_ASSERT(typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
16561 returnType = typedefSymbolInTargetAST->
get_type();
16569 if (enumDeclaration != NULL)
16571 ROSE_ASSERT(enumDeclaration->
get_name().is_null() ==
false);
16577 if (enumSymbolInTargetAST == NULL)
16579 printf (
"Error: It is an error to not have a enum type defined in the target AST! \n");
16580 printf (
" --- The target AST must have a valid enum type (and associated declaration) to support resetting the SgEnumType: %p \n",enumDeclaration->
get_type());
16583 returnType = snippet_type;
16590 returnType = enumSymbolInTargetAST->
get_type();
16597 case V_SgJavaParameterizedType:
16603 printf (
"In getTargetFileType(): case V_SgJavaParameterizedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16606 if (classDeclaration != NULL)
16608 SgTemplateParameterPtrList* templateParameterList = NULL;
16609 SgTemplateArgumentPtrList* templateSpecializationArgumentList = NULL;
16613 ROSE_ASSERT(templateClassSymbolInTargetAST != NULL);
16615 returnType = templateClassSymbolInTargetAST->
get_type();
16619 if (javaParameterizedType != NULL)
16622 returnType = javaParameterizedType;
16624 SgType* internal_type = javaParameterizedType->get_raw_type();
16625 ROSE_ASSERT(internal_type != NULL);
16628 printf (
"SgJavaParameterizedType not yet tested! \n");
16632 case V_SgJavaQualifiedType:
16639 printf (
"In getTargetFileType(): case V_SgJavaQualifiedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16642 if (javaQualifiedType != NULL)
16645 returnType = javaQualifiedType;
16647 SgType* internal_type_1 = javaQualifiedType->get_parent_type();
16648 ROSE_ASSERT(internal_type_1 != NULL);
16649 SgType* internal_type_2 = javaQualifiedType->get_type();
16650 ROSE_ASSERT(internal_type_2 != NULL);
16653 printf (
"SgJavaQualifiedType not yet tested! \n");
16657 case V_SgJavaWildcardType:
16666 printf (
"In getTargetFileType(): case V_SgJavaWildcardType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16669 if (javaWildcardType != NULL)
16672 returnType = javaWildcardType;
16674 SgType* internal_type_1 = javaWildcardType->get_bound_type();
16678 printf (
"SgJavaWildcardType not yet tested! \n");
16684 printf (
"Error: In getTargetFileType(): default reached in switch: namedType = %p = %s \n",namedType,namedType->
class_name().c_str());
16689 ROSE_ASSERT(returnType != NULL);
16691 printf (
"Exiting as a test! \n");
16704 SgType* new_type = returnType;
16708 if (new_type != NULL && typeList.size() > 1)
16710 int size = (int)typeList.size();
16711 for (
int i = size - 2; i >= 0; i--)
16714 printf (
"Rebuild type: typeList[i=%d] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
16717 switch(typeList[i]->variantT())
16719 case V_SgModifierType:
16722 ROSE_ASSERT(modifierType != NULL);
16723 if (modifierType->
get_typeModifier().get_constVolatileModifier().isConst() ==
true)
16725 ROSE_ASSERT(new_type != NULL);
16727 printf (
"Building a SgModifierType: calling buildConstType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
16734 printf (
"Modifier kind not handled (not implemented) check what sort of modifier this is: \n");
16741 case V_SgTypedefType:
16744 ROSE_ASSERT(typedefType != NULL);
16750 ROSE_ASSERT(new_typedefType != NULL);
16751 ROSE_ASSERT(isSgTypedefType(new_typedefType) != NULL);
16753 new_type = new_typedefType;
16755 printf (
"ERROSE: SgTypedefType kind not handled (not implemented) \n");
16761 case V_SgPointerType:
16764 ROSE_ASSERT(pointerType != NULL);
16766 printf (
"Building a SgPointerType: calling buildPointerType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
16768 ROSE_ASSERT(new_type != NULL);
16771 printf (
"ERROSE: SgPointerType kind not handled (not implemented) \n");
16779 printf (
"Error: default reached in evaluation of typelist: typeList[i] = %p = %s \n",typeList[i],typeList[i]->class_name().c_str());
16785 returnType = new_type;
16789 if (typeList.size() > 1)
16791 printf (
"Exiting as a test! \n");
16806 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());
16810 SgStatement* statement_copy = isSgStatement(node_copy);
16811 SgStatement* statement_original = isSgStatement(node_original);
16812 if (statement_copy != NULL)
16819 ROSE_ASSERT(statement_original != NULL);
16821 ROSE_ASSERT(scope_copy != NULL);
16822 ROSE_ASSERT(scope_original != NULL);
16829 printf (
"Warning: SgStatement: scope = %p = %s \n",scope_original,scope_original->
class_name().c_str());
16834 ROSE_ASSERT(snippetFile != NULL);
16835 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
16837 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
16840 if (failOnWarning ==
true)
16842 printf (
"Exit on warning! \n");
16847 SgNode* insertionPointScope = (insertionPointIsScope ==
true) ? insertionPoint : insertionPoint->get_parent();
16848 printf (
"insertionPointIsScope = %s insertionPointScope = %p = %s \n",insertionPointIsScope ?
"true" :
"false",insertionPointScope,insertionPointScope->
class_name().c_str());
16867 printf (
"SgClassDeclaration: Exiting as a test! \n");
16871 if (TransformationSupport::getFile(scope) != targetFile)
16873 printf (
"Warning: SgStatement: scope = %p = %s \n",scope,scope->
class_name().c_str());
16874 SgFile* snippetFile = TransformationSupport::getFile(scope);
16875 ROSE_ASSERT(snippetFile != NULL);
16876 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
16878 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
16888 if (declarationStatement_copy != NULL)
16898 if (snippetFile != NULL && snippetFile != targetFile)
16903 printf (
"Note: SgDeclarationStatement: firstNondefiningDeclaration_original is not in target file (allowed for merged ASTs) \n");
16906 if (failOnWarning ==
true)
16908 printf (
"Exit on warning! \n");
16915 if (snippetFile == NULL)
16917 printf (
"Note: firstNondefiningDeclaration_original = %p getEnclosingFileNode() returned NULL \n",firstNondefiningDeclaration_original);
16919 if (failOnWarning ==
true)
16921 printf (
"Exit on warning! \n");
16929 if (definingDeclaration_original != NULL)
16936 if (snippetFile != NULL && snippetFile != targetFile)
16939 printf (
"Warning: SgDeclarationStatement: definingDeclaration is not in target file \n");
16942 if (failOnWarning ==
true)
16944 printf (
"Exit on warning! \n");
16948 if (declarationStatement_original == definingDeclaration_original)
16957 if (snippetFile == NULL)
16959 printf (
"Note: definingDeclaration_original = %p getEnclosingFileNode() returned NULL \n",definingDeclaration_original);
16961 if (failOnWarning ==
true)
16963 printf (
"Exit on warning! \n");
16973 if (expression != NULL)
16983 ROSE_ASSERT(type != NULL);
16988 printf (
"Leaving errorCheckingTargetAST() \n");
17002 T* classDeclaration_copy_defining =
dynamic_cast<T*
>(classDeclaration_copy->get_definingDeclaration());
17003 T* classDeclaration_copy_nondefining =
dynamic_cast<T*
>(classDeclaration_copy->get_firstNondefiningDeclaration());
17004 T* classDeclaration_original_defining =
dynamic_cast<T*
>(classDeclaration_original->get_definingDeclaration());
17005 T* classDeclaration_original_nondefining =
dynamic_cast<T*
>(classDeclaration_original->get_firstNondefiningDeclaration());
17008 if (classDeclaration_copy_defining != NULL && classDeclaration_copy_defining->get_scope() == classDeclaration_original_defining->get_scope())
17011 printf (
"reset the scope of classDeclaration_copy_defining \n");
17013 classDeclaration_copy_defining->set_scope(targetScope);
17017 if (classDeclaration_copy_nondefining != NULL && classDeclaration_copy_nondefining->get_scope() == classDeclaration_original_nondefining->get_scope())
17020 printf (
"reset the scope of classDeclaration_copy_nondefining \n");
17022 classDeclaration_copy_nondefining->set_scope(targetScope);
17026 if (classDeclaration_copy_nondefining != NULL && classDeclaration_copy_nondefining->get_parent() == classDeclaration_original_nondefining->get_parent())
17029 printf (
"reset the parent of classDeclaration_copy_nondefining \n");
17031 classDeclaration_copy_nondefining->set_parent(classDeclaration_copy->get_parent());
17056 printf (
"In fixupCopyOfNodeFromSeperateFileInNewTargetAst: node_copy = %p = %s \n",node_copy,node_copy->
class_name().c_str());
17060 printf (
"Disabled fixupCopyOfNodeFromSeperateFileInNewTargetAst() \n");
17068 printf (
" --- targetFile = %p = %s \n",targetFile,targetFile->get_sourceFileNameWithPath().c_str());
17069 printf (
" --- insertionPointIsScope = %s \n",insertionPointIsScope ?
"true" :
"false");
17076 SgNode* insertionPointScope = (insertionPointIsScope ==
true) ? insertionPoint : insertionPoint->
get_parent();
17078 printf (
"insertionPointScope = %p = %s \n",insertionPointScope,insertionPointScope->class_name().c_str());
17081 ROSE_ASSERT(targetScope != NULL);
17093 SgStatement* statement_copy = isSgStatement(node_copy);
17094 SgStatement* statement_original = isSgStatement(node_original);
17095 if (statement_copy != NULL)
17103 ROSE_ASSERT(scope_copy != NULL);
17104 ROSE_ASSERT(scope_original != NULL);
17110 printf (
"Warning: SgStatement: scope = %p = %s \n",scope_original,scope_original->
class_name().c_str());
17114 ROSE_ASSERT(snippetFile != NULL);
17115 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
17117 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
17122 SgNode* insertionPointScope = (insertionPointIsScope ==
true) ? insertionPoint : insertionPoint->
get_parent();
17123 printf (
"insertionPointIsScope = %s insertionPointScope = %p = %s \n",insertionPointIsScope ?
"true" :
"false",insertionPointScope,insertionPointScope->
class_name().c_str());
17142 printf (
"SgClassDeclaration: Exiting as a test! \n");
17146 if (TransformationSupport::getFile(scope) != targetFile)
17148 printf (
"Warning: SgStatement: scope = %p = %s \n",scope,scope->
class_name().c_str());
17149 SgFile* snippetFile = TransformationSupport::getFile(scope);
17150 ROSE_ASSERT(snippetFile != NULL);
17151 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
17153 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
17165 if (declarationStatement_copy != NULL)
17172 if (snippetFile != NULL && snippetFile != targetFile)
17177 printf (
"Note: SgDeclarationStatement: firstNondefiningDeclaration_original is not in target file (allowed for merged ASTs) \n");
17184 if (snippetFile == NULL)
17186 printf (
"Note: firstNondefiningDeclaration_original = %p getEnclosingFileNode() returned NULL \n",firstNondefiningDeclaration_original);
17193 if (definingDeclaration_original != NULL)
17198 if (snippetFile != NULL && snippetFile != targetFile)
17201 printf (
"Warning: SgDeclarationStatement: definingDeclaration is not in target file \n");
17204 if (declarationStatement_original == definingDeclaration_original)
17213 if (snippetFile == NULL)
17215 printf (
"Note: definingDeclaration_original = %p getEnclosingFileNode() returned NULL \n",definingDeclaration_original);
17227 if (expression != NULL)
17237 ROSE_ASSERT(type != NULL);
17242 if (new_type != NULL)
17252 case V_SgInitializedName:
17255 SgInitializedName* initializedName_original = isSgInitializedName(node_original);
17262 SgStatement* enclosingStatement_copy = TransformationSupport::getStatement(initializedName_copy);
17264 printf (
"enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
17270 ROSE_ASSERT(scope_copy != NULL);
17271 ROSE_ASSERT(scope_original != NULL);
17277 ROSE_ASSERT(initializedName_copy != NULL);
17278 printf (
"initializedName_copy = %p = %s \n",initializedName_copy,initializedName_copy->get_name().str());
17279 ROSE_ASSERT(initializedName_original != NULL);
17280 printf (
"initializedName_original = %p = %s \n",initializedName_original,initializedName_original->get_name().str());
17281 SgType* initializedName_original_type = initializedName_original->get_type();
17282 printf (
"initializedName_original_type = %p = %s \n",initializedName_original_type,initializedName_original_type->
class_name().c_str());
17283 SgClassType* classType = isSgClassType(initializedName_original_type);
17285 if (classType != NULL)
17287 SgClassDeclaration* classDeclaration = isSgClassDeclaration(classType->get_declaration());
17288 ROSE_ASSERT(classDeclaration != NULL);
17289 printf (
"classDeclaration = %p = %s \n",classDeclaration,classDeclaration->get_name().str());
17293 printf (
"Warning: case V_SgInitializedName: scope_copy = %p = %s \n",scope_copy,scope_copy->
class_name().c_str());
17294 printf (
"Warning: case V_SgInitializedName: scope_original = %p = %s \n",scope_original,scope_original->
class_name().c_str());
17296 printf (
"Warning: case V_SgInitializedName: initializedName_copy->get_parent() = %p \n",initializedName_copy->
get_parent());
17297 printf (
"Warning: case V_SgInitializedName: initializedName_original->get_parent() = %p \n",initializedName_original->
get_parent());
17302 ROSE_ASSERT(snippetFile != NULL);
17303 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
17305 printf (
"Warning: case V_SgInitializedName: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
17311 SgType* type_copy = initializedName_copy->get_type();
17313 printf (
"(before type_copy->getInternalTypes()): type_copy = %p = %s \n",type_copy,type_copy->
class_name().c_str());
17323 for (
size_t i = 0; i < typeList.size(); i++)
17325 printf (
"Input type: typeList[i=%" PRIuPTR
"] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
17334 if (new_type != NULL && typeList.size() > 1)
17336 int size = (int)typeList.size();
17337 for (
int i = size - 2; i >= 0; i--)
17340 printf (
"Rebuild type: typeList[i=%d] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
17343 switch(typeList[i]->variantT())
17345 case V_SgModifierType:
17348 ROSE_ASSERT(modifierType != NULL);
17349 if (modifierType->
get_typeModifier().get_constVolatileModifier().isConst() ==
true)
17351 ROSE_ASSERT(new_type != NULL);
17353 printf (
"Building a SgModifierType: calling buildConstType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
17360 printf (
"Modifier kind not handled (not implemented) check what sort of modifier this is: \n");
17369 case V_SgTypedefType:
17372 ROSE_ASSERT(typedefType != NULL);
17376 ROSE_ASSERT(new_typedefType != NULL);
17377 ROSE_ASSERT(isSgTypedefType(new_typedefType) != NULL);
17379 new_type = new_typedefType;
17381 printf (
"ERROSE: SgTypedefType kind not handled (not implemented) \n");
17389 case V_SgPointerType:
17392 ROSE_ASSERT(pointerType != NULL);
17394 printf (
"Building a SgPointerType: calling buildPointerType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
17396 ROSE_ASSERT(new_type != NULL);
17399 printf (
"ERROSE: SgPointerType kind not handled (not implemented) \n");
17409 printf (
"Error: default reached in evaluation of typelist: typeList[i] = %p = %s \n",typeList[i],typeList[i]->class_name().c_str());
17416 if (typeList.size() > 1)
17418 printf (
"Exiting as a test! \n");
17432 printf (
"new_type = %p \n",new_type);
17434 if (new_type != NULL)
17438 printf (
"Reset type for initializedName_copy = %p from type = %p to type = %p \n",initializedName_copy,initializedName_copy->get_type(),new_type);
17440 SgType* original_type = initializedName_copy->get_type();
17441 SgNamedType* original_named_type = isSgNamedType(original_type);
17442 SgNamedType* new_named_type = isSgNamedType(new_type);
17443 if (original_named_type != NULL)
17445 ROSE_ASSERT(new_named_type != NULL);
17446 SgClassDeclaration* original_classDeclaration = isSgClassDeclaration(original_named_type->get_declaration());
17447 SgClassDeclaration* new_classDeclaration = isSgClassDeclaration(new_named_type->get_declaration());
17448 if (original_classDeclaration != NULL)
17450 ROSE_ASSERT(new_classDeclaration != NULL);
17452 printf (
"original_classDeclaration = %p = %s \n",original_classDeclaration,original_classDeclaration->get_name().str());
17453 printf (
"new_classDeclaration = %p = %s \n",new_classDeclaration,new_classDeclaration->get_name().str());
17456 ROSE_ASSERT(new_classDeclaration->get_name() == original_classDeclaration->get_name());
17460 SgType* old_type = initializedName_copy->get_type();
17461 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());
17463 initializedName_copy->set_type(new_type);
17466 printf (
"enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
17469 if (functionParameterList != NULL)
17476 ROSE_ASSERT(functionDeclaration != NULL);
17478 if (functionDefinition != NULL)
17480 ROSE_ASSERT(initializedName_copy->get_scope() == functionDefinition);
17486 ROSE_ASSERT(globalScope != NULL);
17487 if (initializedName_copy->get_scope() != globalScope)
17490 printf (
"Reset scope for initializedName_copy = %p = %s \n",initializedName_copy,initializedName_copy->get_name().str());
17492 initializedName_copy->set_scope(globalScope);
17494 ROSE_ASSERT(initializedName_copy->get_scope() == globalScope);
17500 printf (
"initializedName_copy->get_scope() = %p = %s \n",initializedName_copy->get_scope(),initializedName_copy->get_scope()->
class_name().c_str());
17502 SgEnumDeclaration* enumDeclaration = isSgEnumDeclaration(enclosingStatement_copy);
17503 if (enumDeclaration != NULL)
17513 SgName name = initializedName_copy->get_name();
17514 SgSymbol* symbol = initializedName_copy->get_scope()->lookup_enum_field_symbol(name);
17515 ROSE_ASSERT(symbol != NULL);
17518 ROSE_ASSERT(enumFieldSymbol != NULL);
17523 ROSE_ASSERT(new_enumFieldSymbol != NULL);
17529 initializedName_copy->set_scope(targetScope);
17531 printf (
"Exiting as a test! \n");
17538 printf (
"enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
17541 if (catchOptionStatement != NULL)
17544 ROSE_ASSERT(variableDeclaration != NULL);
17547 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(initializedName_original);
17548 ROSE_ASSERT(enclosingStatement_original != NULL);
17553 if (symbol == NULL)
17555 printf (
"ERROR: (symbol == NULL): initializedName_copy->get_name() = %s \n",initializedName_copy->get_name().str());
17558 ROSE_ASSERT(symbol != NULL);
17560 initializedName_copy->set_scope(targetScope);
17563 ROSE_ASSERT(new_variableSymbol != NULL);
17566 targetScope->
insert_symbol(initializedName_copy->get_name(),new_variableSymbol);
17572 if (javaForEachStatement != NULL)
17575 ROSE_ASSERT(variableDeclaration != NULL);
17577 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(initializedName_original);
17578 ROSE_ASSERT(enclosingStatement_original != NULL);
17582 if (symbol == NULL)
17584 printf (
"ERROR: (symbol == NULL): initializedName_copy->get_name() = %s \n",initializedName_copy->get_name().str());
17587 ROSE_ASSERT(symbol != NULL);
17589 initializedName_copy->set_scope(targetScope);
17592 ROSE_ASSERT(new_variableSymbol != NULL);
17595 targetScope->
insert_symbol(initializedName_copy->get_name(),new_variableSymbol);
17597 printf (
"Need to handle case of SgJavaForEachStatement \n");
17605 if (symbol == NULL)
17607 printf (
"ERROR: enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
17608 ROSE_ASSERT(enclosingStatement_copy->
get_parent() != NULL);
17609 printf (
"ERROR: enclosingStatement_copy->get_parent() = %p = %s \n",enclosingStatement_copy->
get_parent(),enclosingStatement_copy->
get_parent()->
class_name().c_str());
17610 printf (
"ERROR: (symbol == NULL): initializedName_copy->get_name() = %s \n",initializedName_copy->get_name().str());
17611 initializedName_original->
get_file_info()->display(
"ERROR: (symbol == NULL): debug");
17614 SgScopeStatement* initializedName_copy_scope = isSgScopeStatement(initializedName_copy->get_scope());
17615 ROSE_ASSERT(initializedName_copy_scope != NULL);
17616 SgVariableSymbol* variableSymbol = initializedName_copy_scope->lookup_variable_symbol(initializedName_copy->get_name());
17617 ROSE_ASSERT(variableSymbol != NULL);
17619 symbol = variableSymbol;
17621 ROSE_ASSERT(symbol != NULL);
17624 ROSE_ASSERT(variableSymbol != NULL);
17626 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());
17631 ROSE_ASSERT(new_variableSymbol != NULL);
17634 targetScope->
insert_symbol(initializedName_copy->get_name(),new_variableSymbol);
17637 initializedName_copy->set_scope(targetScope);
17639 SgName mangledName = variableSymbol->get_mangled_name();
17641 printf (
"initializedName_copy: mangledName = %s \n",mangledName.str());
17645 if (initializedName_copy->get_scope() != targetScope)
17647 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());
17649 printf (
"I think this should be an error! \n");
17660 case V_SgVariableDeclaration:
17665 ROSE_ASSERT(variableDeclaration != NULL);
17670#define DEBUG_FUNCTION_DECLARATION 0
17672 case V_SgFunctionDeclaration:
17684 SgFunctionType* functionType_copy = functionDeclaration_copy->get_type();
17685 SgFunctionType* functionType_original = functionDeclaration_original->get_type();
17686 ROSE_ASSERT(functionType_copy != NULL);
17687 ROSE_ASSERT(functionType_original != NULL);
17688 ROSE_ASSERT(functionType_copy == functionType_original);
17689#if DEBUG_FUNCTION_DECLARATION
17690 printf (
"case SgFunctionDeclaration: part 1: Calling functionDeclaration_copy->search_for_symbol_from_symbol_table() \n");
17694 ROSE_ASSERT(symbol_original != NULL);
17695 SgFunctionSymbol* functionSymbol_original = isSgFunctionSymbol(symbol_original);
17696 ROSE_ASSERT(functionSymbol_original != NULL);
17699 ROSE_ASSERT(snippetFile != NULL);
17700 if (snippetFile != targetFile)
17702#if DEBUG_FUNCTION_DECLARATION
17703 printf (
"Warning: case V_SgFunctionDeclaration: functionSymbol_original not in target file \n");
17707 ROSE_ASSERT(isSgMemberFunctionSymbol(symbol_original) == NULL);
17713 SgName name = functionDeclaration_copy->get_name();
17714 SgType* functionType = functionDeclaration_copy->get_type();
17715 ROSE_ASSERT(functionType != NULL);
17716#if DEBUG_FUNCTION_DECLARATION
17717 printf (
"case V_SgFunctionDeclaration: name = %s \n",name.str());
17718 printf (
"case V_SgFunctionDeclaration: functionType = %p \n",functionType);
17719 printf (
"case V_SgFunctionDeclaration: functionType_original = %p \n",functionType_original);
17720 printf (
"case V_SgFunctionDeclaration: functionType_copy = %p \n",functionType_copy);
17724 ROSE_ASSERT(targetScope != NULL);
17725 functionDeclaration_copy->
set_scope(targetScope);
17732 if (functionSymbolInTargetAST == NULL)
17734#if DEBUG_FUNCTION_DECLARATION
17735 printf (
"functionSymbolInTargetAST not found in targetScope = %p = %s \n",targetScope,targetScope->
class_name().c_str());
17739 ROSE_ASSERT(otherPossibleScope != NULL);
17740#if DEBUG_FUNCTION_DECLARATION
17741 printf (
"case V_SgFunctionDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope,otherPossibleScope->
class_name().c_str());
17745 functionSymbolInTargetAST = otherPossibleScope->lookup_function_symbol(name,functionType);
17747 if (functionSymbolInTargetAST == NULL)
17749 printf (
"function symbol not found in otherPossibleScope = %p = %s \n",otherPossibleScope,otherPossibleScope->
class_name().c_str());
17752 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
17753#if DEBUG_FUNCTION_DECLARATION
17754 printf (
"(building a new SgFunctionSymbol): functionSymbolInTargetAST->get_declaration() = %p \n",functionSymbolInTargetAST->get_declaration());
17762 ROSE_ASSERT(new_symbol != NULL);
17766 functionSymbolInTargetAST = new_symbol;
17777#if DEBUG_FUNCTION_DECLARATION
17778 printf (
"(using existing symbol found in target scope): functionSymbolInTargetAST->get_declaration() = %p \n",functionSymbolInTargetAST->get_declaration());
17780 functionDeclaration_copy_firstNondefining = isSgFunctionDeclaration(functionSymbolInTargetAST->get_declaration());
17783 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
17786 ROSE_ASSERT(functionDeclaration_copy_firstNondefining != NULL);
17795 ROSE_ASSERT(functionDeclaration_original_firstNondefining != NULL);
17796 printf (
"functionSymbolInTargetAST->get_declaration() = %p \n",functionSymbolInTargetAST->get_declaration());
17798 printf (
"functionDeclaration_original = %p = %s \n",functionDeclaration_original,functionDeclaration_original->
class_name().c_str());
17799 printf (
"functionDeclaration_copy = %p = %s \n",functionDeclaration_copy,functionDeclaration_copy->
class_name().c_str());
17800 printf (
"functionDeclaration_original_firstNondefining = %p \n",functionDeclaration_original_firstNondefining);
17801 printf (
"functionDeclaration_copy_firstNondefining = %p \n",functionDeclaration_copy_firstNondefining);
17802 printf (
"functionDeclaration_original_defining = %p \n",functionDeclaration_original_defining);
17803 printf (
"functionDeclaration_copy_defining = %p \n",functionDeclaration_copy_defining);
17805 printf (
"functionDeclaration_original->get_scope() = %p = %s \n",functionDeclaration_original->
get_scope(),functionDeclaration_original->
get_scope()->
class_name().c_str());
17806 printf (
"functionDeclaration_copy->get_scope() = %p = %s \n",functionDeclaration_copy->
get_scope(),functionDeclaration_copy->
get_scope()->
class_name().c_str());
17807 printf (
"functionDeclaration_original_firstNondefining->get_scope() = %p = %s \n",functionDeclaration_original_firstNondefining->
get_scope(),functionDeclaration_original_firstNondefining->
get_scope()->
class_name().c_str());
17808 printf (
"functionDeclaration_copy_firstNondefining->get_scope() = %p = %s \n",functionDeclaration_copy_firstNondefining->
get_scope(),functionDeclaration_copy_firstNondefining->
get_scope()->
class_name().c_str());
17809 printf (
"functionDeclaration_original_defining->get_scope() = %p = %s \n",functionDeclaration_original_defining->
get_scope(),functionDeclaration_original_defining->
get_scope()->
class_name().c_str());
17810 printf (
"functionDeclaration_copy_defining->get_scope() = %p = %s \n",functionDeclaration_copy_defining->
get_scope(),functionDeclaration_copy_defining->
get_scope()->
class_name().c_str());
17811 printf (
"functionSymbolInTargetAST = %p = %s \n",functionSymbolInTargetAST,functionSymbolInTargetAST->
class_name().c_str());
17814 ROSE_ASSERT(targetScope->lookup_function_symbol(name,functionType) != NULL);
17828 bool isDefiningDeclaration (functionDeclaration_original->get_declaration() != NULL);
17829 if (isDefiningDeclaration ==
true)
17834 ROSE_ASSERT(nondefiningDeclarationFile != NULL);
17835 if (nondefiningDeclarationFile == targetFile)
17852 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
17860 resetDeclaration(functionDeclaration_copy,functionDeclaration_original,targetScope);
17862 printf (
"SageBuilder::fixupCopyOfNodeFromSeperateFileInNewTargetAst(): Need to be able to fixup the SgFunctionDeclaration \n");
17868 case V_SgClassDeclaration:
17872 SgClassDeclaration* classDeclaration_original = isSgClassDeclaration(node_original);
17873 SgClassType* classType = classDeclaration_copy->get_type();
17874 ROSE_ASSERT(classType != NULL);
17876 printf (
"Need to handle named types from class declarations \n");
17887 printf (
"Warning: case V_SgClassDeclaration: assume getEnclosingFileNode(classDeclaration_copy) != targetFile \n");
17899 SgName name = classDeclaration_copy->get_name();
17902 printf (
"case V_SgClassDeclaration: targetScope = %p classSymbol_copy->get_name() = %s \n",targetScope,classSymbol_copy->get_name().str());
17907 if (classSymbolInTargetAST == NULL)
17911 ROSE_ASSERT(otherPossibleScope != NULL);
17913 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p \n",otherPossibleScope);
17917 ROSE_ASSERT(classSymbolInTargetAST != NULL);
17921 ROSE_ASSERT(classDeclaration != NULL);
17923 ROSE_ASSERT(scope != NULL);
17924 classDeclaration_copy->
set_scope(scope);
17927 classDeclaration_copy->
set_scope(targetScope);
17931 ROSE_ASSERT(classSymbol != NULL);
17932 classSymbolInTargetAST = classSymbol;
17942 ROSE_ASSERT(classDeclaration != NULL);
17944 ROSE_ASSERT(scope != NULL);
17945 classDeclaration_copy->
set_scope(scope);
17948 ROSE_ASSERT(classSymbolInTargetAST != NULL);
17955 SgClassType* new_class_type = isSgClassType(new_type);
17956 if (new_class_type != NULL)
17959 classDeclaration_copy->set_type(new_class_type);
17961 printf (
"case V_SgClassDeclaration: built class type: part 1: classDeclaration_copy->get_type() = %p = %s \n",
17962 classDeclaration_copy->get_type(),classDeclaration_copy->get_type()->
class_name().c_str());
17966 resetDeclaration(classDeclaration_copy,classDeclaration_original,targetScope);
17968 printf (
"SgClassDeclaration: Exiting as a test! \n");
17974 case V_SgEnumDeclaration:
17978 SgEnumDeclaration* enumDeclaration_original = isSgEnumDeclaration(node_original);
17988 printf (
"case V_SgEnumDeclaration: targetScope = %p enumSymbol_copy->get_name() = %s \n",targetScope,name.str());
17992 if (enumSymbolInTargetAST == NULL)
17996 ROSE_ASSERT(otherPossibleScope != NULL);
17998 printf (
"case V_SgEnumDeclaration: otherPossibleScope = %p \n",otherPossibleScope);
18002 printf (
"Since the symbol has not been inserted yet, what symbol are we looking for? \n");
18006 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
18008 ROSE_ASSERT(enumDeclaration != NULL);
18010 ROSE_ASSERT(enumDeclaration != enumDeclaration_original);
18017 ROSE_ASSERT(enumSymbol != NULL);
18018 enumSymbolInTargetAST = enumSymbol;
18025 ROSE_ASSERT(scope != NULL);
18026 enumDeclaration_copy->
set_scope(scope);
18028 printf (
"case V_SgEnumDeclaration: insert_symbol(): name = %s enumSymbolInTargetAST = %p \n",name.str(),enumSymbolInTargetAST);
18037 printf (
"Found an existing enum declaration: name = %s enumSymbolInTargetAST = %p \n",name.str(),enumSymbolInTargetAST);
18041 ROSE_ASSERT(enumDeclaration != NULL);
18044 ROSE_ASSERT(scope != NULL);
18045 ROSE_ASSERT(scope == targetScope);
18053 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
18056 printf (
"Exiting as a test 1! \n");
18060 ROSE_ASSERT(enumType != NULL);
18063 printf (
"Return type from getTargetFileType(): original enumType = %p new_type = %p \n",enumType,new_type);
18065 SgEnumType* new_enum_type = isSgEnumType(new_type);
18066 if (new_enum_type != NULL)
18070 printf (
"reset the type using the new enum type from the target AST \n");
18072 enumDeclaration_copy->
set_type(new_enum_type);
18075 printf (
"Exiting as a test 2! \n");
18079 resetDeclaration(enumDeclaration_copy,enumDeclaration_original,targetScope);
18084 case V_SgTemplateClassDeclaration:
18088 SgClassType* templateClassType = templateClassDeclaration->get_type();
18089 ROSE_ASSERT(templateClassType != NULL);
18093 SgClassType* new_templateClass_type = isSgClassType(new_type);
18094 if (new_templateClass_type != NULL)
18097 templateClassDeclaration->set_type(new_templateClass_type);
18099 printf (
"case V_SgTemplateClassDeclaration: built class type: part 1: templateClassDeclaration->get_type() = %p = %s \n",
18100 templateClassDeclaration->get_type(),templateClassDeclaration->get_type()->
class_name().c_str());
18107 case V_SgTypedefDeclaration:
18113 SgType* base_type = typedefDeclaration_copy->get_base_type();
18114 ROSE_ASSERT(base_type != NULL);
18116 if (new_base_type != NULL)
18119 typedefDeclaration_copy->set_base_type(new_base_type);
18124 SgName name = typedefDeclaration_copy->get_name();
18127 printf (
"case V_SgTypedefDeclaration: targetScope = %p typedefSymbol_copy->get_name() = %s \n",targetScope,name.str());
18131 if (typedefSymbolInTargetAST == NULL)
18135 ROSE_ASSERT(otherPossibleScope != NULL);
18137 printf (
"case V_SgTypedefDeclaration: otherPossibleScope = %p \n",otherPossibleScope);
18141 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
18143 ROSE_ASSERT(typedefDeclaration != NULL);
18146 ROSE_ASSERT(scope != NULL);
18147 typedefDeclaration_copy->
set_scope(scope);
18151 ROSE_ASSERT(typedefSymbol != NULL);
18152 typedefSymbolInTargetAST = typedefSymbol;
18154 printf (
"case V_SgTypedefDeclaration: insert_symbol(): name = %s typedefSymbolInTargetAST = %p \n",name.str(),typedefSymbolInTargetAST);
18163 printf (
"Found an existing typedef declaration: name = %s typedefSymbolInTargetAST = %p \n",name.str(),typedefSymbolInTargetAST);
18167 ROSE_ASSERT(typedefDeclaration != NULL);
18169 ROSE_ASSERT(scope != NULL);
18170 typedefDeclaration_copy->
set_scope(scope);
18173 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
18176 printf (
"Exiting as a test 1! \n");
18179 SgTypedefType* typedefType = typedefDeclaration_copy->get_type();
18180 ROSE_ASSERT(typedefType != NULL);
18182 SgTypedefType* new_typedef_type = isSgTypedefType(new_type);
18183 if (new_typedef_type != NULL)
18187 printf (
"reset the type using the new typedef type from the target AST \n");
18189 typedefDeclaration_copy->set_type(new_typedef_type);
18191 printf (
"case V_SgTypedefDeclaration: built class type: part 1: typedefDeclaration_copy->get_type() = %p = %s \n",
18192 typedefDeclaration_copy->get_type(),typedefDeclaration_copy->get_type()->
class_name().c_str());
18196 resetDeclaration(typedefDeclaration_copy,typedefDeclaration_original,targetScope);
18198 printf (
"Exiting as a test 2! \n");
18204 case V_SgVarRefExp:
18215 SgVarRefExp* varRefExp_copy = isSgVarRefExp(node_copy);
18216 SgVarRefExp* varRefExp_original = isSgVarRefExp(node_original);
18217 SgVariableSymbol* variableSymbol_copy = isSgVariableSymbol(varRefExp_copy->get_symbol());
18218 ROSE_ASSERT(variableSymbol_copy != NULL);
18223 printf (
"Warning: case V_SgVarRefExp: variableSymbol not in target file: name = %s \n",variableSymbol_copy->
get_name().str());
18226 printf (
"insertionPoint = %p = %s \n",insertionPoint,insertionPoint->
class_name().c_str());
18239 if (variableSymbolInTargetAST == NULL)
18245 printf (
"Error: The associated variable = %s should have been found in a parent scope of the target AST \n",variableSymbol_copy->
get_name().str());
18250 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(varRefExp_original);
18251 ROSE_ASSERT(enclosingStatement_original != NULL);
18253 printf (
"case V_SgVarRefExp: enclosingStatement_original = %p = %s \n",enclosingStatement_original,enclosingStatement_original->
class_name().c_str());
18256 ROSE_ASSERT(otherPossibleScope_original != NULL);
18259 ROSE_ASSERT(file != NULL);
18261 printf (
"enclosingStatement_original: associated file name = %s \n",file->get_sourceFileNameWithPath().c_str());
18264 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope_original,otherPossibleScope_original->
class_name().c_str());
18265 printf (
"case V_SgClassDeclaration: variableSymbol_copy->get_name() = %s \n",variableSymbol_copy->
get_name().str());
18268 if (variableSymbolInTargetAST == NULL)
18272 otherPossibleScope_original->
get_symbol_table()->
print(
"otherPossibleScope_original: symbol table");
18277 SgBinaryOp* parentBinaryOp = isSgBinaryOp(parentExpression);
18278 SgDotExp* parentDotExp = isSgDotExp(parentExpression);
18279 SgArrowExp* parentArrowExp = isSgArrowExp(parentExpression);
18280 if (parentDotExp != NULL || parentArrowExp != NULL)
18284 ROSE_ASSERT(lhs != NULL);
18288 ROSE_ASSERT(type != NULL);
18290 printf (
"type = %p = %s \n",type,type->
class_name().c_str());
18293 ROSE_ASSERT(namedType != NULL);
18295 ROSE_ASSERT(declaration != NULL);
18297 ROSE_ASSERT(classDeclaration != NULL);
18299 ROSE_ASSERT(definingClassDeclaration != NULL);
18300 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
18301 ROSE_ASSERT(classDefinition != NULL);
18303 printf (
"case V_SgClassDeclaration: classDefinition = %p = %s \n",classDefinition,classDefinition->
class_name().c_str());
18306 otherPossibleScope_original = classDefinition;
18312 ROSE_ASSERT(variableSymbolInTargetAST != NULL);
18313 SgInitializedName* initializedName = variableSymbolInTargetAST->get_declaration();
18314 ROSE_ASSERT(initializedName != NULL);
18316 ROSE_ASSERT(scope != NULL);
18319 initializedName->set_scope(scope);
18324 ROSE_ASSERT(variableSymbolInTargetAST != NULL);
18327 varRefExp_copy->set_symbol(variableSymbolInTargetAST);
18336 case V_SgFunctionRefExp:
18341 SgFunctionSymbol* functionSymbol_copy = isSgFunctionSymbol(functionRefExp_copy->get_symbol());
18342 ROSE_ASSERT(functionSymbol_copy != NULL);
18347 printf (
"Warning: case V_SgFunctionRefExp: functionSymbol_copy not in target file (find function = %s) \n",functionSymbol_copy->
get_name().str());
18351 printf (
"insertionPointIsScope = %s insertionPointScope = %p = %s \n",insertionPointIsScope ?
"true" :
"false",insertionPointScope,insertionPointScope->class_name().c_str());
18363 if (functionSymbolInTargetAST == NULL)
18374 fprintf (stderr,
"Error: The associated function = \"%s\" should have been found in a parent scope"
18375 " of the target AST\n", name.str());
18377 fprintf (stderr,
" targetScope = %p = %s \n",targetScope,targetScope->
class_name().c_str());
18378 SgGlobal* globalScope = TransformationSupport::getGlobalScope(targetScope);
18379 ROSE_ASSERT(globalScope != NULL);
18380 fprintf (stderr,
" globalScope = %p = %s \n",globalScope,globalScope->
class_name().c_str());
18382 targetScope->
get_file_info()->display(
"case V_SgFunctionRefExp: targetScope: debug");
18383 node_original->
get_file_info()->display(
"case V_SgFunctionRefExp: node_original: debug");
18389 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(functionRefExp_original);
18390 ROSE_ASSERT(enclosingStatement_original != NULL);
18392 printf (
"case V_SgFunctionRefExp: enclosingStatement_original = %p = %s \n",enclosingStatement_original,enclosingStatement_original->
class_name().c_str());
18395 ROSE_ASSERT(otherPossibleScope_original != NULL);
18398 ROSE_ASSERT(file != NULL);
18400 printf (
"enclosingStatement_original: associated file name = %s \n",file->get_sourceFileNameWithPath().c_str());
18403 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope_original,otherPossibleScope_original->
class_name().c_str());
18404 printf (
"case V_SgClassDeclaration: functionSymbol_copy->get_name() = %s \n",functionSymbol_copy->
get_name().str());
18408 if (functionSymbolInTargetAST == NULL)
18412 SgBinaryOp* parentBinaryOp = isSgBinaryOp(parentExpression);
18413 SgDotExp* parentDotExp = isSgDotExp(parentExpression);
18414 SgArrowExp* parentArrowExp = isSgArrowExp(parentExpression);
18415 if (parentDotExp != NULL || parentArrowExp != NULL)
18419 ROSE_ASSERT(lhs != NULL);
18420 ROSE_ASSERT(parentBinaryOp->
get_rhs_operand() == functionRefExp_copy);
18423 ROSE_ASSERT(type != NULL);
18425 printf (
"type = %p = %s \n",type,type->
class_name().c_str());
18428 ROSE_ASSERT(namedType != NULL);
18430 ROSE_ASSERT(declaration != NULL);
18432 ROSE_ASSERT(classDeclaration != NULL);
18434 ROSE_ASSERT(definingClassDeclaration != NULL);
18435 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
18436 ROSE_ASSERT(classDefinition != NULL);
18438 printf (
"case V_SgClassDeclaration: classDefinition = %p = %s \n",classDefinition,classDefinition->
class_name().c_str());
18441 otherPossibleScope_original = classDefinition;
18448 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
18450 ROSE_ASSERT(functionDeclaration != NULL);
18452 ROSE_ASSERT(scope != NULL);
18457 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
18462 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
18465 functionRefExp_copy->set_symbol(functionSymbolInTargetAST);
18467 printf (
"Exiting as a test! \n");
18475#define DEBUG_MEMBER_FUNCTION_REF_EXP 0
18477 case V_SgMemberFunctionRefExp:
18482 SgMemberFunctionSymbol* memberFunctionSymbol_copy = isSgMemberFunctionSymbol(memberFunctionRefExp_copy->get_symbol());
18483 ROSE_ASSERT(memberFunctionSymbol_copy != NULL);
18488#if DEBUG_MEMBER_FUNCTION_REF_EXP
18489 printf (
"Warning: case V_SgMemberFunctionRefExp: memberFunctionSymbol_copy not in target file (find member function = %s) \n",memberFunctionSymbol_copy->
get_name().str());
18493 if (memberFunctionSymbolInTargetAST == NULL)
18498#if DEBUG_MEMBER_FUNCTION_REF_EXP
18499 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());
18504 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(memberFunctionRefExp_original);
18505 ROSE_ASSERT(enclosingStatement_original != NULL);
18506#if DEBUG_MEMBER_FUNCTION_REF_EXP
18507 printf (
"case V_SgMemberFunctionRefExp: enclosingStatement_original = %p = %s \n",enclosingStatement_original,enclosingStatement_original->
class_name().c_str());
18510 ROSE_ASSERT(otherPossibleScope_original != NULL);
18513 ROSE_ASSERT(file != NULL);
18514#if DEBUG_MEMBER_FUNCTION_REF_EXP
18515 printf (
"enclosingStatement_original: associated file name = %s \n",file->get_sourceFileNameWithPath().c_str());
18518 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope_original,otherPossibleScope_original->
class_name().c_str());
18519 printf (
"case V_SgClassDeclaration: memberFunctionSymbol_copy->get_name() = %s \n",memberFunctionSymbol_copy->
get_name().str());
18522 if (memberFunctionSymbolInTargetAST == NULL)
18524#if DEBUG_MEMBER_FUNCTION_REF_EXP
18525 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");
18530 ROSE_ASSERT(parentExpression != NULL);
18531#if DEBUG_MEMBER_FUNCTION_REF_EXP
18532 printf (
"parentExpression = %p = %s \n",parentExpression,parentExpression->
class_name().c_str());
18534 bool handle_as_java =
false;
18536 if (functionCallExp != NULL)
18540 handle_as_java =
true;
18544 ROSE_ASSERT(parentOfFunctionCallExpression != NULL);
18545#if DEBUG_MEMBER_FUNCTION_REF_EXP
18546 printf (
"parentOfFunctionCallExpression = %p = %s \n",parentOfFunctionCallExpression,parentOfFunctionCallExpression->
class_name().c_str());
18548 parentExpression = parentOfFunctionCallExpression;
18551 SgBinaryOp* parentBinaryOp = isSgBinaryOp(parentExpression);
18552 SgDotExp* parentDotExp = isSgDotExp(parentExpression);
18553 SgArrowExp* parentArrowExp = isSgArrowExp(parentExpression);
18554#if DEBUG_MEMBER_FUNCTION_REF_EXP
18555 printf (
"parentBinaryOp = %p \n",parentBinaryOp);
18556 printf (
"parentDotExp = %p \n",parentDotExp);
18557 printf (
"parentArrowExp = %p \n",parentArrowExp);
18559 if (parentDotExp != NULL || parentArrowExp != NULL)
18563 ROSE_ASSERT(lhs != NULL);
18566 if (handle_as_java ==
true)
18574 ROSE_ASSERT(parentBinaryOp->
get_rhs_operand() == memberFunctionRefExp_copy);
18576#if DEBUG_MEMBER_FUNCTION_REF_EXP
18577 printf (
"lhs = %p = %s \n",lhs,lhs->
class_name().c_str());
18583 if (varRefExp != NULL)
18585 SgVariableSymbol* variableSymbol = isSgVariableSymbol(varRefExp->get_symbol());
18586 ROSE_ASSERT(variableSymbol != NULL);
18588 ROSE_ASSERT(initializedName != NULL);
18590 SgType* initializedName_type = initializedName->get_type();
18591#if DEBUG_MEMBER_FUNCTION_REF_EXP
18592 printf (
"initializedName = %p = %s \n",initializedName,initializedName->get_name().str());
18593 printf (
"initializedName_type = %p \n",initializedName_type);
18595 SgClassType* classType = isSgClassType(initializedName_type);
18596 if (classType != NULL)
18598 SgClassDeclaration* classDeclaration = isSgClassDeclaration(classType->get_declaration());
18599 ROSE_ASSERT(classDeclaration != NULL);
18601 ROSE_ASSERT(definingClassDeclaration != NULL);
18602 printf (
"definingClassDeclaration->get_name() = %s \n",definingClassDeclaration->get_name().str());
18604 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
18605 ROSE_ASSERT(classDefinition != NULL);
18606 SgType* memberFunctionType = memberFunctionSymbol_copy->
get_type();
18607 SgName memberFunctionName = memberFunctionSymbol_copy->
get_name();
18608 ROSE_ASSERT(memberFunctionType != NULL);
18609 SgFunctionSymbol *functionSymbol = classDefinition->lookup_function_symbol(memberFunctionName,memberFunctionType);
18610 if (functionSymbol == NULL)
18612 printf (
"Symbol not found: output symbol table (size = %d): \n",classDefinition->
get_symbol_table()->
size());
18613#if DEBUG_MEMBER_FUNCTION_REF_EXP
18614 classDefinition->
get_symbol_table()->
print(
"Symbol not found: output symbol table: SgClassDefinition");
18619 printf (
"\n*************************************************************** \n");
18620 printf (
"ERROR: target has not be properly setup to receive the snippet. \n");
18621 printf (
"*************************************************************** \n");
18623 ROSE_ASSERT(functionSymbol != NULL);
18625 ROSE_ASSERT(memberFunctionSymbol != NULL);
18627 memberFunctionSymbolInTargetAST = memberFunctionSymbol;
18629 printf (
"Exiting as a test! \n");
18639 if (valueExp != NULL)
18641 memberFunctionSymbolInTargetAST = memberFunctionSymbol_copy;
18642 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18645 if (memberFunctionSymbolInTargetAST == NULL)
18649 ROSE_ASSERT(type != NULL);
18650#if DEBUG_MEMBER_FUNCTION_REF_EXP
18651 printf (
"type = %p = %s \n",type,type->
class_name().c_str());
18654 ROSE_ASSERT(namedType != NULL);
18656 ROSE_ASSERT(declaration != NULL);
18658 ROSE_ASSERT(classDeclaration != NULL);
18660 ROSE_ASSERT(definingClassDeclaration != NULL);
18661 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
18662 ROSE_ASSERT(classDefinition != NULL);
18663#if DEBUG_MEMBER_FUNCTION_REF_EXP
18664 printf (
"case V_SgClassDeclaration: classDefinition = %p = %s \n",classDefinition,classDefinition->
class_name().c_str());
18667 otherPossibleScope_original = classDefinition;
18668#if DEBUG_MEMBER_FUNCTION_REF_EXP
18671#if DEBUG_MEMBER_FUNCTION_REF_EXP
18674 printf (
"associated_classDeclaration = %p name = %s \n",associated_classDeclaration,associated_classDeclaration->get_name().str());
18675 printf (
"functionSymbol = %p \n",functionSymbol);
18678 if (memberFunctionSymbolInTargetAST == NULL)
18681 printf (
"Error: (memberFunctionSymbolInTargetAST == NULL): memberFunctionSymbol_copy->get_name() = %s \n",memberFunctionSymbol_copy->
get_name().str());
18684 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18686 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18690 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18692 ROSE_ASSERT(functionDeclaration != NULL);
18694 ROSE_ASSERT(scope != NULL);
18699 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18702 memberFunctionRefExp_copy->set_symbol(memberFunctionSymbolInTargetAST);
18712 printf (
"Exiting as a test! (SgTryStmt) \n");
18719 case V_SgCatchStatementSeq:
18724 printf (
"Exiting as a test! (SgCatchStatementSeq) \n");
18731 case V_SgCatchOptionStmt:
18736 ROSE_ASSERT(catchOptionStatement_copy);
18738 printf (
"Need to check the symbol table of the SgCatchOptionStmt (which is a SgScopeStatement) \n");
18741 printf (
"Exiting as a test! (SgCatchOptionStmt) \n");
18748 case V_SgJavaPackageStatement:
18751 printf (
"Exiting as a test! (SgJavaPackageStatement) \n");
18761 printf (
"enum values contain a reference to the associated SgEnumDeclaration \n");
18763 SgEnumVal* enumVal_copy = isSgEnumVal(node_copy);
18764 SgEnumVal* enumVal_original = isSgEnumVal(node_original);
18766 printf (
" --- enumVal_original = %p = %d name = %s \n",enumVal_original,enumVal_original->get_value(),enumVal_original->get_name().str());
18768 SgEnumDeclaration* associatedEnumDeclaration_copy = isSgEnumDeclaration(enumVal_copy->get_declaration());
18769 SgEnumDeclaration* associatedEnumDeclaration_original = isSgEnumDeclaration(enumVal_original->get_declaration());
18772 bool isUnNamed = associatedEnumDeclaration_original->get_isUnNamed();
18773 if (isUnNamed ==
false)
18775 if (associatedEnumDeclaration_copy == associatedEnumDeclaration_original)
18778 printf (
" --- The stored reference to the enum declaration in the SgEnumVal must be reset \n");
18782 if (symbol == NULL)
18785 enumVal_original->
get_file_info()->display(
"case V_SgEnumVal: symbol == NULL: debug");
18787 ROSE_ASSERT(symbol != NULL);
18789 ROSE_ASSERT(enumSymbol != NULL);
18790 SgEnumDeclaration* new_associatedEnumDeclaration_copy = enumSymbol->get_declaration();
18791 ROSE_ASSERT(new_associatedEnumDeclaration_copy != NULL);
18794 ROSE_ASSERT(new_associatedEnumDeclaration_copy != associatedEnumDeclaration_original);
18796 ROSE_ASSERT(new_associatedEnumDeclaration_copy != associatedEnumDeclaration_original->
get_definingDeclaration());
18798 enumVal_copy->set_declaration(new_associatedEnumDeclaration_copy);
18800 printf (
"Exiting as a test! \n");
18809 printf (
"Warning: can't handle enum values from unnamed enum declarations \n");
18810 printf (
" --- enumVal_original = %p = %lld name = %s \n",enumVal_original,enumVal_original->get_value(),enumVal_original->get_name().str());
18844 ROSE_ASSERT(insertionPoint != NULL);
18845 ROSE_ASSERT(toInsert != NULL);
18846 ROSE_ASSERT(original_before_copy != NULL);
18850 SgSymbolTable::set_force_search_of_base_classes(
true);
18857 ROSE_ASSERT(targetFile != NULL);
18866 ROSE_ASSERT(snippetFile_of_copy == targetFile);
18871 ROSE_ASSERT(snippetFile_of_original != targetFile);
18874 printf (
" --- targetFile = %p = %s \n",targetFile,targetFile->get_sourceFileNameWithPath().c_str());
18875 printf (
" --- snippetFile_of_copy = %p = %s \n",snippetFile_of_copy,snippetFile_of_copy->get_sourceFileNameWithPath().c_str());
18876 printf (
" --- snippetFile_of_original = %p = %s \n",snippetFile_of_original,snippetFile_of_original->get_sourceFileNameWithPath().c_str());
18888 if (isStructurallyEquivalent ==
false)
18890 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");
18893 ROSE_ASSERT(isStructurallyEquivalent ==
true);
18903 RoseAst ast_of_copy(toInsert);
18904 RoseAst ast_of_original(original_before_copy);
18913 while (i_copy != ast_of_copy.
end())
18917 if ((*i_copy)->variantT() != (*i_original)->variantT())
18919 printf (
"ERROR: return from fixupCopyOfAstFromSeparateFileInNewTargetAst(): "
18920 "(*i_copy)->variantT() != (*i_original)->variantT() \n");
18922 printf (
"Making this an error! \n");
18935 ROSE_ASSERT(i_original != ast_of_original.
end());
18940 ROSE_ASSERT(i_copy == ast_of_copy.
end() && i_original == ast_of_original.
end());
18946 if (functionDeclaration != NULL)
18948 printf (
"functionDeclaration = %s \n",functionDeclaration->get_name().str());
18950 printf (
"Exiting as a test! \n");
18957 SgSymbolTable::set_force_search_of_base_classes(
false);
18967 ROSE_ASSERT (scope != NULL);
18977 ROSE_ASSERT(result != NULL);
18981 cerr<<
"Error. buildStatementFromString() cannot parse the input string:"<<s
18982 <<
"\n\t within the given scope:"<<scope->
class_name() <<endl;
19006 template <
class SgAstNode>
19009 static const bool explicitlySpecified =
true;
19027 res = createTemplateArg_(*isSgType(&n));
19028 else if (isSgExpression(&n))
19029 res = createTemplateArg_(*isSgExpression(&n));
19032 ROSE_ASSERT(isSgTemplateDeclaration(&n));
19033 res = createTemplateArg_(*isSgTemplateDeclaration(&n));
19040 SgName genTemplateName(
SgName base, Rose_STL_Container<SgNode*>& targs)
19042 Rose_STL_Container<SgNode*>::iterator aa = targs.begin();
19043 Rose_STL_Container<SgNode*>::iterator zz = targs.begin();
19044 std::string name(base.getString());
19047 for ( ; aa != zz; ++aa) name.append((*aa)->unparseToString());
19053 SgTemplateArgumentPtrList genTemplateArgumentList(Rose_STL_Container<SgNode*>& targs)
19055 Rose_STL_Container<SgNode*>::iterator aa = targs.begin();
19056 Rose_STL_Container<SgNode*>::iterator zz = targs.begin();
19057 SgTemplateArgumentPtrList lst;
19059 for ( ; aa != zz; ++aa)
19061 lst.push_back(createTemplateArg(**aa));
19069 ROSE_ASSERT(main_decl);
19075 ROSE_ASSERT(tdecl);
19081 ROSE_ASSERT(tclassdecl);
19102 ROSE_ASSERT(tdecl);
19107 struct TemplateArgumentParentSetter
19125Rose_STL_Container<SgNode *>& template_args)
19132Rose_STL_Container<SgNode *>& template_args)
19134 ROSE_ASSERT(template_decl);
19137 SgName name = template_decl->get_name();
19139 SgTemplateArgumentPtrList targs = genTemplateArgumentList(template_args);
19142 ROSE_ASSERT(tinst);
19146 ROSE_ASSERT(tclass);
19149 tinst->set_type(tclass);
19153 std::for_each(targs.begin(), targs.end(), TemplateArgumentParentSetter(tinst));
19159#ifdef ROSE_BUILD_JAVA_LANGUAGE_SUPPORT
19166 ROSE_ASSERT(Rose::Frontend::Java::lengthSymbol);
19178 if (parent_scope != NULL) {
19179 scope -> set_parent(parent_scope);
19209 pair -> set_value(value);
19210 value -> set_parent(pair);
19237 for (std::list<SgJavaMemberValuePair *>::iterator i = pair_list.begin(); i != pair_list.end(); i++) {
19239 member_value_pair -> set_parent(annotation);
19240 annotation -> append_value_pair(member_value_pair);
19263 return initialized_name;
19272 package_statement -> set_firstNondefiningDeclaration(package_statement);
19273 package_statement -> set_definingDeclaration(package_statement);
19274 return package_statement;
19283 import_statement -> set_firstNondefiningDeclaration(import_statement);
19284 import_statement -> set_definingDeclaration(import_statement);
19285 return import_statement;
19292 ROSE_ASSERT(scope);
19293 SgName class_name = name;
19294 ROSE_ASSERT(scope -> lookup_class_symbol(class_name) == NULL);
19297 bool buildTemplateInstantiation =
false;
19298 SgTemplateArgumentPtrList* templateArgumentsList = NULL;
19300 ROSE_ASSERT(class_declaration);
19301 class_declaration -> set_parent(scope);
19302 class_declaration -> set_scope(scope);
19305 ROSE_ASSERT(class_definition);
19309 class_definition -> setAttribute(
"extension_type_names",
new AstRegExAttribute());
19312 type_space -> set_parent(class_definition);
19314 class_declaration -> setAttribute(
"type_space",
new AstSgNodeAttribute(type_space));
19316 return class_declaration;
19325 string filename = directory_name +
"/" + type_name +
".java";
19326 ROSE_ASSERT((*project)[filename] == NULL);
19328 string command = string(
"touch ") + filename;
19329 int status = system(command.c_str());
19330 ROSE_ASSERT(status == 0);
19331 project -> get_sourceFileNameList().push_back(filename);
19332 Rose_STL_Container<std::string> arg_list = project -> get_originalCommandLineArgumentList();
19333 arg_list.push_back(filename);
19337 int error_code = 0;
19338 SgFile *file = determineFileType(arg_list, error_code, project);
19340 ROSE_ASSERT(sourcefile);
19341 sourcefile -> set_parent(project);
19342 project -> get_fileList_ptr() -> get_listOfFiles().push_back(sourcefile);
19343 ROSE_ASSERT(sourcefile == isSgSourceFile((*project)[filename]));
19349 ROSE_ASSERT(pkgDefDecl != NULL);
19351 package_statement->
set_parent(package_definition);
19352 sourcefile->set_package(package_statement);
19358 import_statement_list -> set_parent(sourcefile);
19359 sourcefile -> set_import_list(import_statement_list);
19365 class_declaration_list -> set_parent(package_definition);
19366 sourcefile -> set_class_list(class_declaration_list);
19376 ROSE_ASSERT(num_dimensions > 0);
19377 if (num_dimensions > 1) {
19381 ROSE_ASSERT(base_type != NULL);
19383 if (attribute == NULL) {
19385 array_type -> set_rank(num_dimensions);
19387 base_type -> setAttribute(
"array", attribute);
19390 return isSgArrayType(attribute -> getNode());
19401 generic_type -> setAttribute(
"parameterized types", attribute);
19403 ROSE_ASSERT(attribute);
19405 return attribute -> findOrInsertParameterizedType(new_args);
19416 type -> setAttribute(
"qualified types", attribute);
19418 ROSE_ASSERT(attribute);
19420 for (
int i = 0; i < attribute -> size(); i++) {
19422 ROSE_ASSERT(qualified_type);
19423 if (qualified_type -> get_parent_type() == parent_type && qualified_type -> get_type() == type) {
19424 return qualified_type;
19429 qualified_type -> set_parent_type(parent_type);
19430 qualified_type -> set_type(type);
19432 attribute -> addNode(qualified_type);
19434 return qualified_type;
19445 SgClassDeclaration *class_declaration = isSgClassDeclaration(Rose::Frontend::Java::ObjectClassType -> get_declaration());
19448 Rose::Frontend::Java::ObjectClassType -> setAttribute(
"unbound", attribute);
19451 return isSgJavaWildcardType(attribute -> getNode());
19464 ROSE_ASSERT(array_type || named_type);
19465 SgClassDeclaration *class_declaration = isSgClassDeclaration((array_type ? (
SgNamedType *) Rose::Frontend::Java::ObjectClassType : named_type) -> get_declaration());
19468 wildcard -> set_has_extends(
true);
19471 type -> setAttribute(
"extends", attribute);
19474 return isSgJavaWildcardType(attribute -> getNode());
19487 ROSE_ASSERT(array_type || named_type);
19488 SgClassDeclaration *class_declaration = isSgClassDeclaration((array_type ? (
SgNamedType *) Rose::Frontend::Java::ObjectClassType : named_type) -> get_declaration());
19491 wildcard -> set_has_super(
true);
19494 type -> setAttribute(
"super", attribute);
19497 return isSgJavaWildcardType(attribute -> getNode());
19507 namespace Builder {
19508 namespace Templates {
19511 if (t ==
nullptr)
return nullptr;
19517 if (e ==
nullptr)
return nullptr;
19537std::string strTemplateArgument(
int v) {
19538 std::ostringstream oss;
19543std::string strTemplateArgument(
bool v) {
19544 std::ostringstream oss;
19545 if (v) oss <<
"true";
19546 else oss <<
"false";
19550std::string strTemplateArgument(
SgNamedType * nt) {
19551 std::ostringstream oss;
19556std::string strTemplateArgument(
SgType * t) {
19557 std::ostringstream oss;
19563 std::ostringstream oss;
19568#define DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps 0
19572 std::vector<std::vector<SgTemplateParameter *>> & tpl_params,
19573 std::vector<std::vector<SgTemplateArgument *>> & tpl_args
19575#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19576 std::cout <<
"Rose::Builder::Templates::instantiateNonrealRefExps" << std::endl;
19577 std::cout <<
" expr = " << std::hex << expr <<
" : " << ( expr ? expr->
class_name() :
"" ) << std::endl;
19578 std::cout <<
" = " << ( expr ? expr->
unparseToString() :
"" ) << std::endl;
19582 }
else if (isSgNonrealRefExp(expr)) {
19583#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19584 std::cerr <<
"Error: In instantiateNonrealRefExps: case of a SgNonrealRefExp!!!" << std::endl;
19587 }
else if (isSgVarRefExp(expr)) {
19590 ROSE_ASSERT(iname);
19591#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19592 std::cout <<
" iname = " << std::hex << iname <<
" : " << ( iname ? iname->
class_name() :
"" ) << std::endl;
19593 std::cout <<
" iname->get_name() = " << iname->get_name() << std::endl;
19594 std::cout <<
" iname->get_initializer() = " << std::hex << iname->get_initializer() <<
" : " << ( iname->get_initializer() ? iname->get_initializer()->
class_name() :
"" ) << std::endl;
19598 unsigned depth = 0;
19600 for (
auto tpl_params_: tpl_params) {
19602 for (
auto tpl_param: tpl_params_) {
19603 if (tpl_param->get_initializedName()) {
19604#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19605 std::cout <<
" tpl_param->get_initializedName() = " << std::hex << tpl_param->get_initializedName() << std::endl;
19606 std::cout <<
" tpl_param->get_initializedName()->get_name() = " << tpl_param->get_initializedName()->get_name() << std::endl;
19608 if (tpl_param->get_initializedName()->get_name() == iname->get_name()) {
19609 iname = tpl_param->get_initializedName();
19618 if (depth < tpl_args.size() && pos < tpl_args[depth].size()) {
19619 SgExpression * res = tpl_args[depth][pos]->get_expression();
19622 }
else if (depth < tpl_params.size() && pos < tpl_params[depth].size()) {
19623 SgExpression * dft = tpl_params[depth][pos]->get_defaultExpressionParameter();
19625 dft = instantiateNonrealRefExps(dft, tpl_params, tpl_args);
19629#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19630 std::cerr <<
"Error: In instantiateNonrealRefExps: this should not be reached!!!" << std::endl;
19633 }
else if (isSgValueExp(expr)) {
19635 }
else if (isSgConditionalExp(expr)) {
19641 }
else if (isSgSizeOfOp(expr)) {
19643#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19644 std::cout <<
" szo->get_operand_expr() = " << std::hex << szo->get_operand_expr() <<
" : " << ( szo->get_operand_expr() ? szo->get_operand_expr()->
class_name() :
"" ) << std::endl;
19645 std::cout <<
" szo->get_operand_type() = " << std::hex << szo->get_operand_type() <<
" : " << ( szo->get_operand_type() ? szo->get_operand_type()->
class_name() :
"" ) << std::endl;
19647 SgExpression * eres = instantiateNonrealRefExps(szo->get_operand_expr(), tpl_params, tpl_args);
19648 ROSE_ASSERT(szo->get_operand_expr() ==
nullptr || eres !=
nullptr);
19649 szo->set_operand_expr(eres);
19651 SgType * tres = instantiateNonrealTypes(szo->get_operand_type(), tpl_params, tpl_args);
19652 ROSE_ASSERT(szo->get_operand_type() ==
nullptr || tres !=
nullptr);
19653 szo->set_operand_type(tres);
19655#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19656 std::cout <<
" szo->get_operand_expr() = " << std::hex << szo->get_operand_expr() <<
" : " << ( szo->get_operand_expr() ? szo->get_operand_expr()->
class_name() :
"" ) << std::endl;
19657 std::cout <<
" szo->get_operand_type() = " << std::hex << szo->get_operand_type() <<
" : " << ( szo->get_operand_type() ? szo->get_operand_type()->
class_name() :
"" ) << std::endl;
19660 }
else if (isSgCastExp(expr)) {
19662 auto operand = instantiateNonrealRefExps(cast->
get_operand_i(), tpl_params, tpl_args);
19663 if (operand ==
nullptr)
return nullptr;
19664 auto type = instantiateNonrealTypes(cast->
get_type(), tpl_params, tpl_args);
19665 if (type ==
nullptr)
return operand;
19667 cast->set_type(type);
19669 }
else if (isSgUnaryOp(expr)) {
19673 }
else if (isSgBinaryOp(expr)) {
19679 std::cerr <<
"!!! expr = " << std::hex << expr <<
" : " << ( expr ? expr->
class_name() :
"" ) << std::endl;
19686 std::vector<SgTemplateParameter *> & tpl_params,
19687 std::vector<SgTemplateArgument *> & tpl_args
19689 std::vector<std::vector<SgTemplateParameter *>> tpl_params_{tpl_params};
19690 std::vector<std::vector<SgTemplateArgument *>> tpl_args_{tpl_args};
19691 return instantiateNonrealRefExps(expr, tpl_params_, tpl_args_);
19694#define DEBUG_Rose_Builder_Templates_instantiateNonrealTypes 0
19696SgType * instantiateNonrealTypes(
19698 std::vector<std::vector<SgTemplateParameter *>> & tpl_params,
19699 std::vector<std::vector<SgTemplateArgument *>> & tpl_args
19701#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19702 std::cout <<
"Rose::Builder::Templates::instantiateNonrealTypes" << std::endl;
19703 std::cout <<
" type = " << std::hex << type <<
" : " << ( type ? type->
class_name() :
"" ) << std::endl;
19704 std::cout <<
" = " << ( type ? type->
unparseToString() :
"" ) << std::endl;
19708 }
else if (isSgNonrealType(type)) {
19710 SgNonrealDecl * nrdecl = isSgNonrealDecl(nrtype->get_declaration());
19711 ROSE_ASSERT(nrdecl !=
nullptr);
19712#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19713 std::cout <<
" nrdecl = " << std::hex << nrdecl <<
" : " << nrdecl->
class_name() << std::endl;
19714 std::cout <<
" ->get_qualified_name() = " << nrdecl->get_qualified_name().getString() << std::endl;
19716 std::cout <<
" ->get_tpl_args() = " << std::dec << nrdecl->get_tpl_args().size() << std::endl;
19717 std::cout <<
" ->get_tpl_params() = " << std::dec << nrdecl->get_tpl_params().size() << std::endl;
19718 std::cout <<
" ->get_is_class_member() = " << ( nrdecl->get_is_class_member() ?
"true" :
"false" ) << std::endl;
19719 std::cout <<
" ->get_is_template_param() = " << ( nrdecl->get_is_template_param() ?
"true" :
"false" ) << std::endl;
19720 std::cout <<
" ->get_is_template_template_param() = " << ( nrdecl->get_is_template_template_param() ?
"true" :
"false" ) << std::endl;
19721 std::cout <<
" ->get_is_nonreal_template() = " << ( nrdecl->get_is_nonreal_template() ?
"true" :
"false" ) << std::endl;
19722 std::cout <<
" ->get_is_nonreal_function() = " << ( nrdecl->get_is_nonreal_function() ?
"true" :
"false" ) << std::endl;
19725 if (tpldecl !=
nullptr) {
19726#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19727 std::cout <<
" tpldecl = " << std::hex << tpldecl <<
" : " << tpldecl->
class_name() << std::endl;
19731 if (xtpldecl !=
nullptr) {
19732#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19733 std::cout <<
" xtpldecl->get_name() = " << xtpldecl->get_name() << std::endl;
19735 std::vector<SgTemplateArgument *> inst_tpl_args;
19737#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19738 std::cout <<
" tplarg = " << std::hex << tplarg <<
" : " << ( tplarg ? tplarg->class_name() :
"" ) << std::endl;
19739 std::cout <<
" ->get_argumentType() = " << tplarg->get_argumentType() << std::endl;
19741 switch (tplarg->get_argumentType()) {
19743#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19744 std::cout <<
" tplarg->get_type() = " << std::hex << tplarg->get_type() <<
" : " << ( tplarg->get_type() ? tplarg->get_type()->class_name() :
"" ) << std::endl;
19746 auto inst_tplarg = instantiateNonrealTypes(tplarg->get_type(), tpl_params, tpl_args);
19748 inst_tpl_args.push_back(buildTemplateArgument(inst_tplarg));
19752#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19753 std::cout <<
" tplarg->get_expression() = " << std::hex << tplarg->get_expression() <<
" : " << ( tplarg->get_expression() ? tplarg->get_expression()->class_name() :
"" ) << std::endl;
19754 std::cout <<
" ->unparseToString() = " << tplarg->get_expression()->unparseToString() << std::endl;
19757#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19758 std::cout <<
" inst_tplarg = " << std::hex << inst_tplarg <<
" : " << ( inst_tplarg ? inst_tplarg->class_name() :
"" ) << std::endl;
19759 std::cout <<
" inst_tplarg->unparseToString() = " << ( inst_tplarg ? inst_tplarg->unparseToString() :
"" ) << std::endl;
19762 inst_tpl_args.push_back(buildTemplateArgument(inst_tplarg));
19766#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19767 std::cout <<
" tplarg->get_templateDeclaration() = " << std::hex << tplarg->get_templateDeclaration() <<
" : " << ( tplarg->get_templateDeclaration() ? tplarg->get_templateDeclaration()->class_name() :
"" ) << std::endl;
19772#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19773 std::cout <<
" start_of_pack_expansion_argument" << std::endl;
19777 default: ROSE_ABORT();
19783 ROSE_ASSERT(inst_decl);
19784#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19785 std::cout <<
" inst_decl = " << std::hex << inst_decl <<
" : " << inst_decl->
class_name() << std::endl;
19787 std::cout <<
" inst_decl->get_definingDeclaration() = " << std::hex << inst_decl->
get_definingDeclaration() << std::endl;
19794 for (
auto inst_tpl_arg: inst_tpl_args) {
19795 inst_tpl_arg->set_parent(inst_decl);
19799 return inst_decl->get_type();
19803 }
else if (nrdecl->get_is_template_param()) {
19804 auto depth = nrdecl->get_template_parameter_depth();
19805 auto position = nrdecl->get_template_parameter_position();
19806#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19807 std::cout <<
" ->get_template_parameter_position() = " << std::dec <<
position << std::endl;
19808 std::cout <<
" ->get_template_parameter_depth() = " << std::dec << depth << std::endl;
19810 ROSE_ASSERT(depth > 0);
19811 ROSE_ASSERT(position > 0);
19812 if (depth <= tpl_args.size() && position <= tpl_args[depth-1].size()) {
19814#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19815 std::cout <<
" tpl_args[" << std::dec << depth-1 <<
"][" << std::dec <<
position-1 <<
"]->get_type() = " << std::dec << res << std::endl;
19818 }
else if (depth <= tpl_params.size() && position <= tpl_params[depth-1].size()) {
19819 SgType * dft_tpl_arg = tpl_params[depth-1][
position-1]->get_defaultTypeParameter();
19820#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19821 std::cout <<
" tpl_params[" << std::dec << depth-1 <<
"][" << std::dec <<
position-1 <<
"]->get_type() = " << std::dec << dft_tpl_arg << std::endl;
19823 dft_tpl_arg = instantiateNonrealTypes(dft_tpl_arg, tpl_params, tpl_args);
19824#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19825 std::cout <<
" dft_tpl_arg = " << std::dec << dft_tpl_arg << std::endl;
19827 return dft_tpl_arg;
19831 }
else if (nrdecl->get_is_class_member()) {
19832#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19833 std::cout <<
" Case of a non-real class member will return INT." << std::endl;
19845 }
else if (isSgTypeVoid(type) || isSgTypeUnsignedLong(type) || isSgTypeInt(type) || isSgTypeLong(type) || isSgTypeUnsignedInt(type) || isSgTypedefType(type) || isSgClassType(type)) {
19847 }
else if (isSgModifierType(type)) {
19849 SgType * btype = mtype->get_base_type();
19850 ROSE_ASSERT(btype !=
nullptr);
19852 ROSE_ASSERT(rtype !=
nullptr);
19856 std::cerr <<
"!!! type = " << std::hex << type <<
" : " << ( type ? type->
class_name() :
"" ) << std::endl;
19862SgType * instantiateNonrealTypes(
19864 std::vector<SgTemplateParameter *> & tpl_params,
19865 std::vector<SgTemplateArgument *> & tpl_args
19867 std::vector<std::vector<SgTemplateParameter *>> tpl_params_{tpl_params};
19868 std::vector<std::vector<SgTemplateArgument *>> tpl_args_{tpl_args};
19869 return instantiateNonrealTypes(type, tpl_params_, tpl_args_);
to specify a construct using a specifier Can be used alone or with parent handles when relative speci...
Users should provide a concrete node implementation especially a constructor/builder to avoid duplica...
Attribute containing a regex expression as a string.
Attribute storing an SgNode.
Class for traversing the AST.
virtual void visit(SgNode *astNode)=0
this method is called at every traversed node.
For preprocessing information including source comments, include , if, define, etc.
RelativePositionType
MK: Enum type to store if the directive goes before or after the corresponding line of source code.
Interface for iterating over an AST.
iterator begin()
Iterator positioned at root of subtree.
iterator end()
Iterator positioned at the end of the traversal.
std::string comment() const
Property: Comment associated with facility.
This class represents the concept of a C Assembler statement.
This class represents the rhs of a variable declaration which includes an optional assignment (e....
This class represents the concept of a block (not a basic block from control flow analysis).
This class represents the notion of a binary operator. It is derived from a SgExpression because oper...
void set_rhs_operand_i(SgExpression *rhs_operand_i)
This function allows the p_rhs_operand_i pointer to be set (used internally).
SgExpression * get_lhs_operand() const
returns SgExpression pointer to the lhs operand associated with this binary operator.
SgExpression * get_rhs_operand_i() const
returns SgExpression pointer to the operand associated with this binary operator.
SgExpression * get_lhs_operand_i() const
returns SgExpression pointer to the operand associated with this binary operator.
void set_lhs_operand_i(SgExpression *lhs_operand_i)
This function allows the p_lhs_operand_i pointer to be set (used internally).
SgExpression * get_rhs_operand() const
returns SgExpression pointer to the rhs operand associated with this binary operator.
This class represents a boolean value (expression value).
This class represents the notion of a break statement (typically used in a switch statment).
This class represents the concept of a C and C++ case option (used within a switch statement).
This class represents a cast of one type to another.
cast_type_enum
Classification of Casts.
SgType * get_type() const override
unparsing support for pragmas
This class represents the concept of a catch within a try-catch construct used in C++ exception handl...
This class represents the concept of a C++ sequence of catch statements.
This class represents the concept of a class declaration statement. It includes the concept of an ins...
void set_scope(SgScopeStatement *scope) override
Support for setting scopes (only meaningful on IR statements that store the scope explicitly).
virtual std::string class_name() const override
returns a string representing the class name
virtual SgSymbol * get_symbol_from_symbol_table() const override
FOR INTERNAL USE Get the associated symbol from the symbol table in the stored scope....
SgScopeStatement * get_scope() const override
Returns scope of current statement.
virtual VariantT variantT() const override
returns new style SageIII enum values
This class represents the concept of a class definition in C++.
SgClassDeclaration * get_declaration() const
returns the class declaration associated with this class decinition.
virtual std::string class_name() const override
returns a string representing the class name
This class represents the concept of a C++ expression built from a class name.
This class represents the concept of a class name within the compiler.
virtual std::string class_name() const override
returns a string representing the class name
SgType * get_type() const override
This function returns the type associated with the named entity.
virtual std::string class_name() const override
returns a string representing the class name
virtual SgName get_mangled(void) const override
Mangled name support for unparser support.
SgName get_name() const override
Support for some classes which have pure virtual function in base classes.
static SgClassType * createType(SgDeclarationStatement *decl=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgClassType (types whose constructors take par...
This class represents the concept of a C trinary conditional expression (e.g. "test ?...
SgExpression * get_true_exp() const
Access function for p_true_exp.
void set_false_exp(SgExpression *false_exp)
Access function for p_false_exp.
SgExpression * get_conditional_exp() const
Access function for p_conditional_exp.
SgExpression * get_false_exp() const
Access function for p_false_exp.
void set_true_exp(SgExpression *true_exp)
Access function for p_true_exp.
void set_conditional_exp(SgExpression *conditional_exp)
Access function for p_conditional_exp.
cv_modifier_enum
Const Volatile Modifier.
This class represents the call of a class constructor to initialize a variable. For example "Foo foo;...
This class represents the concept of a C or C++ continue statement.
This class represents the concept of a contructor initializer list (used in constructor (member funct...
static SgDeclType * createType(SgExpression *expr=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgDeclType (types whose constructors take para...
virtual std::string class_name() const override
returns a string representing the class name
This class represents the concept of a declaration statement.
SgSymbol * search_for_symbol_from_symbol_table() const
User interface for retrieving the associated symbol from the declaration.
void set_definingDeclaration(SgDeclarationStatement *definingDeclaration)
This is an access function for the SgDeclarationStatement::p_definingDeclaration data member (see tha...
void set_firstNondefiningDeclaration(SgDeclarationStatement *firstNondefiningDeclaration)
This is an access function for the SgDeclarationStatement::p_firstNondefiningDeclaration data member ...
SgDeclarationStatement * get_definingDeclaration() const
This is an access function for the SgDeclarationStatement::p_definingDeclaration data member (see tha...
virtual VariantT variantT() const override
returns new style SageIII enum values
virtual std::string class_name() const override
returns a string representing the class name
SgDeclarationStatement * get_firstNondefiningDeclaration() const
This is an access function for the SgDeclarationStatement::p_firstNondefiningDeclaration data member ...
virtual SgSymbol * get_symbol_from_symbol_table() const override
FOR INTERNAL USE Get the associated symbol from the symbol table in the stored scope....
void setForward()
Marks a declaration as a forward declaration.
This class represents the concept of a C or C++ default case within a switch statement.
This class represents the concept of a C++ call to the delete operator.
This class represents the concept of a do-while statement.
SgStatement * get_condition() const
Access function for p_condition.
SgStatement * get_body() const
Access function for p_body.
void set_condition(SgStatement *condition)
Access function for p_condition.
void set_body(SgStatement *body)
Access function for p_body.
This class represents the notion of an value (expression value).
This class represents the concept of an enum declaration.
void set_type(SgEnumType *type)
Access function for p_type.
SgScopeStatement * get_scope() const override
Access function for p_scope.
SgName get_name() const
Access function for p_name.
void set_scope(SgScopeStatement *scope) override
Access function for p_scope.
SgEnumType * get_type() const
Access function for p_type.
SgType * get_type() const override
This function returns the type associated with the named entity.
This class represents the concept of the dynamic execution of a string, file, or code object....
This class represents the concept of a C and C++ expression list.
This class represents the concept of a C or C++ statement which contains a expression.
This class represents the notion of an expression. Expressions are derived from SgLocatedNodes,...
virtual std::string class_name() const override
returns a string representing the class name
void set_need_paren(bool need_paren)
This function allows the p_need_paren flag to be set (used internally).
virtual SgType * get_type() const
unparsing support for pragmas
bool hasExplicitType()
Some expressions store internal SgType pointers explicitly while others compute them from other expre...
virtual Sg_File_Info * get_file_info(void) const override
Interface function to implement original SAGE interface to SgFile_Info objects.
void set_lvalue(bool lvalue)
This function allows the p_lvalue flag to be set (used internally).
void set_explicitly_stored_type(SgType *type)
Some expressions store internal SgType pointers explicitly, this allows these IR nodes to be reset wi...
This class represents a source file for a project (which may contian many source files and or directo...
Sg_File_Info * get_startOfConstruct() const override
New function interface for Sg_File_Info data stores starting location of contruct (typically the open...
void secondaryPassOverSourceFile()
Fixups to be run when the whole project has been created (this attaches preprocessing information).
std::string getFileName() const
associated filename
virtual std::string class_name() const override
returns a string representing the class name
Sg_File_Info * get_file_info() const override
Access function calling get_startOfConstruct(), provided to support older interface.
This class represents the notion of an value (expression value).
This class represents the variable declaration or variable initialization withn a for loop.
const SgStatementPtrList & get_init_stmt() const
Returns const reference to a SgStatementPtrList (typedef to a STL list).
This class represents the concept of a for loop.
SgForInitStatement * get_for_init_stmt() const
Access function for p_for_init_stmt.
void set_loop_body(SgStatement *loop_body)
Access function for p_loop_body.
SgStatement * get_loop_body() const
Access function for p_loop_body.
void set_for_init_stmt(SgForInitStatement *for_init_stmt)
Access function for p_for_init_stmt.
This class represents the concept of a C++ function call (which is an expression).
This class represents the concept of a function declaration statement.
SgScopeStatement * get_scope() const override
Returns scope of current statement.
virtual SgSymbol * get_symbol_from_symbol_table() const override
FOR INTERNAL USE Get the associated symbol from the symbol table in the stored scope....
void set_scope(SgScopeStatement *scope) override
Support for setting scopes (only meaningful on IR statements that store the scope explicitly).
virtual std::string class_name() const override
returns a string representing the class name
This class represents the concept of a scope in C++ (e.g. global scope, fuction scope,...
void set_body(SgBasicBlock *body)
Access function for p_body.
This class represents the concept of a declaration list.
const SgInitializedNamePtrList & get_args() const
Access function for p_args.
const SgTypePtrList & get_arguments() const
Get a const list of input types (types of the parameters list) to this function type (from a cost fun...
This class represents the function being called and must be assembled in the SgFunctionCall with the ...
SgType * get_type() const override
Get the type associated with this expression.
virtual std::string class_name() const override
returns a string representing the class name
SgName get_name() const override
Access function for getting name from declarations or types internally.
This class represents the function type table (stores all function types so that they can be shared i...
This class represents a type for all functions.
virtual std::string class_name() const override
returns a string representing the class name
virtual SgName get_mangled(void) const override
Mangled name support for unparser support.
This class represents the concept of a namespace definition.
virtual std::string class_name() const override
returns a string representing the class name
const SgDeclarationStatementPtrList & get_declarations() const
Returns a const list to the global scope declarations.
This class represents the concept of a C or C++ goto statement.
This class represents the concept of an "if" construct.
void set_use_then_keyword(bool use_then_keyword)
Fortran specific function to indicate if the Fortran "if" statement uses the "then" construct (C/C++ ...
void set_has_end_statement(bool has_end_statement)
Fortran specific function to indicate if the Fortran "if" statement has an "end" construct (C/C++ use...
This class represents the notion of a declared variable.
SgName get_qualified_name() const
Returns the name with appropriate qualified names representing nested scopes.
SgSymbol * get_symbol_from_symbol_table() const
Get the associated SgSymbol from the symbol table located in the scope, without considering possible ...
virtual std::string class_name() const override
returns a string representing the class name
SgSymbol * search_for_symbol_from_symbol_table() const
User interface for retrieving the associated symbol. It searches through the possible chain of prev_d...
This class represents the notion of an initializer for a variable declaration or expression in a func...
virtual std::string class_name() const override
returns a string representing the class name
static SgJavaParameterType * createType(SgClassDeclaration *decl=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgJavaParameterType (types whose constructors ...
static SgJovialBitType * createType(SgExpression *size=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgJovialBitType (types whose constructors take...
static SgJovialTableType * createType(SgClassDeclaration *decl=NULL, SgExpression *optional_fortran_type_kind=NULL)
more sophisticated version for more complex types like SgJovialTableType (types whose constructors ta...
This class represents the concept of a C or C++ label statement.
This class represents a lambda expression.
This class represents a list display.
This class represents the notion of an expression or statement which has a position within the source...
virtual std::string class_name() const override
returns a string representing the class name
Sg_File_Info * get_endOfConstruct() const override
New function interface for Sg_File_Info data stores ending location of contruct (typically the closin...
void set_endOfConstruct(Sg_File_Info *endOfConstruct)
This function sets the current source location position of the end of the current construct.
Sg_File_Info * get_startOfConstruct() const override
New function interface for Sg_File_Info data stores starting location of contruct (typically the open...
virtual Sg_File_Info * get_file_info() const override
Interface function to implement original SAGE interface to SgFile_Info objects.
This class represents the notion of an value (expression value).
This class represents the concept of a member function declaration statement.
SgCtorInitializerList * get_CtorInitializerList() const
Access function for p_CtorInitializerList.
void set_associatedClassDeclaration(SgDeclarationStatement *associatedClassDeclaration)
This is an access function for the p_associatedClassDeclaration data member.
virtual SgSymbol * get_symbol_from_symbol_table() const override
FOR INTERNAL USE Get the associated symbol from the symbol table in the stored scope....
This class represents the member function being called and must be assembled in the SgFunctionCall wi...
SgType * get_type() const override
Get the type associated with this expression.
SgName get_name() const override
Access function for getting name from declarations or types internally.
SgType * get_type() const override
This function returns the type associated with the named entity.
virtual std::string class_name() const override
returns a string representing the class name
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
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'.
Unsigned position(size_t i)
Generate a single-bit mask.
Controls diagnostic messages from ROSE.
ROSE_DLL_API void initAndRegister(Facility *mlog, const std::string &name)
Initialize and register a logging facility.
ROSE_DLL_API Sawyer::Message::Facility mlog
Diagnostic facility for the ROSE library as a whole.
ROSE_UTIL_API std::string intToHex(uint64_t)
Convert an integer to a hexadecimal string.
Functions that build an AST.
ROSE_DLL_API 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 SgCompoundInitializer * buildCompoundInitializer(SgExprListExp *initializers=NULL, SgType *type=NULL)
Build a compound initializer, for vector type initialization.
ROSE_DLL_API SgTypeString * buildStringType()
DQ (8/21/2010): We want to move to the new buildStringType( SgExpression*,size_t) function over the o...
ROSE_DLL_API SgUpcThreads * buildUpcThreads_nfi()
Build UPC THREADS (integer expression)
ROSE_DLL_API SgModifierType * buildModifierType(SgType *base_type=nullptr)
Build a modifier type.
ROSE_DLL_API SgCaseOptionStmt * buildCaseOptionStmt(SgExpression *key=NULL, SgStatement *body=NULL)
Build a case option statement.
ROSE_DLL_API SgTemplateFunctionDeclaration * buildDefiningTemplateFunctionDeclaration(const SgName &name, SgType *return_type, SgFunctionParameterList *parlist, SgScopeStatement *scope, SgExprListExp *decoratorList, SgTemplateFunctionDeclaration *first_nondefining_declaration)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgCatchOptionStmt * buildCatchOptionStmt(SgVariableDeclaration *condition=NULL, SgStatement *body=NULL)
Build a catch statement.
ROSE_DLL_API SgLongLongIntVal * buildLongLongIntVal_nfi(long long value, const std::string &str)
ROSE_DLL_API SgClassType * buildTemplateClassType(SgTemplateClassDeclaration *template_decl, std::vector< SgNode * > &template_args)
Same as buildClassTemplateType(), just better name.
SgFortranContinueStmt * buildFortranContinueStmt_nfi()
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgTemplateMemberFunctionDeclaration * buildNondefiningTemplateMemberFunctionDeclaration(const SgName &name, SgType *return_type, SgFunctionParameterList *parlist, SgScopeStatement *scope, SgExprListExp *decoratorList, unsigned int functionConstVolatileFlags, SgTemplateParameterPtrList *templateParameterList)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgLabelStatement * buildLabelStatement(const SgName &name, SgStatement *stmt=NULL, SgScopeStatement *scope=NULL)
Build a label statement, name is the label's name. Handling label symbol and scope internally.
ROSE_DLL_API SgFortranDo * buildFortranDo_nfi(SgExpression *initialization, SgExpression *bound, SgExpression *increment, SgBasicBlock *)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgUpcThreads * buildUpcThreads()
Build UPC THREADS (integer expression)
ROSE_DLL_API SgModifierType * buildRestrictType(SgType *base_type)
Build a restrict type.
ROSE_DLL_API SgIntVal * buildIntVal_nfi(int value=0)
ROSE_DLL_API SgLongDoubleVal * buildLongDoubleVal(long double value=0.0)
SgFunctionParameterList * buildFunctionParameterList_nfi()
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API AbstractHandle::abstract_handle * buildAbstractHandle(SgNode *n)
Build an abstract handle from a SgNode.
ROSE_DLL_API SgClassDeclaration * buildClassDeclaration(SgName name, SgScopeStatement *scope)
Build C++ class (builds both the non-defining and defining declarations; in that order).
ROSE_DLL_API SgMinusOp * buildMinusOp_nfi(SgExpression *op)
ROSE_DLL_API SgTemplateFunctionDeclaration * buildNondefiningTemplateFunctionDeclaration(const SgName &name, SgType *return_type, SgFunctionParameterList *parlist, SgScopeStatement *scope=NULL, SgExprListExp *decoratorList=NULL, SgTemplateParameterPtrList *templateParameterList=NULL)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgAsmStmt * buildMultibyteNopStatement(int n)
DQ (4/30/2010): Added support for building nop statement using asm statement Building nop statement u...
ROSE_DLL_API SgKeyDatumPair * buildKeyDatumPair(SgExpression *key, SgExpression *datum)
Build a key-datum pair.
ROSE_DLL_API SgComprehension * buildComprehension(SgExpression *target, SgExpression *iter, SgExprListExp *ifs)
ROSE_DLL_API SgJavaParameterizedType * getUniqueJavaParameterizedType(SgNamedType *, SgTemplateParameterPtrList *)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgComplexVal * buildImaginaryVal_nfi(SgValueExp *imaginary_value, const std::string &str)
ROSE_DLL_API SgFunctionCallExp * buildFunctionCallExp(SgFunctionSymbol *sym, SgExprListExp *parameters=NULL)
Build a function call expression.
ROSE_DLL_API SgType * getTargetFileType(SgType *snippet_type, SgScopeStatement *targetScope)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgTemplateParameter * buildTemplateParameter(SgTemplateParameter::template_parameter_enum parameterType, SgType *)
Build a template parameter, passing enum kind and SgTemplateType template_parameter_enum { parameter_...
ROSE_DLL_API SgNoexceptOp * buildNoexceptOp(SgExpression *exp=NULL)
Build noexcept operator expression with an expression parameter.
ROSE_DLL_API SgSignedCharVal * buildSignedCharVal_nfi(signed char v, const std::string &str)
ROSE_DLL_API SgClassDeclaration * buildNondefiningClassDeclaration(SgName name, SgScopeStatement *scope)
DQ (11/7/2009): Added functions to build C++ class.
SgMemberFunctionRefExp * buildMemberFunctionRefExp_nfi(SgMemberFunctionSymbol *sym, bool virtual_call, bool need_qualifier)
ROSE_DLL_API SgFunctionDeclaration * buildDefiningFunctionDeclaration(const SgName &name, SgType *return_type, SgFunctionParameterList *parlist, SgScopeStatement *scope, SgExprListExp *decoratorList, bool buildTemplateInstantiation=false, SgFunctionDeclaration *first_nondefinng_declaration=NULL, SgTemplateArgumentPtrList *templateArgumentsList=NULL)
Build a function declaration with a function body.
ROSE_DLL_API SgModifierType * buildUpcSharedType(SgType *base_type=nullptr, long layout=-1)
Build a UPC shared type.
ROSE_DLL_API SgGotoStatement * buildGotoStatement(SgLabelStatement *label=NULL)
Build a goto statement.
ROSE_DLL_API std::string display(SourcePositionClassification &scp)
display function for debugging
ROSE_DLL_API SgUnsignedLongVal * buildUnsignedLongVal_nfi(unsigned long v, const std::string &str)
ROSE_DLL_API SgLabelRefExp * buildLabelRefExp(SgLabelSymbol *s)
Build a Fortran numeric label ref exp.
ROSE_DLL_API SgCompoundInitializer * buildCompoundInitializer_nfi(SgExprListExp *initializers, SgType *type=NULL)
Build a compound initializer, for vector type initialization.
ROSE_DLL_API SgSourceFile * buildJavaSourceFile(SgProject *, std::string, SgClassDefinition *, std::string)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgCatchStatementSeq * buildCatchStatementSeq(SgCatchOptionStmt *=NULL)
Build an initial sequence of Catch blocks containing 0 or 1 element.
ROSE_DLL_API SgInitializedName * buildInitializedName(const SgName &name, SgType *type, SgInitializer *init=NULL)
Initialized names are tricky, their scope vary depending on context, so scope and symbol information ...
ROSE_DLL_API SgTryStmt * buildTryStmt(SgStatement *body, SgCatchOptionStmt *catch0=NULL, SgCatchOptionStmt *catch1=NULL, SgCatchOptionStmt *catch2=NULL, SgCatchOptionStmt *catch3=NULL, SgCatchOptionStmt *catch4=NULL)
Build a try statement.
ROSE_DLL_API SgJavaImportStatement * buildJavaImportStatement(std::string, bool)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgThisExp * buildThisExp_nfi(SgSymbol *sym)
ROSE_DLL_API SgEnumDeclaration * buildEnumDeclaration_nfi(const SgName &name, SgScopeStatement *scope=NULL)
Build an enum, It is also a declaration statement in SAGE III.
ROSE_DLL_API SgNonrealDecl * buildNonrealDecl(const SgName &name, SgDeclarationScope *scope, SgDeclarationScope *child_scope=NULL)
Build a declaration of a non-real class or class-member representing template parameters and their me...
SgAssertStmt * buildAssertStmt_nfi(SgExpression *test)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgThisExp * buildThisExp(SgSymbol *sym)
Build this pointer.
ROSE_DLL_API SgSymbol * findAssociatedSymbolInTargetAST(SgDeclarationStatement *snippet_declaration, SgScopeStatement *targetScope)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgListComprehension * buildListComprehension(SgExpression *elt, SgExprListExp *generators)
ROSE_DLL_API SgMinusMinusOp * buildMinusMinusOp_nfi(SgExpression *op)
ROSE_DLL_API SgModifierType * buildUpcBlockStarType(SgType *base_type=nullptr)
Build a UPC shared[*] type.
ROSE_DLL_API SgStringConversion * buildStringConversion_nfi(SgExpression *exp)
Build a variable declaration, handle symbol table transparently.
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 SgInitializedName * buildInitializedName_nfi(const SgName &name, SgType *type, SgInitializer *init, SgVariableDeclaration *declptr=NULL)
Initialized names are tricky, their scope vary depending on context, so scope and symbol information ...
ROSE_DLL_API PreprocessingInfo * buildCpreprocessorDefineDeclaration(SgLocatedNode *target, const std::string &content, PreprocessingInfo::RelativePositionType position=PreprocessingInfo::before)
Build and attach #define XX directives, pass "#define xxx xxx" as content.
ROSE_DLL_API SgTypeDouble * buildDoubleType()
Built in simple types.
ROSE_DLL_API SgReferenceType * buildReferenceType(SgType *base_type=nullptr)
Build a reference type.
SgExecStatement * buildExecStatement_nfi(SgExpression *executable, SgExpression *globals=NULL, SgExpression *locals=NULL)
Build an exec stmt.
ROSE_DLL_API SgTypeLongDouble * buildLongDoubleType()
Built in simple types.
ROSE_DLL_API SgTypeLong * buildLongType()
Built in simple types.
ROSE_DLL_API SgExprStatement * buildExprStatement(SgExpression *exp=NULL)
Build a SgExprStatement, set File_Info automatically.
ROSE_DLL_API SgLongIntVal * buildLongIntVal_nfi(long value, const std::string &str)
ROSE_DLL_API SgFunctionParameterRefExp * buildFunctionParameterRefExp(int parameter_number, int parameter_level)
ROSE_DLL_API SgTemplateTypedefDeclaration * buildTemplateTypedefDeclaration_nfi(const SgName &name, SgType *base_type, SgScopeStatement *scope=NULL, bool has_defining_base=false)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API void fixupSourcePositionFileSpecification(SgNode *subtreeRoot, const std::string &newFileName)
Change the source file associated with the source position information in the AST.
ROSE_DLL_API SgAssertStmt * buildAssertStmt(SgExpression *test)
Build a Assert statement.
ROSE_DLL_API SgAtExp * buildAtExp(SgExpression *expression, SgBasicBlock *body)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgChar32Val * buildChar32Val(unsigned int value=0)
ROSE_DLL_API SgSizeOfOp * buildSizeOfOp_nfi(SgExpression *exp)
Build sizeof() expression with an expression parameter.
ROSE_DLL_API SgIfStmt * buildIfStmt(SgStatement *conditional, SgStatement *true_body, SgStatement *false_body)
Build if statement.
ROSE_DLL_API SgAsyncStmt * buildAsyncStmt(SgBasicBlock *body)
MH (6/10/2014): Added async support.
ROSE_DLL_API SgFunctionParameterList * buildFunctionParameterList(SgInitializedName *in1=NULL, SgInitializedName *in2=NULL, SgInitializedName *in3=NULL, SgInitializedName *in4=NULL, SgInitializedName *in5=NULL, SgInitializedName *in6=NULL, SgInitializedName *in7=NULL, SgInitializedName *in8=NULL, SgInitializedName *in9=NULL, SgInitializedName *in10=NULL)
Build an empty SgFunctionParameterList, possibly with some initialized names filled in.
ROSE_DLL_API SgModifierType * buildFortranKindType(SgType *base_type, SgExpression *kindExpression)
Build a type based on the Fortran kind mechanism.
ROSE_DLL_API SgPragmaDeclaration * buildPragmaDeclaration(const std::string &name, SgScopeStatement *scope=NULL)
Build pragma declaration, handle SgPragma and defining/nondefining pointers internally.
ROSE_DLL_API SgUnsignedCharVal * buildUnsignedCharVal(unsigned char v=0)
Build an unsigned char.
SgLabelStatement * buildLabelStatement_nfi(const SgName &name, SgStatement *stmt, SgScopeStatement *scope)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgAlignOfOp * buildAlignOfOp(SgExpression *exp=NULL)
Build alignof() expression with an expression parameter.
ROSE_DLL_API SgMatlabForStatement * buildMatlabForStatement(SgExpression *loop_index, SgExpression *loop_range, SgBasicBlock *loop_body)
Build a For-loop statement for matlab.
bool inSwitchScope()
intended to be a private member, don't access it directly. could be changed any time
ROSE_DLL_API SgUpcMythread * buildUpcMythread()
Build UPC MYTHREAD (integer expression)
ROSE_DLL_API SgTypeUnsignedLong * buildUnsignedLongType()
Built in simple types.
ROSE_DLL_API SgPlusPlusOp * buildPlusPlusOp_nfi(SgExpression *op)
ROSE_DLL_API SgSignedCharVal * buildSignedCharValHex(signed char v=0)
ROSE_DLL_API SgTypeShort * buildShortType()
Built in simple types.
ROSE_DLL_API SgNonrealRefExp * buildNonrealRefExp_nfi(SgNonrealSymbol *sym)
Build a reference to the non-real declaration of a member of a non-real class.
SgFunctionCallExp * buildFunctionCallExp_nfi(SgExpression *f, SgExprListExp *parameters=NULL)
ROSE_DLL_API SgTypeVoid * buildVoidType()
Built in simple types.
ROSE_DLL_API void fixupSharingSourcePosition(SgNode *subtreeRoot, int new_file_id)
Sharing IR nodes requires that the file id be added to the fileIDsToUnparse held in the Sg_File_Info ...
ROSE_DLL_API SgAssignInitializer * buildAssignInitializer_nfi(SgExpression *operand_i=NULL, SgType *expression_type=NULL)
ROSE_DLL_API SgTypeBool * buildBoolType()
Built in simple types.
ROSE_DLL_API SgMicrosoftAttributeDeclaration * buildMicrosoftAttributeDeclaration(const SgName &name)
DQ (8/17/2014): Adding support for Microsoft MSVC specific attributes.
ROSE_DLL_API SgStatement * buildStatementFromString(const std::string &stmt_str, SgScopeStatement *scope)
Liao (9/18/2015): experimental support of building a statement from a string.
ROSE_DLL_API SgFile * buildFile(const std::string &inputFileName, const std::string &outputFileName, SgProject *project=NULL, bool clear_globalScopeAcrossFiles=false)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgMemberFunctionDeclaration * buildDefiningMemberFunctionDeclaration(const SgName &name, SgType *return_type, SgFunctionParameterList *parlist, SgScopeStatement *scope, SgExprListExp *decoratorList, bool buildTemplateInstantiation, unsigned int functionConstVolatileFlags, SgMemberFunctionDeclaration *first_nondefinng_declaration, SgTemplateArgumentPtrList *templateArgumentsList)
Build a defining ( non-prototype) member function declaration.
ROSE_DLL_API SgVarRefExp * buildVarRefExp_nfi(SgVariableSymbol *varSymbol)
ROSE_DLL_API SgPointerType * buildPointerType(SgType *base_type=nullptr)
Build a pointer type.
ROSE_DLL_API SgLongDoubleVal * buildLongDoubleVal_nfi(long double value, const std::string &str)
ROSE_DLL_API SgMagicColonExp * buildMagicColonExp()
Build a Matlab colon expression :
ROSE_DLL_API SgTypedefDeclaration * buildTypedefDeclaration(const std::string &name, SgType *base_type, SgScopeStatement *scope=NULL, bool has_defining_base=false)
Build a typedef declaration, such as: typedef int myint; typedef struct A {..} s_A;.
ROSE_DLL_API SgTemplateParameterVal * buildTemplateParameterVal(int template_parameter_position=-1)
Build an template parameter value expression.
ROSE_DLL_API SgFortranContinueStmt * buildFortranContinueStmt()
Build a Fortran continue statement.
ROSE_DLL_API SgFloat128Val * buildFloat128Val_nfi(long double value, const std::string &str)
ROSE_DLL_API SgBoolValExp * buildBoolValExp(int value=0)
Build a bool value expression, the name convention of SgBoolValExp is little different from others fo...
ROSE_DLL_API SgSwitchStatement * buildSwitchStatement(SgStatement *item_selector=NULL, SgStatement *body=NULL)
Build a switch statement.
ROSE_DLL_API SgType * buildOpaqueType(std::string const type_name, SgScopeStatement *scope)
Build an opaque type with a name, useful when a type's details are unknown during transformation,...
ROSE_DLL_API SgTypeChar32 * buildChar32Type()
Built in simple types.
ROSE_DLL_API SgConstructorInitializer * buildConstructorInitializer_nfi(SgMemberFunctionDeclaration *declaration, SgExprListExp *args, SgType *expression_type, bool need_name, bool need_qualifier, bool need_parenthesis_after_name, bool associated_class_unknown)
ROSE_DLL_API SgMatrixExp * buildMatrixExp(SgExprListExp *firstRow)
Build a Matlab Matrix.
ROSE_DLL_API SgPassStatement * buildPassStatement()
Build a pass statement.
ROSE_DLL_API SgTypeComplex * buildComplexType(SgType *base_type=nullptr)
Build a complex type.
ROSE_DLL_API SgProcedureHeaderStatement * buildProcedureHeaderStatement(const SgName &name, SgType *return_type, SgFunctionParameterList *parameter_list, SgProcedureHeaderStatement::subprogram_kind_enum, SgScopeStatement *scope=NULL)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgDeclarationStatement * findAssociatedDeclarationInTargetAST(SgDeclarationStatement *snippet_declaration, SgScopeStatement *targetScope)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgTypeTuple * buildTupleType(SgType *t1=NULL, SgType *t2=NULL, SgType *t3=NULL, SgType *t4=NULL, SgType *t5=NULL, SgType *t6=NULL, SgType *t7=NULL, SgType *t8=NULL, SgType *t9=NULL, SgType *t10=NULL)
Build a tuple of types. Useful for a function returning multiple variables of different types.
ROSE_DLL_API SgNaryComparisonOp * buildNaryComparisonOp(SgExpression *lhs)
driscoll6 (7/20/11) : Support n-ary operators for python
ROSE_DLL_API SgNonrealType * buildNonrealType(const SgName &name, SgDeclarationScope *scope)
Build a non real type used for template parameter. Internally a SgNorealDecl is also built.
ROSE_DLL_API SgDeclarationScope * buildDeclarationScope()
Build a scope statement. Used to build SgNonrealDecl and SgNonrealType.
ROSE_DLL_API SgName appendTemplateArgumentsToName(const SgName &name, const SgTemplateArgumentPtrList &templateArgumentsList)
DQ (7/27/2012): changed semantics from removing the template arguments in names to adding the templat...
ROSE_DLL_API SgStaticAssertionDeclaration * buildStaticAssertionDeclaration(SgExpression *condition, const SgName &string_literal)
DQ (7/25/2014): Adding support for C11 static assertions.
ROSE_DLL_API SgNullExpression * buildNullExpression_nfi()
No file info version of buildNullExpression(). File info is to be set later on.
ROSE_DLL_API SgFunctionParameterTypeList * buildFunctionParameterTypeList(SgFunctionParameterList *paralist)
Build SgFunctionParameterTypeList from SgFunctionParameterList.
ROSE_DLL_API SgFunctionCallExp * buildMemberFunctionCall(std::string className, SgExpression *objectExpression, std::string functionName, SgExprListExp *params, SgScopeStatement *scope)
Build member function calls.
SgDefaultOptionStmt * buildDefaultOptionStmt_nfi(SgStatement *body)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgActualArgumentExpression * buildActualArgumentExpression(SgName arg_name, SgExpression *arg)
Build an Actual Argument Expression.
ROSE_DLL_API PreprocessingInfo * buildHeader(const std::string &header_filename, PreprocessingInfo::RelativePositionType position=PreprocessingInfo::before, bool isSystemHeader=false)
Build a dangling #include "x.h" header, insertHeader() is needed to actually insert it.
SgPassStatement * buildPassStatement_nfi()
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgStringVal * buildStringVal(std::string value="")
ROSE_DLL_API SgTypeSignedLong * buildSignedLongType()
Built in simple types.
ROSE_DLL_API SgClassDeclaration * buildDefiningClassDeclaration(SgName name, SgScopeStatement *scope)
Build a variable declaration, handle symbol table transparently.
SgGotoStatement * buildGotoStatement_nfi(SgLabelStatement *label)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgTypeChar * buildCharType()
Built in simple types.
ROSE_DLL_API SgTemplateParameterPtrList * getTemplateParameterList(SgDeclarationStatement *decl)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgClassExp * buildClassExp_nfi(SgClassSymbol *sym)
ROSE_DLL_API SgBreakStmt * buildBreakStmt()
Build a break statement.
ROSE_DLL_API SgForInitStatement * buildForInitStatement_nfi(SgStatementPtrList &statements)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API void setTemplateParameterParents(SgDeclarationStatement *decl)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API void pushScopeStack(SgScopeStatement *stmt)
Public interfaces of the scope stack, should be stable.
ROSE_DLL_API SgTypeSignedShort * buildSignedShortType()
Built in simple types.
ROSE_DLL_API SgUsingDirectiveStatement * buildUsingDirectiveStatement(SgNamespaceDeclarationStatement *ns_decl)
Build a using directive statement.
SgDictionaryExp * buildDictionaryExp_nfi(std::vector< SgKeyDatumPair * > pairs)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgCastExp * buildCastExp(SgExpression *operand_i=NULL, SgType *expression_type=NULL, SgCastExp::cast_type_enum cast_type=SgCastExp::e_C_style_cast)
Build a type casting expression.
SgTemplateMemberFunctionRefExp * buildTemplateMemberFunctionRefExp_nfi(SgTemplateMemberFunctionSymbol *sym, bool virtual_call, bool need_qualifier)
DQ (12/29/2011): Adding template declaration support to the AST.
ROSE_DLL_API SgRvalueReferenceType * buildRvalueReferenceType(SgType *base_type)
Build a rvalue reference type.
ROSE_DLL_API SgClassDeclaration * buildNondefiningClassDeclaration_nfi(const SgName &name, SgClassDeclaration::class_types kind, SgScopeStatement *scope, bool buildTemplateInstantiation, SgTemplateArgumentPtrList *templateArgumentsList)
Build a structure first nondefining declaration, without file info.
ROSE_DLL_API SgStmtDeclarationStatement * buildStmtDeclarationStatement_nfi(SgStatement *stmt)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgForInitStatement * buildForInitStatement()
Build a for init statement.
SgDoWhileStmt * buildDoWhileStmt_nfi(SgStatement *body, SgStatement *condition)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API void popScopeStack()
intended to be a private member, don't access it directly. could be changed any time
ROSE_DLL_API SgSignedCharVal * buildSignedCharVal(signed char v=0)
Build a signed char.
ROSE_DLL_API SgAlignOfOp * buildAlignOfOp_nfi(SgExpression *exp)
Build alignof() expression with an expression parameter.
ROSE_DLL_API SgVarArgOp * buildVarArgOp_nfi(SgExpression *operand_i, SgType *expression_type)
Build vararg op expression.
ROSE_DLL_API void testTemplateArgumentParents(SgDeclarationStatement *decl)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgTypeNullptr * buildNullptrType()
Built in simple types.
ROSE_DLL_API SgModifierType * buildUpcStrictType(SgType *base_type=nullptr)
Build a UPC strict type.
ROSE_DLL_API SgExprStatement * buildAssignStatement_ast_translate(SgExpression *lhs, SgExpression *rhs)
This version does not recursively reset the file info as a transformation.
ROSE_DLL_API SgTypeFloat * buildFloatType()
Built in simple types.
ROSE_DLL_API SgDeleteExp * buildDeleteExp(SgExpression *variable, short is_array, short need_global_specifier, SgFunctionDeclaration *deleteOperatorDeclaration)
ROSE_DLL_API SgTypeOfType * buildTypeOfType(SgExpression *base_expression, SgType *base_type)
Build a GNU typeof operator.
ROSE_DLL_API SgVoidVal * buildVoidVal()
DQ (2/14/2019): Adding support for C++14 void value expressions.
SgWhileStmt * buildWhileStmt_nfi(SgStatement *condition, SgStatement *body, SgStatement *else_body=NULL)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API bool emptyScopeStack()
intended to be a private member, don't access it directly. could be changed any time
SgClassNameRefExp * buildClassNameRefExp_nfi(SgClassSymbol *sym)
ROSE_DLL_API SgFloat80Val * buildFloat80Val_nfi(long double value, const std::string &str)
ROSE_DLL_API SgSetComprehension * buildSetComprehension(SgExpression *elt, SgExprListExp *generators)
ROSE_DLL_API SgColonShapeExp * buildColonShapeExp_nfi()
No file info version of buildColonShapeExp(). File info is to be set later on.
ROSE_DLL_API SgVoidVal * buildVoidVal_nfi()
ROSE_DLL_API SgModifierType * buildVolatileType(SgType *base_type=nullptr)
Build a volatile type.
ROSE_DLL_API SgFunctionRefExp * buildFunctionRefExp(const SgName &name, const SgType *func_type, SgScopeStatement *scope=NULL)
Build SgFunctionRefExp based on a C++ function's name and function type. It will lookup symbol table ...
ROSE_DLL_API SgTemplateVariableInstantiation * buildTemplateVariableInstantiation(const SgName &name, SgType *type, SgInitializer *varInit, SgScopeStatement *scope, SgTemplateVariableDeclaration *tpl_decl, SgTemplateArgumentPtrList &tpl_args)
Build template variable declarations.
ROSE_DLL_API SgTypeWchar * buildWcharType()
Built in simple types.
ROSE_DLL_API SgBasicBlock * buildBasicBlock(SgStatement *stmt1=NULL, SgStatement *stmt2=NULL, SgStatement *stmt3=NULL, SgStatement *stmt4=NULL, SgStatement *stmt5=NULL, SgStatement *stmt6=NULL, SgStatement *stmt7=NULL, SgStatement *stmt8=NULL, SgStatement *stmt9=NULL, SgStatement *stmt10=NULL)
Build a SgBasicBlock, setting file info internally.
ROSE_DLL_API SgAggregateInitializer * buildAggregateInitializer(SgExprListExp *initializers=NULL, SgType *type=NULL)
Build an aggregate initializer.
ROSE_DLL_API SgNoexceptOp * buildNoexceptOp_nfi(SgExpression *exp)
Build noexcept operator expression with an expression parameter.
ROSE_DLL_API SgTypeUnknown * buildUnknownType()
Built in simple types.
ROSE_DLL_API SgFoldExpression * buildFoldExpression(SgExpression *operands, std::string operator_token_string, bool is_left_associative)
ROSE_DLL_API SgVariableDeclaration * buildVariableDeclaration_nfi(const SgName &name, SgType *type, SgInitializer *varInit, SgScopeStatement *scope, bool builtFromUseOnly=false, SgStorageModifier::storage_modifier_enum sm=SgStorageModifier::e_default)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgTypeIdOp * buildTypeIdOp(SgExpression *operand_expr, SgType *operand_type)
DQ (1/25/2013): Added support for typeId operators.
ROSE_DLL_API SgExprStatement * buildAssignStatement(SgExpression *lhs, SgExpression *rhs)
Build an assignment statement from lefthand operand and right hand operand.
ROSE_DLL_API SgTypeUnsigned128bitInteger * buildUnsigned128bitIntegerType()
Built in simple types.
ROSE_DLL_API SgUnsignedIntVal * buildUnsignedIntVal(unsigned int v=0)
Build an unsigned integer.
SgFunctionRefExp * buildFunctionRefExp_nfi(SgFunctionSymbol *sym)
ROSE_DLL_API SgCharVal * buildCharVal(char value=0)
SgActualArgumentExpression * buildActualArgumentExpression_nfi(SgName arg_name, SgExpression *arg)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgSizeOfOp * buildSizeOfOp(SgExpression *exp=NULL)
Build sizeof() expression with an expression parameter.
ROSE_DLL_API SgMemberFunctionDeclaration * buildNondefiningMemberFunctionDeclaration(const SgName &name, SgType *return_type, SgFunctionParameterList *parlist, SgScopeStatement *scope, SgExprListExp *decoratorList, unsigned int functionConstVolatileFlags, bool buildTemplateInstantiation, SgTemplateArgumentPtrList *templateArgumentsList)
Build a prototype member function declaration.
ROSE_DLL_API SgJavaWildcardType * getUniqueJavaWildcardSuper(SgType *)
Build a SgFile node and attach it to SgProject.
SgTypeTraitBuiltinOperator * buildTypeTraitBuiltinOperator(SgName functionName, SgNodePtrList parameters)
SgCompoundLiteralExp * buildCompoundLiteralExp(SgVariableSymbol *varSymbol)
Build function for compound literals (uses a SgVariableSymbol and is similar to buildVarRefExp()).
ROSE_DLL_API SgTemplateVariableInstantiation * buildTemplateVariableInstantiation_nfi(const SgName &name, SgType *type, SgInitializer *varInit, SgScopeStatement *scope, SgTemplateVariableDeclaration *tpl_decl, SgTemplateArgumentPtrList &tpl_args)
Build a variable declaration, handle symbol table transparently.
SgExprListExp * buildExprListExp_nfi()
ROSE_DLL_API SgType * getTargetFileTypeSupport(SgType *snippet_type, SgScopeStatement *targetScope)
Build a SgFile node and attach it to SgProject.
ROSE_DLL_API SgVariantExpression * buildVariantExpression()
ROSE_DLL_API SgNonrealBaseClass * buildNonrealBaseClass(SgNonrealDecl *classDeclaration, SgClassDefinition *classDefinition, bool isVirtual, bool isDirect)
Build a variable declaration, handle symbol table transparently.
ROSE_DLL_API SgTypeSignedInt * buildSignedIntType()
Built in simple types.
ROSE_DLL_API 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.