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);
2236 ROSE_ASSERT(type_decl->get_type() != NULL);
2237 ROSE_ASSERT(scope != NULL);
2239#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2240 std::cout <<
" type_decl = " << std::hex << type_decl <<
" : " << ( type_decl ? type_decl->
class_name() :
"" ) << std::endl;
2241 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;
2246 if (scope->lookup_template_typedef_symbol(nameWithTemplateArguments) != NULL)
2248 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());
2250 ROSE_ASSERT(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) == NULL);
2253 ROSE_ASSERT(typedef_symbol);
2255 scope->
insert_symbol(nameWithTemplateArguments,typedef_symbol);
2258 ROSE_ASSERT(scope->lookup_template_typedef_symbol(nameWithTemplateArguments) != NULL);
2261#if DEBUG__SageBuilder__buildTemplateInstantiationTypedefDeclaration_nfi
2262 std::cout <<
" type_decl = " << std::hex << type_decl <<
" : " << ( type_decl ? type_decl->
class_name() :
"" ) << std::endl;
2263 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;
2279 ROSE_ASSERT (parameterList);
2295 if (in10)
appendArg(parameterList, in10);
2297 return parameterList;
2303 ROSE_ASSERT (parameterList);
2309 return parameterList;
2316 ROSE_ASSERT (ctorInitList);
2322 return ctorInitList;
2331 if (paralist == NULL)
2333 printf (
"WARNING: In buildFunctionParameterTypeList(): Accepting NULL input and returning NULL pointer. \n");
2343 ROSE_ASSERT(typePtrList != NULL);
2345 SgInitializedNamePtrList args = paralist->
get_args();
2346 SgInitializedNamePtrList::const_iterator i;
2347 for(i = args.begin(); i != args.end(); i++)
2348 (typePtrList->
get_arguments()).push_back( (*i)->get_type() );
2359 if (expList ==NULL)
return NULL;
2360 SgExpressionPtrList expPtrList = expList->get_expressions();
2363 ROSE_ASSERT(typePtrList);
2365 SgExpressionPtrList::const_iterator i;
2366 for (i=expPtrList.begin();i!=expPtrList.end();i++)
2381 ROSE_ASSERT(typePtrList);
2385 if (type0 != NULL) types.push_back(type0);
2386 if (type1 != NULL) types.push_back(type1);
2387 if (type2 != NULL) types.push_back(type2);
2388 if (type3 != NULL) types.push_back(type3);
2389 if (type4 != NULL) types.push_back(type4);
2390 if (type5 != NULL) types.push_back(type5);
2391 if (type6 != NULL) types.push_back(type6);
2392 if (type7 != NULL) types.push_back(type7);
2404 ROSE_ASSERT(return_type != NULL);
2407 ROSE_ASSERT(typeList != NULL);
2410 ROSE_ASSERT(fTable);
2416 SgFunctionType* funcType = isSgFunctionType(fTable->lookup_function_type(typeName));
2418 if (funcType == NULL)
2422 ROSE_ASSERT(funcType);
2424 if (typeList != NULL)
2427 if (funcType->get_argument_list() != NULL)
2429 delete funcType->get_argument_list();
2430 funcType->set_argument_list(NULL);
2432 ROSE_ASSERT(funcType->get_argument_list() == NULL);
2434 funcType->set_argument_list(typeList);
2438 fTable->insert_function_type(typeName,funcType);
2458 ROSE_ASSERT(fTable != NULL);
2464 ROSE_ASSERT(typeList != NULL);
2468 SgType* typeInTable = fTable->lookup_function_type(typeName);
2471 printf (
"In buildMemberFunctionType(SgType*,SgFunctionParameterTypeList*,SgType*,int,int): fTable->lookup_function_type(typeName = %s) = %p \n",typeName.str(),typeInTable);
2472 printf (
" --- mfunc_specifier = %d ref_qualifiers = %d \n",mfunc_specifier,ref_qualifiers);
2477 if (ref_qualifiers > 0)
2479 printf (
"Exiting as a test! \n");
2485 if (typeInTable == NULL)
2487 bool has_ellipses =
false;
2491 ROSE_ASSERT(partialFunctionType != NULL);
2493 printf (
"Building a SgPartialFunctionType: partialFunctionType = %p \n",partialFunctionType);
2494 printf (
" --- partialFunctionType->isLvalueReferenceFunc() = %s \n",partialFunctionType->
isLvalueReferenceFunc() ?
"true" :
"false");
2495 printf (
" --- partialFunctionType->isRvalueReferenceFunc() = %s \n",partialFunctionType->
isRvalueReferenceFunc() ?
"true" :
"false");
2498 if (partialFunctionType->get_argument_list() != NULL)
2500 delete partialFunctionType->get_argument_list();
2501 partialFunctionType->set_argument_list(NULL);
2503 ROSE_ASSERT(partialFunctionType->get_argument_list() == NULL);
2510 partialFunctionType->set_argument_list(typeList);
2512 ROSE_ASSERT(partialFunctionType->get_argument_list() != NULL);
2521 partialFunctionType->set_argument_list(NULL);
2524 delete partialFunctionType;
2525 partialFunctionType = NULL;
2530 ROSE_ASSERT(funcType->get_argument_list() != NULL);
2533 if (typeInTable ==
nullptr)
2535 ASSERT_not_null(funcType);
2536 fTable->insert_function_type(typeName,funcType);
2542 ASSERT_require(typeInTable != funcType);
2546 funcType = isSgMemberFunctionType(typeInTable);
2547 ASSERT_not_null(funcType);
2567 ROSE_ASSERT(return_type != NULL);
2572 ROSE_ASSERT(struct_name != NULL);
2575 printf(
"In buildMemberFunctionType():\n");
2576 printf(
" - struct_name = %p (%s)\n", struct_name, struct_name->
class_name().c_str());
2581 printf (
"SageBuilder::buildMemberFunctionType(SgType*,SgFunctionParameterTypeList*,SgScopeStatement*,int,int): This function does not use the input ref_qualifiers = %x \n",ref_qualifiers);
2582 printf (
" --- mfunc_specifier = %d ref_qualifiers = %d \n",mfunc_specifier,ref_qualifiers);
2586 printf (
"Exiting as a test! \n");
2590 ROSE_ASSERT(struct_name->
get_parent() != NULL);
2594 printf(
"struct_name = %p ( %s )\n", struct_name, struct_name->
class_name().c_str());
2601 if (classDefinition == NULL && decl_scope == NULL)
2603 printf (
"Error: (classDefinition == NULL && decl_scope == NULL): struct_name = %p = %s name = %s \n",
2606 ROSE_ASSERT(classDefinition != NULL || decl_scope != NULL);
2609 if (classDefinition != NULL)
2613 else if (decl_scope != NULL)
2615 declaration = isSgDeclarationStatement(decl_scope->
get_parent());
2622 ROSE_ASSERT(declaration != NULL);
2624 if (typeList != NULL)
2628 for (SgTypePtrList::iterator i = typeListArgs.begin(); i != typeListArgs.end(); i++)
2630 printf (
" --- type argument = %p = %s \n",*i,(*i)->class_name().c_str());
2636 printf (
"WARNING: typeList == NULL \n");
2643 ROSE_ASSERT(classDeclaration != NULL || nrdecl != NULL);
2650 SgType* classType = NULL;
2651 if (classDeclaration != NULL)
2653 classType = classDeclaration->get_type();
2655 else if (decl_scope != NULL)
2657 classType = nrdecl->get_type();
2664 ROSE_ASSERT(classType != NULL);
2667 printf (
"In buildMemberFunctionType(): Calling refactored function: buildMemberFunctionType(...,classType = %p,...) \n",classType);
2674 printf (
"In buildMemberFunctionType(): DONE: Calling refactored function: buildMemberFunctionType(...,classType = %p,...) \n",classType);
2684 ROSE_ASSERT(base_type != NULL);
2686 ROSE_ASSERT(classType != NULL);
2688 return pointerToMemberType;
2697 ASSERT_not_null(scope);
2706 if (type_symbol == NULL)
2709 ASSERT_not_null(type_decl);
2717 ROSE_ASSERT(type_symbol);
2733 type_decl = type_symbol->get_declaration();
2734 result = type_decl->get_type();
2736 ASSERT_not_null(result);
2746 ASSERT_not_null(argList);
2751 if (func_type->get_argument_list() != typeList)
2768 if (isSgMemberFunctionDeclaration(func) != NULL)
2770#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
2771 printf (
"WARNING: setting parent of function to match scope by default \n");
2775 ROSE_ASSERT(scope != NULL);
2777 if (isSgTemplateInstantiationMemberFunctionDecl(func) != NULL)
2785#if !ENFORCE_NO_FUNCTION_TEMPLATE_DECLARATIONS_IN_TEMPLATE_CLASS_INSTANTIATIONS
2792 if (isSgTemplateFunctionDeclaration(func) != NULL)
2794 if (isSgTemplateInstantiationMemberFunctionDecl(func) != NULL)
2796 ROSE_ASSERT(isSgTemplateClassDefinition(scope) != NULL);
2808template <
class actualFunction>
2810SageBuilder::buildNondefiningFunctionDeclaration_T (
2813 SgTemplateArgumentPtrList* templateArgumentsList, SgTemplateParameterPtrList* templateParameterList,
2824 if (scope ==
nullptr)
2828 ASSERT_not_null(scope);
2830 if (XXX_name.is_null() ==
true)
2833 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");
2836 SgName nameWithoutTemplateArguments = XXX_name;
2837 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
2839 bool buildTemplateInstantiation = ((VariantT)actualFunction::static_variant == V_SgTemplateInstantiationFunctionDecl || (VariantT)actualFunction::static_variant == V_SgTemplateInstantiationMemberFunctionDecl);
2842 bool buildTemplateDeclaration = ((VariantT)actualFunction::static_variant == V_SgTemplateFunctionDeclaration || (VariantT)actualFunction::static_variant == V_SgTemplateMemberFunctionDeclaration);
2846 if (buildTemplateInstantiation ==
true)
2848 ASSERT_not_null(templateArgumentsList);
2853 if (nameWithTemplateArguments.is_null() ==
true)
2857 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");
2860 if (nameWithoutTemplateArguments.is_null() ==
true)
2864 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");
2867 ASSERT_not_null(return_type);
2868 ASSERT_not_null(paralist);
2874#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
2875 printf (
"Warning: In buildNondefiningFunctionDeclaration_T(): nameWithoutTemplateArguments = %s nameWithTemplateArguments = %s \n",nameWithoutTemplateArguments.str(),nameWithTemplateArguments.str());
2885 if (isMemberFunction ==
true)
2895 ASSERT_not_null(func_type);
2898 actualFunction* func =
nullptr;
2916 func_symbol = scope->find_symbol_by_type_of_function<actualFunction>(nameWithTemplateArguments,func_type,templateParameterList,templateArgumentsList);
2919 printf (
"In buildNondefiningFunctionDeclaration_T(): func_symbol from scope->find_symbol_by_type_of_function<actualFunction>(name = %s) = %p \n",nameWithTemplateArguments.str(),func_symbol);
2920 if (func_symbol != NULL) {
2921 printf (
"In buildNondefiningFunctionDeclaration_T(): func_symbol->get_declaration() = %p \n", func_symbol->get_declaration());
2926 if (func_symbol == NULL)
2929 ROSE_ASSERT(func_type != NULL);
2934 if (func_symbol != NULL)
2936 switch((VariantT)actualFunction::static_variant)
2938 case V_SgFunctionDeclaration:
2939 case V_SgProcedureHeaderStatement:
2940 case V_SgTemplateInstantiationFunctionDecl:
2942 ROSE_ASSERT(isSgFunctionSymbol(func_symbol) != NULL);
2945 case V_SgMemberFunctionDeclaration:
2946 case V_SgTemplateInstantiationMemberFunctionDecl:
2948 ROSE_ASSERT(isSgMemberFunctionSymbol(func_symbol) != NULL);
2951 case V_SgTemplateFunctionDeclaration:
2953 ROSE_ASSERT(isSgTemplateFunctionSymbol(func_symbol) != NULL);
2956 case V_SgTemplateMemberFunctionDeclaration:
2958 ROSE_ASSERT(isSgTemplateMemberFunctionSymbol(func_symbol) != NULL);
2964 printf (
"default reach in buildNondefiningFunctionDeclaration_T(): variantT(actualFunction::static_variant) = %d \n",actualFunction::static_variant);
2971 ROSE_ASSERT(scope != NULL);
2972 if ( isSgGlobal(scope) != NULL
2973 && scope != func_symbol->get_scope()
2975 && !scope->symbol_exists(nameWithTemplateArguments, func_symbol) )
2977 scope->
insert_symbol(nameWithTemplateArguments, func_symbol);
2981 if (func_symbol == NULL)
2983 func =
new actualFunction (nameWithTemplateArguments,func_type,NULL);
2984 ROSE_ASSERT(func != NULL);
2987 func->get_declarationModifier().get_storageModifier().set_modifier(sm);
2990 ROSE_ASSERT(func->get_file_info() == NULL);
2993 func->set_scope(scope);
2996 checkThatNoTemplateInstantiationIsDeclaredInTemplateDefinitionScope(func,scope);
2999 ROSE_ASSERT(func->get_parameterList() != NULL);
3007 if (isSgMemberFunctionDeclaration(func))
3012 if (isSgTemplateMemberFunctionDeclaration(func) != NULL)
3017 ROSE_ASSERT(memberFunctionDeclaration != NULL);
3021 ROSE_ASSERT(func_symbol != NULL);
3022 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
3027 if (isSgTemplateFunctionDeclaration(func))
3033 ROSE_ASSERT(templatedeclaration != NULL);
3035 ROSE_ASSERT(template_symbol != NULL);
3036 ROSE_ASSERT(template_symbol->get_symbol_basis() != NULL);
3037 func_symbol = template_symbol;
3042 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
3046 ROSE_ASSERT(func_symbol != NULL);
3047 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
3048 scope->
insert_symbol(nameWithTemplateArguments, func_symbol);
3051 ROSE_ASSERT(func->get_symbol_from_symbol_table() != NULL);
3053 if (isSgFunctionDeclaration(func) == NULL)
3059 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3067 ROSE_ASSERT(buildTemplateDeclaration ==
false || templateParameterList != NULL);
3073 ROSE_ASSERT(scope->lookup_function_symbol(nameWithTemplateArguments) != NULL ||
3074 scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL ||
3075 scope->lookup_template_member_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3077#if BUILDER_MAKE_REDUNDANT_CALLS_TO_SYMBOL_TABLE_LOOKUP
3081 if (scope->lookup_function_symbol(nameWithTemplateArguments,templateArgumentList) == NULL || scope->lookup_template_symbol(nameWithTemplateArguments,templateParameterList,NULL) != NULL)
3084 printf (
"Need to make sure this is a template function declaration... \n");
3090 ROSE_ASSERT(func->get_scope() != NULL);
3092 if (isSgFunctionDeclaration(func) == NULL)
3098 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3100 func->set_firstNondefiningDeclaration(func);
3101 func->set_definingDeclaration(NULL);
3104 ROSE_ASSERT(func->get_firstNondefiningDeclaration() == func);
3106 ROSE_ASSERT(func->get_definingDeclaration() == NULL);
3110 if (testMemberDecl != NULL)
3112 ROSE_ASSERT(testMemberDecl->
get_scope() != NULL);
3113 ROSE_ASSERT(testMemberDecl->get_class_scope() != NULL);
3114 ROSE_ASSERT(testMemberDecl->get_associatedClassDeclaration() != NULL);
3119 ROSE_ASSERT(func_symbol != NULL);
3121 ROSE_ASSERT(scope != NULL);
3129 SgNode* associatedSymbolBasis = func_symbol->get_symbol_basis();
3130 ROSE_ASSERT(associatedSymbolBasis != NULL);
3133 ROSE_ASSERT(associatedDeclaration != NULL);
3137 if (functionDeclaration != NULL)
3139 func_type = functionDeclaration->get_type();
3143 if (templateFunctionDeclaration != NULL)
3148 printf (
"This code should not be reachable! \n");
3151 func_type = templateFunctionDeclaration->get_type();
3159 ROSE_ASSERT(func_type != NULL);
3161 func =
new actualFunction(nameWithTemplateArguments,func_type,NULL);
3162 ROSE_ASSERT(func != NULL);
3164#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3171 func->set_scope(scope);
3174 ROSE_ASSERT(func->get_symbol_from_symbol_table() == NULL);
3177 checkThatNoTemplateInstantiationIsDeclaredInTemplateDefinitionScope(func,scope);
3183 if (functionDeclaration != NULL)
3185 prevDecl = functionDeclaration;
3189 ROSE_ASSERT(templateFunctionDeclaration != NULL);
3190 prevDecl = templateFunctionDeclaration;
3193 ROSE_ASSERT(prevDecl != NULL);
3200 printf (
"WARNING: Switching declaration in functionSymbol to point to the non-defining declaration \n");
3201 function_symbol->set_declaration(isSgFunctionDeclaration(func));
3202 ROSE_ASSERT(function_symbol->get_declaration() != NULL);
3207 if (nondefiningDeclaration == NULL)
3209 nondefiningDeclaration = func;
3212 ROSE_ASSERT(nondefiningDeclaration != NULL);
3213 ROSE_ASSERT(func != NULL);
3214 ROSE_ASSERT(prevDecl != NULL);
3216 func->set_firstNondefiningDeclaration(nondefiningDeclaration);
3220 ROSE_ASSERT(func->get_firstNondefiningDeclaration()->get_symbol_from_symbol_table() != NULL);
3224 if (func->get_symbol_from_symbol_table() == NULL)
3226 ROSE_ASSERT(nondefiningDeclaration != NULL);
3227 ROSE_ASSERT(func->get_firstNondefiningDeclaration() == nondefiningDeclaration);
3231 ROSE_ASSERT(scope != NULL);
3232 ROSE_ASSERT(func->get_scope() != NULL);
3233 ROSE_ASSERT(func->get_scope() == scope);
3237 if (testMemberDecl != NULL)
3239 ROSE_ASSERT(testMemberDecl->
get_scope() != NULL);
3240 ROSE_ASSERT(testMemberDecl->get_associatedClassDeclaration() != NULL);
3244 if (isSgFunctionDeclaration(func) == NULL)
3255 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3259 ROSE_ASSERT(func != NULL);
3261 ROSE_ASSERT(func->get_file_info() == NULL);
3264 ROSE_ASSERT(func->get_firstNondefiningDeclaration() != NULL);
3265 ROSE_ASSERT(func_symbol != NULL);
3266 ROSE_ASSERT(func_symbol->get_symbol_basis() == func->get_firstNondefiningDeclaration());
3267 ROSE_ASSERT(func->get_symbol_from_symbol_table() != NULL || func->get_firstNondefiningDeclaration()->get_symbol_from_symbol_table() != NULL);
3270 ROSE_ASSERT(func->get_parameterList() != NULL);
3271 delete func->get_parameterList();
3272 func->set_parameterList(NULL);
3275 if (buildTemplateInstantiation ==
true)
3281 if (buildTemplateDeclaration ==
true)
3287 ROSE_ASSERT(templateFunctionDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateFunctionDeclaration->get_templateParameters().size()));
3290 ROSE_ASSERT(templateMemberFunctionDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateMemberFunctionDeclaration->get_templateParameters().size()));
3299 i_name->set_scope(scope);
3304 printf (
"In buildNondefiningFunctionDeclaration_T(): setting the source position information (calling setTransformation()) \n");
3312 printf (
"In buildNondefiningFunctionDeclaration_T(): DONE: setting the source position information (calling setTransformation()) \n");
3315#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3317 if (SourcePositionClassificationMode != e_sourcePositionTransformation)
3319 detectTransformations_local(paralist);
3323 ASSERT_not_null(scope);
3324 ASSERT_not_null(func->get_scope());
3325 ASSERT_require(func->get_scope() == scope);
3333#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
3334 printf (
"Warning: SageBuilder::buildNondefiningFunctionDeclaration_T(): scope parameter may not be the same as the topScopeStack() (e.g. for member functions) \n");
3339 func->set_parent(scope);
3340 ASSERT_not_null(func->get_firstNondefiningDeclaration());
3345 ROSE_ASSERT(func->get_file_info() == NULL);
3350 ROSE_ASSERT(func->get_file_info() != NULL);
3352#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3354 if (SourcePositionClassificationMode != e_sourcePositionTransformation)
3356 detectTransformations_local(func);
3366 ROSE_ASSERT (f_func != NULL);
3380 ROSE_ASSERT(func->get_firstNondefiningDeclaration() != NULL);
3381 SgSymbol* symbol_from_first_nondefining_function = func->get_firstNondefiningDeclaration()->get_symbol_from_symbol_table();
3382 ROSE_ASSERT(symbol_from_first_nondefining_function != NULL);
3385 if (func != func->get_firstNondefiningDeclaration())
3387 SgSymbol* symbol_from_nondefining_function = func->get_symbol_from_symbol_table();
3388 ROSE_ASSERT(symbol_from_nondefining_function == NULL);
3392 if (isSgFunctionDeclaration(func) == NULL)
3398 ROSE_ASSERT(scope->lookup_template_function_symbol(nameWithTemplateArguments,func_type,templateParameterList) != NULL);
3404#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3406 if (SourcePositionClassificationMode !=e_sourcePositionTransformation)
3408 detectTransformations_local(func);
3413 if (functionConstVolatileFlags & SgMemberFunctionType::e_restrict)
3415 func->get_declarationModifier().get_typeModifier().setRestrict();
3423 unsetNodesMarkedAsModified(func);
3434 ROSE_ASSERT(funcdecl!=NULL);
3435 SgName name=funcdecl->get_name();
3437 SgType* return_type = funcType->get_return_type();
3442 ROSE_ASSERT(funcType== ref_funcType);
3447 returnFunction->set_linkage(funcdecl->get_linkage());
3448 if (funcdecl->get_declarationModifier().get_storageModifier().
isExtern() ==
true)
3450 returnFunction->get_declarationModifier().get_storageModifier().
setExtern();
3453 ROSE_ASSERT (returnFunction->get_linkage() == funcdecl->get_linkage());
3454 ROSE_ASSERT (returnFunction->get_declarationModifier().get_storageModifier().
isExtern() ==
3455 funcdecl->get_declarationModifier().get_storageModifier().
isExtern());
3464 return returnFunction;
3473 result = buildNondefiningFunctionDeclaration_T <SgProcedureHeaderStatement> (name,return_type,paralist,
false, scope, decoratorList,
false, NULL, NULL, sm);
3478 if (buildTemplateInstantiation ==
true)
3480 result = buildNondefiningFunctionDeclaration_T <SgTemplateInstantiationFunctionDecl> (name,return_type,paralist,
false, scope, decoratorList,
false, templateArgumentsList, NULL, sm);
3484 result = buildNondefiningFunctionDeclaration_T <SgFunctionDeclaration> (name,return_type,paralist,
false, scope, decoratorList,
false, NULL, NULL, sm);
3497 unsigned int memberFunctionModifiers = 0;
3511 unsigned int memberFunctionModifiers = 0;
3518 if (member_func_symbol != NULL)
3520 nondefining_decl = member_func_symbol->get_declaration();
3544 ROSE_ASSERT(result != NULL);
3564 ROSE_ASSERT(first_nondefining_declaration != NULL);
3571 SgTemplateFunctionDeclaration* result = buildDefiningFunctionDeclaration_T <SgTemplateFunctionDeclaration> (name,return_type,paralist,
false, scope, decoratorList, 0, first_nondefining_declaration, NULL);
3583 SgTemplateMemberFunctionDeclaration* result = buildDefiningFunctionDeclaration_T <SgTemplateMemberFunctionDeclaration> (name,return_type,paralist,
true, scope, decoratorList, functionConstVolatileFlags, first_nondefining_declaration, NULL);
3584 ROSE_ASSERT(result != NULL);
3586 ROSE_ASSERT(result->get_definition() != NULL);
3593 SgExprListExp* decoratorList,
unsigned int functionConstVolatileFlags,
bool buildTemplateInstantiation, SgTemplateArgumentPtrList* templateArgumentsList)
3600 if (buildTemplateInstantiation ==
true)
3603 result = buildNondefiningFunctionDeclaration_T <SgTemplateInstantiationMemberFunctionDecl> (name,return_type,paralist,
true,scope,decoratorList,functionConstVolatileFlags,templateArgumentsList,NULL,
SgStorageModifier::e_default);
3608 result = buildNondefiningFunctionDeclaration_T <SgMemberFunctionDeclaration> (name,return_type,paralist,
true,scope,decoratorList,functionConstVolatileFlags,NULL,NULL,
SgStorageModifier::e_default);
3610 ROSE_ASSERT(result != NULL);
3614 ROSE_ASSERT(ctor != NULL);
3621 ROSE_ASSERT(result->get_associatedClassDeclaration() != NULL);
3623 if (result->get_associatedClassDeclaration() == NULL)
3625 printf (
"Warning, must set the SgMemberFunctionDeclaration::associatedClassDeclaration \n");
3627 ROSE_ASSERT(scope != NULL);
3629 ROSE_ASSERT(classDefinition != NULL);
3631 ROSE_ASSERT(associatedDeclaration != NULL);
3632 SgClassDeclaration* associatedClassDeclaration = isSgClassDeclaration(associatedDeclaration);
3653 ROSE_ASSERT(result != NULL);
3655#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3659 detectTransformations_local(result);
3666 SgSymbol* associatedSymbol = scope->lookup_template_member_function_symbol(name,result->get_type(),templateParameterList);
3667 if (associatedSymbol == NULL)
3669 printf (
"ERROR: associatedSymbol == NULL \n");
3670 printf (
" --- result = %p = %s \n",result,result->
class_name().c_str());
3671 printf (
" --- scope = %p = %s \n",scope,scope->
class_name().c_str());
3672 printf (
" --- name = %s \n",name.str());
3673 printf (
" --- result->get_type() = %p = %s \n",result->get_type(),result->get_type()->
class_name().c_str());
3674 printf (
" --- result->get_type()->get_mangled() = %s \n",result->get_type()->get_mangled().str());
3676 ROSE_ASSERT(associatedSymbol != NULL);
3679 ROSE_ASSERT(ctor != NULL);
3687 ROSE_ASSERT(symbol_from_first_nondefining_function != NULL);
3693 ROSE_ASSERT(symbol_from_nondefining_function == NULL);
3696#if BUILDER_MAKE_REDUNDANT_CALLS_TO_SYMBOL_TABLE_LOOKUP
3699 if (scope->lookup_template_member_function_symbol(name,result->get_type(),templateParameterList) == NULL)
3701 printf (
"Error: scope->lookup_template_member_function_symbol(name,result->get_type()) == NULL (investigate this) \n");
3702 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());
3703 scope->
get_symbol_table()->
print(
"Error: scope->lookup_template_member_function_symbol(name,result->get_type()) == NULL (investigate this)");
3706 ROSE_ASSERT(scope->lookup_template_member_function_symbol(name,result->get_type(),templateParameterList) != NULL);
3708#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
3712 detectTransformations_local(result);
3724 if (buildTemplateInstantiation ==
true)
3727 ROSE_ASSERT(templateInstantiationMemberFunctionDecl != NULL);
3731 ROSE_ASSERT(templateArgumentsList != NULL);
3732 string nameWithoutTemplateArguments = name;
3734 SgMemberFunctionType* func_type = isSgMemberFunctionType(first_nondefining_declaration->get_type());
3735 ROSE_ASSERT(func_type != NULL);
3739 if (func_symbol == NULL)
3741 printf (
"ERROR caught in SageBuilder::buildDefiningMemberFunctionDeclaration(): nameWithTemplateArguments = %s buildTemplateInstantiation = %s \n",nameWithTemplateArguments.c_str(),buildTemplateInstantiation ?
"true:" :
"false");
3742 printf (
"ERROR caught in SageBuilder::buildDefiningMemberFunctionDeclaration(): func_symbol == NULL for first_nondefining_declaration = %p = %s and func_type = %p = %s \n",
3743 templateInstantiationMemberFunctionDecl,templateInstantiationMemberFunctionDecl->
class_name().c_str(),func_type,func_type->
class_name().c_str());
3747 result = buildDefiningFunctionDeclaration_T <SgTemplateInstantiationMemberFunctionDecl> (name, return_type, paralist,
true, scope, decoratorList, functionConstVolatileFlags, templateInstantiationMemberFunctionDecl, templateArgumentsList);
3748 ROSE_ASSERT(isSgTemplateInstantiationMemberFunctionDecl(result) != NULL);
3749 ROSE_ASSERT(isSgTemplateInstantiationMemberFunctionDecl(result)->get_templateName().is_null() ==
false);
3753 ROSE_ASSERT(first_nondefining_declaration != NULL);
3759 result = buildDefiningFunctionDeclaration_T <SgMemberFunctionDeclaration> (name,return_type,paralist,
true,scope,decoratorList,functionConstVolatileFlags,first_nondefining_declaration, NULL);
3762 ROSE_ASSERT(result != NULL);
3766 ROSE_ASSERT(ctor != NULL);
3773 ROSE_ASSERT(result->get_associatedClassDeclaration() != NULL);
3783template <
class actualFunction>
3792#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
3793 printf (
"WARNING: This function for building defining function declarations has different semantics from that of the function to build defining class declarations. \n");
3796 ASSERT_not_null(first_nondefining_declaration);
3797 ASSERT_require(first_nondefining_declaration->get_firstNondefiningDeclaration() == first_nondefining_declaration);
3799 if (scope ==
nullptr)
3804 ASSERT_require(XXX_name.is_null() ==
false);
3805 ASSERT_not_null(scope);
3806 ASSERT_not_null(return_type);
3808 SgName nameWithoutTemplateArguments = XXX_name;
3809 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
3811 bool buildTemplateInstantiation = ((VariantT)actualFunction::static_variant == V_SgTemplateInstantiationFunctionDecl || (VariantT)actualFunction::static_variant == V_SgTemplateInstantiationMemberFunctionDecl);
3814 bool buildTemplateDeclaration = ((VariantT)actualFunction::static_variant == V_SgTemplateFunctionDeclaration || (VariantT)actualFunction::static_variant == V_SgTemplateMemberFunctionDeclaration);
3817 if (buildTemplateInstantiation ==
true)
3819 ASSERT_not_null(templateArgumentsList);
3821 SgTemplateArgumentPtrList & templateArgumentsList_from_first_nondefining_declaration = (isMemberFunction ==
false) ?
3823 isSgTemplateInstantiationMemberFunctionDecl(first_nondefining_declaration)->
get_templateArguments();
3825 ASSERT_not_null(templateArgumentsList);
3827 ASSERT_require(templateArgumentListsAreEquivalent ==
true);
3830 SgTemplateParameterPtrList* templateParameterList =
nullptr;
3831 if (buildTemplateDeclaration ==
true)
3834 templateParameterList = (isMemberFunction ==
false) ?
3835 &(isSgTemplateFunctionDeclaration(first_nondefining_declaration)->get_templateParameters()) :
3836 &(isSgTemplateMemberFunctionDeclaration(first_nondefining_declaration)->get_templateParameters());
3838 ASSERT_require(templateArgumentsList ==
nullptr);
3839 ASSERT_not_null(templateParameterList);
3842 if (buildTemplateInstantiation ==
true)
3844 ASSERT_not_null(templateArgumentsList);
3847 if (nameWithTemplateArguments ==
"insert < __normal_iterator< SgInitializedName ** , __type > > ")
3849 printf (
"In buildDefiningFunctionDeclaration_T(): Found function nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
3853 ASSERT_require(nameWithoutTemplateArguments.is_null() ==
false);
3854 ASSERT_require(nameWithTemplateArguments.is_null() ==
false);
3855 ASSERT_not_null(paralist);
3863 actualFunction* defining_func =
nullptr;
3869 ASSERT_not_null(first_nondefining_declaration);
3886 func_type = first_nondefining_declaration->get_type();
3887 ASSERT_not_null(func_type);
3890 ASSERT_require(func_type == first_nondefining_declaration->get_type());
3895 SgSymbol* func_symbol = scope->find_symbol_by_type_of_function<actualFunction>(nameWithTemplateArguments,func_type,templateParameterList,templateArgumentsList);
3898 ASSERT_not_null(func_symbol);
3900 if (func_symbol ==
nullptr)
3905 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");
3919 if (temp_function_sym !=
nullptr)
3921 func_type = temp_function_sym->get_declaration()->get_type();
3927 ASSERT_not_null(temp_template_sym);
3930 ASSERT_not_null(firstNondefiningFunctionDeclaration);
3933 defining_func =
new actualFunction(nameWithTemplateArguments,func_type,
nullptr);
3934 ASSERT_not_null(defining_func);
3936 ASSERT_not_null(firstNondefiningFunctionDeclaration);
3937 defining_func->set_firstNondefiningDeclaration(firstNondefiningFunctionDeclaration);
3943 if (decoratorList !=
nullptr)
3945 defining_func->set_decoratorList(decoratorList);
3950 defining_func->set_definingDeclaration(defining_func);
3954 ASSERT_not_null(func_body);
3960 if (templateFunctionDeclaration ==
nullptr)
3963 ASSERT_not_null(functionDeclaration);
3968 ASSERT_not_null(templateFunctionDeclaration);
3971 ASSERT_not_null(func_def);
3975 func_def->setCaseInsensitive(
true);
3976 func_body->setCaseInsensitive(
true);
3989 i_name->set_scope(func_def);
3992 ASSERT_not_null(variableSymbol);
3993 func_def->
insert_symbol(i_name->get_name(), variableSymbol);
3996 SgArrayType* arrayType = isSgArrayType(i_name->get_type());
3997 if (arrayType !=
nullptr)
4001 SgExpression* indexExpression = arrayType->get_index();
4003 if (indexExpression !=
nullptr)
4007 vector<SgVarRefExp* > varRefList;
4010 for (
size_t i = 0; i < varRefList.size(); i++)
4014 ASSERT_not_null(dimension_variableSymbol);
4015 ASSERT_require(dimension_variableSymbol != variableSymbol);
4018 SgSymbol* symbolFromLookup = func_def->lookup_symbol(dimension_variableSymbol->
get_name());
4019 if (symbolFromLookup !=
nullptr)
4021 SgVariableSymbol* variableSymbolFromLookup = isSgVariableSymbol(symbolFromLookup);
4022 ASSERT_not_null(variableSymbolFromLookup);
4024 varRefList[i]->set_symbol(variableSymbolFromLookup);
4025 ASSERT_require(dimension_variableSymbol != variableSymbol);
4036 defining_func->set_parent(scope);
4037 defining_func->set_scope(scope);
4039 ASSERT_not_null(defining_func->get_scope());
4041 checkThatNoTemplateInstantiationIsDeclaredInTemplateDefinitionScope(defining_func,scope);
4047 if (isMemberFunction ==
true)
4049 ASSERT_not_null(isSgMemberFunctionDeclaration(defining_func));
4056 if (buildTemplateInstantiation ==
true)
4062 if (buildTemplateDeclaration ==
true)
4068 ROSE_ASSERT(templateFunctionDeclaration ==
nullptr || (templateParameterList !=
nullptr && templateParameterList->size() == templateFunctionDeclaration->get_templateParameters().size()));
4070 ROSE_ASSERT(templateMemberFunctionDeclaration ==
nullptr || (templateParameterList !=
nullptr && templateParameterList->size() == templateMemberFunctionDeclaration->get_templateParameters().size()));
4074 if (functionConstVolatileFlags & SgMemberFunctionType::e_restrict)
4076 defining_func->get_declarationModifier().get_typeModifier().setRestrict();
4083 unsetNodesMarkedAsModified(defining_func);
4085 return defining_func;
4095 bool isTemplateInstantition = (templateInstantiationFunctionDecl != NULL) || (templateInstantiationMemberFunctionDecl != NULL);
4096 if (isTemplateInstantition ==
true)
4100 SgName templateNameWithoutArguments = name;
4106 bool isMemberFunction = (templateInstantiationMemberFunctionDecl != NULL);
4107 if (isMemberFunction ==
true)
4109 ROSE_ASSERT(templateInstantiationMemberFunctionDecl != NULL);
4110 ROSE_ASSERT(templateInstantiationFunctionDecl == NULL);
4112 if (templateInstantiationMemberFunctionDecl->
get_templateName().is_null() ==
true)
4116 templateInstantiationMemberFunctionDecl->
set_templateName(templateNameWithoutArguments);
4120 ROSE_ASSERT(templateInstantiationMemberFunctionDecl->
get_templateName().is_null() ==
false);
4124 ROSE_ASSERT(templateInstantiationFunctionDecl != NULL);
4125 ROSE_ASSERT(templateInstantiationMemberFunctionDecl == NULL);
4127 if (templateInstantiationFunctionDecl->
get_templateName().is_null() ==
true)
4131 templateInstantiationFunctionDecl->
set_templateName(templateNameWithoutArguments);
4136 ROSE_ASSERT(templateInstantiationFunctionDecl->
get_templateName().is_null() ==
false);
4146 if (buildTemplateInstantiation ==
true)
4150 ROSE_ASSERT(first_nondefining_declaration != NULL);
4152 func = buildDefiningFunctionDeclaration_T<SgTemplateInstantiationFunctionDecl>(name,return_type,paralist,
false,scope,decoratorList,0,templateInstantiationFunctionDecl, templateArgumentsList);
4154 ROSE_ASSERT(isSgTemplateInstantiationFunctionDecl(func) != NULL);
4155 ROSE_ASSERT(isSgTemplateInstantiationFunctionDecl(func)->get_templateName().is_null() ==
false);
4159 ROSE_ASSERT(first_nondefining_declaration != NULL);
4161 func = buildDefiningFunctionDeclaration_T<SgFunctionDeclaration>(name,return_type,paralist,
false,scope,decoratorList,0,first_nondefining_declaration, NULL);
4163 ROSE_ASSERT(isSgFunctionDeclaration(func) != NULL);
4178 ROSE_ASSERT(return_type != NULL);
4179 ROSE_ASSERT(parameter_list != NULL);
4195 if (func_symbol != NULL)
4197 nondefiningDeclaration = func_symbol->get_declaration();
4204 ROSE_ASSERT(nondefiningDeclaration != NULL);
4216 ASSERT_not_null(return_type);
4217 ASSERT_not_null(param_list);
4221 if (scope ==
nullptr) {
4227 nondef_decl = buildNondefiningFunctionDeclaration_T <SgProcedureHeaderStatement>
4228 ( name, return_type, param_list,
false, scope,
nullptr,
4231 ASSERT_not_null(isSgProcedureHeaderStatement(nondef_decl));
4234 nondef_decl->set_subprogram_kind(kind);
4243 ASSERT_not_null(return_type);
4244 ASSERT_not_null(parameter_list);
4248 if (scope ==
nullptr) {
4254 if (func_symbol ==
nullptr)
4256 nondef_decl = buildNondefiningFunctionDeclaration_T <SgProcedureHeaderStatement>
4257 ( name, return_type, parameter_list,
false, scope,
4262 nondef_decl = func_symbol->get_declaration();
4266 ASSERT_not_null(proc_header_stmt);
4279 ASSERT_not_null(firstNondefDecl);
4287 mlog[ERROR] <<
"unhandled subprogram kind for Fortran (or Jovial) function declaration:"
4292 func = buildDefiningFunctionDeclaration_T<SgProcedureHeaderStatement>(
SgName(name), returnType, params,
false,
4293 scope,
nullptr, 0U, firstNondefDecl,
nullptr);
4294 ASSERT_not_null(func);
4295 func->set_subprogram_kind(kind);
4306 ROSE_ASSERT(boolValue);
4317 ROSE_ASSERT(boolValue);
4325 ROSE_ASSERT(nullptrValue);
4327 return nullptrValue;
4333 ROSE_ASSERT(nullptrValue);
4335 return nullptrValue;
4341 ROSE_ASSERT(voidValue);
4349 ROSE_ASSERT(voidValue);
4357 ROSE_ASSERT(result);
4365 ROSE_ASSERT(result);
4373 ROSE_ASSERT(result);
4381 ROSE_ASSERT(result);
4390 ROSE_ASSERT(result);
4398 ROSE_ASSERT(result);
4407 ROSE_ASSERT(result);
4415 ROSE_ASSERT(result);
4424 ROSE_ASSERT(result);
4427 if (real_value != NULL)
4430 if (imaginary_value != NULL)
4433 ROSE_ASSERT(real_value == NULL || real_value->
get_parent() != NULL);
4434 ROSE_ASSERT(imaginary_value == NULL || imaginary_value->
get_parent() != NULL);
4442 ROSE_ASSERT(imaginary_value != NULL);
4444 ROSE_ASSERT(result != NULL);
4447 if (real_value != NULL)
4450 if (imaginary_value != NULL)
4453 ROSE_ASSERT(real_value == NULL || real_value->
get_parent() != NULL);
4454 ROSE_ASSERT(imaginary_value == NULL || imaginary_value->
get_parent() != NULL);
4463 ROSE_ASSERT(result);
4466 result->get_imaginary_value()->
set_parent(result);
4467 ROSE_ASSERT(result->get_imaginary_value()->
get_parent() != NULL);
4475 ROSE_ASSERT(imaginary_value != NULL);
4478 ROSE_ASSERT(result);
4482 ROSE_ASSERT(imaginary_value->
get_parent() != NULL);
4490 ROSE_ASSERT(imaginary_value != NULL);
4494 ROSE_ASSERT(result);
4497 ROSE_ASSERT(imaginary_value->
get_parent() != NULL);
4522 ROSE_ASSERT(result);
4530 ROSE_ASSERT(result);
4538 ROSE_ASSERT(result);
4553 ASSERT_not_null(intValue);
4561 ASSERT_not_null(intValue);
4569 ASSERT_not_null(intValue);
4577 ASSERT_not_null(intValue);
4590 ASSERT_not_null(intValue);
4598 ASSERT_not_null(intValue);
4606 ASSERT_not_null(intValue);
4614 ASSERT_not_null(intValue);
4622 ASSERT_not_null(enumVal);
4631 ASSERT_not_null(enumVal);
4638 ROSE_ASSERT(init_name != NULL);
4640 ROSE_ASSERT(assign_init != NULL);
4641 SgEnumVal * enum_val = isSgEnumVal(assign_init->get_operand_i());
4642 ROSE_ASSERT(enum_val != NULL);
4650 ASSERT_not_null(result);
4658 ASSERT_not_null(result);
4666 ASSERT_not_null(result);
4674 ASSERT_not_null(result);
4682 ASSERT_not_null(result);
4690 ASSERT_not_null(result);
4698 ASSERT_not_null(result);
4706 ASSERT_not_null(result);
4714 ASSERT_not_null(result);
4722 ASSERT_not_null(result);
4730 ASSERT_not_null(result);
4738 ASSERT_not_null(result);
4746 ASSERT_not_null(result);
4754 ASSERT_not_null(result);
4762 ASSERT_not_null(result);
4770 ASSERT_not_null(result);
4778 ASSERT_not_null(result);
4786 ASSERT_not_null(result);
4794 ASSERT_not_null(result);
4802 ASSERT_not_null(result);
4810 ASSERT_not_null(result);
4818 ASSERT_not_null(result);
4826 ASSERT_not_null(result);
4834 ASSERT_not_null(result);
4842 ASSERT_not_null(result);
4850 ASSERT_not_null(result);
4858 ASSERT_not_null(result);
4866 ASSERT_not_null(result);
4874 ASSERT_not_null(result);
4881 SgJovialBitVal* result =
new SgJovialBitVal(str);
4882 ASSERT_not_null(result);
4890 ASSERT_not_null (result);
4899 ROSE_ASSERT (result);
4907 ROSE_ASSERT(templateParameterValue);
4911 ROSE_ASSERT(templateParameterValue->
get_parent() == NULL);
4913 return templateParameterValue;
4919 ROSE_ASSERT(templateParameterValue);
4923 ROSE_ASSERT(templateParameterValue->
get_parent() == NULL);
4925 return templateParameterValue;
4928#define DEBUG_BUILD_NONREAL_DECL 0
4931 ROSE_ASSERT(scope != NULL);
4932#if DEBUG_BUILD_NONREAL_DECL
4933 printf(
"ENTER SageBuilder::buildNonrealDecl\n");
4934 printf(
" --- name = %s\n", name.str());
4935 printf(
" --- scope = %p (%s)\n", scope, scope->
class_name().c_str());
4943#if DEBUG_BUILD_NONREAL_DECL
4944 printf(
" --- nrdecl = %p (%s)\n", nrdecl, nrdecl->
class_name().c_str());
4949#if DEBUG_BUILD_NONREAL_DECL
4950 printf(
" --- symbol = %p (%s)\n", symbol, symbol->
class_name().c_str());
4954 type->set_declaration(nrdecl);
4956 nrdecl->set_type(type);
4958#if DEBUG_BUILD_NONREAL_DECL
4959 printf(
" --- type = %p (%s)\n", type, type->
class_name().c_str());
4962 if (child_scope == NULL) {
4964#if DEBUG_BUILD_NONREAL_DECL
4965 printf(
" --- child_scope = %p (new)\n", name.str(), child_scope);
4971#if DEBUG_BUILD_NONREAL_DECL
4972 printf(
" --- child_scope = %p (provided)\n", name.str(), child_scope);
4977 nrdecl->set_nonreal_decl_scope(child_scope);
4979#if DEBUG_BUILD_NONREAL_DECL
4980 printf(
"LEAVE SageBuilder::buildNonrealDecl\n");
4990 ROSE_ASSERT(result);
4999 ROSE_ASSERT(result);
5008 ROSE_ASSERT(result);
5017 ROSE_ASSERT(result);
5025 ROSE_ASSERT(result);
5033 ROSE_ASSERT(result);
5041 ROSE_ASSERT(result);
5049 ROSE_ASSERT(result);
5057 ROSE_ASSERT(result);
5065 ROSE_ASSERT(result);
5161#define BUILD_UNARY_DEF(suffix) \
5162 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix##_nfi(SgExpression* op) \
5164 return SageBuilder::buildUnaryExpression_nfi<Sg##suffix>(op); \
5166 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix(SgExpression* op) \
5168 return SageBuilder::buildUnaryExpression<Sg##suffix>(op); \
5171BUILD_UNARY_DEF(AddressOfOp)
5172BUILD_UNARY_DEF(BitComplementOp)
5173BUILD_UNARY_DEF(MinusOp)
5174BUILD_UNARY_DEF(NotOp)
5175BUILD_UNARY_DEF(PointerDerefExp)
5176BUILD_UNARY_DEF(UnaryAddOp)
5177BUILD_UNARY_DEF(AbsOp)
5178BUILD_UNARY_DEF(MinusMinusOp)
5179BUILD_UNARY_DEF(PlusPlusOp)
5180BUILD_UNARY_DEF(RealPartOp)
5181BUILD_UNARY_DEF(ImagPartOp)
5182BUILD_UNARY_DEF(ConjugateOp)
5183BUILD_UNARY_DEF(VarArgStartOneOperandOp)
5184BUILD_UNARY_DEF(VarArgEndOp)
5186BUILD_UNARY_DEF(MatrixTransposeOp)
5188#undef BUILD_UNARY_DEF
5191 SgType * expression_type,
5195 ROSE_ASSERT(result);
5196 if (operand_i) {operand_i->
set_parent(result); markLhsValues(result);}
5207 short int need_global_specifier,
5211 SgNewExp* result =
new SgNewExp(specified_type, placement_args, constructor_args, builtin_args, need_global_specifier, newOperatorDeclaration);
5212 ROSE_ASSERT(result);
5220 short need_global_specifier,
5224 need_global_specifier, deleteOperatorDeclaration);
5225 ROSE_ASSERT(result);
5235 ROSE_ASSERT(result != NULL);
5243 ROSE_ASSERT(result);
5244 if (operand_i) {operand_i->
set_parent(result); markLhsValues(result);}
5251 ROSE_ASSERT(result);
5252 if (operand_i) {operand_i->
set_parent(result); markLhsValues(result);}
5259 SgMinusMinusOp* result = buildUnaryExpression<SgMinusMinusOp>(operand_i);
5260 ROSE_ASSERT(result);
5267 SgMinusMinusOp* result = buildUnaryExpression_nfi<SgMinusMinusOp>(operand_i);
5268 ROSE_ASSERT(result);
5275 SgMinusOp* result = buildUnaryExpression<SgMinusOp>(operand_i);
5276 ROSE_ASSERT(result);
5283 SgMinusOp* result = buildUnaryExpression_nfi<SgMinusOp>(operand_i);
5284 ROSE_ASSERT(result);
5291 SgPlusPlusOp* result = buildUnaryExpression<SgPlusPlusOp>(operand_i);
5292 ROSE_ASSERT(result);
5300 SgPlusPlusOp* result = buildUnaryExpression_nfi<SgPlusPlusOp>(operand_i);
5301 ROSE_ASSERT(result);
5315 markLhsValues(result);
5321 operand_i -> set_parent(result);
5323 ROSE_ASSERT(result);
5330#define BUILD_BINARY_DEF(suffix) \
5331 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix##_nfi(SgExpression* lhs, SgExpression* rhs) \
5333 return buildBinaryExpression_nfi<Sg##suffix>(lhs, rhs); \
5335 ROSE_DLL_API Sg##suffix* SageBuilder::build##suffix(SgExpression* lhs, SgExpression* rhs) \
5337 return buildBinaryExpression<Sg##suffix>(lhs, rhs); \
5340BUILD_BINARY_DEF(AddOp)
5341BUILD_BINARY_DEF(AndAssignOp)
5342BUILD_BINARY_DEF(AndOp)
5343BUILD_BINARY_DEF(ArrowExp)
5344BUILD_BINARY_DEF(ArrowStarOp)
5345BUILD_BINARY_DEF(AssignOp)
5346BUILD_BINARY_DEF(AtOp)
5347BUILD_BINARY_DEF(BitAndOp)
5348BUILD_BINARY_DEF(BitOrOp)
5349BUILD_BINARY_DEF(BitXorOp)
5351BUILD_BINARY_DEF(CommaOpExp)
5352BUILD_BINARY_DEF(ConcatenationOp)
5353BUILD_BINARY_DEF(DivAssignOp)
5354BUILD_BINARY_DEF(DivideOp)
5355BUILD_BINARY_DEF(DotExp)
5356BUILD_BINARY_DEF(DotStarOp)
5357BUILD_BINARY_DEF(EqualityOp)
5359BUILD_BINARY_DEF(ExponentiationOp)
5360BUILD_BINARY_DEF(ExponentiationAssignOp)
5361BUILD_BINARY_DEF(GreaterOrEqualOp)
5362BUILD_BINARY_DEF(GreaterThanOp)
5363BUILD_BINARY_DEF(IntegerDivideOp)
5364BUILD_BINARY_DEF(IntegerDivideAssignOp)
5365BUILD_BINARY_DEF(IorAssignOp)
5366BUILD_BINARY_DEF(IsOp)
5367BUILD_BINARY_DEF(IsNotOp)
5369BUILD_BINARY_DEF(LessOrEqualOp)
5370BUILD_BINARY_DEF(LessThanOp)
5371BUILD_BINARY_DEF(LshiftAssignOp)
5372BUILD_BINARY_DEF(LshiftOp)
5374BUILD_BINARY_DEF(MembershipOp)
5375BUILD_BINARY_DEF(MinusAssignOp)
5376BUILD_BINARY_DEF(ModAssignOp)
5377BUILD_BINARY_DEF(ModOp)
5378BUILD_BINARY_DEF(MultAssignOp)
5379BUILD_BINARY_DEF(MultiplyOp)
5381BUILD_BINARY_DEF(NotEqualOp)
5382BUILD_BINARY_DEF(NonMembershipOp)
5383BUILD_BINARY_DEF(OrOp)
5384BUILD_BINARY_DEF(PlusAssignOp)
5385BUILD_BINARY_DEF(PntrArrRefExp)
5386BUILD_BINARY_DEF(RemOp)
5387BUILD_BINARY_DEF(RshiftAssignOp)
5388BUILD_BINARY_DEF(JavaUnsignedRshiftAssignOp)
5390BUILD_BINARY_DEF(RshiftOp)
5391BUILD_BINARY_DEF(JavaUnsignedRshiftOp)
5392BUILD_BINARY_DEF(ScopeOp)
5393BUILD_BINARY_DEF(SubtractOp)
5394BUILD_BINARY_DEF(XorAssignOp)
5396BUILD_BINARY_DEF(VarArgCopyOp)
5397BUILD_BINARY_DEF(VarArgStartOp)
5400BUILD_BINARY_DEF(ReplicationOp);
5403BUILD_BINARY_DEF(PowerOp);
5404BUILD_BINARY_DEF(ElementwisePowerOp);
5405BUILD_BINARY_DEF(ElementwiseMultiplyOp);
5406BUILD_BINARY_DEF(ElementwiseDivideOp);
5407BUILD_BINARY_DEF(LeftDivideOp);
5408BUILD_BINARY_DEF(ElementwiseLeftDivideOp);
5409BUILD_BINARY_DEF(ElementwiseAddOp);
5410BUILD_BINARY_DEF(ElementwiseSubtractOp);
5413BUILD_BINARY_DEF(SpaceshipOp)
5415#undef BUILD_BINARY_DEF
5423 ROSE_ASSERT(base_type != NULL);
5427 if (dim_info == NULL)
5438 ROSE_ASSERT(array_type);
5439 ROSE_ASSERT(array_type->get_dim_info() == NULL);
5444 array_type->set_dim_info(dim_info);
5445 array_type->set_rank(dim_info->get_expressions().size());
5453 ASSERT_not_null(result);
5455 if (index !=
nullptr) {
5476 if (a) {a->
set_parent(result); markLhsValues(a);}
5477 if (b) {b->
set_parent(result); markLhsValues(b);}
5485 ROSE_ASSERT(result);
5505 ASSERT_not_null(expr);
5519 ROSE_ASSERT(result);
5520 if (operand_i!=NULL)
5524 markLhsValues(result);
5533 ASSERT_not_null(result);
5538 markLhsValues(result);
5551 ROSE_ASSERT(result);
5552 if (initializers!=NULL)
5556 result->set_need_explicit_braces(
true);
5565 ROSE_ASSERT(result);
5566 if (initializers!=NULL)
5570 result->set_need_explicit_braces(
true);
5579 ROSE_ASSERT(result);
5580 if (initializers!=NULL)
5592 ROSE_ASSERT(result);
5593 if (initializers!=NULL)
5608 bool need_qualifier ,
5609 bool need_parenthesis_after_name ,
5610 bool associated_class_unknown )
5617 ROSE_ASSERT(declaration == NULL || declaration->get_associatedClassDeclaration() != NULL);
5620 need_qualifier, need_parenthesis_after_name, associated_class_unknown );
5621 ROSE_ASSERT(result != NULL);
5640 bool need_qualifier ,
5641 bool need_parenthesis_after_name ,
5642 bool associated_class_unknown )
5648 ROSE_ASSERT(declaration == NULL || declaration->get_associatedClassDeclaration() != NULL);
5651 ROSE_ASSERT(result != NULL);
5676 ROSE_ASSERT(result);
5677 if (initializers!=NULL)
5688 ROSE_ASSERT(result);
5689 if (initializers!=NULL)
5706 ROSE_ASSERT(result);
5710 markLhsValues(result);
5724 ROSE_ASSERT(result);
5728 markLhsValues(result);
5739 ROSE_ASSERT(result);
5749 ROSE_ASSERT(result);
5761 ROSE_ASSERT(result);
5765 markLhsValues(result);
5778 ROSE_ASSERT(result);
5782 markLhsValues(result);
5795 ROSE_ASSERT(result);
5799 markLhsValues(result);
5813 ROSE_ASSERT(result);
5817 markLhsValues(result);
5828 ROSE_ASSERT(result);
5837 ROSE_ASSERT(result);
5846 ROSE_ASSERT(expList);
5868 ROSE_ASSERT(expList);
5871 for (
size_t i = 0; i < exprs.size(); ++i) {
5880 ROSE_ASSERT(expList);
5889 ROSE_ASSERT(expList != NULL);
5892 for (
size_t i = 0; i < exprs.size(); ++i)
5898 testAstForUniqueNodes(expList);
5906 if (lower_bound == NULL)
5915 ROSE_ASSERT(lower_bound);
5916 ROSE_ASSERT(upper_bound);
5917 ROSE_ASSERT(stride);
5920 ROSE_ASSERT(subscript);
5934 ROSE_ASSERT(initname);
5941 if (initname->get_scope()!=NULL)
5946 varRef =
new SgVarRefExp(isSgVariableSymbol(symbol));
5948 ROSE_ASSERT(varRef);
5993 varSymbol = isSgVariableSymbol(symbol);
6001 name1->set_scope(scope);
6007 if (varSymbol == NULL)
6009 printf (
"Error: varSymbol == NULL for name = %s \n",name.str());
6011 ROSE_ASSERT(varSymbol != NULL);
6015 ROSE_ASSERT(varRef != NULL);
6017 ROSE_ASSERT (isSgVariableSymbol(varRef->get_symbol())->get_declaration()!=NULL);
6027 ROSE_ASSERT(symbol);
6037 ROSE_ASSERT(varRef);
6048 ROSE_ASSERT(varRef);
6059 ROSE_ASSERT(refexp != NULL);
6074 ROSE_ASSERT(scope != NULL);
6085 ROSE_ASSERT(isSgVariableSymbol(symbol));
6111 ROSE_ASSERT(compoundLiteral != NULL);
6115 return compoundLiteral;
6124 ROSE_ASSERT(compoundLiteral != NULL);
6128 return compoundLiteral;
6136 ROSE_ASSERT (s!= NULL);
6138 ROSE_ASSERT (result != NULL);
6147 if (paraTypeList==NULL)
return paraList;
6150 SgTypePtrList::iterator i;
6151 for (i=typeList.begin();i!=typeList.end();i++)
6164 ROSE_ASSERT (paraList);
6166 SgTypePtrList::iterator i;
6167 for (i=typeList.begin();i!=typeList.end();i++)
6179 ASSERT_not_null(funcType);
6181 ASSERT_not_null(func_type);
6183 bool isMemberFunc = isSgMemberFunctionType(func_type);
6185 if (scope ==
nullptr) {
6188 ASSERT_not_null(scope);
6190 if (symbol ==
nullptr)
6193 SgType* return_type = func_type->get_return_type();
6199 ASSERT_require(isMemberFunc ==
false);
6205 funcDecl = buildNondefiningFunctionDeclaration_T
6210 funcDecl = buildNondefiningFunctionDeclaration_T
6214 funcDecl->get_declarationModifier().get_storageModifier().
setExtern();
6217 ASSERT_not_null(symbol);
6222 ASSERT_not_null(func_ref);
6237 ROSE_ASSERT(func_decl != NULL);
6241 if (nondef_func != NULL)
6243 ROSE_ASSERT(nondef_func!= NULL);
6245 ROSE_ASSERT( symbol != NULL);
6248 else if (def_func != NULL)
6254 std::cerr<<
"Fatal error: SageBuilder::buildFunctionRefExp():defining and nondefining declarations for a function cannot be both NULL"<<std::endl;
6257 ROSE_ASSERT( symbol != NULL);
6268 ROSE_ASSERT(func_ref);
6278 ROSE_ASSERT(func_ref);
6287 ROSE_ASSERT(sym != NULL);
6290 ROSE_ASSERT(func_ref != NULL);
6295 ROSE_ASSERT(func_ref->get_symbol() != NULL);
6306 ROSE_ASSERT(func_ref);
6316 ROSE_ASSERT(func_ref);
6326 ROSE_ASSERT(func_ref);
6336 ROSE_ASSERT(class_ref);
6345 ROSE_ASSERT(class_ref);
6355 ROSE_ASSERT(scope != NULL);
6369 printf (
"Error: buildFunctionRefExp(): This function should not be used! \n");
6380 funcDecl->get_declarationModifier().get_storageModifier().
setExtern();
6383 ROSE_ASSERT(symbol);
6389 ROSE_ASSERT(func_ref);
6405 ROSE_ASSERT(expStmt);
6415 ROSE_ASSERT(expStmt);
6426 ROSE_ASSERT(expStmt);
6438 ROSE_ASSERT(expStmt);
6448 if (scope ==
nullptr) {
6451 ASSERT_not_null(scope);
6453 if (parameters ==
nullptr) {
6464 ASSERT_not_null(func_call_expr);
6466 return func_call_expr;
6474 ROSE_ASSERT (sym != NULL);
6475 if (parameters == NULL)
6477 ROSE_ASSERT (parameters != NULL);
6484 if (memberFunctionSymbol != NULL)
6487 bool virtual_call =
false;
6490 bool need_qualifier =
false;
6508 ROSE_ASSERT(func_call_expr);
6509 return func_call_expr;
6515 ROSE_ASSERT(f != NULL);
6517 ROSE_ASSERT(func_call_expr != NULL);
6522 if (parameters != NULL) {
6527 return func_call_expr;
6533 ROSE_ASSERT(f != NULL);
6535 ROSE_ASSERT(func_call_expr != NULL);
6538 if (parameters) parameters->
set_parent(func_call_expr);
6541 return func_call_expr;
6552 ROSE_ASSERT(scope != NULL);
6578 std::string functionName,
6584 ROSE_ASSERT(classSymbol);
6588 ROSE_ASSERT(classDeclaration != NULL);
6591 ROSE_ASSERT(classDefinition);
6595 ROSE_ASSERT(functionSymbol);
6618 ROSE_ASSERT(builtin_func_call_expr != NULL);
6620 SgNodePtrList & args = builtin_func_call_expr->get_args();
6621 for (SgNodePtrList::iterator it = parameters.begin(); it != parameters.end(); ++it) {
6622 args.push_back(*it);
6623 (*it)->set_parent(builtin_func_call_expr);
6626 return builtin_func_call_expr;
6633 ROSE_ASSERT(kernel);
6634 ROSE_ASSERT(parameters);
6635 ROSE_ASSERT(config);
6640 if (func_ref_exp == NULL && template_func_ref_exp == NULL)
6642 std::cerr <<
"SgCudaKernelCallExp accept only direct reference to a function. Got, " <<
typeid(*kernel).name()
6649 else if ( (func_ref_exp != NULL && func_ref_exp->get_symbol_i()->get_declaration()->get_functionModifier().isCudaKernel() ==
false) &&
6650 (template_func_ref_exp != NULL && template_func_ref_exp->get_symbol_i()->get_declaration()->get_functionModifier().isCudaKernel() ==
false) )
6652 std::cerr <<
"To build a SgCudaKernelCallExp the callee needs to be a kernel (having \"__global__\" attribute)." << std::endl;
6664 ROSE_ASSERT(kernel_call_expr);
6666 return kernel_call_expr;
6671 if (!grid || !blocks) {
6672 std::cerr <<
"SgCudaKernelExecConfig need fields 'grid' and 'blocks' to be set." << std::endl;
6689 ROSE_ASSERT(config);
6698 ROSE_ASSERT(lhs != NULL);
6699 ROSE_ASSERT(rhs != NULL);
6704 ROSE_ASSERT(assignOp);
6725 ROSE_ASSERT(lhs != NULL);
6726 ROSE_ASSERT(rhs != NULL);
6731 ROSE_ASSERT(assignOp);
6758 ROSE_ASSERT(labelstmt);
6778 ASSERT_not_null(labelStmt);
6781 if (stmt !=
nullptr) {
6795 ROSE_ASSERT(conditional);
6796 ROSE_ASSERT(true_body);
6798 ROSE_ASSERT(ifstmt);
6803 ifstmt->setCaseInsensitive(
true);
6808 if (false_body != NULL) false_body->
set_parent(ifstmt);
6818 if (isSgBasicBlock(true_body)|| isSgFortranDo(true_body)|| isSgIfStmt(true_body))
6831 ROSE_ASSERT(ifstmt);
6846 ASSERT_not_null(result);
6849 result->setCaseInsensitive(
true);
6856 increment->set_parent(result);
6870 ASSERT_not_null(result);
6873 result->setCaseInsensitive(
true);
6880 increment->set_parent(result);
6903 ROSE_ASSERT(forInit != NULL);
6905 ROSE_ASSERT(statement != NULL);
6906 forInit->append_init_stmt(statement);
6920 (*it)->set_parent(result);
6935 (*it)->set_parent(result);
6949 ROSE_ASSERT(result);
6952 result->setCaseInsensitive(
true);
6960 increment->set_parent(result);
6964 result->set_else_body(else_body);
6979 for_init_stmt->set_parent(result);
6984 ROSE_ASSERT(init_stmt);
6998 if (initialize_stmt)
7000 init_stmt->append_init_stmt(initialize_stmt);
7003 if (isSgVariableDeclaration(initialize_stmt))
7021 ROSE_ASSERT(result);
7026 result->setCaseInsensitive(
true);
7030 if (loop_body) loop_body->
set_parent(result);
7031 if (increment) increment->set_parent(result);
7032 if (else_body) else_body->
set_parent(result);
7034 result->set_else_body(else_body);
7036 if (initialize_stmt != NULL)
7039 ROSE_ASSERT(init_stmt);
7041 init_stmt->append_init_stmt(initialize_stmt);
7053 ROSE_ASSERT(result != NULL);
7069 ROSE_ASSERT(result != NULL);
7078 if (result->get_test() != NULL && test != result->get_test())
7080 delete result->get_test();
7081 result->set_test(NULL);
7084 if (result->get_increment() != NULL && increment != result->get_increment())
7086 delete result->get_increment();
7087 result->set_increment(NULL);
7096 if (result->get_else_body() != NULL && else_body != result->get_else_body())
7098 delete result->get_else_body();
7099 result->set_else_body(NULL);
7103 result->set_test(test);
7104 result->set_increment(increment);
7108 result->setCaseInsensitive(
true);
7112 if (loop_body) loop_body->
set_parent(result);
7113 if (increment) increment->set_parent(result);
7114 if (init_stmt) init_stmt->
set_parent(result);
7115 if (else_body) else_body->
set_parent(result);
7117 result->set_else_body(else_body);
7120 ROSE_ASSERT(result->get_test() != NULL);
7121 ROSE_ASSERT(result->get_increment() != NULL);
7145 ROSE_ASSERT(result != NULL);
7149 if (initializer != NULL) initializer->
set_parent(result);
7150 if (range != NULL) range->
set_parent(result);
7152 if (begin_declaration != NULL) begin_declaration->
set_parent(result);
7153 if (end_declaration != NULL) end_declaration->
set_parent(result);
7155 if (not_equal_expression != NULL) not_equal_expression->
set_parent(result);
7156 if (increment_expression != NULL) increment_expression->
set_parent(result);
7172 ASSERT_not_null(result);
7173 ASSERT_not_null(body);
7174 ASSERT_not_null(condition);
7176 ASSERT_require(result->
get_body() ==
nullptr);
7187 ASSERT_not_null(result->
get_body());
7201 ROSE_ASSERT(result);
7204 if (loop_body) loop_body->
set_parent(result);
7205 if (increment) increment->set_parent(result);
7208 if (initialize_stmt != NULL) {
7210 ROSE_ASSERT(init_stmt);
7212 init_stmt->append_init_stmt(initialize_stmt);
7223 ROSE_ASSERT(result);
7228 result->setCaseInsensitive(
true);
7232 if (loop_body) loop_body->
set_parent(result);
7233 if (increment) increment->set_parent(result);
7235 if (init_stmt) init_stmt->
set_parent(result);
7298 ROSE_ASSERT(condition);
7301 ROSE_ASSERT(result);
7306 result->setCaseInsensitive(
true);
7313 if (else_body != NULL) {
7314 result->set_else_body(else_body);
7326 ROSE_ASSERT(result);
7331 result->setCaseInsensitive(
true);
7334 if (condition) condition->
set_parent(result);
7338 if (else_body != NULL)
7340 result->set_else_body(else_body);
7354 ROSE_ASSERT(expr != NULL && body != NULL);
7365 ROSE_ASSERT(expr != NULL && body != NULL);
7376 ROSE_ASSERT(condition);
7379 ROSE_ASSERT(result);
7389 ROSE_ASSERT(result);
7391 if (condition) condition->
set_parent(result);
7401 ROSE_ASSERT(result != NULL);
7412 ROSE_ASSERT(result);
7420 ROSE_ASSERT(result);
7428 ASSERT_not_null(result);
7436 ASSERT_not_null(result);
7444 ASSERT_not_null(result);
7452 ASSERT_not_null(result);
7460 ROSE_ASSERT(result);
7468 ROSE_ASSERT(result);
7475 SgDeleteExp *result =
new SgDeleteExp(target, is_array, need_global_specifier, deleteOperatorDeclaration);
7476 target->set_parent(result);
7483 SgDeleteExp *result =
new SgDeleteExp(target, is_array, need_global_specifier, deleteOperatorDeclaration);
7484 target->set_parent(result);
7492 ROSE_ASSERT(test != NULL);
7505 ROSE_ASSERT(result);
7509 markLhsValues(result);
7519 ROSE_ASSERT(test != NULL);
7521 if (exceptionArgument != NULL) {
7522 result -> set_exception_argument(exceptionArgument);
7532 ROSE_ASSERT(test != NULL);
7540 ROSE_ASSERT(value != NULL);
7549 ROSE_ASSERT(value != NULL);
7558 ROSE_ASSERT(key != NULL && datum != NULL);
7568 ROSE_ASSERT(key != NULL && datum != NULL);
7579 ROSE_ASSERT(result);
7580 for (
size_t i = 0; i < pairs.size(); ++i)
7581 result->append_pair(pairs[i]);
7589 ROSE_ASSERT(result);
7590 for (
size_t i = 0; i < pairs.size(); ++i)
7591 result->append_pair(pairs[i]);
7599 ROSE_ASSERT(target != NULL);
7600 ROSE_ASSERT(iter != NULL);
7602 ROSE_ASSERT(result);
7604 target->set_parent(result);
7615 ROSE_ASSERT(target != NULL);
7616 ROSE_ASSERT(iter != NULL);
7618 ROSE_ASSERT(result);
7619 target->set_parent(result);
7629 ROSE_ASSERT(elt != NULL);
7630 ROSE_ASSERT(generators != NULL);
7641 ROSE_ASSERT(elt != NULL);
7642 ROSE_ASSERT(generators != NULL);
7653 ROSE_ASSERT(elt != NULL);
7654 ROSE_ASSERT(generators != NULL);
7665 ROSE_ASSERT(elt != NULL);
7666 ROSE_ASSERT(generators != NULL);
7677 ROSE_ASSERT(kd_pair != NULL);
7678 ROSE_ASSERT(generators != NULL);
7689 ROSE_ASSERT(kd_pair != NULL);
7690 ROSE_ASSERT(generators != NULL);
7700 ROSE_ASSERT(arg != NULL);
7709 ROSE_ASSERT(arg != NULL);
7723 ROSE_ASSERT(pragma);
7728 ROSE_ASSERT(result);
7750 ROSE_ASSERT(result);
7760 ROSE_ASSERT(emptyDeclaration != NULL);
7773 ROSE_ASSERT(emptyDeclaration->
get_parent() != NULL);
7776 return emptyDeclaration;
7783 ROSE_ASSERT(result);
7788 result->setCaseInsensitive(
true);
7808 ROSE_ASSERT(result);
7814 result->setCaseInsensitive(
true);
7820 printf (
"In buildBasicBlock_nfi(): returning result = %p \n",result);
7832 printf (
"In buildBasicBlock_nfi(const vector<SgStatement*>& stmts): returning result = %p \n",result);
7836 printf (
"Exiting as a test! \n");
7859 ROSE_ASSERT(result);
7868 ROSE_ASSERT (symbol != NULL);
7874 result->set_label_expression(l_exp);
7879 ROSE_ASSERT (l_stmt != NULL);
7882 ROSE_ASSERT(result);
7890 ROSE_ASSERT(result);
7901 result->set_selector_expression(label_expression);
7902 ROSE_ASSERT(result);
7914 if (expression == NULL)
7919 ROSE_ASSERT(result);
7920 if (expression != NULL) expression->
set_parent(result);
7929 ROSE_ASSERT(result);
7930 if (expression != NULL) expression->
set_parent(result);
7938 ROSE_ASSERT(result);
7948 ROSE_ASSERT(result);
7958 ROSE_ASSERT(result);
7963 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7964 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7965 printf (
"SageBuilder::buildDefaultOptionStmt() body = %p \n",body);
7966 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7967 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7976 ROSE_ASSERT(result);
7981 static int count = 0;
7983 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7984 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7985 printf (
"SageBuilder::buildDefaultOptionStmt_nfi() body = %p \n",body);
7986 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7987 printf (
"DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \n");
7991 printf (
"Exiting as a test! \n");
8003 ROSE_ASSERT(result);
8008 result->setCaseInsensitive(
true);
8011 if (item_selector) item_selector->
set_parent(result);
8020 ROSE_ASSERT(result);
8025 result->setCaseInsensitive(
true);
8028 if (item_selector) item_selector->
set_parent(result);
8043 ROSE_ASSERT(result);
8053 ROSE_ASSERT(result);
8062 if (locals != NULL && globals == NULL)
8063 ROSE_ASSERT(!
"buildExecStatement with non-NULL locals requires non-NULL globals");
8064 ROSE_ASSERT(executable != NULL);
8068 if (globals != NULL) globals->
set_parent(result);
8069 if (locals != NULL) locals->
set_parent(result);
8079 if (locals != NULL && globals == NULL)
8080 ROSE_ASSERT(!
"buildExecStatement with non-NULL locals requires non-NULL globals");
8081 ROSE_ASSERT(executable != NULL);
8085 if (globals != NULL) globals->
set_parent(result);
8086 if (locals != NULL) locals->
set_parent(result);
8095 ROSE_ASSERT(body != NULL);
8097 ROSE_ASSERT(async_stmt);
8107 ROSE_ASSERT(body != NULL);
8109 ROSE_ASSERT(finish_stmt);
8119 ROSE_ASSERT(expression);
8132 ROSE_ASSERT(body != NULL);
8134 ROSE_ASSERT(atomic_stmt);
8144 ROSE_ASSERT(expression);
8157 ROSE_ASSERT(expression);
8170 ROSE_ASSERT(expression);
8202 ROSE_ASSERT(body != NULL);
8221 if (catch0 != NULL) try_stmt->append_catch_statement(catch0);
8222 if (catch1 != NULL) try_stmt->append_catch_statement(catch1);
8223 if (catch2 != NULL) try_stmt->append_catch_statement(catch2);
8224 if (catch3 != NULL) try_stmt->append_catch_statement(catch3);
8225 if (catch4 != NULL) try_stmt->append_catch_statement(catch4);
8242 ROSE_ASSERT(try_body != NULL);
8244 try_body -> set_parent(try_stmt);
8250 try_stmt -> set_finally_body(finally_body);
8251 finally_body -> set_parent(try_stmt);
8265 if (catch_option_stmt) {
8266 catch_statement_sequence -> append_catch_statement(catch_option_stmt);
8267 catch_option_stmt -> set_parent(catch_statement_sequence);
8270 return catch_statement_sequence;
8277 if (condition) condition->
set_parent(result);
8285 ROSE_ASSERT(expression);
8300 ROSE_ASSERT(throw_stmt);
8312 ROSE_ASSERT(foreach_stmt);
8314 if (collection) collection -> set_parent(foreach_stmt);
8315 if (body) body -> set_parent(foreach_stmt);
8317 return foreach_stmt;
8323 ROSE_ASSERT(label_stmt);
8327 stmt -> set_parent(label_stmt);
8333 ROSE_ASSERT(lsymbol);
8334 label_stmt -> insert_symbol(lsymbol ->
get_name(), lsymbol);
8384 ROSE_ASSERT(result);
8385 result->set_assemblyCode(s);
8396 ROSE_ASSERT(result);
8397 result->set_assemblyCode(s);
8407#define NOP_1_BYTE_STRING "nop"
8408#define NOP_2_BYTE_STRING ".byte 0x66,0x90"
8409#define NOP_3_BYTE_STRING "nopl (%eax)"
8410#define NOP_4_BYTE_STRING "nopl 0x01(%eax)"
8411#define NOP_5_BYTE_STRING ".byte 0x0f,0x1f,0x44,0x00,0x00"
8412#define NOP_6_BYTE_STRING ".byte 0x66,0x0f,0x1f,0x44,0x00,0x00"
8413#define NOP_7_BYTE_STRING ".byte 0x0f,0x1f,0x80,0x00,0x00,0x00,0x00"
8414#define NOP_8_BYTE_STRING ".byte 0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00"
8415#define NOP_9_BYTE_STRING ".byte 0x66,0x0f,0x1f,0x84,0x00,0x00,0x00,0x00,0x00"
8435 printf (
"Only supporting values of multi-byte nop's up to 9 bytes long. \n");
8440 return nopStatement;
8447 ROSE_ASSERT(condition != NULL);
8450 ROSE_ASSERT(result != NULL);
8467 ROSE_ASSERT(result != NULL);
8499 if (isSgReferenceType (base_type))
8501 cerr<<
"Error in SageBuilder::buildPointerType(): trying to build a pointer to a reference type! This is not allowed in C++."<<endl;
8506 ROSE_ASSERT(result != NULL);
8520 ROSE_ASSERT(result != NULL);
8527 ROSE_ASSERT(base_type != NULL);
8529 ROSE_ASSERT(result != NULL);
8536 ROSE_ASSERT(base_expression != NULL);
8540 if (isSgFunctionParameterRefExp(base_expression) != NULL)
8543 result->set_base_type(base_type);
8550 ROSE_ASSERT(result != NULL);
8563#define DEBUG_TYPEOF_TYPE 0
8565#if DEBUG_TYPEOF_TYPE
8566 printf (
"In SageBuilder::buildTypeOfType(): base_expression = %p = %s \n",base_expression,base_expression != NULL ? base_expression->
class_name().c_str() :
"NULL");
8567 printf (
" ------------------------------- base_type = %p = %s \n",base_type,base_type != NULL ? base_type->
class_name().c_str() :
"NULL");
8571 if (isSgFunctionParameterRefExp(base_expression) != NULL)
8573#if DEBUG_TYPEOF_TYPE
8574 printf (
"In SageBuilder::buildTypeOfType(): isSgFunctionParameterRefExp(base_expression) != NULL: calling new SgTypeOfType(base_expression,NULL) \n");
8579 ROSE_ASSERT(result != NULL);
8580#if DEBUG_TYPEOF_TYPE
8581 printf (
"In buildTypeOfType(): test 1: result = %p = %s \n",result,result->class_name().c_str());
8583 result->set_base_type(base_type);
8587 if (base_expression != NULL)
8589#if DEBUG_TYPEOF_TYPE
8590 printf (
"In SageBuilder::buildTypeOfType(): isSgFunctionParameterRefExp(base_expression) == NULL: base_expression != NULL: calling SgTypeOfType::createType(base_expression,NULL) \n");
8595 ROSE_ASSERT(result != NULL);
8596#if DEBUG_TYPEOF_TYPE
8597 printf (
"In buildTypeOfType(): test 2: result = %p = %s \n",result,result->class_name().c_str());
8602 ROSE_ASSERT(base_type != NULL);
8604#if DEBUG_TYPEOF_TYPE
8605 printf (
"In SageBuilder::buildTypeOfType(): isSgFunctionParameterRefExp(base_expression) == NULL: base_expression == NULL: calling SgTypeOfType::createType(base_type,NULL) \n");
8610 ROSE_ASSERT(result != NULL);
8612#if DEBUG_TYPEOF_TYPE
8613 printf (
"In buildTypeOfType(): test 3: result = %p = %s \n",result,result->class_name().c_str());
8616 if (result->get_base_type() != base_type)
8618 ROSE_ASSERT(result->get_base_type() != NULL);
8619#if DEBUG_TYPEOF_TYPE
8620 printf (
"result->get_base_type() = %p = %s \n",result->get_base_type(),result->get_base_type()->class_name().c_str());
8622 ROSE_ASSERT(base_type != NULL);
8623#if DEBUG_TYPEOF_TYPE
8624 printf (
"base_type = %p = %s \n",base_type,base_type->
class_name().c_str());
8630 ROSE_ASSERT(result != NULL);
8632 if (base_expression != NULL)
8638 ROSE_ASSERT(result != NULL);
8640#if DEBUG_TYPEOF_TYPE
8641 printf (
"In buildTypeOfType(): test 4: result = %p = %s \n",result,result->class_name().c_str());
8655 printf (
"Error: this function SageBuilder::buildModifierType() should not be called! (call the buildConst() function (or whatever other function is required) directly \n");
8662 ROSE_ASSERT(result != NULL);
8667 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
8676 ROSE_ASSERT(result);
8677 if (kind_expr != NULL) kind_expr->
set_parent(result);
8687 ROSE_ASSERT(result);
8694 ROSE_ASSERT(result);
8699#define BUILD_SGTYPE_DEF(item) \
8700 SgType##item * SageBuilder::build##itemType() { \
8701 SgType##item * result =SgType##item::createType(); \
8702 ROSE_ASSERT(result); \
8706 BUILD_SGTYPE_DEF(Bool)
8707 BUILD_SGTYPE_DEF(Char)
8708 BUILD_SGTYPE_DEF(Double)
8709 BUILD_SGTYPE_DEF(Float)
8710 BUILD_SGTYPE_DEF(Int)
8711 BUILD_SGTYPE_DEF(Long)
8712 BUILD_SGTYPE_DEF(LongDouble)
8713 BUILD_SGTYPE_DEF(LongLong)
8714 BUILD_SGTYPE_DEF(Short)
8715 BUILD_SGTYPE_DEF(Void)
8717 BUILD_SGTYPE_DEF(Wchar)
8720 BUILD_SGTYPE_DEF(Char16)
8721 BUILD_SGTYPE_DEF(Char32)
8723 BUILD_SGTYPE_DEF(SignedChar)
8724 BUILD_SGTYPE_DEF(SignedInt)
8725 BUILD_SGTYPE_DEF(SignedLong)
8726 BUILD_SGTYPE_DEF(SignedShort)
8727 BUILD_SGTYPE_DEF(UnsignedChar)
8728 BUILD_SGTYPE_DEF(UnsignedInt)
8729 BUILD_SGTYPE_DEF(UnsignedLong)
8730 BUILD_SGTYPE_DEF(UnsignedLongLong)
8731 BUILD_SGTYPE_DEF(UnsignedShort)
8732#undef BUILD_SGTYPE_DEF
8737 ROSE_ASSERT(result);
8744 ROSE_ASSERT(result);
8751 ROSE_ASSERT(result);
8758 ROSE_ASSERT(result);
8766 ROSE_ASSERT(result);
8767 if (kind_expr != NULL) kind_expr->
set_parent(result);
8778 ROSE_ASSERT(result);
8784 ROSE_ASSERT(result);
8790 ROSE_ASSERT(result);
8797 ROSE_ASSERT(result);
8804 ROSE_ASSERT(result);
8811 ROSE_ASSERT(result);
8818 ROSE_ASSERT(result);
8826 ROSE_ASSERT(result);
8833 ROSE_ASSERT(result);
8842 ROSE_ASSERT(result);
8850 ROSE_ASSERT(result);
8858 ROSE_ASSERT(result);
8866 ROSE_ASSERT(result);
8873 ROSE_ASSERT(result);
8880 ROSE_ASSERT(result);
8887 ROSE_ASSERT(result);
8894 ROSE_ASSERT(result);
8901 ROSE_ASSERT(result);
8908 ROSE_ASSERT(result);
8920 ROSE_ASSERT(result != NULL);
8935 SgTypeString* result = SgTypeString::createType(stringLengthExpression);
8936 ASSERT_not_null(result);
8944 if (kind_expr != NULL)
8953 ASSERT_not_null(result);
8964 ROSE_ASSERT(result);
8972 if (kind_expr != NULL)
8981 ASSERT_not_null(result);
8987 ASSERT_not_null(result);
8995 ROSE_ASSERT(result);
9018 ROSE_ASSERT(base_type != NULL);
9022 ROSE_ASSERT(result != NULL);
9025 ROSE_ASSERT(result != base_type);
9030 SgModifierType* result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9032 if (result != result2)
9035 printf (
"WARNING: In SageBuilder::buildModifierType(): using previously build SgModifierType from global type table: result2 = %p = %s \n",result2,result2->
class_name().c_str());
9040 ROSE_ASSERT(result2 != base_type);
9049 ROSE_ASSERT(base_type != NULL);
9053 ROSE_ASSERT(result!=NULL);
9059 SgModifierType *result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9061 if (result != result2)
9067 ROSE_ASSERT(result2 != base_type);
9077 ROSE_ASSERT(base_type != NULL);
9080 ROSE_ASSERT(result != NULL);
9082 result->set_type_kind(kindExpression);
9085 printf (
"In SageBuilder::buildFortranKindType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9088 SgModifierType *result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9090 if (result != result2)
9094 printf (
"(debugging) In SageBuilder::buildFortranKindType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9108 ROSE_ASSERT(base_type != NULL);
9111 ROSE_ASSERT(result!=NULL);
9116 printf (
"In SageBuilder::buildVolatileType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9122 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9123 if (result != result2)
9127 printf (
"(debugging) In SageBuilder::buildVolatileType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9141 ROSE_ASSERT(base_type != NULL);
9144 ROSE_ASSERT(result!=NULL);
9150 printf (
"In SageBuilder::buildConstVolatileType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9156 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9157 if (result != result2)
9161 printf (
"(debugging) In SageBuilder::buildConstVolatileType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9171generate_type_list (
SgType* type)
9174 string returnString;
9176 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);
9178 SgType* currentType = type;
9187 while (currentType != NULL)
9191 printf (
"In generate_type_list(): returnString = %s \n",returnString.c_str());
9193 if ( (bit_array & SgType::STRIP_MODIFIER_TYPE) && (modType = isSgModifierType(currentType)) )
9195 currentType = modType->get_base_type();
9197 else if ( (bit_array & SgType::STRIP_REFERENCE_TYPE) && (refType = isSgReferenceType(currentType)) )
9199 currentType = refType->get_base_type();
9201 else if ( (bit_array & SgType::STRIP_RVALUE_REFERENCE_TYPE) && (rRefType = isSgRvalueReferenceType(currentType)) )
9203 currentType = rRefType->get_base_type();
9205 else if ( (bit_array & SgType::STRIP_POINTER_TYPE) && (pointType = isSgPointerType(currentType)) )
9207 currentType = pointType->get_base_type();
9209 else if ( (bit_array & SgType::STRIP_ARRAY_TYPE) && (arrayType = isSgArrayType(currentType)) )
9211 currentType = arrayType->get_base_type();
9213 else if ( (bit_array & SgType::STRIP_TYPEDEF_TYPE) && (typedefType = isSgTypedefType(currentType)) )
9223 returnString +=
" , ";
9226 return returnString;
9233 ROSE_ASSERT(base_type != NULL);
9240 if (!isSgPointerType(base_type) && !isSgReferenceType(base_type) && !isSgArrayType(base_type) && !isSgTypedefType(base_type) && !isSgModifierType(base_type))
9242 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());
9243 printf (
" --- generate_type_list() = %s \n",generate_type_list(base_type).c_str());
9248 ROSE_ASSERT(result!=NULL);
9253 printf (
"In SageBuilder::buildRestrictType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9259 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9260 if (result != result2)
9264 printf (
"(debugging) In SageBuilder::buildRestrictType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9280 ASSERT_not_null(base_type);
9284 setModifiers(result);
9286 SgModifierType* result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9287 if (result != result2)
delete result;
9298 return _buildModifierType(base_type, op);
9305 return _buildModifierType(base_type, op);
9314 ROSE_ASSERT(base_type != NULL);
9317 ROSE_ASSERT(result!=NULL);
9322 printf (
"In SageBuilder::buildUpcStrictType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9328 SgModifierType *result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9329 if (result != result2)
9333 printf (
"(debugging) In SageBuilder::buildUpcStrictType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9347 ROSE_ASSERT(base_type != NULL);
9350 ROSE_ASSERT(result!=NULL);
9355 printf (
"In SageBuilder::buildUpcRelaxedType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9361 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9362 if (result != result2)
9366 printf (
"(debugging) In SageBuilder::buildUpcRelaxedType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9380 ROSE_ASSERT(base_type != NULL);
9383 ROSE_ASSERT(result!=NULL);
9392 printf (
"In SageBuilder::buildUpcSharedType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9398 SgModifierType * result2 = SgModifierType::insertModifierTypeIntoTypeTable(result);
9399 if (result != result2)
9403 printf (
"(debugging) In SageBuilder::buildUpcSharedType(): Skipping delete of SgModifierType = %p = %s \n",result,result->
class_name().c_str());
9417 ROSE_ASSERT(base_type != NULL);
9420 ROSE_ASSERT(result!=NULL);
9425 printf (
"In SageBuilder::buildUpcBlockIndefiniteType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9431 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
9441 ROSE_ASSERT(base_type != NULL);
9444 ROSE_ASSERT(result!=NULL);
9449 printf (
"In SageBuilder::buildUpcBlockStarType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9455 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
9465 ROSE_ASSERT(base_type != NULL);
9468 ROSE_ASSERT(result!=NULL);
9473 printf (
"In SageBuilder::buildUpcBlockNumberType(): Building a SgModifierType: result = %p base_type = %p = %s \n",result,base_type,base_type->
class_name().c_str());
9479 result = SgModifierType::insertModifierTypeIntoTypeTable(result);
9490 ROSE_ASSERT(base_type != NULL);
9493 ROSE_ASSERT(result!=NULL);
9501 ROSE_ASSERT(base_type != NULL);
9504 ROSE_ASSERT(result!=NULL);
9512 ROSE_ASSERT(result != NULL);
9520 ROSE_ASSERT(result != NULL);
9522 if(t1) result->append_type(t1);
9523 if(t2) result->append_type(t2);
9524 if(t3) result->append_type(t3);
9525 if(t4) result->append_type(t4);
9526 if(t5) result->append_type(t5);
9527 if(t6) result->append_type(t6);
9528 if(t7) result->append_type(t7);
9529 if(t8) result->append_type(t8);
9530 if(t9) result->append_type(t9);
9531 if(t10) result->append_type(t10);
9542 nrdecl->set_is_template_param (
true);
9543 return nrdecl->get_type();
9550 ROSE_ASSERT(result != NULL);
9552 result->append(start);
9560 ROSE_ASSERT(result != NULL);
9562 result->set_start(start);
9565 result->set_end(end);
9568 result->set_stride(stride);
9579 result->append_expression(firstRow);
9580 ROSE_ASSERT(result != NULL);
9590 ROSE_ASSERT(result != NULL);
9600 ROSE_ASSERT (result != NULL);
9601 result->set_modifier (mtype);
9634 ROSE_ASSERT(expr != NULL);
9646 ROSE_ASSERT(expr != NULL);
9657 ROSE_ASSERT(expr != NULL);
9660 if (lambda_capture_list != NULL)
9665 if (lambda_closure_class != NULL)
9670 if (lambda_function != NULL)
9675 if (lambda_closure_class != NULL)
9677 lambda_function->
set_parent(lambda_closure_class);
9681 printf (
"Warning: In SageBuilder::buildLambdaExp(): lambda_closure_class == NULL: lambda_function parent not set! \n");
9694 ROSE_ASSERT(expr != NULL);
9697 if (lambda_capture_list != NULL)
9702 if (lambda_closure_class != NULL)
9707 if (lambda_function != NULL)
9712 if (lambda_closure_class != NULL)
9714 lambda_function->
set_parent(lambda_closure_class);
9718 printf (
"Warning: In SageBuilder::buildLambdaExp(): lambda_closure_class == NULL: lambda_function parent not set! \n");
9732 ROSE_ASSERT(lambdaCapture != NULL);
9735 return lambdaCapture;
9742 ROSE_ASSERT(lambdaCapture != NULL);
9745 return lambdaCapture;
9752 ROSE_ASSERT(lambdaCapture != NULL);
9755 return lambdaCapture;
9762 ROSE_ASSERT(lambdaCapture != NULL);
9765 return lambdaCapture;
9773 ROSE_ASSERT(lambdaCaptureList != NULL);
9776 return lambdaCaptureList;
9783 ROSE_ASSERT(lambdaCaptureList != NULL);
9786 return lambdaCaptureList;
9794 ROSE_ASSERT(result != NULL);
9804 ROSE_ASSERT(result != NULL);
9815 ROSE_ASSERT(result != NULL);
9824 ROSE_ASSERT(result != NULL);
9835 ROSE_ASSERT(result != NULL);
9845 ROSE_ASSERT(result != NULL);
9867 ROSE_ASSERT(result);
9880 return nonreal_decl_scope;
9891 ROSE_ASSERT(buildTemplateInstantiation ==
false || isSgTemplateInstantiationDecl(d) != NULL);
9900 ROSE_ASSERT(result);
9906 result->setCaseInsensitive(
true);
9924 ROSE_ASSERT(buildTemplateInstantiation ==
false || isSgTemplateInstantiationDecl(d) != NULL);
9933 ROSE_ASSERT(result);
9938 result->setCaseInsensitive(
true);
9948 SgName nameWithoutTemplateArguments = XXX_name;
9950 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
9955#define DEBUG_NONDEFINING_CLASS_DECLARATION 0
9958#if DEBUG_NONDEFINING_CLASS_DECLARATION
9959 printf (
"Building a SgClassDeclaration: buildNondefiningClassDeclaration_nfi() nameWithoutTemplateArguments = %s buildTemplateInstantiation = %s \n",nameWithoutTemplateArguments.str(),buildTemplateInstantiation ?
"true:" :
"false");
9960 printf (
" --- scope = %p = %s \n",scope,(scope != NULL) ? scope->
class_name().c_str() :
"null");
9967 if (buildTemplateInstantiation ==
true)
9969 ROSE_ASSERT(templateArgumentsList != NULL);
9972#if DEBUG_NONDEFINING_CLASS_DECLARATION
9973 printf (
"Building a SgClassDeclaration: buildNondefiningClassDeclaration_nfi() nameWithTemplateArguments = %s buildTemplateInstantiation = %s \n",nameWithTemplateArguments.str(),buildTemplateInstantiation ?
"true:" :
"false");
9977 SgTemplateArgumentPtrList emptyList;
9980#if DEBUG_NONDEFINING_CLASS_DECLARATION
9981 printf (
"In buildNondefiningClassDeclaration_nfi(): built new SgTemplateInstantiationDecl: nondefdecl = %p \n",nondefdecl);
9983 ROSE_ASSERT(nondefdecl->get_type() == NULL);
9984 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl) != NULL);
9985#if DEBUG_NONDEFINING_CLASS_DECLARATION
9986 printf (
"In buildNondefiningClassDeclaration_nfi(): nondefdecl->get_name() = %s nondefdecl->get_templateName() = %s \n",
9987 nondefdecl->get_name().str(),isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().str());
9990 ROSE_ASSERT(templateArgumentsList != NULL);
9992#if DEBUG_NONDEFINING_CLASS_DECLARATION
9993 printf (
"nondefdecl->get_name() = %s \n",nondefdecl->get_name().str());
9994 printf (
"nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
9995 printf (
"Output templateArgumentsList: \n");
9996 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
9998 printf (
" --- --- templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
10004 ROSE_ASSERT(nondefdecl->get_name() == nameWithTemplateArguments);
10021 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
10025 ROSE_ASSERT((*templateArgumentsList)[i]->get_parent() != NULL);
10035 (*templateArgumentsList)[i]->set_parent(nondefdecl);
10039 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().is_null() ==
true);
10040 isSgTemplateInstantiationDecl(nondefdecl)->
set_templateName(nameWithoutTemplateArguments);
10046#if DEBUG_NONDEFINING_CLASS_DECLARATION
10047 printf (
"In buildNondefiningClassDeclaration_nfi(): built new SgClassDeclaration: nondefdecl = %p \n",nondefdecl);
10052 ROSE_ASSERT(nameWithoutTemplateArguments == nameWithTemplateArguments);
10055 ROSE_ASSERT(nondefdecl != NULL);
10058 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
10062 ROSE_ASSERT(nondefdecl->get_type() == NULL);
10067 if (nondefdecl->get_type() == NULL)
10074 printf (
"SageBuilder::buildNondefiningClassDeclaration_nfi(): (and setting source position) nondefdecl = %p \n",nondefdecl);
10099 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10106 ROSE_ASSERT(mysymbol != NULL);
10121 SgClassSymbol* mysymbol = scope->lookup_nontemplate_class_symbol(nameWithTemplateArguments,templateArgumentsList);
10123#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10124 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): mysymbol = %p = %s \n",mysymbol,(mysymbol != NULL) ? mysymbol->
class_name().c_str() :
"null");
10126 if (mysymbol != NULL)
10128 firstNondefdecl = isSgClassDeclaration(mysymbol->get_declaration());
10129 ROSE_ASSERT(firstNondefdecl != NULL);
10132 ROSE_ASSERT(firstNondefdecl->get_type() != NULL);
10135 ROSE_ASSERT(nondefdecl->get_type() == NULL);
10137 if (nondefdecl->get_type() == NULL)
10139#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10140 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);
10143#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10144 printf (
"NOTE: Call nondefdecl->set_type(firstNondefdecl->get_type()); instead of nondefdecl->set_type(SgClassType::createType(firstNondefdecl)); \n");
10149 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10151 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());
10154#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10155 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str());
10158 ROSE_ASSERT(nondefdecl->get_type() == firstNondefdecl->get_type());
10161#if (REUSE_CLASS_DECLARATION_FROM_SYMBOL == 0)
10162 ROSE_ASSERT(nondefdecl != NULL);
10163 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10169 printf (
"ERROR: In SgDeclarationStatement::set_firstNondefiningDeclaration(): nondefdecl = %p = %s IS NOT THE SAME AS firstNondefiningDeclaration = %p = %s \n",
10170 nondefdecl,nondefdecl->
class_name().c_str(),firstNondefdecl,firstNondefdecl->
class_name().c_str());
10172 nondefdecl->
get_file_info()->display(
"ERROR: In SgDeclarationStatement::set_firstNondefiningDeclaration(): nondefdecl: debug");
10174 firstNondefdecl->
get_file_info()->display(
"ERROR: In SgDeclarationStatement::set_firstNondefiningDeclaration(): firstNondefdecl: debug");
10186 ROSE_ASSERT(firstNondefdecl != NULL);
10187 ROSE_ASSERT(firstNondefdecl->get_type() != NULL);
10193 if (buildTemplateInstantiation ==
true)
10199 ROSE_ASSERT (nondefdecl->get_type() == firstNondefdecl->get_type());
10202 if (nondefdecl->get_type() != firstNondefdecl->get_type())
10205 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());
10206 printf (
"Skipping delete of %p so we can maintain unique type pointers \n",nondefdecl->get_type());
10208 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());
10209 nondefdecl->set_type(firstNondefdecl->get_type());
10212 printf (
"Unclear if this code is executed \n");
10219 ROSE_ASSERT(nondefdecl == NULL);
10226#if REUSE_CLASS_DECLARATION_FROM_SYMBOL
10235 ROSE_ASSERT(nondefdecl != NULL);
10236 if (nondefdecl->get_type() == NULL)
10239 printf (
"SageBuilder::buildNondefiningClassDeclaration_nfi(): nondefdecl = %p \n",nondefdecl);
10251 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
10254 firstNondefdecl = nondefdecl;
10257 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
10258 ROSE_ASSERT(mysymbol->get_declaration()->get_definition() == NULL);
10265 if (buildTemplateInstantiation ==
true)
10269#if DEBUG_NONDEFINING_CLASS_DECLARATION
10270 printf (
"BEFORE scope->insert_symbol(): scope = %p = %s nameWithTemplateArguments = %s mysymbol = %p = %s \n",
10271 scope,scope->
class_name().c_str(),nameWithTemplateArguments.str(),mysymbol,mysymbol->
class_name().c_str());
10278 ROSE_ASSERT(nondefdecl->get_type() == NULL);
10279 if (nondefdecl->get_type() == NULL)
10282 printf (
"In buildNondefiningClassDeclaration_nfi(): nondefdecl = %p = %s \n",nondefdecl,nondefdecl->
class_name().c_str());
10283 printf (
"In buildNondefiningClassDeclaration_nfi(): nondefdecl->get_firstNondefiningDeclaration() = %p \n",nondefdecl->
get_firstNondefiningDeclaration());
10287 printf (
"In SageBuilder::buildNondefiningClassDeclaration(): built class type: part 2: nondefdecl->get_type() = %p = %s = %s \n",
10288 nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str(),nondefdecl->get_type()->
unparseToString().c_str());
10292#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10293 printf (
"NOTE: In buildNondefiningClassDeclaration_nfi(): 2nd time this is a performance issue (maybe) to call the lookup_nontemplate_class_symbol() again \n");
10303 SgClassSymbol* temp_classSymbol = nondefdecl->
get_scope()->lookup_nontemplate_class_symbol(nameWithTemplateArguments,templateArgumentsList);
10304#if DEBUG_NONDEFINING_CLASS_DECLARATION
10306 printf (
"In buildNondefiningClassDeclaration_nfi(): temp_classSymbol = %p \n",temp_classSymbol);
10307 printf (
"In buildNondefiningClassDeclaration_nfi(): nondefdecl->get_scope() = %p = %s scope = %p \n",nondefdecl->
get_scope(),nondefdecl->
get_scope()->
class_name().c_str(),scope);
10309 printf (
"In buildNondefiningClassDeclaration_nfi(): nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
10310 if (templateArgumentsList != NULL)
10312 printf (
" --- templateArgumentsList elements: \n");
10313 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
10315 printf (
" --- --- templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
10316 printf (
" --- --- templateArgumentsList->[%zu] = %s \n",i,templateArgumentsList->operator[](i)->class_name().c_str());
10317 templateArgumentsList->operator[](i)->
display(
"In SageBuilder::buildNondefiningClassDeclaration_nfi()");
10322 ROSE_ASSERT(nondefdecl->
get_scope()->lookup_class_symbol(nameWithTemplateArguments,templateArgumentsList) != NULL);
10323 ROSE_ASSERT(nondefdecl->
get_scope() == scope);
10327 ROSE_ASSERT(temp_classSymbol == NULL || temp_classSymbol->get_declaration()->get_definition() == NULL);
10330 ROSE_ASSERT(mysymbol != NULL);
10331 ROSE_ASSERT(firstNondefdecl != NULL);
10344 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10346 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10348#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
10349 printf (
"NOTE: In buildNondefiningClassDeclaration_nfi(): 3rd time this is a performance issue (maybe) to call the lookup_nontemplate_class_symbol() again \n");
10359 SgClassSymbol* temp_classSymbol = nondefdecl->
get_scope()->lookup_nontemplate_class_symbol(nameWithTemplateArguments,templateArgumentsList);
10361 ROSE_ASSERT(temp_classSymbol == NULL || temp_classSymbol->get_declaration()->get_definition() == NULL);
10364 ROSE_ASSERT(nondefdecl != NULL);
10365 ROSE_ASSERT(nondefdecl->get_name() == nameWithTemplateArguments);
10368 if (isSgTemplateInstantiationDecl(nondefdecl) != NULL)
10372 ROSE_ASSERT(finalName == nameWithTemplateArguments);
10373 ROSE_ASSERT(finalName == nondefdecl->get_name());
10376#if DEBUG_NONDEFINING_CLASS_DECLARATION
10377 printf (
"Leaving buildNondefiningClassDeclaration_nfi(): nondefdecl = %p nondefdecl->unparseNameToString() = %s \n",nondefdecl,nondefdecl->unparseNameToString().c_str());
10378 printf (
" --- nondefdecl = %p = %s \n",nondefdecl,nondefdecl->
class_name().c_str());
10381#if DEBUG_NONDEFINING_CLASS_DECLARATION
10383 printf (
"Leaving buildNondefiningClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
10384 SgSymbol* test_symbol = nondefdecl->
get_scope()->find_symbol_from_declaration(nondefdecl);
10386 printf (
"test_symbol = %p \n",test_symbol);
10389 printf (
"Leaving buildNondefiningClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
10398 ROSE_ASSERT(stmt != NULL);
10410 ROSE_ASSERT(stmt != NULL);
10424 std::string directive_string(name);
10428 ROSE_ASSERT(scope);
10430 if (params.length() > 0)
10431 directive_string +=
" " + params;
10433 directive_string +=
" " + def_string;
10436 ROSE_ASSERT(define_decl);
10443 return define_decl;
10456 ASSERT_not_null(forStmt);
10462 forStmt->setCaseInsensitive(
true);
10481 ROSE_ASSERT(defdecl);
10484 classDef->set_declaration(defdecl);
10489 ROSE_ASSERT(nondefdecl);
10507 bool buildTemplateInstantiation =
false;
10527 SgDerivedTypeStatement* type_decl = buildClassDeclarationStatement_nfi <SgDerivedTypeStatement> (name, kind, scope);
10540 SgModuleStatement* module_stmt = buildClassDeclarationStatement_nfi <SgModuleStatement> (name, kind, scope);
10546 return module_stmt;
10554 SgJovialTableStatement* table_decl = buildClassDeclarationStatement_nfi <SgJovialTableStatement> (name, kind, scope);
10566 std::string type_name(name);
10569 type_name =
"_table_of_" + type_name;
10571 if (dim_info->get_expressions().size() > 0) {
10572 std::ostringstream address;
10573 address << (
void const *)dim_info;
10574 type_name +=
"_" + address.str();
10579 SgJovialTableStatement* table_decl = buildClassDeclarationStatement_nfi <SgJovialTableStatement> (type_name, kind, scope);
10587 ROSE_ASSERT(nondef_decl != NULL);
10591 ROSE_ASSERT(table_type != NULL);
10593 table_type->set_base_type(base_type);
10594 table_type->set_dim_info(dim_info);
10595 table_type->set_rank(dim_info->get_expressions().size());
10598 nondef_decl->set_type(table_type);
10604template <
class DeclClass> DeclClass *
10633 mysymbol = scope->lookup_class_symbol(name);
10635 if (mysymbol == NULL)
10638 if (nonDefiningDecl != NULL)
10642 ROSE_ASSERT(temp_mysymbol != NULL);
10644 mysymbol = isSgClassSymbol(temp_mysymbol);
10645 ROSE_ASSERT(mysymbol != NULL);
10648 ROSE_ASSERT(scope == nonDefiningDecl->
get_scope());
10653 if (mysymbol != NULL)
10655 nondefdecl = (mysymbol->get_declaration() == NULL)
10656 ? NULL : dynamic_cast<DeclClass*>(mysymbol->get_declaration());
10657 ROSE_ASSERT(nondefdecl != NULL);
10662 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
10667 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10668 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
10673 DeclClass* nondefining_classDeclaration = (nondefdecl == NULL) ? NULL : dynamic_cast<DeclClass*>(nondefdecl);
10674 ROSE_ASSERT(nondefining_classDeclaration != NULL);
10676 ? NULL : dynamic_cast<DeclClass*>(nondefdecl->get_definingDeclaration());
10677 ROSE_ASSERT(defining_classDeclaration != NULL);
10679 return defining_classDeclaration;
10684 ROSE_ASSERT(nondefdecl == NULL);
10687 nondefdecl =
new DeclClass(name, kind, NULL, NULL);
10688 ROSE_ASSERT(nondefdecl != NULL);
10700 ROSE_ASSERT(scope != NULL);
10707 ROSE_ASSERT(nondefdecl->
get_scope() != NULL);
10708 ROSE_ASSERT(nondefdecl->get_type() == NULL);
10710 if (nondefdecl->get_type() == NULL)
10726 ROSE_ASSERT(class_type != NULL);
10728 nondefdecl->set_type(class_type);
10730 SgClassDeclaration* tmp_classDeclarationFromType = isSgClassDeclaration(class_type->get_declaration());
10731 ROSE_ASSERT(tmp_classDeclarationFromType != NULL);
10735 ROSE_ASSERT(nondefdecl->get_type() != NULL);
10736 if (nondefdecl->get_type()->get_declaration() != nondefdecl)
10738 printf (
"ERROR: nondefdecl = %p = %s \n",nondefdecl,nondefdecl->
class_name().c_str());
10739 printf (
"ERROR: nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->
class_name().c_str());
10740 printf (
"ERROR: nondefdecl->get_type()->get_declaration() = %p = %s \n",nondefdecl->get_type()->get_declaration(),nondefdecl->get_type()->get_declaration()->
class_name().c_str());
10742 SgClassDeclaration* classDeclarationFromType = isSgClassDeclaration(nondefdecl->get_type()->get_declaration());
10743 ROSE_ASSERT(classDeclarationFromType != NULL);
10745 printf (
"nondefdecl->get_name() = %s \n",nondefdecl->get_name().str());
10746 printf (
"nondefdecl->get_type()->get_name() = %s \n",nondefdecl->get_type()->
get_name().str());
10747 printf (
"nondefdecl->get_type()->get_declaration()->get_name() = %s \n",classDeclarationFromType->get_name().str());
10749 printf (
"nondefdecl->get_mangled_name() = %s \n",nondefdecl->get_mangled_name().getString().c_str());
10750 printf (
"nondefdecl->get_type()->get_mangled() = %s \n",nondefdecl->get_type()->
get_mangled().getString().c_str());
10751 printf (
"nondefdecl->get_type()->get_declaration()->get_mangled_name() = %s \n",classDeclarationFromType->get_mangled_name().getString().c_str());
10754 printf (
"nondefdecl->get_type()->get_declaration()->get_firstNondefiningDeclaration() = %s \n",classDeclarationFromType->
get_firstNondefiningDeclaration() ?
"true" :
"false");
10764 ROSE_ASSERT(nondefdecl->get_type()->get_declaration() == nondefdecl);
10774#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
10776 if (SourcePositionClassificationMode != e_sourcePositionTransformation)
10778 detectTransformations(nondefdecl);
10789 ROSE_ASSERT(nondefdecl->
get_scope() == scope);
10802 DeclClass* defdecl =
new DeclClass(name,kind,NULL,classDef);
10803 ROSE_ASSERT(defdecl != NULL);
10804 ROSE_ASSERT(defdecl->get_type() == NULL);
10807 ROSE_ASSERT(defdecl->get_definition() != NULL);
10808 ROSE_ASSERT(defdecl != NULL);
10818 classDef->set_declaration(defdecl);
10819 defdecl->set_definingDeclaration(defdecl);
10821 defdecl->set_firstNondefiningDeclaration(nondefdecl);
10824 ROSE_ASSERT(defdecl->get_type() == NULL);
10831 if (defdecl->get_type() != NULL)
10838 ROSE_ASSERT (nondefdecl->get_type() != NULL);
10839 defdecl->set_type(nondefdecl->get_type());
10845 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10848 ROSE_ASSERT (nondefdecl->get_type() != NULL);
10851 ROSE_ASSERT (defdecl->get_type() != NULL);
10852 ROSE_ASSERT (defdecl->get_type()->get_declaration() != NULL);
10853 ROSE_ASSERT (defdecl->get_type()->get_declaration() != isSgDeclarationStatement(defdecl));
10858 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10868 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10874 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10879 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
10889 ROSE_ASSERT(defdecl->get_parent() == NULL);
10894 ROSE_ASSERT(defdecl->get_definingDeclaration() == defdecl);
10895 ROSE_ASSERT(defdecl->get_firstNondefiningDeclaration() != defdecl->get_definingDeclaration());
10898 SgClassDeclaration* temp_firstNondefiningDeclaration = isSgClassDeclaration(defdecl->get_firstNondefiningDeclaration());
10899 SgClassDeclaration* temp_definingDeclaration = isSgClassDeclaration(defdecl->get_definingDeclaration());
10900 ROSE_ASSERT(temp_firstNondefiningDeclaration != NULL);
10901 ROSE_ASSERT(temp_definingDeclaration != NULL);
10904 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_name() == temp_definingDeclaration->get_name());
10905 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_type() == temp_definingDeclaration->get_type());
10909 printf (
"Leaving buildClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
10910 SgSymbol* test_symbol = nondefdecl->
get_scope()->find_symbol_from_declaration(nondefdecl);
10913 printf (
"Leaving buildClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
10948 ROSE_ASSERT(scope != NULL);
10959 ROSE_ASSERT(defdecl != NULL);
10963 printf (
"#################### SageBuilder::buildNamespaceDeclaration_nfi(): defdecl = %p = %s namespaceDef = %p \n",defdecl,defdecl->
get_name().str(),namespaceDef);
10970 namespaceDef->set_namespaceDeclaration(defdecl);
10985 mysymbol = scope->lookup_namespace_symbol(name);
10991 printf (
"Warning: In SageBuilder::buildNamespaceDeclaration_nfi(): scope == NULL \n");
10995 printf (
"In SageBuilder::buildNamespaceDeclaration_nfi(): mysymbol = %p \n",mysymbol);
10998 if (mysymbol != NULL)
11002 ROSE_ASSERT(namespaceDeclaration != NULL);
11003 nondefdecl = isSgNamespaceDeclarationStatement(namespaceDeclaration);
11005 ROSE_ASSERT(nondefdecl != NULL);
11006 ROSE_ASSERT(nondefdecl->
get_parent() != NULL);
11016 if (namespaceDeclaration->
get_definition()->get_global_definition() == NULL)
11018 printf (
"ERROR: namespaceDeclaration->get_definition()->get_global_definition() == NULL: namespaceDeclaration = %p = %s namespaceDeclaration->get_definition() = %p \n",
11021 ROSE_ASSERT(namespaceDeclaration->
get_definition()->get_global_definition() != NULL);
11022 namespaceDef->set_global_definition(namespaceDeclaration->
get_definition()->get_global_definition());
11023 ROSE_ASSERT(namespaceDef->get_global_definition() != NULL);
11026 ROSE_ASSERT(namespaceDef->get_global_definition() == namespaceDef->get_global_definition()->get_global_definition());
11028 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
11030 ROSE_ASSERT(nondefdecl->
get_definition()->get_previousNamespaceDefinition() == NULL);
11034 ROSE_ASSERT(i != NULL);
11035 while (i != NULL && i->get_nextNamespaceDefinition() != NULL)
11037 i = i->get_nextNamespaceDefinition();
11038 ROSE_ASSERT(i->get_previousNamespaceDefinition() != NULL);
11041 ROSE_ASSERT(i != NULL);
11042 i->set_nextNamespaceDefinition(namespaceDef);
11043 namespaceDef->set_previousNamespaceDefinition(i);
11051 nondefdecl = defdecl;
11052 ROSE_ASSERT(nondefdecl != NULL);
11054 ROSE_ASSERT(namespaceDef->get_namespaceDeclaration() != NULL);
11065 ROSE_ASSERT(nondefdecl != NULL);
11067 printf (
"In SageBuilder::buildNamespaceDeclaration_nfi(): Built namespace definition for nondefdecl = %p = %s definition = %p \n",nondefdecl,nondefdecl->
get_name().str(),namespaceDef);
11070 ROSE_ASSERT(namespaceDef->get_namespaceDeclaration() == NULL);
11071 namespaceDef->set_namespaceDeclaration(nondefdecl);
11072 ROSE_ASSERT(namespaceDef->get_namespaceDeclaration() != NULL);
11077 namespaceDef->set_global_definition(global_definition_namespaceDef);
11078 ROSE_ASSERT(namespaceDef->get_global_definition() != NULL);
11081 global_definition_namespaceDef->set_global_definition(global_definition_namespaceDef);
11083 global_definition_namespaceDef->set_isUnionOfReentrantNamespaceDefinitions(
true);
11086 ROSE_ASSERT(global_definition_namespaceDef->
get_parent() == NULL);
11087 global_definition_namespaceDef->
set_parent(defdecl);
11088 ROSE_ASSERT(global_definition_namespaceDef->
get_parent() != NULL);
11091 ROSE_ASSERT(global_definition_namespaceDef->get_namespaceDeclaration() == NULL);
11092 global_definition_namespaceDef->set_namespaceDeclaration(nondefdecl);
11093 ROSE_ASSERT(global_definition_namespaceDef->get_namespaceDeclaration() != NULL);
11096 global_definition_namespaceDef->set_namespaceDeclaration(nondefdecl);
11097 ROSE_ASSERT(global_definition_namespaceDef->get_namespaceDeclaration() != NULL);
11100 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() == NULL);
11102 defdecl->
get_definition()->set_global_definition(global_definition_namespaceDef);
11105 printf (
"In SageBuilder::buildNamespaceDeclaration_nfi(): defdecl->get_definition()->get_global_definition() = %p \n",defdecl->
get_definition()->get_global_definition());
11109 defdecl->
get_definition()->set_global_definition(global_definition_namespaceDef);
11113 ROSE_ASSERT(global_definition_namespaceDef == global_definition_namespaceDef->get_global_definition());
11115 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
11116 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() == namespaceDef->get_global_definition());
11118 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());
11151 printf (
"Warning: no scope provided to support symbol table entry! \n");
11155 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
11157 ROSE_ASSERT(nondefdecl->
get_definition()->get_previousNamespaceDefinition() == NULL);
11158 ROSE_ASSERT(nondefdecl->
get_definition()->get_nextNamespaceDefinition() == NULL);
11161 ROSE_ASSERT(nondefdecl != NULL);
11183 ROSE_ASSERT(mysymbol);
11216 ROSE_ASSERT(defdecl->
get_definition()->get_global_definition() != NULL);
11222 defdecl->
get_file_info()->display(
"In buildNamespaceDeclaration_nfi(): namespaceDeclaration: debug");
11235 result->get_operands().push_back(lhs);
11246 result->get_operands().push_back(lhs);
11257 result->get_operands().push_back(lhs);
11268 result->get_operands().push_back(lhs);
11308 printf (
"In buildNondefiningClassDeclaration(): name = %s scope = %p = %s \n",name.str(),scope,scope != NULL ? scope->
class_name().c_str() :
"NULL");
11323 mysymbol = scope->lookup_class_symbol(name,NULL);
11334 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
11337 if (mysymbol != NULL)
11339 nondefdecl = isSgClassDeclaration(mysymbol->get_declaration());
11341 ROSE_ASSERT(nondefdecl != NULL);
11350 ROSE_ASSERT(nondefdecl->get_type() != NULL);
11361 ROSE_ASSERT(nondefdecl != NULL);
11362 if (nondefdecl->get_type() == NULL)
11366 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());
11390 ROSE_ASSERT(nondefdecl->
get_scope() == NULL);
11395 ROSE_ASSERT(nondefdecl->
get_scope() != NULL);
11399 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());
11412 ROSE_ASSERT(nondefdecl->get_type() != NULL);
11415 ROSE_ASSERT(scope == NULL || (scope != NULL && nondefdecl->
get_scope() != NULL));
11418 ROSE_ASSERT(nondefdecl != NULL);
11431 printf (
"WARNING: This function for building defining class declarations has different semantics from that of the function to build defining function declarations. \n");
11434 printf (
"In buildDefiningClassDeclaration(): name = %s scope = %p = %s \n",name.str(),scope,scope != NULL ? scope->
class_name().c_str() :
"NULL");
11445 ROSE_ASSERT(nondefiningClassDeclaration != NULL);
11448 ROSE_ASSERT(definingClassDefinition != NULL);
11451 SgClassType* classType = nondefiningClassDeclaration->get_type();
11452 ROSE_ASSERT(classType != NULL);
11459 ROSE_ASSERT(definingClassDeclaration != NULL);
11466 definingClassDefinition->set_declaration(definingClassDeclaration);
11476 ROSE_ASSERT(definingClassDeclaration->get_definition() != NULL);
11478 ROSE_ASSERT(definingClassDeclaration->
get_scope() == NULL);
11481 definingClassDeclaration->
set_scope(scope);
11482 ROSE_ASSERT(definingClassDeclaration->
get_scope() != NULL);
11483 ROSE_ASSERT(nondefiningClassDeclaration->
get_scope() != NULL);
11486 ROSE_ASSERT(definingClassDeclaration->get_definition()->
get_parent() != NULL);
11489 ROSE_ASSERT(definingClassDeclaration->get_type() != NULL);
11491 return definingClassDeclaration;
11498 ROSE_ASSERT(scope != NULL);
11500 ROSE_ASSERT(definingClassDeclaration != NULL);
11502 return definingClassDeclaration;
11519#define DEBUG_CLASS_DECLARATION 0
11523 printf (
"WARNING: In SageBuilder::buildClassDeclaration_nfi(): the nonDefiningDecl pointer = %p (input parameter) does not appear to be used. \n",nonDefiningDecl);
11529 if (nonDefiningDecl != NULL)
11531 ROSE_ASSERT(nonDefiningDecl->get_type() != NULL);
11532 ROSE_ASSERT(nonDefiningDecl->get_type()->get_declaration() != NULL);
11533 printf (
"nonDefiningDecl->get_type() = %p = %s \n",nonDefiningDecl->get_type(),nonDefiningDecl->get_type()->
class_name().c_str());
11534 printf (
"nonDefiningDecl->get_type()->get_declaration() = %p = %s \n",nonDefiningDecl->get_type()->get_declaration(),nonDefiningDecl->get_type()->get_declaration()->
class_name().c_str());
11536 printf (
"In buildClassDeclaration_nfi(): nonDefiningDecl: unparseNameToString() = %s \n",nonDefiningDecl->unparseNameToString().c_str());
11547 bool buildTemplateDeclaration = (isSgTemplateClassDeclaration(nonDefiningDecl) != NULL);
11550 if (buildTemplateDeclaration ==
true)
11553 printf (
"ERROR: If buildTemplateDeclaration == true, then we should have called a different function to build the associated SgTemplateClassDeclaration \n");
11555 ROSE_ASSERT(buildTemplateDeclaration ==
false);
11558 printf (
"In SageBuilder::buildClassDeclaration_nfi(): XXX_name = %s \n",XXX_name.str());
11559 printf (
"In SageBuilder::buildClassDeclaration_nfi(): the nonDefiningDecl pointer = %p = %s \n",nonDefiningDecl,nonDefiningDecl != NULL ? nonDefiningDecl->
class_name().c_str() :
"null");
11560 printf (
"In SageBuilder::buildClassDeclaration_nfi(): buildTemplateDeclaration = %s \n",buildTemplateDeclaration ?
"true" :
"false");
11561 printf (
" --- templateArgumentsList = %p \n",templateArgumentsList);
11562 if (templateArgumentsList != NULL)
11564 printf (
" --- templateArgumentsList.size() = %zu \n",templateArgumentsList->size());
11565 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
11567 printf (
" --- --- argument pointer: templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
11576 printf (
"In SageBuilder::buildClassDeclaration_nfi(): no scope was provided so using the SageBuilder::topScopeStack() = %p = %s \n",scope,scope->
class_name().c_str());
11582 printf (
"In SageBuilder::buildClassDeclaration_nfi(): scope was provided scope = %p = %s \n",scope,scope->
class_name().c_str());
11587 printf (
"Building a SgClassDeclaration: buildClassDeclaration_nfi() XXX_name = %s buildTemplateInstantiation = %s \n",XXX_name.str(),buildTemplateInstantiation ?
"true" :
"false");
11597 SgName nameWithoutTemplateArguments = XXX_name;
11598 SgName nameWithTemplateArguments = nameWithoutTemplateArguments;
11599 if (buildTemplateInstantiation ==
true)
11601 ROSE_ASSERT(templateArgumentsList != NULL);
11605#if DEBUG_CLASS_DECLARATION
11606 printf (
"In SageBuilder::buildClassDeclaration_nfi():\n");
11607 printf (
" -- nameWithoutTemplateArguments = %s\n", nameWithoutTemplateArguments.str());
11608 printf (
" -- nameWithTemplateArguments = %s\n", nameWithTemplateArguments.str());
11621#if DEBUG_CLASS_DECLARATION
11622 printf (
"Looking up the SgClassSymbol in scope = %p = %s nameWithTemplateArguments = %s \n",scope,scope->
class_name().c_str(),nameWithTemplateArguments.str());
11633 printf (
"This was a redundant call to lookup_class_symbol \n");
11638 if (buildTemplateDeclaration ==
true)
11640#if DEBUG_CLASS_DECLARATION
11641 printf (
"Note: In SageBuilder::buildClassDeclaration_nfi(): Need to look up a template symbol \n");
11643 ROSE_ASSERT(nonDefiningDecl != NULL);
11645 SgTemplateParameterPtrList templateParameterList;
11646 SgTemplateArgumentPtrList templateSpecializationArgumentList;
11648 ROSE_ASSERT(scope->lookup_template_class_symbol(nameWithTemplateArguments,&templateParameterList,&templateSpecializationArgumentList) != NULL);
11650 mysymbol = scope->lookup_template_class_symbol(nameWithTemplateArguments,&templateParameterList,&templateSpecializationArgumentList);
11652 ROSE_ASSERT(mysymbol != NULL);
11654 printf (
"ERROR: Need to look up a template symbol \n");
11660#if DEBUG_CLASS_DECLARATION
11661 printf (
"In SageBuilder::buildClassDeclaration_nfi(): calling lookup_class_symbol(nameWithTemplateArguments = %s,templateArgumentsList->size() = %zu \n",
11662 nameWithTemplateArguments.str(),(templateArgumentsList != NULL) ? templateArgumentsList->size() : 999);
11663 if (templateArgumentsList != NULL)
11665 printf (
" --- templateArgumentsList elements: \n");
11666 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
11668 printf (
" --- --- templateArgumentsList->[%zu] = %p \n",i,templateArgumentsList->operator[](i));
11669 printf (
" --- --- templateArgumentsList->[%zu] = %s \n",i,templateArgumentsList->operator[](i)->class_name().c_str());
11670 templateArgumentsList->operator[](i)->
display(
"In SageBuilder::buildClassDeclaration_nfi()");
11674 mysymbol = scope->lookup_class_symbol(nameWithTemplateArguments,templateArgumentsList);
11675#if DEBUG_CLASS_DECLARATION
11676 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
11679 if (mysymbol == NULL)
11681#if DEBUG_CLASS_DECLARATION
11682 printf (
"WARNING: scope->lookup_class_symbol(nameWithTemplateArguments = %s,templateArgumentsList->size() = %zu) == NULL \n",nameWithTemplateArguments.str(),templateArgumentsList->size());
11687#if DEBUG_CLASS_DECLARATION
11688 printf (
"Checking lookup_class_symbol() using nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
11690 ROSE_ASSERT(scope->lookup_class_symbol(nameWithoutTemplateArguments,templateArgumentsList) == NULL);
11692#if DEBUG_CLASS_DECLARATION
11693 printf (
"nonDefiningDecl = %p \n",nonDefiningDecl);
11695 if (nonDefiningDecl != NULL)
11697#if DEBUG_CLASS_DECLARATION
11698 printf (
"nonDefiningDecl = %p = %s \n",nonDefiningDecl,nonDefiningDecl->
class_name().c_str());
11702 ROSE_ASSERT(temp_mysymbol != NULL);
11704 mysymbol = isSgClassSymbol(temp_mysymbol);
11705 ROSE_ASSERT(mysymbol != NULL);
11708 ROSE_ASSERT(scope == nonDefiningDecl->
get_scope());
11716 if (mysymbol != NULL)
11718 SgClassDeclaration* symbol_declaration = isSgClassDeclaration(mysymbol->get_declaration());
11719 ROSE_ASSERT(symbol_declaration != NULL);
11720 ROSE_ASSERT(symbol_declaration->
get_scope() == scope);
11722 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Testing scope->get_symbol_table()->exists(mysymbol) == true (expensive) \n");
11736#if DEBUG_CLASS_DECLARATION
11737 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
11740 if (mysymbol != NULL)
11742 nondefdecl = isSgClassDeclaration(mysymbol->get_declaration());
11744 ROSE_ASSERT(nondefdecl != NULL);
11746#if DEBUG_CLASS_DECLARATION
11747 printf (
"In SageBuilder::buildClassDeclaration_nfi(): mysymbol->get_declaration(): nondefdecl = %p = %s nondefdecl->get_definition() = %p = %s \n",
11748 nondefdecl,nondefdecl->class_name().c_str(),nondefdecl->get_definition(),
11749 nondefdecl->get_definition() != NULL ? nondefdecl->get_definition()->class_name().c_str() :
"NULL");
11754 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
11757 ROSE_ASSERT(nondefdecl == nondefdecl->get_firstNondefiningDeclaration());
11762#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11764 detectTransformations(nondefdecl);
11768 ROSE_ASSERT(nondefdecl->get_type() != NULL);
11771 if (nondefdecl->get_parent() == NULL)
11773#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11774 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Note that nondefdecl->get_parent() == NULL, this might be OK. \n");
11783 if (nondefdecl->get_definingDeclaration() != NULL)
11785#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11786 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",
11787 nondefdecl,nondefdecl->class_name().c_str(),nondefdecl->get_definingDeclaration(),nondefdecl->get_definingDeclaration()->class_name().c_str());
11789 SgClassDeclaration* nondefining_classDeclaration = isSgClassDeclaration(nondefdecl);
11790 ROSE_ASSERT(nondefining_classDeclaration != NULL);
11791 SgClassDeclaration* defining_classDeclaration = isSgClassDeclaration(nondefdecl->get_definingDeclaration());
11792 ROSE_ASSERT(defining_classDeclaration != NULL);
11794#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11795 printf (
"In SageBuilder::buildClassDeclaration_nfi(): nondefining_classDeclaration: scope = %p = %s name = %s \n",
11796 nondefining_classDeclaration->
get_scope(),nondefining_classDeclaration->
get_scope()->
class_name().c_str(),nondefining_classDeclaration->get_name().str());
11797 printf (
"In SageBuilder::buildClassDeclaration_nfi(): defining_classDeclaration: scope = %p = %s name = %s \n",
11798 defining_classDeclaration->
get_scope(),defining_classDeclaration->
get_scope()->
class_name().c_str(),defining_classDeclaration->get_name().str());
11799 defining_classDeclaration->
get_file_info()->display(
"already has a defining declaration");
11802 printf (
"Error: In SageBuilder::buildClassDeclaration_nfi(): exiting as part of test \n");
11806#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11807 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);
11812 printf (
"Exiting as a test! \n");
11815 return defining_classDeclaration;
11822 ROSE_ASSERT(nondefdecl->get_definingDeclaration() == defdecl);
11823 ROSE_ASSERT(nondefdecl->get_firstNondefiningDeclaration() != defdecl);
11828#if DEBUG_CLASS_DECLARATION
11829 printf (
"In SageBuilder::buildClassDeclaration_nfi(): building a nondefining declaration since it does not exist \n");
11832 ROSE_ASSERT(nondefdecl == NULL);
11836 if (buildTemplateInstantiation ==
true)
11839#if DEBUG_CLASS_DECLARATION
11840 printf (
"************************************************************************* \n");
11841 printf (
"Building SgTemplateInstantiationDecl with empty SgTemplateArgumentPtrList \n");
11842 printf (
" --- using nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
11843 printf (
"************************************************************************* \n");
11845 SgTemplateArgumentPtrList emptyList;
11848 ROSE_ASSERT(nondefdecl != NULL);
11849#if DEBUG_CLASS_DECLARATION
11850 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Build SgTemplateInstantiationDecl: nondefdecl = %p \n",nondefdecl);
11854 ROSE_ASSERT(nondefdecl->get_type() == NULL);
11855 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl) != NULL);
11857 printf (
"In buildClassDeclaration_nfi(): nondefdecl->get_name() = %s nondefdecl->get_templateName() = %s \n",nondefdecl->get_name().str(),isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().str());
11859#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11868 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().is_null() ==
true);
11871 ROSE_ASSERT(templateArgumentsList != NULL);
11881 if (templateArgumentsList->size() == 0)
11883 printf (
"Warning: In SageBuilder::buildClassDeclaration_nfi(): templateArgumentsList->size() == 0 \n");
11887 nondefdecl->set_firstNondefiningDeclaration(nondefdecl);
11904#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11905 printf (
"Warning: In buildClassDeclaration_nfi(): calling set_templateName(nameWithTemplateArguments = %s) for nondefining declaration \n",nameWithTemplateArguments.str());
11910 isSgTemplateInstantiationDecl(nondefdecl)->
set_templateName(nameWithoutTemplateArguments);
11917 ROSE_ASSERT(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName().is_null() ==
false);
11923 if (
hasTemplateSyntax(isSgTemplateInstantiationDecl(nondefdecl)->get_templateName()) ==
false)
11925#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
11926 printf (
"WARNING: No template syntax present in name of template class instantiation (nondefdecl) \n");
11931#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11936 ROSE_ASSERT(nondefdecl->get_file_info() == NULL);
11941#if DEBUG_CLASS_DECLARATION
11942 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);
11943 printf (
" --- nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
11948 ROSE_ASSERT(nondefdecl != NULL);
11949#if DEBUG_CLASS_DECLARATION
11950 printf (
"In buildClassDeclaration_nfi(): (no file info set): nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
11955 ROSE_ASSERT(nameWithoutTemplateArguments == nameWithTemplateArguments);
11957#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
11963 nondefdecl->set_firstNondefiningDeclaration(nondefdecl);
11968 ROSE_ASSERT(nondefdecl->get_file_info() == NULL);
11971 ROSE_ASSERT(nondefdecl != NULL);
11975 ROSE_ASSERT(nondefdecl == nondefdecl->get_firstNondefiningDeclaration());
11984 ROSE_ASSERT(scope != NULL);
11986#if DEBUG_CLASS_DECLARATION
11987 printf (
"In SageBuilder::buildClassDeclaration_nfi(): Set the scope of the new non-defining declaration to %p = %s \n",scope,scope->
class_name().c_str());
11989 nondefdecl->set_scope(scope);
11990 ROSE_ASSERT(nondefdecl->get_scope() != NULL);
11999 printf (
"In buildClassDeclaration_nfi(): setting the parent of the non defining declaration to be the scope by default) \n");
12006 ROSE_ASSERT(nondefdecl->get_type() == NULL);
12008 if (nondefdecl->get_type() == NULL)
12010#if DEBUG_CLASS_DECLARATION
12012 printf (
"Calling scope->get_type_table()->lookup_type(): nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
12014 printf (
"WE NEED THE MANGLED NAME FOR THIS TO BE RELEVANT! \n");
12020#if DEBUG_CLASS_DECLARATION
12021 printf (
"In SageBuilder::buildClassDeclaration_nfi(): kind == SgClassDeclaration::e_java_parameter = %s \n",(kind ==
SgClassDeclaration::e_java_parameter) ?
"true" :
"false");
12026#if DEBUG_CLASS_DECLARATION
12027 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());
12029 nondefdecl->set_type(class_type);
12030#if DEBUG_CLASS_DECLARATION
12031 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());
12033 SgClassDeclaration* tmp_classDeclarationFromType = isSgClassDeclaration(class_type->get_declaration());
12034 ROSE_ASSERT(tmp_classDeclarationFromType != NULL);
12035#if DEBUG_CLASS_DECLARATION
12037 printf (
"tmp_classDeclarationFromType: scope = %p = %s \n",scope,scope->
class_name().c_str());
12038 printf (
"tmp_classDeclarationFromType = %p = %s \n",tmp_classDeclarationFromType,tmp_classDeclarationFromType->
class_name().c_str());
12039 printf (
"tmp_classDeclarationFromType name = %s \n",tmp_classDeclarationFromType->get_name().str());
12042 tmp_classDeclarationFromType->
get_file_info()->display(
"tmp_classDeclarationFromType: debug");
12048 ROSE_ASSERT(nondefdecl->get_type() != NULL);
12049 if (nondefdecl->get_type()->get_declaration() != nondefdecl)
12051 printf (
"ERROR: nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
12052 printf (
"ERROR: nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
12053 printf (
"ERROR: nondefdecl->get_type()->get_declaration() = %p = %s \n",nondefdecl->get_type()->get_declaration(),nondefdecl->get_type()->get_declaration()->class_name().c_str());
12055 SgClassDeclaration* classDeclarationFromType = isSgClassDeclaration(nondefdecl->get_type()->get_declaration());
12056 ROSE_ASSERT(classDeclarationFromType != NULL);
12058 printf (
"nondefdecl->get_name() = %s \n",nondefdecl->get_name().str());
12059 printf (
"nondefdecl->get_type()->get_name() = %s \n",nondefdecl->get_type()->get_name().str());
12060 printf (
"nondefdecl->get_type()->get_declaration()->get_name() = %s \n",classDeclarationFromType->get_name().str());
12062 printf (
"nondefdecl->get_mangled_name() = %s \n",nondefdecl->get_mangled_name().getString().c_str());
12063 printf (
"nondefdecl->get_type()->get_mangled() = %s \n",nondefdecl->get_type()->get_mangled().getString().c_str());
12064 printf (
"nondefdecl->get_type()->get_declaration()->get_mangled_name() = %s \n",classDeclarationFromType->get_mangled_name().getString().c_str());
12067 printf (
"nondefdecl->get_type()->get_declaration()->get_firstNondefiningDeclaration() = %s \n",classDeclarationFromType->
get_firstNondefiningDeclaration() ?
"true" :
"false");
12068 printf (
"nondefdecl->get_firstNondefiningDeclaration() = %s \n",nondefdecl->get_firstNondefiningDeclaration() ?
"true" :
"false");
12074 if (parent != NULL)
12076 printf (
"nondefdecl->get_parent() = %p = %s \n",parent,parent->
class_name().c_str());
12081#if DEBUG_CLASS_DECLARATION
12082 nondefdecl->get_type()->get_declaration()->get_file_info()->display(
"nondefdecl->get_type()->get_declaration()");
12089 if (nondefdecl->get_file_info() == NULL)
12091 printf (
"ERROR: In SageBuilder::buildClassDeclaration_nfi(): nondefdecl = %p = %s does not have its source position information setup \n",nondefdecl,nondefdecl->class_name().c_str());
12092 printf (
" --- nondefdecl = %s \n",nondefdecl->get_name().str());
12093 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p \n",nondefdecl->get_firstNondefiningDeclaration());
12094 printf (
" --- nondefdecl->get_definingDeclaration() = %p \n",nondefdecl->get_definingDeclaration());
12095 printf (
" --- nondefdecl->get_type() = %p \n",nondefdecl->get_type());
12096 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
12097 printf (
"The real error is: (nondefdecl->get_type()->get_declaration() != nondefdecl) \n");
12101 ROSE_ASSERT(nondefdecl->get_file_info() != NULL);
12102 nondefdecl->get_file_info()->display(
"nondefdecl");
12106 ROSE_ASSERT(nondefdecl->get_type()->get_declaration() == nondefdecl);
12109 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());
12120 ROSE_ASSERT (nondefdecl->get_startOfConstruct() != NULL);
12122#if BUILDER_MAKE_REDUNDANT_CALLS_TO_DETECT_TRANSFORAMTIONS
12126 detectTransformations(nondefdecl);
12134 nondefdecl->setForward();
12140 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");
12149 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());
12155 ROSE_ASSERT(nondefdecl->get_scope() == scope);
12162 printf (
"Warning: no scope provided to support symbol table entry! \n");
12175 if (buildTemplateInstantiation ==
true)
12178 for (
size_t i = 0; i < templateArgumentsList->size(); i++)
12182 ROSE_ASSERT((*templateArgumentsList)[i]->get_parent() != NULL);
12192 (*templateArgumentsList)[i]->set_parent(nondefdecl);
12207 printf (
"Building a SgClassDeclaration: buildClassDeclaration_nfi() buildTemplateInstantiation = %s \n",buildTemplateInstantiation ?
"true:" :
"false");
12212 if (buildTemplateInstantiation ==
true)
12215 SgTemplateArgumentPtrList emptyList;
12221 ROSE_ASSERT(defdecl->get_type() == NULL);
12222 ROSE_ASSERT(isSgTemplateInstantiationDecl(defdecl) != NULL);
12224 printf (
"In buildClassDeclaration_nfi(): defdecl->get_name() = %s defdecl->get_templateName() = %s \n",defdecl->get_name().str(),isSgTemplateInstantiationDecl(defdecl)->get_templateName().str());
12228 ROSE_ASSERT(isSgTemplateInstantiationDecl(defdecl)->get_templateName().is_null() ==
true);
12231 printf (
"Warning: In buildClassDeclaration_nfi(): calling set_templateName(name = %s) for defining declaration \n",name.str());
12240 ROSE_ASSERT(name.getString().find(
'<') == string::npos);
12243 SgName templateName = generateTemplateNameFromTemplateNameWithTemplateArguments(name);
12244 printf (
"In buildClassDeclaration_nfi(): templateName = %s \n",templateName.str());
12259 printf (
"In buildClassDeclaration_nfi(): nameWithoutTemplateArguments = %s nameWithTemplateArguments = %s \n",nameWithoutTemplateArguments.str(),nameWithTemplateArguments.str());
12261 isSgTemplateInstantiationDecl(defdecl)->
set_templateName(nameWithoutTemplateArguments);
12263#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12267 printf (
"WARNING: In buildClassDeclaration_nfi(): nameWithTemplateArguments = %s is not using template syntax \n",nameWithTemplateArguments.str());
12276 ROSE_ASSERT(isSgTemplateInstantiationDecl(defdecl)->get_templateName().is_null() ==
false);
12279 if (isSgTemplateInstantiationDecl(defdecl)->get_templateName().getString().find(
'>') == string::npos)
12281#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12282 printf (
"WARNING: No template syntax present in name of template class instantiation (defdecl) \n");
12287 printf (
"Should we have set the template instantiation name at this point? \n");
12291 ROSE_ASSERT(defdecl->get_definition() != NULL);
12292 ROSE_ASSERT(isSgTemplateInstantiationDefn(defdecl->get_definition()) != NULL);
12297 printf (
"Building a SgClassDeclaration, but we might require a SgTemplateClassDeclaration \n");
12304 if (buildTemplateDeclaration ==
true)
12306 printf (
"In buildClassDeclaration_nfi(): I think we also want template specialization arguments to be more general: using nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
12312 ROSE_ASSERT(defdecl->get_type() == NULL);
12314 printf (
"Exiting afte test! \n");
12324 printf (
"In SageBuilder::buildClassDeclaration_nfi(): build a SgClassDeclaration: defdecl = %p \n",defdecl);
12328 ROSE_ASSERT(defdecl->get_type() == NULL);
12332 ROSE_ASSERT(defdecl->get_definition() != NULL);
12333 ROSE_ASSERT(isSgTemplateInstantiationDefn(defdecl->get_definition()) == NULL);
12335 ROSE_ASSERT(defdecl != NULL);
12338 printf (
"In buildClassDeclaration_nfi(): nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
12342 nondefdecl->set_definingDeclaration(defdecl);
12344 ROSE_ASSERT(nondefdecl->get_definingDeclaration() == defdecl);
12345 ROSE_ASSERT(nondefdecl->get_firstNondefiningDeclaration() != defdecl);
12351 classDef->set_declaration(defdecl);
12352 defdecl->set_definingDeclaration(defdecl);
12366 defdecl->set_firstNondefiningDeclaration(nondefdecl);
12368 if (buildTemplateInstantiation ==
true)
12375 ROSE_ASSERT(defdecl->get_type() == NULL);
12382 if (defdecl->get_type() != NULL)
12386 if (defdecl->get_type()->get_declaration() == isSgDeclarationStatement(defdecl))
12389 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12392 if (nondefdecl->get_type() != defdecl->get_type())
12395 printf (
"Deleting defdecl->get_type() = %p = %s (using type from nondefdecl = %p) \n",defdecl->get_type(),defdecl->get_type()->class_name().c_str(),nondefdecl);
12396 printf (
"Skipping delete of %p to maintain unique type pointers \n",defdecl->get_type());
12398 delete defdecl->get_type();
12401 defdecl->set_type(NULL);
12403 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());
12407 printf (
"Is this executed! \n");
12411 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12412 defdecl->set_type(nondefdecl->get_type());
12414 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());
12418 ROSE_ASSERT(classType != NULL);
12419 SgClassDeclaration* local_classDeclaration = isSgClassDeclaration(classType->get_declaration());
12420 ROSE_ASSERT (local_classDeclaration != NULL);
12421 printf (
"In buildClassDeclaration_nfi(): classType = %p local_classDeclaration = %p \n",classType,local_classDeclaration);
12430 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12431 defdecl->set_type(nondefdecl->get_type());
12433 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());
12436 ROSE_ASSERT (nondefdecl->get_firstNondefiningDeclaration() != NULL);
12440 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()))
12442 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");
12443 printf (
" --- nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
12444 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
12445 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl->get_firstNondefiningDeclaration(),nondefdecl->get_firstNondefiningDeclaration()->class_name().c_str());
12451 ROSE_ASSERT (nondefdecl->get_type()->get_declaration() == isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()));
12456 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12459 ROSE_ASSERT (nondefdecl->get_type() != NULL);
12462 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl))
12464 printf (
"nondefdecl = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
12465 printf (
"nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
12466 printf (
"nondefdecl->get_type()->get_declaration() = %p = %s \n",nondefdecl->get_type()->get_declaration(),nondefdecl->get_type()->get_declaration()->class_name().c_str());
12467 printf (
"nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl->get_firstNondefiningDeclaration(),nondefdecl->get_firstNondefiningDeclaration()->class_name().c_str());
12471 ROSE_ASSERT (defdecl->get_type() != NULL);
12472 ROSE_ASSERT (defdecl->get_type()->get_declaration() != NULL);
12473 ROSE_ASSERT (defdecl->get_type()->get_declaration() != isSgDeclarationStatement(defdecl));
12474 ROSE_ASSERT (nondefdecl->get_firstNondefiningDeclaration() != NULL);
12475 ROSE_ASSERT (nondefdecl->get_firstNondefiningDeclaration() == nondefdecl);
12477 ROSE_ASSERT (nondefdecl->get_type()->get_declaration() == isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()));
12483 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl->get_firstNondefiningDeclaration()))
12485 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");
12486 printf (
" --- nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
12487 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
12488 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl->get_firstNondefiningDeclaration(),nondefdecl->get_firstNondefiningDeclaration()->class_name().c_str());
12491 if (nondefdecl->get_type()->get_declaration() != isSgDeclarationStatement(nondefdecl))
12493 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");
12494 printf (
" --- nondefdecl->get_type() = %p = %s \n",nondefdecl->get_type(),nondefdecl->get_type()->class_name().c_str());
12495 printf (
" --- nondefdecl->get_type()->get_declaration() = %p \n",nondefdecl->get_type()->get_declaration());
12496 printf (
" --- nondefdecl->get_firstNondefiningDeclaration() = %p = %s \n",nondefdecl,nondefdecl->class_name().c_str());
12504 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12507 defdecl->set_type(nondefdecl->get_type());
12510 printf (
"In buildClassDeclaration_nfi(): after calling set_type() again: defdecl = %p = %s defdecl->get_type() = %p = %s \n",
12511 defdecl,defdecl->class_name().c_str(),defdecl->get_type(),defdecl->get_type()->class_name().c_str());
12515 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12520 nondefdecl->setForward();
12525 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12531 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12536 ROSE_ASSERT (defdecl->get_type() == nondefdecl->get_type());
12540 ROSE_ASSERT(mysymbol);
12542 printf (
"@@@@@@@@@@@@@@ In buildClassDeclaration_nfi(): setting scope of defining and non-defining declaration to scope = %s \n",scope->
class_name().c_str());
12543 defdecl->set_scope(scope);
12544 nondefdecl->set_scope(scope);
12550 nondefdecl->set_parent(scope);
12553 defdecl->set_parent(scope);
12565 ROSE_ASSERT(defdecl->get_parent() == NULL);
12570 ROSE_ASSERT(defdecl->get_definingDeclaration() == defdecl);
12571 ROSE_ASSERT(defdecl->get_firstNondefiningDeclaration() != defdecl->get_definingDeclaration());
12577 SgClassDeclaration* temp_firstNondefiningDeclaration = isSgClassDeclaration(defdecl->get_firstNondefiningDeclaration());
12578 SgClassDeclaration* temp_definingDeclaration = isSgClassDeclaration(defdecl->get_definingDeclaration());
12579 ROSE_ASSERT(temp_firstNondefiningDeclaration != NULL);
12580 ROSE_ASSERT(temp_definingDeclaration != NULL);
12583 printf (
"Leaving buildClassDeclaration_nfi(): defdecl = %p = %s = %s \n",defdecl,defdecl->class_name().c_str(),defdecl->get_name().str());
12584 printf (
" --- defdecl->get_firstNondefiningDeclaration() = %p \n",defdecl->get_firstNondefiningDeclaration());
12585 printf (
" --- defdecl->get_definingDeclaration() = %p \n",defdecl->get_definingDeclaration());
12587 printf (
" --- defdecl->get_firstNondefiningDeclaration()->get_name() = %s \n",temp_firstNondefiningDeclaration->get_name().str());
12588 printf (
" --- defdecl->get_definingDeclaration()->get_name() = %s \n",temp_definingDeclaration->get_name().str());
12590 printf (
" --- defdecl->get_firstNondefiningDeclaration()->get_type() = %p = %s \n",
12591 temp_firstNondefiningDeclaration->get_type(),temp_firstNondefiningDeclaration->get_type()->
unparseToString().c_str());
12592 printf (
" --- defdecl->get_definingDeclaration()->get_type() = %p = %s \n",
12593 temp_definingDeclaration->get_type(),temp_definingDeclaration->get_type()->
unparseToString().c_str());
12595 printf (
" --- nameWithoutTemplateArguments = %s \n",nameWithoutTemplateArguments.str());
12596 printf (
" --- nameWithTemplateArguments = %s \n",nameWithTemplateArguments.str());
12599 printf (
"Leaving buildClassDeclaration_nfi(): defdecl: unparseNameToString() = %s \n",defdecl->unparseNameToString().c_str());
12604 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_name() == temp_definingDeclaration->get_name());
12605 ROSE_ASSERT(temp_firstNondefiningDeclaration->get_type() == temp_definingDeclaration->get_type());
12610 if (definingDeclaration != NULL && nondefiningDeclaration != NULL)
12616 printf (
"NOTE: buildClassDeclaration_nfi(): Setting the templateDeclaration for the defining declaration = %p using the value = %p from the nondefiningDeclaration = %p \n",
12617 definingDeclaration,templateDeclaration,nondefiningDeclaration);
12627 if (definingDeclaration != NULL)
12632 printf (
"NOTE: buildClassDeclaration_nfi(): definingDeclaration->get_templateDeclaration() == NULL \n");
12639 printf (
"Leaving buildClassDeclaration_nfi(): defdecl = %p defdecl->unparseNameToString() = %s \n",defdecl,defdecl->unparseNameToString().c_str());
12644 printf (
"Leaving buildClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
12645 SgSymbol* test_symbol = nondefdecl->get_scope()->find_symbol_from_declaration(nondefdecl);
12648 printf (
"Leaving buildClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
12649 ROSE_ASSERT(nondefdecl->get_symbol_from_symbol_table() != NULL);
12674 ROSE_ASSERT(scope != NULL);
12676 ROSE_ASSERT(definingClassDeclaration != NULL);
12678 return definingClassDeclaration;
12697 ROSE_ASSERT(result);
12702 result->setCaseInsensitive(
true);
12721 printf(
"In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(XXX_name = %p):\n", XXX_name.str());
12728 ROSE_ASSERT(scope != NULL);
12731 printf (
"SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): XXX_name = %s scope = %p = %s \n",XXX_name.str(),scope,scope->
class_name().c_str());
12735 SgName nameWithoutTemplateArguments = XXX_name;
12739 printf (
"SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): nameWithTemplateSpecializationArguments = %s \n",nameWithTemplateSpecializationArguments.str());
12767 mysymbol = scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList);
12774 printf (
"Warning: In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): scope == NULL \n");
12777 printf (
"In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
12780 if (mysymbol != NULL)
12786 ROSE_ASSERT(classType != NULL);
12796 if (nondefdecl->get_type() != NULL)
12798 printf (
"Note: SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(): nondefdecl->get_type() != NULL: name = %s \n",nondefdecl->get_name().str());
12803 ROSE_ASSERT(nondefdecl != NULL);
12806 ROSE_ASSERT(templateParameterList != NULL);
12807 nondefdecl->get_templateParameters() = *templateParameterList;
12818 nondefdecl->set_nonreal_decl_scope(nonreal_decl_scope);
12824 printf(
"In SageBuilder::buildNondefiningTemplateClassDeclaration_nfi(XXX_name = %p): nrscope = %p (new)\n", XXX_name.str(), nonreal_decl_scope);
12834 ROSE_ASSERT(templateSpecializationArgumentList != NULL);
12835 nondefdecl->get_templateSpecializationArguments() = *templateSpecializationArgumentList;
12838 if (nondefdecl->get_templateParameters().size() == 0)
12840#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12841 printf (
"WARNING: In buildNondefiningTemplateClassDeclaration_nfi(): (part 1) nondefdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations nondefdecl = %p \n",nondefdecl);
12861 nondefdecl->set_templateName(nameWithoutTemplateArguments);
12868 ROSE_ASSERT(nondefdecl != NULL);
12871 ROSE_ASSERT(templateParameterList != NULL);
12872 nondefdecl->get_templateParameters() = *templateParameterList;
12882 if (nondefdecl->get_templateParameters().size() == 0)
12884#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
12885 printf (
"WARNING: In buildNondefiningTemplateClassDeclaration_nfi(): (part 2) nondefdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations nondefdecl = %p \n",nondefdecl);
12891 nondefdecl->set_templateName(nameWithoutTemplateArguments);
12895 if (nondefdecl->get_type() == NULL)
12902 ROSE_ASSERT(nondefdecl->get_type() != NULL);
12921 printf (
"In buildNondefiningTemplateClassDeclaration_nfi(): Commented out setting the parent to the scope. \n");
12931 if (nondefdecl->get_type() == NULL)
12938 ROSE_ASSERT(nondefdecl->get_type() != NULL);
12940 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());
12949 printf (
"Building a SgTemplateSymbol using nameWithTemplateSpecializationArguments = %s and nondefdecl = %p = %s \n",nameWithTemplateSpecializationArguments.str(),nondefdecl,nondefdecl->
class_name().c_str());
12955 ROSE_ASSERT(mysymbol != NULL);
12961 ROSE_ASSERT(scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList) == NULL);
12965 scope->
insert_symbol(nameWithTemplateSpecializationArguments, mysymbol);
12967 printf (
"SageBuilder::buildNondefiningTemplateClassDeclaration_nfi() (after building symbol): scope = %p = %s \n",scope,scope->
class_name().c_str());
12969 ROSE_ASSERT(nondefdecl->
get_scope() != NULL);
12976 ROSE_ASSERT(scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList) != NULL);
12995 ROSE_ASSERT(templateClassDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateClassDeclaration->get_templateParameters().size()));
13012 if (defdecl->get_type() != NULL)
13016 if (defdecl->get_type()->get_declaration() == isSgDeclarationStatement(defdecl) )
13018 delete defdecl->get_type();
13023 ROSE_ASSERT (nondefdecl->get_type() != NULL);
13024 ROSE_ASSERT (nondefdecl->get_type()->get_declaration() == isSgDeclarationStatement(nondefdecl));
13025 defdecl->set_type(nondefdecl->get_type());
13028 ROSE_ASSERT(nondefdecl->get_type() != NULL);
13046 ROSE_ASSERT(defdecl->get_definingDeclaration() == defdecl);
13047 ROSE_ASSERT(defdecl->get_firstNondefiningDeclaration() != defdecl->get_definingDeclaration());
13049 ROSE_ASSERT(defdecl->get_scope() != NULL);
13053 ROSE_ASSERT(nondefdecl->
get_parent() == NULL);
13056 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
13062 printf (
"Leaving buildNondefiningTemplateClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
13064 SgSymbol* test_symbol = nondefdecl->
get_scope()->find_symbol_from_declaration(tmp_classDeclaration);
13067 printf (
"Leaving buildNondefiningTemplateClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
13076 SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateSpecializationArgumentList )
13085 SgTemplateParameterPtrList* templateParameterList, SgTemplateArgumentPtrList* templateSpecializationArgumentList )
13094 printf (
"In buildTemplateClassDeclaration_nfi(): nonDefiningDecl = %p \n",nonDefiningDecl);
13095 if (nonDefiningDecl != NULL)
13098 printf (
"--- nonDefiningDecl->get_definingDeclaration() = %p \n",nonDefiningDecl->
get_definingDeclaration());
13103 ROSE_ASSERT(scope != NULL);
13106 SgName nameWithoutTemplateArguments = XXX_name;
13115 if (nonDefiningDecl != NULL)
13120 SgName templateString =
"template string";
13122 SgTemplateParameterPtrList templateParameters;
13139 printf (
"In buildTemplateClassDeclaration_nfi(): calling new SgTemplateClassDeclaration() name = %s \n",nameWithTemplateSpecializationArguments.str());
13154 if (nonDefiningDecl != NULL)
13162 ROSE_ASSERT(defdecl != NULL);
13164 printf (
"In buildTemplateClassDeclaration_nfi(): Reusing the defining declaration previously build: defdecl = %p = %s \n",defdecl,defdecl->get_name().str());
13170 printf (
"In buildTemplateClassDeclaration_nfi(): No defining declaration found, so we have to build one. \n");
13175 if (defdecl == NULL)
13178 printf (
"Building a defining declaration \n");
13183 ROSE_ASSERT(defdecl != NULL);
13186 printf (
"In buildTemplateClassDeclaration_nfi(): defdecl = %p = %s \n",defdecl,defdecl->
class_name().c_str());
13190 ROSE_ASSERT(templateParameterList != NULL);
13191 defdecl->get_templateParameters() = *templateParameterList;
13194 ROSE_ASSERT(templateSpecializationArgumentList != NULL);
13195 defdecl->get_templateSpecializationArguments() = *templateSpecializationArgumentList;
13201 if (defdecl->get_templateParameters().size() == 0)
13203#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
13204 printf (
"WARNING: In buildTemplateClassDeclaration_nfi(): defdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations defdecl = %p \n",defdecl);
13210 defdecl->set_templateName(nameWithoutTemplateArguments);
13213 printf (
"SageBuilder::buildTemplateClassDeclaration_nfi(): scope = %p = %s \n",scope,scope->
class_name().c_str());
13222 ROSE_ASSERT(classDef != NULL);
13229 classDef->set_declaration(defdecl);
13238 if (nondefdecl == NULL) {
13239 ROSE_ASSERT(scope != NULL);
13241 SgClassSymbol* mysymbol = scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList);
13243 printf (
"In buildTemplateClassDeclaration_nfi(): mysymbol = %p \n",mysymbol);
13246 if (mysymbol != NULL) {
13247 nondefdecl = isSgTemplateClassDeclaration(mysymbol->get_declaration());
13248 ROSE_ASSERT(nondefdecl != NULL);
13255 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
13262 printf(
" start build non-defn decl for %p\n",defdecl);
13266 ROSE_ASSERT(nondefdecl != NULL);
13271 printf(
" nondefdecl = %p\n",nondefdecl);
13278 nondefdecl->set_nonreal_decl_scope(nonreal_decl_scope);
13284 printf(
"In buildTemplateClassDeclaration_nfi(): nrscope = %p\n", nonreal_decl_scope);
13288 ROSE_ASSERT(templateParameterList != NULL);
13289 nondefdecl->get_templateParameters() = *templateParameterList;
13297 if (nondefdecl->get_templateParameters().size() == 0)
13299#ifdef ROSE_DEBUG_NEW_EDG_ROSE_CONNECTION
13300 printf (
"WARNING: In buildTemplateClassDeclaration_nfi(): nondefdecl->get_templateParameters().size() == 0: OK for nested classes/structs in template declarations nondefdecl = %p \n",nondefdecl);
13305 printf(
" next 1\n");
13309 nondefdecl->set_templateName(nameWithoutTemplateArguments);
13312 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
13327 printf(
" next 2\n");
13330 if (nondefdecl->get_type() == NULL)
13334 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());
13338 printf(
" next 3\n");
13342 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
13353 ROSE_ASSERT(templateClassDeclaration == NULL || (templateParameterList != NULL && templateParameterList->size() == templateClassDeclaration->get_templateParameters().size()));
13356 scope->
insert_symbol(nameWithTemplateSpecializationArguments, mysymbol);
13358 printf(
" end build non-defn decl\n");
13362 SgClassSymbol* mysymbol = scope->lookup_template_class_symbol(nameWithTemplateSpecializationArguments,templateParameterList,templateSpecializationArgumentList);
13363 if (mysymbol == NULL) {
13364 printf(
"WARNING: In buildTemplateClassDeclaration_nfi(): non-defining declaration was provided but cannot be located in the associated scope.\n");
13369 printf (
"In buildTemplateClassDeclaration_nfi(): Setting the firstNondefiningDeclaration to be nondefdecl = %p \n",nondefdecl);
13385 if (defdecl->get_type() != NULL)
13391 if (defdecl->get_type()->get_declaration() == isSgDeclarationStatement(defdecl) )
13393 delete defdecl->get_type();
13405 ROSE_ASSERT (nondefdecl->get_type() != NULL);
13409 if (isSgClassType(nondefdecl->get_type())->get_declaration() != isSgDeclarationStatement(nondefdecl))
13412 printf (
"In buildTemplateClassDeclaration_nfi(): detected isSgClassType(nondefdecl->get_type())->get_declaration() != isSgDeclarationStatement(nondefdecl) (problem with Boost code in ROSE compiling ROSE) \n");
13417 defdecl->set_type(nondefdecl->get_type());
13420 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());
13435 printf (
"***** WARNING *****: Commented out call to fixStructDeclaration() \n");
13443 ROSE_ASSERT(defdecl->
get_scope() != NULL);
13447 ROSE_ASSERT(defdecl->get_type() != NULL);
13450 ROSE_ASSERT(nondefdecl->get_definition() == NULL);
13456#if PRINT_DEVELOPER_WARNINGS
13457 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());
13462 ROSE_ASSERT(defdecl->get_templateName().is_null() ==
false);
13465 ROSE_ASSERT(nondefdecl->get_templateName().is_null() ==
false);
13472 printf (
"Leaving buildTemplateClassDeclaration_nfi(): Calling find_symbol_from_declaration() \n");
13474 SgSymbol* test_symbol = defdecl->
get_scope()->find_symbol_from_declaration(tmp_classDeclaration);
13477 printf (
"Leaving buildTemplateClassDeclaration_nfi(): Calling get_symbol_from_symbol_table() \n");
13507 ASSERT_not_null(scope);
13518 SgEnumSymbol* existing_symbol = scope->lookup_enum_symbol(name);
13519 if (existing_symbol != NULL)
13521 enumType = isSgEnumType(existing_symbol->
get_type());
13522 first_nondefdecl = existing_symbol->get_declaration();
13523 ROSE_ASSERT(first_nondefdecl != NULL);
13532 ROSE_ASSERT(nondefdecl);
13536 if (first_nondefdecl)
13551 ASSERT_not_null(type);
13557 SgEnumSymbol* existing_symbol = scope->lookup_enum_symbol(name);
13559 if (existing_symbol)
13561 mysymbol = existing_symbol;
13562 first_nondefdecl = mysymbol->get_declaration();
13566 first_nondefdecl = nondefdecl;
13569 ASSERT_not_null(mysymbol);
13579 if (first_nondefdecl != nondefdecl)
13589 ASSERT_not_null(nondefdecl->
get_type());
13590 ASSERT_not_null(scope->lookup_enum_symbol(name));
13599 ROSE_ASSERT(scope != NULL);
13602 printf (
"In buildEnumDeclaration_nfi(): name = %s scope = %p = %s \n",name.str(),scope,scope->
class_name().c_str());
13610 SgEnumSymbol* existing_symbol = scope->lookup_enum_symbol(name);
13611 if (existing_symbol != NULL)
13613 enumType = isSgEnumType(existing_symbol->
get_type());
13618 printf (
"In buildEnumDeclaration_nfi(): name = %s building using enumType = %p \n",name.str(),enumType);
13623 ROSE_ASSERT(defdecl);
13626 printf (
"In buildEnumDeclaration_nfi(): built defining declaration = %p name = %s scope = %p = %s \n",defdecl,name.str(),scope,scope->
class_name().c_str());
13631 ROSE_ASSERT(type != NULL);
13638 printf (
"In buildEnumDeclaration_nfi(): name = %s \n",name.str());
13643 ROSE_ASSERT(scope != NULL);
13644 SgEnumSymbol* enumSymbol = scope->lookup_enum_symbol(name);
13647 if (enumSymbol != NULL)
13649 ROSE_ASSERT(enumSymbol->get_declaration() != NULL);
13650 nondefdecl = enumSymbol->get_declaration();
13651 ROSE_ASSERT(nondefdecl != NULL);
13658 printf (
"###### In buildEnumDeclaration_nfi(): built a non-defining declaration to support the symbol table: name = %s nondefdecl = %p \n",name.str(),nondefdecl);
13687 ROSE_ASSERT(mysymbol);
13707 printf (
"In buildEnumDeclaration_nfi(): name = %s defdecl = %p \n",name.str(),defdecl);
13711 ROSE_ASSERT(scope->lookup_enum_symbol(name) != NULL);
13723 ROSE_ASSERT(classDeclaration != NULL);
13724 ROSE_ASSERT(classDefinition != NULL);
13735 ROSE_ASSERT(baseclass != NULL);
13737 if (isVirtual ==
true)
13741 ROSE_ASSERT(baseclass->get_baseClassModifier() != NULL);
13742 baseclass->get_baseClassModifier()->setVirtual();
13754 classDefinition->append_inheritance(baseclass);
13763 ROSE_ASSERT(nrdecl != NULL);
13764 ROSE_ASSERT(classDefinition != NULL);
13767 ROSE_ASSERT(baseclass != NULL);
13769 if (isVirtual ==
true)
13771 baseclass->get_baseClassModifier()->setVirtual();
13776 classDefinition->append_inheritance(baseclass);
13786SageBuilder::buildAccessModifier (
unsigned int access )
13794 printf (
"In SageBuilder::set_access_modifiers(): Mark as public \n");
13801 printf (
"In SageBuilder::set_access_modifiers(): Mark as protected \n");
13808 printf (
"In SageBuilder::set_access_modifiers(): Mark as private \n");
13814 printf (
"Error: default reached in SageBuilder::set_access_modifiers() \n");
13829 ROSE_ASSERT(subtreeRoot != NULL);
13830 ROSE_ASSERT(newFileName !=
"");
13832#define DEBUG_FIXUP 0
13835 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): newFileName = %s \n",newFileName.c_str());
13836 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
13843 Traversal(
const std::string& tmp_newFileName,
int tmp_new_file_id,
int tmp_originalFileId)
13845 newFileName = tmp_newFileName;
13846 new_file_id = tmp_new_file_id;
13847 originalFileId = tmp_originalFileId;
13849 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): newFileName = %s new_file_id = %d originalFileId = %d \n",newFileName.c_str(),new_file_id,originalFileId);
13856 printf (
"In fixupSourcePositionFileSpecification visit(): node = %p = %s \n",node,node->
class_name().c_str());
13860 if (locatedNode != NULL)
13871 printf (
"Found SgLocatedNode marked as isShared() == true: locatedNode = %p = %s \n",locatedNode,locatedNode->
class_name().c_str());
13874 printf (
"Exiting as a test! \n");
13885 printf (
"locatedNode->get_startOfConstruct()->get_filename() = %s locatedNode->get_startOfConstruct()->get_physical_filename() = %s \n",
13887 printf (
"locatedNode->get_startOfConstruct()->get_file_id() = %d locatedNode->get_startOfConstruct()->get_physical_file_id() = %d \n",
13889 printf (
"locatedNode->get_startOfConstruct()->isShared() = %s \n",locatedNode->
get_startOfConstruct()->
isShared() ?
"true" :
"false");
13895 printf (
"NOT MATCHING: originalFileId = %d locatedNode->get_startOfConstruct()->get_file_id() = %d locatedNode->get_startOfConstruct()->get_physical_file_id() = %d \n",
13897 printf (
" ------------ originalFileId = %d locatedNode->get_endOfConstruct()->get_file_id() = %d locatedNode->get_endOfConstruct()->get_physical_file_id() = %d \n",
13905 if (initializedName != NULL)
13923 if (sourceFile != NULL)
13931 printf (
"sourceFile->get_endOfConstruct() == NULL: fixup endOfConstruct \n");
13945 printf (
"sourceFile->get_startOfConstruct()->get_file_id() = %d \n",sourceFile->
get_startOfConstruct()->get_file_id());
13946 printf (
"sourceFile->get_startOfConstruct()->get_physical_file_id() = %d \n",sourceFile->
get_startOfConstruct()->get_physical_file_id());
13955 printf (
"Unhandled: node = %p = %s \n",node,node->
class_name().c_str());
13962 if (expression != NULL)
13964 if (expression->get_operatorPosition()->get_physical_file_id() == originalFileId)
13966 expression->get_operatorPosition()->set_file_id(new_file_id);
13967 expression->get_operatorPosition()->set_physical_file_id(new_file_id);
13974 int originalFileId;
13975 string newFileName;
13979 SgFile* file = isSgFile(subtreeRoot);
13980 int new_file_id = -1;
13981 int originalFileId = -1;
13990 printf (
"originalFileId = %d \n",originalFileId);
14003 int new_file_id_2 = Sg_File_Info::getIDFromFilename(newFileName);
14005 printf (
"new_file_id = %d new_file_id_2 = %d \n",new_file_id,new_file_id_2);
14007 ROSE_ASSERT(new_file_id == new_file_id_2);
14009 string new_filename_2 = Sg_File_Info::getFilenameFromID(new_file_id);
14011 printf (
"newFileName = %s new_filename_2 = %s \n",newFileName.c_str(),new_filename_2.c_str());
14013 ROSE_ASSERT(newFileName == new_filename_2);
14017 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): file != NULL: newFileName = %s new_file_id = %d \n",newFileName.c_str(),new_file_id);
14022 SgLocatedNode* subtreeLocatedNode = isSgLocatedNode(subtreeRoot);
14023 if (subtreeLocatedNode != NULL)
14026 printf (
"subtreeLocatedNode->get_startOfConstruct()->get_file_id() = %d \n",subtreeLocatedNode->
get_startOfConstruct()->get_file_id());
14027 printf (
"subtreeLocatedNode->get_startOfConstruct()->get_physical_file_id() = %d \n",subtreeLocatedNode->
get_startOfConstruct()->get_physical_file_id());
14030 new_file_id = Sg_File_Info::getIDFromFilename(newFileName);
14032 printf (
"originalFileId = %d \n",originalFileId);
14033 printf (
"new_file_id = %d \n",new_file_id);
14036 printf (
"In SageBuilder::fixupSourcePositionFileSpecification(): subtreeLocatedNode = %s : originalFileId = %d newFileName = %s new_file_id = %d \n",
14037 subtreeLocatedNode->
class_name().c_str(),originalFileId,newFileName.c_str(),new_file_id);
14042 printf (
"Error: In SageBuilder::fixupSourcePositionFileSpecification(): subtree should be a SgFile or SgLocatedNode: subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
14047 printf (
"Error: In SageBuilder::fixupSourcePositionFileSpecification(): subtree should be a SgFile: subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
14052 ROSE_ASSERT(new_file_id >= 0);
14055 Traversal traversal (newFileName,new_file_id,originalFileId);
14060 traversal.traverse(subtreeRoot, preorder);
14063 printf (
"Exiting as a test in SageBuilder::fixupSourcePositionFileSpecification() \n");
14081 ROSE_ASSERT(subtreeRoot != NULL);
14082 ROSE_ASSERT(new_file_id >= 0);
14085 printf (
"In SageBuilder::fixupSharingSourcePosition(): subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
14086 printf (
"In SageBuilder::fixupSharingSourcePosition(): new_file_id = %d \n",new_file_id);
14093 Traversal(
int tmp_new_file_id)
14095 new_file_id = tmp_new_file_id;
14097 printf (
"In SageBuilder::fixupSharingSourcePosition(): new_file_id = %d \n",new_file_id);
14101 void visit (
SgNode* node)
14104 printf (
"In fixupSharingSourcePosition visit(): node = %p = %s new_file_id = %d \n",node,node->
class_name().c_str(),new_file_id);
14108 if (statement != NULL)
14113 printf (
"new_file_id = %d startOfConstruct->get_physical_file_id() = %d \n",new_file_id,startOfConstruct->get_physical_file_id());
14116 if (startOfConstruct->get_physical_file_id() == new_file_id)
14124 printf (
" --- adding entries for file_id and line number to support sharing: new_file_id = %d line = %d end line = %d \n",
14127 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == startOfConstruct->get_fileLineNumbersToUnparse().size());
14128 ROSE_ASSERT(endOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
14129 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
14132 startOfConstruct->get_fileIDsToUnparse().push_back(new_file_id);
14133 startOfConstruct->get_fileLineNumbersToUnparse().push_back(startOfConstruct->
get_line());
14135 endOfConstruct->get_fileIDsToUnparse().push_back(new_file_id);
14136 endOfConstruct->get_fileLineNumbersToUnparse().push_back(endOfConstruct->
get_line());
14138 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == startOfConstruct->get_fileLineNumbersToUnparse().size());
14139 ROSE_ASSERT(endOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
14140 ROSE_ASSERT(startOfConstruct->get_fileIDsToUnparse().size() == endOfConstruct->get_fileLineNumbersToUnparse().size());
14146 printf (
"Unhandled: node = %p = %s \n",node,node->
class_name().c_str());
14156 SgStatement* statement = isSgStatement(subtreeRoot);
14157 if (statement != NULL)
14160 printf (
"statement->get_startOfConstruct()->get_file_id() = %d \n",statement->
get_startOfConstruct()->get_file_id());
14161 printf (
"statement->get_startOfConstruct()->get_physical_file_id() = %d \n",statement->
get_startOfConstruct()->get_physical_file_id());
14164 printf (
"new_file_id = %d \n",new_file_id);
14167 printf (
"In SageBuilder::fixupSharingSourcePosition(): statement = %s : new_file_id = %d \n",statement->
class_name().c_str(),new_file_id);
14172 printf (
"Error: In SageBuilder::fixupSharingSourcePosition(): subtree should be a SgFile or SgLocatedNode: subtreeRoot = %p = %s \n",subtreeRoot,subtreeRoot->
class_name().c_str());
14176 ROSE_ASSERT(new_file_id >= 0);
14179 Traversal traversal (new_file_id);
14184 traversal.traverse(subtreeRoot, preorder);
14187 printf (
"Exiting as a test in SageBuilder::fixupSharingSourcePosition() \n");
14204#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
14207 printf (
"In SageBuilder::buildFile(inputFileName = %s, outputFileName = %s, project = %p) \n",inputFileName.c_str(),outputFileName.c_str(),project);
14213 ROSE_ASSERT(project != NULL);
14216 if (tmp1_collectionOfModifiedLocatedNodes.size() > 0)
14218 printf (
"In Traversal::evaluateInheritedAttribute(): tmp1_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp1_collectionOfModifiedLocatedNodes.size());
14220 printf (
"Exiting as a test! \n");
14221 ROSE_ASSERT(
false);
14226 ROSE_ASSERT(inputFileName.size() != 0);
14231 string sourceFilename = inputFileName;
14235 printf (
"sourceFilename = %s \n",sourceFilename.c_str());
14241 if (project != NULL)
14243 SgGlobal* globalScopeAcrossFiles = project->get_globalScopeAcrossFiles();
14244 ROSE_ASSERT(globalScopeAcrossFiles != NULL);
14247 ROSE_ASSERT(globalScopeAcrossFiles->
get_symbol_table()->get_table() != NULL);
14250 printf (
"In SageBuilder::buildFile(): globalScopeAcrossFiles = %p \n",globalScopeAcrossFiles);
14251 printf (
" --- globalScopeAcrossFiles->get_declarations().size() = %zu \n",globalScopeAcrossFiles->
get_declarations().size());
14252 printf (
" --- globalScopeAcrossFiles->get_symbol_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->
size());
14253 printf (
" --- globalScopeAcrossFiles->get_symbol_table()->get_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->get_table()->size());
14256 printf (
"Removing all elements from the globalScopeAcrossFiles->get_symbol_table() \n");
14262 if (clear_globalScopeAcrossFiles ==
true)
14264 globalScopeAcrossFiles->
get_symbol_table()->get_table()->delete_elements();
14268 printf (
"After removing all symbols (alias symbols): globalScopeAcrossFiles->get_symbol_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->
size());
14269 printf (
"After removing all symbols (alias symbols): globalScopeAcrossFiles->get_symbol_table()->get_table()->size() = %d \n",globalScopeAcrossFiles->
get_symbol_table()->get_table()->size());
14276 Rose_STL_Container<std::string> arglist;
14277 int nextErrorCode = 0;
14280 bool set_header_file_unparsing_optimization =
false;
14284 bool isCopyOfExistingFile_testForSharedNodes =
false;
14285 SgFile* fileBeingCopied = NULL;
14287 if (project == NULL)
14292 printf (
"In SageBuilder::buildFile(): build the SgProject \n");
14295 ROSE_ASSERT(project);
14296 project->get_fileList().clear();
14298 arglist.push_back(
"cc");
14299 arglist.push_back(
"-c");
14307 SgFilePtrList & files = project->get_fileList();
14308 for (SgFilePtrList::iterator i = files.begin(); i != files.end(); i++)
14312 printf (
"file = %p = %s name = %s \n",file,file->
class_name().c_str(), file->
getFileName().c_str());
14314 printf (
"file->get_header_file_unparsing_optimization() = %s \n",file->get_header_file_unparsing_optimization() ?
"true" :
"false");
14315 printf (
"file->get_header_file_unparsing_optimization_source_file() = %s \n",file->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
14316 printf (
"file->get_header_file_unparsing_optimization_header_file() = %s \n",file->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
14321 printf (
"This is a copy of an existing file in the project: sourceFilename = %s \n",sourceFilename.c_str());
14324 isCopyOfExistingFile_testForSharedNodes =
true;
14325 fileBeingCopied = file;
14330 if (file->get_header_file_unparsing_optimization() ==
true)
14332 set_header_file_unparsing_optimization =
true;
14339 printf (
"Exiting as a test! \n");
14344 ifstream testfile(inputFileName.c_str());
14345 if (!testfile.is_open())
14351 ofstream outputfile(inputFileName.c_str(),ios::out);
14353 outputfile<<
"// Output file generated so that StringUtility::getAbsolutePathFromRelativePath() will see a vaild file ... unparsed file will have rose_ prefix "<<endl;
14354 outputfile.close();
14374 project->get_sourceFileNameList().push_back(inputFileName);
14376 Rose_STL_Container<string> sourceFilenames = project->get_sourceFileNameList();
14384 if (std::find(arglist.begin(), arglist.end(), sourceFilename) == arglist.end())
14386 arglist.push_back(sourceFilename);
14391 if (outputFileName.empty() ==
false)
14393 arglist.push_back(
"-rose:o");
14395 arglist.push_back(outputFileName);
14412 SgFile* result = determineFileType(arglist, nextErrorCode, project);
14413 ROSE_ASSERT(result != NULL);
14416 printf (
"In SageBuilder::buildFile(): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",project,project->get_fileList_ptr()->get_listOfFiles().size());
14420 if (sourceFile != NULL)
14422 SgGlobal* globalScope = sourceFile->get_globalScope();
14423 ROSE_ASSERT(globalScope != NULL);
14432 printf (
"In SageBuilder::buildFile(): globalScope->get_isModified() == true: reset to false \n");
14436 printf (
"In SageBuilder::buildFile(): Verify false setting: globalScope->get_isModified() = %s \n",globalScope->
get_isModified() ?
"true" :
"false");
14451 ROSE_ASSERT(project != NULL);
14454 if (tmp2_collectionOfModifiedLocatedNodes.size() > 0)
14456 printf (
"In Traversal::evaluateInheritedAttribute(): tmp2_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp2_collectionOfModifiedLocatedNodes.size());
14458 printf (
"Exiting as a test! \n");
14459 ROSE_ASSERT(
false);
14466 ROSE_ASSERT(project != NULL);
14469 if (tmp22_collectionOfModifiedLocatedNodes.size() > 0)
14471 printf (
"In Traversal::evaluateInheritedAttribute(): tmp22_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp22_collectionOfModifiedLocatedNodes.size());
14473 printf (
"Exiting as a test! \n");
14474 ROSE_ASSERT(
false);
14480 printf (
"Calling outputFileIds() \n");
14484 printf (
"DONE: Calling outputFileIds() \n");
14489 printf (
"In SageBuilder::buildFile(): file = %p = %s result->get_header_file_unparsing_optimization() = %s \n",
14490 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization() ?
"true" :
"false");
14494 printf (
"In SageBuilder::buildFile(): file = %p = %s result->get_header_file_unparsing_optimization_source_file() = %s \n",
14495 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
14496 printf (
"In SageBuilder::buildFile(): file = %p = %s result->get_header_file_unparsing_optimization_header_file() = %s \n",
14497 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
14509 if (set_header_file_unparsing_optimization ==
true)
14511 result->set_header_file_unparsing_optimization(
true);
14521 result->set_header_file_unparsing_optimization_header_file(
false);
14524 printf (
"In SageBuilder::buildFile(): set_header_file_unparsing_optimization == true: file = %p = %s result->get_header_file_unparsing_optimization() = %s \n",
14525 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization() ?
"true" :
"false");
14526 printf (
"In SageBuilder::buildFile(): set_header_file_unparsing_optimization == true: file = %p = %s result->get_header_file_unparsing_optimization_source_file() = %s \n",
14527 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
14528 printf (
"In SageBuilder::buildFile(): set_header_file_unparsing_optimization == true: file = %p = %s result->get_header_file_unparsing_optimization_header_file() = %s \n",
14529 result,result->
class_name().c_str(),result->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
14545 if (project->get_Java_only() ==
true)
14548 printf (
"WARNING: Java specific action to add new file to SgProject (using set_file()) (more uniform language handling symantics would avoid this problem) \n");
14560 printf (
"In SageBuilder::buildFile(): Outliner::use_dlopen = %s \n",Outliner::use_dlopen ?
"true" :
"false");
14565 ROSE_ASSERT(project != NULL);
14568 if (tmp23_collectionOfModifiedLocatedNodes.size() > 0)
14570 printf (
"In Traversal::evaluateInheritedAttribute(): tmp23_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp23_collectionOfModifiedLocatedNodes.size());
14572 printf (
"Exiting as a test! \n");
14573 ROSE_ASSERT(
false);
14580 ROSE_ASSERT(project != NULL);
14583 if (tmp24_collectionOfModifiedLocatedNodes.size() > 0)
14585 printf (
"In Traversal::evaluateInheritedAttribute(): tmp24_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp24_collectionOfModifiedLocatedNodes.size());
14587 printf (
"Exiting as a test! \n");
14588 ROSE_ASSERT(
false);
14598 if (!Outliner::use_dlopen)
14601 printf (
"In SageBuilder::buildFile(): (after test for (!Outliner::use_dlopen) == true: project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
14602 project,project->get_fileList_ptr()->get_listOfFiles().size());
14607 printf (
"In SageBuilder::buildFile(): (after 2nd project->set_file()): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
14608 project,project->get_fileList_ptr()->get_listOfFiles().size());
14614 printf (
"In SageBuilder::buildFile(): (after test for (!Outliner::use_dlopen) == false: project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
14615 project,project->get_fileList_ptr()->get_listOfFiles().size());
14630 SgFilePtrList& flist = project->get_fileList();
14631 flist.insert(flist.begin(),result);
14633 printf (
"In SageBuilder::buildFile(): (after flist.insert(flist.begin(),result)): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
14634 project,project->get_fileList_ptr()->get_listOfFiles().size());
14641 ROSE_ASSERT(project != NULL);
14644 if (tmp25_collectionOfModifiedLocatedNodes.size() > 0)
14646 printf (
"In Traversal::evaluateInheritedAttribute(): tmp25_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp25_collectionOfModifiedLocatedNodes.size());
14648 printf (
"Exiting as a test! \n");
14649 ROSE_ASSERT(
false);
14657 EDG_ROSE_Translation::suppress_detection_of_transformations =
true;
14660 printf (
"In SageBuilder::buildFile(): EDG_ROSE_Translation::suppress_detection_of_transformations = %s \n",EDG_ROSE_Translation::suppress_detection_of_transformations ?
"true" :
"false");
14664 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());
14687 ROSE_ASSERT(project != NULL);
14690 if (tmp251_collectionOfModifiedLocatedNodes.size() > 0)
14692 printf (
"In Traversal::evaluateInheritedAttribute(): tmp251_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp251_collectionOfModifiedLocatedNodes.size());
14694 printf (
"Exiting as a test! \n");
14695 ROSE_ASSERT(
false);
14703 result->runFrontend(nextErrorCode);
14706 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());
14710 printf (
"After result->runFrontend(): calling outputFileIds() \n");
14714 printf (
"DONE: After result->runFrontend(): calling outputFileIds() \n");
14729 ROSE_ASSERT(project != NULL);
14732 if (tmp26_collectionOfModifiedLocatedNodes.size() > 0)
14734 printf (
"In Traversal::evaluateInheritedAttribute(): tmp26_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp26_collectionOfModifiedLocatedNodes.size());
14736 printf (
"Exiting as a test! \n");
14737 ROSE_ASSERT(
false);
14744 printf (
"Generating a dot file... (SgFile only) \n");
14745 generateDOT ( *project );
14750 printf (
"In SageBuilder::buildFile(): Generate the dot output for multiple files (ROSE AST) \n");
14752 generateDOTforMultipleFile ( *project );
14753 printf (
"DONE: Generate the dot output of the SAGE III AST \n");
14759 const int MAX_NUMBER_OF_IR_NODES_TO_GRAPH_FOR_WHOLE_GRAPH = 8000;
14760 generateAstGraph(project,MAX_NUMBER_OF_IR_NODES_TO_GRAPH_FOR_WHOLE_GRAPH);
14765 printf (
"In SageBuilder::buildFile(): calling astPostProcessing() \n");
14768 if (!project->get_skip_post_processing()) AstPostProcessing(result);
14771 printf (
"In SageBuilder::buildFile(): DONE: calling astPostProcessing() \n");
14784 ROSE_ASSERT(project != NULL);
14787 if (tmp265_collectionOfModifiedLocatedNodes.size() > 0)
14789 printf (
"In Traversal::evaluateInheritedAttribute(): tmp265_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp265_collectionOfModifiedLocatedNodes.size());
14791 printf (
"Exiting as a test! \n");
14792 ROSE_ASSERT(
false);
14798 result->display(
"SageBuilder::buildFile()");
14801 ROSE_ASSERT(project != NULL);
14802 project->set_frontendErrorCode(max(project->get_frontendErrorCode(), nextErrorCode));
14817 printf (
"Exiting as a test! \n");
14823 ROSE_ASSERT(project != NULL);
14826 if (tmp27_collectionOfModifiedLocatedNodes.size() > 0)
14828 printf (
"In Traversal::evaluateInheritedAttribute(): tmp27_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp27_collectionOfModifiedLocatedNodes.size());
14830 printf (
"Exiting as a test! \n");
14831 ROSE_ASSERT(
false);
14837 if (isCopyOfExistingFile_testForSharedNodes ==
true)
14843 printf (
"Found isCopyOfExistingFile_testForSharedNodes == true \n");
14844 printf (
"fileBeingCopied = %p = %s \n",fileBeingCopied,fileBeingCopied->
getFileName().c_str());
14847 SgSourceFile* sourceFileBeingCopied = isSgSourceFile(fileBeingCopied);
14848 ROSE_ASSERT(sourceFileBeingCopied != NULL);
14851 ROSE_ASSERT(sourceResult != NULL);
14853 SgGlobal* fileBeingCopied_globalScope = sourceFileBeingCopied->get_globalScope();
14854 SgGlobal* result_globalScope = sourceResult->get_globalScope();
14856 printf (
"fileBeingCopied_globalScope = %p \n",fileBeingCopied_globalScope);
14857 printf (
"result_globalScope = %p \n",result_globalScope);
14859 ROSE_ASSERT(fileBeingCopied_globalScope != NULL);
14860 ROSE_ASSERT(result_globalScope != NULL);
14862 SgDeclarationStatementPtrList fileBeingCopied_declarationList = fileBeingCopied_globalScope->
get_declarations();
14863 SgDeclarationStatementPtrList result_declarationList = result_globalScope->
get_declarations();
14868 vector<SgDeclarationStatement*>::iterator it;
14869 SgDeclarationStatementPtrList v(fileBeingCopied_declarationList.size());
14872 std::sort(fileBeingCopied_declarationList.begin(),fileBeingCopied_declarationList.end());
14873 std::sort(result_declarationList.begin(),result_declarationList.end());
14877 it = std::set_intersection(fileBeingCopied_declarationList.begin(),fileBeingCopied_declarationList.end(),result_declarationList.begin(),result_declarationList.end(),v.begin());
14879 v.resize(it-v.begin());
14881 int fileBeingCopied_file_id = fileBeingCopied->
get_startOfConstruct()->get_physical_file_id();
14884 for (
size_t i = 0; i < v.size(); i++)
14889 printf (
" --- SageBuilder::buildFile() is sharing this node: %p %s \n",intersection_element,intersection_element->
class_name().c_str());
14895 printf (
"Exiting as a test! \n");
14902 ROSE_ASSERT(project != NULL);
14905 if (tmp28_collectionOfModifiedLocatedNodes.size() > 0)
14907 printf (
"In Traversal::evaluateInheritedAttribute(): tmp28_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp28_collectionOfModifiedLocatedNodes.size());
14909 printf (
"Exiting as a test! \n");
14910 ROSE_ASSERT(
false);
14922 std::vector<SgDeclarationStatementPtrList::iterator> removeList;
14923 SgDeclarationStatementPtrList::iterator i = fileBeingCopied_declarationList.begin();
14924 while (i != fileBeingCopied_declarationList.end())
14927 if (emptyDeclaration != NULL)
14929 removeList.push_back(i);
14939 for (std::vector<SgDeclarationStatementPtrList::iterator>::iterator i = removeList.begin(); i != removeList.end(); i++)
14941 fileBeingCopied_declarationList.erase(*i);
14946 if (fileBeingCopied_declarationList.size() != result_declarationList.size())
14948 printf (
"fileBeingCopied_declarationList.size() = %zu \n",fileBeingCopied_declarationList.size());
14949 printf (
"result_declarationList.size() = %zu \n",result_declarationList.size());
14951 ROSE_ASSERT(fileBeingCopied_declarationList.size() == result_declarationList.size());
14956 printf (
"Statements from global scope (size = %zu): \n",fileBeingCopied_declarationList.size());
14958 for (
size_t i = 0; i < fileBeingCopied_declarationList.size(); i++)
14963 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());
14965 if (fileBeingCopied_decl == result_decl)
14968 printf (
" --- SageBuilder::buildFile() is sharing this node: %p %s \n",fileBeingCopied_decl,fileBeingCopied_decl->
class_name().c_str());
14974 int fileBeingCopied_file_id = fileBeingCopied->
get_startOfConstruct()->get_physical_file_id();
14977 printf (
"Exiting as a test! \n");
14988 printf (
"exiting as a test! \n");
14998 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
14999 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
15000 printf (
"Leaving SageBuilder::buildFile(): (after result->runFrontend()): project = %p project->get_fileList_ptr()->get_listOfFiles().size() = %" PRIuPTR
" \n",
15001 project,project->get_fileList_ptr()->get_listOfFiles().size());
15002 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
15003 printf (
"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ \n");
15013 ROSE_ASSERT(result->get_preprocessorDirectivesAndCommentsList() != NULL);
15017 ROSE_ASSERT(project != NULL);
15020 if (tmp3_collectionOfModifiedLocatedNodes.size() > 0)
15022 printf (
"In Traversal::evaluateInheritedAttribute(): tmp3_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp3_collectionOfModifiedLocatedNodes.size());
15024 printf (
"Exiting as a test! \n");
15025 ROSE_ASSERT(
false);
15053 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
15054 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
15055 printf (
"In SageBuilder::buildSourceFile(outputFileName = %s, project = %p) \n",outputFileName.c_str(),project);
15056 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
15057 printf (
"B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1B1 \n");
15061 string inputFilePrefix =
"temp_dummy_file_";
15064 printf (
"In SageBuilder::buildSourceFile(const std::string& outputFileName, SgProject* project): calling buildFile() \n");
15067 SgFile* file =
buildFile(inputFilePrefix+outputFileName,outputFileName,project,clear_globalScopeAcrossFiles);
15068 ROSE_ASSERT(file != NULL);
15071 printf (
"DONE: In SageBuilder::buildSourceFile(): calling buildFile() \n");
15075 ROSE_ASSERT(sourceFile != NULL);
15077 ROSE_ASSERT(sourceFile->get_globalScope() != NULL);
15080 printf (
"call the unparser on the just built file \n");
15084 printf (
"Exiting as a test! \n");
15095 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
15096 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
15097 printf (
"In SageBuilder::buildSourceFile(const std::string& inputFileName,const std::string& outputFileName, SgProject* project): calling buildFile() \n");
15099 printf (
" --- inputFileName = %s \n",inputFileName.c_str());
15100 printf (
" --- outputFileName = %s \n",outputFileName.c_str());
15101 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
15102 printf (
"B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2 \n");
15107 ROSE_ASSERT(project != NULL);
15110 if (tmp1_collectionOfModifiedLocatedNodes.size() > 0)
15112 printf (
"In Traversal::evaluateInheritedAttribute(): tmp1_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp1_collectionOfModifiedLocatedNodes.size());
15114 printf (
"Exiting as a test! \n");
15115 ROSE_ASSERT(
false);
15120 SgFile* file =
buildFile(inputFileName, outputFileName,project,clear_globalScopeAcrossFiles);
15121 ROSE_ASSERT(file != NULL);
15124 printf (
"DONE: In SageBuilder::buildSourceFile(): calling buildFile() \n");
15129 ROSE_ASSERT(project != NULL);
15132 if (tmp2_collectionOfModifiedLocatedNodes.size() > 0)
15134 printf (
"In Traversal::evaluateInheritedAttribute(): tmp2_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp2_collectionOfModifiedLocatedNodes.size());
15136 printf (
"Exiting as a test! \n");
15137 ROSE_ASSERT(
false);
15143 ROSE_ASSERT(sourceFile != NULL);
15145 ROSE_ASSERT(sourceFile->get_globalScope() != NULL);
15149 printf (
"Debugging the unparsing header file optimization \n");
15151 printf (
"sourceFile->get_header_file_unparsing_optimization() = %s \n",sourceFile->get_header_file_unparsing_optimization() ?
"true" :
"false");
15152 printf (
"sourceFile->get_header_file_unparsing_optimization_source_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
15153 printf (
"sourceFile->get_header_file_unparsing_optimization_header_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
15160 ROSE_ASSERT(sourceFile->get_header_file_unparsing_optimization() ==
true);
15161 ROSE_ASSERT(sourceFile->get_header_file_unparsing_optimization_source_file() ==
true);
15163 ROSE_ASSERT(sourceFile->get_header_file_unparsing_optimization_header_file() ==
false);
15169 SgFilePtrList & fileList = project->get_fileList();
15172 printf (
"Looking for file = %s \n",inputFileName.c_str());
15175 for (SgFilePtrList::iterator i = fileList.begin(); i != fileList.end(); i++)
15179 printf (
"temp_file = %p = %s name = %s \n",temp_file,temp_file->
class_name().c_str(),temp_file->
getFileName().c_str());
15181 if (temp_file != file)
15196 printf (
"sourceFile = %p = %s \n",sourceFile,sourceFile->
class_name().c_str());
15197 printf (
"sourceFile->get_header_file_unparsing_optimization() = %s \n",sourceFile->get_header_file_unparsing_optimization() ?
"true" :
"false");
15198 printf (
"sourceFile->get_header_file_unparsing_optimization_source_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
15199 printf (
"sourceFile->get_header_file_unparsing_optimization_header_file() = %s \n",sourceFile->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
15201 printf (
"temp_file = %p = %s \n",temp_file,temp_file->
class_name().c_str());
15202 printf (
"temp_file->get_header_file_unparsing_optimization() = %s \n",temp_file->get_header_file_unparsing_optimization() ?
"true" :
"false");
15203 printf (
"temp_file->get_header_file_unparsing_optimization_source_file() = %s \n",temp_file->get_header_file_unparsing_optimization_source_file() ?
"true" :
"false");
15204 printf (
"temp_file->get_header_file_unparsing_optimization_header_file() = %s \n",temp_file->get_header_file_unparsing_optimization_header_file() ?
"true" :
"false");
15223 printf (
"Sg_File_Info::get_nametofileid_map()[sourceFile->get_file_info()->get_filename()] = %d \n",filename_id);
15224 printf (
"Sg_File_Info::get_nametofileid_map()[sourceFile->get_file_info()->get_filename()] = %d \n",filename_physical_id);
15225 sourceFile->
get_file_info()->set_physical_file_id(filename_physical_id);
15227 printf (
"sourceFile->get_file_info()->get_physical_filename() = %s \n",sourceFile->
get_file_info()->get_physical_filename().c_str());
15228 printf (
"sourceFile->get_file_info()->get_physical_file_id() = %d \n",sourceFile->
get_file_info()->get_physical_file_id());
15232 printf (
"Exiting as a test! \n");
15244 if (sourceFile->get_preprocessorDirectivesAndCommentsList() == NULL)
15247 printf (
"Initialize NULL p_preprocessorDirectivesAndCommentsList to empty ROSEAttributesListContainer \n");
15250 sourceFile->set_preprocessorDirectivesAndCommentsList(tmp_preprocessorDirectivesAndCommentsList);
15255 printf (
"NOTE: p_preprocessorDirectivesAndCommentsList is already defined! \n");
15256 printf (
" --- inputFileName = %s \n",inputFileName.c_str());
15257 printf (
" --- outputFileName = %s \n",outputFileName.c_str());
15258 printf (
" --- sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size() = %zu \n",sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size());
15261 ROSE_ASSERT (sourceFile->get_preprocessorDirectivesAndCommentsList() != NULL);
15268 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");
15273 ROSE_ASSERT(filePreprocInfo != NULL);
15279 printf (
"In SageBuilder::buildSourceFile(const std::string& inputFileName,const std::string& outputFileName, SgProject* project): calling attachPreprocessingInfo() \n");
15280 printf (
" --- sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size() = %zu \n",sourceFile->get_preprocessorDirectivesAndCommentsList()->getList().size());
15285 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");
15286 printf (
" --- inputFileName = %s \n",inputFileName.c_str());
15287 printf (
" --- outputFileName = %s \n",outputFileName.c_str());
15288 printf (
"sourceFile = %p \n",sourceFile);
15289 printf (
"sourceFile->get_token_list.size() = %zu \n",sourceFile->get_token_list().size());
15290 printf (
"sourceFile->get_tokenSubsequenceMap().size() = %zu \n",sourceFile->get_tokenSubsequenceMap().size());
15298 attachPreprocessingInfo (sourceFile,outputFileName);
15305 printf (
"Exiting after test! processed first phase of collecting comments and CPP directives for source file) \n");
15306 ROSE_ASSERT(
false);
15310 printf (
"DONE: In SageBuilder::buildSourceFile(const std::string& inputFileName,const std::string& outputFileName, SgProject* project): calling attachPreprocessingInfo() \n");
15314 printf (
"call the unparser on the just built file \n");
15318 printf (
"In buildSourceFile(): AS A TEST: calling unparseFile(): filename = %s \n",sourceFile->
getFileName().c_str());
15337 printf (
"In SageBuilder::buildSourceFile(): changing the name of the file represented in sourceFile: \n");
15338 printf (
"inputFileName = %s \n",inputFileName.c_str());
15339 printf (
"outputFileName = %s \n",outputFileName.c_str());
15340 printf (
"sourceFile->getFileName() = %s \n",sourceFile->
getFileName().c_str());
15343 SgGlobal* globalScope = sourceFile->get_globalScope();
15346 printf (
"Leaving SageBuilder::buildSourceFile() sourceFile = %p globalScope = %p \n",sourceFile,sourceFile->get_globalScope());
15347 printf (
"sourceFile->get_file_info()->get_file_id() = %d \n",sourceFile->
get_file_info()->get_file_id());
15348 printf (
"sourceFile->get_file_info()->get_physical_file_id() = %d \n",sourceFile->
get_file_info()->get_physical_file_id());
15349 printf (
"sourceFile->get_token_list.size() = %zu \n",sourceFile->get_token_list().size());
15350 printf (
"sourceFile->get_tokenSubsequenceMap().size() = %zu \n",sourceFile->get_tokenSubsequenceMap().size());
15351 printf (
"inputFileName = %s \n",inputFileName.c_str());
15352 printf (
"outputFileName = %s \n",outputFileName.c_str());
15353 printf (
"sourceFile->getFileName() = %s \n",sourceFile->
getFileName().c_str());
15355 printf (
"sourceFile->get_globalScope() = %p \n",globalScope);
15356 printf (
"globalScope->get_isModified() = %s \n",globalScope->
get_isModified() ?
"true" :
"false");
15366 printf (
"globalScope->get_isModified() == true: reset to false \n");
15370 printf (
"Verify false setting: globalScope->get_isModified() = %s \n",globalScope->
get_isModified() ?
"true" :
"false");
15376 ROSE_ASSERT(project != NULL);
15379 if (tmp3_collectionOfModifiedLocatedNodes.size() > 0)
15381 printf (
"In Traversal::evaluateInheritedAttribute(): tmp3_collectionOfModifiedLocatedNodes.size() = %zu \n",tmp3_collectionOfModifiedLocatedNodes.size());
15383 printf (
"Exiting as a test! \n");
15384 ROSE_ASSERT(
false);
15390 printf (
"Exiting as a test! \n");
15406 bool isSystemHeader)
15408 std::string content;
15409 if (isSystemHeader)
15410 content =
"#include <" + header_filename +
"> \n";
15412 content =
"#include \"" + header_filename +
"\" \n";
15414 content,
"Transformation generated",0, 0, 0, position);
15415 ROSE_ASSERT(result);
15424 ROSE_ASSERT(target != NULL);
15426 std::string content2 = content;
15427 boost::algorithm::trim(content2);
15428 string prefix =
"#define";
15429 string::size_type pos = content2.find(prefix, 0);
15430 ROSE_ASSERT (pos == 0);
15434 PreprocessingInfo::DirectiveType mytype = PreprocessingInfo::CpreprocessorDefineDeclaration;
15438 result =
new PreprocessingInfo (mytype,content,
"transformation-generated", 0, 0, 0, position);
15439 ROSE_ASSERT(result);
15440 target->addToAttachedPreprocessingInfo(result);
15446#ifndef ROSE_USE_INTERNAL_FRONTEND_DEVELOPMENT
15451 static std::map<SgNode*, AbstractHandle::abstract_handle *> handleMap;
15453 ROSE_ASSERT(n != NULL);
15458 ROSE_ASSERT(anode !=NULL );
15461 ROSE_ASSERT(ahandle != NULL);
15470 ROSE_ASSERT(exp1 != NULL);
15471 ROSE_ASSERT(exp2 != NULL);
15476 ROSE_ASSERT(equivalenceStatement->get_equivalence_set_list() == NULL);
15477 equivalenceStatement->set_equivalence_set_list(setList);
15478 ROSE_ASSERT(equivalenceStatement->get_equivalence_set_list() != NULL);
15481 return equivalenceStatement;
15494 typedef Rose_STL_Container<SgScopeStatement*> SgScopeStatementPtrList;
15495 SgScopeStatementPtrList snippet_scope_list;
15501 printf (
"First scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
15503 if (temp_classDefinition != NULL)
15506 SgName className = temp_classDeclaration->get_name();
15508 printf (
"Input snippet declaration's class name = %s \n",className.str());
15512 if (namespaceDefinitionStatement != NULL)
15517 snippet_scope_list.push_back(snippet_scope);
15518 while (snippet_scope != NULL && isSgGlobal(snippet_scope) == NULL)
15524 snippet_scope = snippet_scope->
get_scope();
15526 printf (
"snippet_scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
15528 snippet_scope_list.push_back(snippet_scope);
15532 printf (
"snippet_scope_list.size() = %" PRIuPTR
" \n",snippet_scope_list.size());
15535 SgGlobal* global_scope_in_target_ast = TransformationSupport::getGlobalScope(targetScope);
15536 SgScopeStatementPtrList::reverse_iterator i = snippet_scope_list.rbegin();
15541 ROSE_ASSERT(isSgGlobal(snippet_AST_scope) != NULL);
15546 while (i != snippet_scope_list.rend())
15550 printf (
"snippet_AST_scope list *i = %p = %s \n",*i,(*i)->class_name().c_str());
15557 if (classDefinition != NULL)
15560 SgName className = classDeclaration->get_name();
15562 printf (
"Found snippet class name = %s \n",className.str());
15564 SgClassSymbol* classSymbol = target_AST_scope->lookup_class_symbol(className);
15565 ROSE_ASSERT(classSymbol != NULL);
15566 ROSE_ASSERT(classSymbol->get_declaration() != NULL);
15568 printf (
"Associated symbol in taget AST: declaration = %p name = %s \n",classSymbol->get_declaration(),classSymbol->get_declaration()->get_name().str());
15571 returnSymbol = classSymbol;
15574 target_AST_scope = classDefinition;
15579 if (functionDefinition != NULL)
15581 printf (
"ERROR: Found an unusual case of SgFunctionDefinition in list of scopes holding a declaration for a type \n");
15586 if (namespaceDefinition != NULL)
15591 printf (
"Found snippet namespace name = %s \n",namespaceName.str());
15593 SgNamespaceSymbol* namespaceSymbol = target_AST_scope->lookup_namespace_symbol(namespaceName);
15594 ROSE_ASSERT(namespaceSymbol != NULL);
15600 returnSymbol = namespaceSymbol;
15603 target_AST_scope = namespaceDefinition;
15611 switch (snippet_declaration->
variantT())
15613 case V_SgClassDeclaration:
15615 SgClassDeclaration* snippet_classDeclaration = isSgClassDeclaration(snippet_declaration);
15616 ROSE_ASSERT(snippet_classDeclaration != NULL);
15618 SgName snippet_className = snippet_classDeclaration->get_name();
15620 printf (
"snippet snippet declaration's class name = %s \n",snippet_className.str());
15622 SgClassSymbol* target_symbol = target_AST_scope->lookup_class_symbol(snippet_className);
15623 ROSE_ASSERT(target_symbol != NULL);
15624 returnSymbol = target_symbol;
15626 SgClassSymbol* classSymbolInTargetAST = isSgClassSymbol(returnSymbol);
15627 ROSE_ASSERT(classSymbolInTargetAST != NULL);
15628 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
15629 ROSE_ASSERT(target_classDeclaration != NULL);
15631 printf (
"snippet: classDeclaration = %p = %s \n",snippet_classDeclaration,snippet_classDeclaration->get_name().str());
15632 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
15634 ROSE_ASSERT(snippet_classDeclaration->get_name() == target_classDeclaration->get_name());
15638 case V_SgTypedefDeclaration:
15640 SgTypedefDeclaration* snippet_typedefDeclaration = isSgTypedefDeclaration(snippet_declaration);
15641 ROSE_ASSERT(snippet_typedefDeclaration != NULL);
15643 SgName snippet_typedefName = snippet_typedefDeclaration->get_name();
15645 printf (
"snippet snippet declaration's typedef name = %s \n",snippet_typedefName.str());
15647 SgTypedefSymbol* target_symbol = target_AST_scope->lookup_typedef_symbol(snippet_typedefName);
15648 ROSE_ASSERT(target_symbol != NULL);
15649 returnSymbol = target_symbol;
15651 SgTypedefSymbol* typedefSymbolInTargetAST = isSgTypedefSymbol(returnSymbol);
15652 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
15653 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
15654 ROSE_ASSERT(target_typedefDeclaration != NULL);
15656 printf (
"snippet: typedefDeclaration = %p = %s \n",snippet_typedefDeclaration,snippet_typedefDeclaration->get_name().str());
15657 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
15659 ROSE_ASSERT(snippet_typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
15663 case V_SgEnumDeclaration:
15665 SgEnumDeclaration* snippet_enumDeclaration = isSgEnumDeclaration(snippet_declaration);
15666 ROSE_ASSERT(snippet_enumDeclaration != NULL);
15670 printf (
"snippet snippet declaration's enum name = %s \n",snippet_enumName.str());
15673 bool isUnNamed = snippet_enumDeclaration->get_isUnNamed();
15674 if (isUnNamed ==
false)
15678 if (target_symbol == NULL)
15682 printf (
"scope = %p = %s \n",scope,scope->
class_name().c_str());
15683 scope->
get_file_info()->display(
"case V_SgEnumDeclaration: target_symbol == NULL: scope: debug");
15685 ROSE_ASSERT(target_symbol != NULL);
15686 returnSymbol = target_symbol;
15688 SgEnumSymbol* enumSymbolInTargetAST = isSgEnumSymbol(returnSymbol);
15689 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
15690 SgEnumDeclaration* target_enumDeclaration = isSgEnumDeclaration(enumSymbolInTargetAST->get_declaration());
15691 ROSE_ASSERT(target_enumDeclaration != NULL);
15693 printf (
"snippet: enumDeclaration = %p = %s \n",snippet_enumDeclaration,snippet_enumDeclaration->
get_name().str());
15694 printf (
"target: enumDeclaration = %p = %s \n",target_enumDeclaration,target_enumDeclaration->
get_name().str());
15696 ROSE_ASSERT(snippet_enumDeclaration->
get_name() == target_enumDeclaration->
get_name());
15701 printf (
"Warning: can't handle unnamed enum declarations \n");
15702 ROSE_ASSERT(returnSymbol == NULL);
15708 case V_SgMemberFunctionDeclaration:
15709 case V_SgFunctionDeclaration:
15712 ROSE_ASSERT(snippet_functionDeclaration != NULL);
15714 printf (
"snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15716 SgName snippet_functionName = snippet_functionDeclaration->get_name();
15718 printf (
"snippet snippet declaration's function name = %s \n",snippet_functionName.str());
15719 printf (
" --- target_AST_scope = %p = %s \n",target_AST_scope,target_AST_scope->
class_name().c_str());
15721 SgFunctionSymbol* target_symbol = target_AST_scope->lookup_function_symbol(snippet_functionName);
15722 ROSE_ASSERT(target_symbol != NULL);
15723 returnSymbol = target_symbol;
15725 SgFunctionSymbol* functionSymbolInTargetAST = isSgFunctionSymbol(returnSymbol);
15726 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
15727 SgFunctionDeclaration* target_functionDeclaration = isSgFunctionDeclaration(functionSymbolInTargetAST->get_declaration());
15728 ROSE_ASSERT(target_functionDeclaration != NULL);
15730 printf (
"snippet: functionDeclaration = %p = %s \n",snippet_functionDeclaration,snippet_functionDeclaration->get_name().str());
15731 printf (
"target: functionDeclaration = %p = %s \n",target_functionDeclaration,target_functionDeclaration->get_name().str());
15733 ROSE_ASSERT(snippet_functionDeclaration->get_name() == target_functionDeclaration->get_name());
15739 printf (
"Error: default reached in switch: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
15745 return returnSymbol;
15757#define DEBUG_FIND_ASSOCIATED_DECLARATION 0
15764#if DEBUG_FIND_ASSOCIATED_DECLARATION
15765 printf (
"isDefiningDeclaration = %s \n",isDefiningDeclaration ?
"true" :
"false");
15771 typedef Rose_STL_Container<SgScopeStatement*> SgScopeStatementPtrList;
15772 SgScopeStatementPtrList snippet_scope_list;
15777#if DEBUG_FIND_ASSOCIATED_DECLARATION
15778 printf (
"First scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
15780 if (temp_classDefinition != NULL)
15783 SgName className = temp_classDeclaration->get_name();
15784 printf (
"Input declaration's class name = %s \n",className.str());
15788 if (namespaceDefinitionStatement != NULL)
15792 printf (
"Input declaration's namespace name = %s \n",namespaceName.str());
15796 snippet_scope_list.push_back(snippet_scope);
15797 while (snippet_scope != NULL && isSgGlobal(snippet_scope) == NULL)
15803 snippet_scope = snippet_scope->
get_scope();
15805#if DEBUG_FIND_ASSOCIATED_DECLARATION
15806 printf (
"snippet_scope = %p = %s \n",snippet_scope,snippet_scope->
class_name().c_str());
15808 snippet_scope_list.push_back(snippet_scope);
15815#if DEBUG_FIND_ASSOCIATED_DECLARATION
15816 printf (
"snippet_scope_list.size() = %" PRIuPTR
" \n",snippet_scope_list.size());
15817 for (SgScopeStatementPtrList::iterator i = snippet_scope_list.begin(); i != snippet_scope_list.end(); i++)
15821 SgGlobal* global_scope_from_declarations_scope = TransformationSupport::getGlobalScope(scope);
15822 printf (
" --- --- global_scope_from_declarations_scope = %p \n",global_scope_from_declarations_scope);
15830 SgGlobal* global_scope_in_target_ast = TransformationSupport::getGlobalScope(targetScope);
15831 SgScopeStatementPtrList::reverse_iterator i = snippet_scope_list.rbegin();
15833#if DEBUG_FIND_ASSOCIATED_DECLARATION
15834 printf (
"global_scope_in_target_ast = %p = %s \n",global_scope_in_target_ast,global_scope_in_target_ast->
class_name().c_str());
15843 ROSE_ASSERT(isSgGlobal(snippet_AST_scope) != NULL);
15847#if DEBUG_FIND_ASSOCIATED_DECLARATION
15848 string otherASTnameFromGlobalScope = global_scope_in_target_ast->
get_file_info()->get_filenameString();
15849 SgSourceFile* otherSourceFile = SageInterface::getEnclosingNode<SgSourceFile>(targetScope,
true);
15850 string otherASTnameFromSourceFile = otherSourceFile->
getFileName();
15851 printf (
"Now traverse the list of scopes in reverse to find the declaration in the other AST: \n");
15852 printf (
"otherASTnameFromGlobalScope = %s \n",otherASTnameFromGlobalScope.c_str());
15853 printf (
"otherASTnameFromSourceFile = %s \n",otherASTnameFromSourceFile.c_str());
15860 while (i != snippet_scope_list.rend())
15866#if DEBUG_FIND_ASSOCIATED_DECLARATION
15867 printf (
"snippet_AST_scope list *i = %p = %s \n",*i,(*i)->class_name().c_str());
15869 printf (
" --- target_AST_scope = %p = %s \n",target_AST_scope,target_AST_scope ->class_name().c_str());
15876#if DEBUG_FIND_ASSOCIATED_DECLARATION
15877 SgSourceFile* otherSourceFile = SageInterface::getEnclosingNode<SgSourceFile>(targetScope,
true);
15878 string otherASTnameFromSourceFile = otherSourceFile->
getFileName();
15879 printf (
" --- otherASTnameFromSourceFile = %s \n",otherASTnameFromSourceFile.c_str());
15884 if (classDefinition != NULL)
15887 SgName className = classDeclaration->get_name();
15888#if DEBUG_FIND_ASSOCIATED_DECLARATION
15889 printf (
" --- Found snippet class name = %s \n",className.str());
15891 SgClassSymbol* classSymbol = target_AST_scope->lookup_class_symbol(className);
15892 ROSE_ASSERT(classSymbol != NULL);
15893 ROSE_ASSERT(classSymbol->get_declaration() != NULL);
15894#if DEBUG_FIND_ASSOCIATED_DECLARATION
15895 printf (
" --- Associated symbol in taget AST: declaration = %p name = %s \n",classSymbol->get_declaration(),classSymbol->get_declaration()->get_name().str());
15898 returnSymbol = classSymbol;
15901 SgClassDeclaration* temp_classDeclaration_in_target_ast = classSymbol->get_declaration();
15902 ROSE_ASSERT(temp_classDeclaration_in_target_ast != NULL);
15904 ROSE_ASSERT(classDeclaration_in_target_ast != NULL);
15905 SgClassDefinition* classDefinition_in_target_ast = classDeclaration_in_target_ast->get_definition();
15906 ROSE_ASSERT(classDefinition_in_target_ast != NULL);
15913 target_AST_scope = classDefinition_in_target_ast;
15921 if (functionDefinition != NULL)
15923 printf (
"ERROR: Found an unusual case of SgFunctionDefinition in list of scopes holding a declaration for a type \n");
15928 if (namespaceDefinition != NULL)
15932#if DEBUG_FIND_ASSOCIATED_DECLARATION
15933 printf (
" --- Found snippet namespace name = %s \n",namespaceName.str());
15935 SgNamespaceSymbol* namespaceSymbol = target_AST_scope->lookup_namespace_symbol(namespaceName);
15936 ROSE_ASSERT(namespaceSymbol != NULL);
15939#if DEBUG_FIND_ASSOCIATED_DECLARATION
15943 returnSymbol = namespaceSymbol;
15950 target_AST_scope = otherASTnamespaceDeclaration->
get_definition();
15959#if DEBUG_FIND_ASSOCIATED_DECLARATION
15960 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());
15963 SgSourceFile* otherSourceFile = SageInterface::getEnclosingNode<SgSourceFile>(target_AST_scope,
true);
15964 string otherASTnameFromSourceFile = otherSourceFile->
getFileName();
15965 printf (
" --- At base of loop: otherASTnameFromSourceFile = %s \n",otherASTnameFromSourceFile.c_str());
15972#if DEBUG_FIND_ASSOCIATED_DECLARATION
15973 printf (
"##### Now based on the kind of declaration, search for that same named declaration in the target_AST_scope = %p = %s \n",
15974 target_AST_scope,target_AST_scope->
class_name().c_str());
15980 switch (snippet_declaration->
variantT())
15982 case V_SgClassDeclaration:
15984 SgClassDeclaration* snippet_classDeclaration = isSgClassDeclaration(snippet_declaration);
15985 ROSE_ASSERT(snippet_classDeclaration != NULL);
15987 SgName snippet_className = snippet_classDeclaration->get_name();
15989#if DEBUG_FIND_ASSOCIATED_DECLARATION
15990 printf (
"snippet snippet declaration's class name = %s \n",snippet_className.str());
15992 SgClassSymbol* target_symbol = target_AST_scope->lookup_class_symbol(snippet_className);
15993 ROSE_ASSERT(target_symbol != NULL);
15994 returnSymbol = target_symbol;
15996 SgClassSymbol* classSymbolInTargetAST = isSgClassSymbol(returnSymbol);
15997 ROSE_ASSERT(classSymbolInTargetAST != NULL);
15998 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
15999 ROSE_ASSERT(target_classDeclaration != NULL);
16001#if DEBUG_FIND_ASSOCIATED_DECLARATION
16002 printf (
"snippet: classDeclaration = %p = %s \n",snippet_classDeclaration,snippet_classDeclaration->get_name().str());
16003 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
16005 ROSE_ASSERT(snippet_classDeclaration->get_name() == target_classDeclaration->get_name());
16009 case V_SgTypedefDeclaration:
16011 SgTypedefDeclaration* snippet_typedefDeclaration = isSgTypedefDeclaration(snippet_declaration);
16012 ROSE_ASSERT(snippet_typedefDeclaration != NULL);
16014 SgName snippet_typedefName = snippet_typedefDeclaration->get_name();
16016#if DEBUG_FIND_ASSOCIATED_DECLARATION
16017 printf (
"snippet snippet declaration's typedef name = %s \n",snippet_typedefName.str());
16019 SgTypedefSymbol* target_symbol = target_AST_scope->lookup_typedef_symbol(snippet_typedefName);
16020 ROSE_ASSERT(target_symbol != NULL);
16021 returnSymbol = target_symbol;
16023 SgTypedefSymbol* typedefSymbolInTargetAST = isSgTypedefSymbol(returnSymbol);
16024 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
16025 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
16026 ROSE_ASSERT(target_typedefDeclaration != NULL);
16028#if DEBUG_FIND_ASSOCIATED_DECLARATION
16029 printf (
"snippet: typedefDeclaration = %p = %s \n",snippet_typedefDeclaration,snippet_typedefDeclaration->get_name().str());
16030 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
16032 ROSE_ASSERT(snippet_typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
16036 case V_SgEnumDeclaration:
16038 SgEnumDeclaration* snippet_enumDeclaration = isSgEnumDeclaration(snippet_declaration);
16039 ROSE_ASSERT(snippet_enumDeclaration != NULL);
16043#if DEBUG_FIND_ASSOCIATED_DECLARATION
16044 printf (
"snippet snippet declaration's enum name = %s \n",snippet_enumName.str());
16047 bool isUnNamed = snippet_enumDeclaration->get_isUnNamed();
16048 if (isUnNamed ==
false)
16052 if (target_symbol == NULL)
16056 printf (
"scope = %p = %s \n",scope,scope->
class_name().c_str());
16057 scope->
get_file_info()->display(
"case V_SgEnumDeclaration: target_symbol == NULL: scope: debug");
16059 ROSE_ASSERT(target_symbol != NULL);
16060 returnSymbol = target_symbol;
16062 SgEnumSymbol* enumSymbolInTargetAST = isSgEnumSymbol(returnSymbol);
16063 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
16064 SgEnumDeclaration* target_enumDeclaration = isSgEnumDeclaration(enumSymbolInTargetAST->get_declaration());
16065 ROSE_ASSERT(target_enumDeclaration != NULL);
16067#if DEBUG_FIND_ASSOCIATED_DECLARATION
16068 printf (
"snippet: enumDeclaration = %p = %s \n",snippet_enumDeclaration,snippet_enumDeclaration->
get_name().str());
16069 printf (
"target: enumDeclaration = %p = %s \n",target_enumDeclaration,target_enumDeclaration->
get_name().str());
16071 ROSE_ASSERT(snippet_enumDeclaration->
get_name() == target_enumDeclaration->
get_name());
16076 printf (
"Warning: can't handle unnamed enum declarations \n");
16077 ROSE_ASSERT(returnSymbol == NULL);
16083 case V_SgTemplateMemberFunctionDeclaration:
16085 case V_SgTemplateFunctionDeclaration:
16087 case V_SgMemberFunctionDeclaration:
16088 case V_SgFunctionDeclaration:
16091 ROSE_ASSERT(snippet_functionDeclaration != NULL);
16093#if DEBUG_FIND_ASSOCIATED_DECLARATION
16094 printf (
"snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16096 SgName snippet_functionName = snippet_functionDeclaration->get_name();
16098#if DEBUG_FIND_ASSOCIATED_DECLARATION
16099 printf (
"snippet snippet declaration's function name = %s \n",snippet_functionName.str());
16100 printf (
" --- target_AST_scope = %p = %s \n",target_AST_scope,target_AST_scope->
class_name().c_str());
16102 SgFunctionSymbol* target_symbol = target_AST_scope->lookup_function_symbol(snippet_functionName);
16103 ROSE_ASSERT(target_symbol != NULL);
16104 returnSymbol = target_symbol;
16106 SgFunctionSymbol* functionSymbolInTargetAST = isSgFunctionSymbol(returnSymbol);
16107 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
16108 SgFunctionDeclaration* target_functionDeclaration = isSgFunctionDeclaration(functionSymbolInTargetAST->get_declaration());
16109 ROSE_ASSERT(target_functionDeclaration != NULL);
16111#if DEBUG_FIND_ASSOCIATED_DECLARATION
16112 printf (
"snippet: functionDeclaration = %p = %s \n",snippet_functionDeclaration,snippet_functionDeclaration->get_name().str());
16113 printf (
"target: functionDeclaration = %p = %s \n",target_functionDeclaration,target_functionDeclaration->get_name().str());
16114 printf (
"isDefiningDeclaration = %s \n",isDefiningDeclaration ?
"true" :
"false");
16116 if (isDefiningDeclaration ==
true)
16118#if DEBUG_FIND_ASSOCIATED_DECLARATION
16119 printf (
"get the defining declaration instead of the firstNondefining declaration from the function symbol \n");
16124 ROSE_ASSERT(snippet_functionDeclaration->get_name() == target_functionDeclaration->get_name());
16130 printf (
"Error: default reached in switch: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16135 ROSE_ASSERT(returnDeclaration != NULL);
16142 return returnDeclaration;
16150 SgType* returnType = NULL;
16152 ROSE_ASSERT(snippet_type != NULL);
16153 ROSE_ASSERT(targetScope != NULL);
16161 SgType* type_copy = snippet_type;
16162 printf (
"(before type_copy->getInternalTypes()): type_copy = %p = %s \n",type_copy,type_copy->
class_name().c_str());
16165 SgNamedType* namedType = isSgNamedType(snippet_type);
16166 if (namedType != NULL)
16170 ROSE_ASSERT(snippet_declaration != NULL);
16172 printf (
"Need to find the declaration in the target AST that is associated with the snippet_declaration in the snippet AST \n");
16173 printf (
" --- snippet_declaration = %p = %s = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str(),
SageInterface::get_name(snippet_declaration).c_str());
16178 case V_SgClassType:
16181 if (classDeclaration != NULL)
16184 if (classSymbolInTargetAST == NULL)
16191 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");
16192 printf (
" --- Looking for target AST match for class name = %s \n",classDeclaration->get_name().str());
16195 ROSE_ASSERT(symbol != NULL);
16197 classSymbolInTargetAST = isSgClassSymbol(symbol);
16200 ROSE_ASSERT(classSymbolInTargetAST != NULL);
16201 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
16202 ROSE_ASSERT(target_classDeclaration != NULL);
16204 printf (
"snippet: classDeclaration = %p = %s \n",classDeclaration,classDeclaration->get_name().str());
16205 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
16207 ROSE_ASSERT(classDeclaration->get_name() == target_classDeclaration->get_name());
16209 returnType = classSymbolInTargetAST->
get_type();
16214 case V_SgTypedefType:
16217 if (typedefDeclaration != NULL)
16224 if (typedefSymbolInTargetAST == NULL)
16227 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");
16228 printf (
" --- The target AST must have a valid typedef type (and associated declaration) to support resetting the SgTypedefType: %p \n",typedefDeclaration->get_type());
16233 ROSE_ASSERT(symbol != NULL);
16235 typedefSymbolInTargetAST = isSgTypedefSymbol(symbol);
16241 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
16242 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
16243 ROSE_ASSERT(target_typedefDeclaration != NULL);
16245 printf (
"snippet: typedefDeclaration = %p = %s \n",typedefDeclaration,typedefDeclaration->get_name().str());
16246 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
16248 ROSE_ASSERT(typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
16250 returnType = typedefSymbolInTargetAST->
get_type();
16258 if (enumDeclaration != NULL)
16260 ROSE_ASSERT(enumDeclaration->
get_name().is_null() ==
false);
16266 if (enumSymbolInTargetAST == NULL)
16268 printf (
"Error: It is an error to not have a enum type defined in the target AST! \n");
16269 printf (
" --- The target AST must have a valid enum type (and associated declaration) to support resetting the SgEnumType: %p \n",enumDeclaration->
get_type());
16272 returnType = snippet_type;
16279 returnType = enumSymbolInTargetAST->
get_type();
16286 case V_SgJavaParameterizedType:
16292 printf (
"In getTargetFileTypeSupport(): case V_SgJavaParameterizedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16296 if (classDeclaration != NULL)
16299 printf (
"Looking for classDeclaration = %s \n",classDeclaration->get_name().str());
16302 ROSE_ASSERT(javaParameterizedType != NULL);
16306 ROSE_ASSERT(templateParameterListNode != NULL);
16307 SgTemplateParameterPtrList* templateParameterList = &templateParameterListNode->get_args();
16315 printf (
"Calling lookupTemplateClassSymbolInParentScopes() name = %s \n",classDeclaration->get_name().str());
16320 printf (
"DONE: Calling lookupTemplateClassSymbolInParentScopes() \n");
16323 printf (
"targetScope->get_symbol_table()->size() = %d \n",targetScope->
get_symbol_table()->
size());
16324 if (templateClassSymbolInTargetAST == NULL)
16330 if (templateClassSymbolInTargetAST == NULL)
16333 printf (
"Calling findAssociatedSymbolInTargetAST \n");
16336 ROSE_ASSERT(symbol != NULL);
16338 templateClassSymbolInTargetAST = isSgClassSymbol(symbol);
16340 ROSE_ASSERT(templateClassSymbolInTargetAST != NULL);
16344 ROSE_ASSERT(templateClassSymbolInTargetAST != NULL);
16346 returnType = templateClassSymbolInTargetAST->
get_type();
16350 if (javaParameterizedType != NULL)
16354 returnType = javaParameterizedType;
16356 SgType* internal_type = javaParameterizedType->get_raw_type();
16357 ROSE_ASSERT(internal_type != NULL);
16361 printf (
"SgJavaParameterizedType not yet tested! \n");
16367 case V_SgJavaQualifiedType:
16378 printf (
"In getTargetFileTypeSupport(): case V_SgJavaQualifiedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16381 if (javaQualifiedType != NULL)
16384 returnType = javaQualifiedType;
16386 SgType* internal_type_1 = javaQualifiedType->get_parent_type();
16387 ROSE_ASSERT(internal_type_1 != NULL);
16388 SgType* internal_type_2 = javaQualifiedType->get_type();
16389 ROSE_ASSERT(internal_type_2 != NULL);
16392 printf (
"Case of SgJavaQualifiedType: not yet handled: commented out assertion! \n");
16397 case V_SgJavaWildcardType:
16406 printf (
"In getTargetFileTypeSupport(): case V_SgJavaWildcardType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16409 if (javaWildcardType != NULL)
16412 returnType = javaWildcardType;
16415 printf (
"SgJavaWildcardType not yet tested! \n");
16421 printf (
"Error: In getTargetFileTypeSupport(): default reached in switch: namedType = %p = %s \n",namedType,namedType->
class_name().c_str());
16426 ROSE_ASSERT(returnType != NULL);
16428 printf (
"Exiting as a test! \n");
16447 SgType* returnType = NULL;
16449 ROSE_ASSERT(snippet_type != NULL);
16450 ROSE_ASSERT(targetScope != NULL);
16454 SgType* type_copy = snippet_type;
16457 printf (
"(before type_copy->getInternalTypes()): type_copy = %p = %s \n",type_copy,type_copy->
class_name().c_str());
16464 for (
size_t i = 0; i < typeList.size(); i++)
16466 printf (
"Input type: typeList[i=%" PRIuPTR
"] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
16474 SgNamedType* namedType = isSgNamedType(snippet_type);
16478 if (namedType != NULL)
16482 ROSE_ASSERT(snippet_declaration != NULL);
16484 printf (
"Need to find the declaration in the target AST that is associated with the snippet_declaration in the snippet AST \n");
16485 printf (
" --- snippet_declaration = %p = %s = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str(),
SageInterface::get_name(snippet_declaration).c_str());
16490 case V_SgClassType:
16493 if (classDeclaration != NULL)
16496 if (classSymbolInTargetAST == NULL)
16503 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");
16504 printf (
" --- Looking for target AST match for class name = %s \n",classDeclaration->get_name().str());
16507 ROSE_ASSERT(symbol != NULL);
16509 classSymbolInTargetAST = isSgClassSymbol(symbol);
16512 ROSE_ASSERT(classSymbolInTargetAST != NULL);
16513 SgClassDeclaration* target_classDeclaration = isSgClassDeclaration(classSymbolInTargetAST->get_declaration());
16514 ROSE_ASSERT(target_classDeclaration != NULL);
16516 printf (
"snippet: classDeclaration = %p = %s \n",classDeclaration,classDeclaration->get_name().str());
16517 printf (
"target: classDeclaration = %p = %s \n",target_classDeclaration,target_classDeclaration->get_name().str());
16519 ROSE_ASSERT(classDeclaration->get_name() == target_classDeclaration->get_name());
16521 returnType = classSymbolInTargetAST->
get_type();
16526 case V_SgTypedefType:
16529 if (typedefDeclaration != NULL)
16536 if (typedefSymbolInTargetAST == NULL)
16539 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");
16540 printf (
" --- The target AST must have a valid typedef type (and associated declaration) to support resetting the SgTypedefType: %p \n",typedefDeclaration->get_type());
16545 ROSE_ASSERT(symbol != NULL);
16547 typedefSymbolInTargetAST = isSgTypedefSymbol(symbol);
16553 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
16554 SgTypedefDeclaration* target_typedefDeclaration = isSgTypedefDeclaration(typedefSymbolInTargetAST->get_declaration());
16555 ROSE_ASSERT(target_typedefDeclaration != NULL);
16557 printf (
"snippet: typedefDeclaration = %p = %s \n",typedefDeclaration,typedefDeclaration->get_name().str());
16558 printf (
"target: typedefDeclaration = %p = %s \n",target_typedefDeclaration,target_typedefDeclaration->get_name().str());
16560 ROSE_ASSERT(typedefDeclaration->get_name() == target_typedefDeclaration->get_name());
16562 returnType = typedefSymbolInTargetAST->
get_type();
16570 if (enumDeclaration != NULL)
16572 ROSE_ASSERT(enumDeclaration->
get_name().is_null() ==
false);
16578 if (enumSymbolInTargetAST == NULL)
16580 printf (
"Error: It is an error to not have a enum type defined in the target AST! \n");
16581 printf (
" --- The target AST must have a valid enum type (and associated declaration) to support resetting the SgEnumType: %p \n",enumDeclaration->
get_type());
16584 returnType = snippet_type;
16591 returnType = enumSymbolInTargetAST->
get_type();
16598 case V_SgJavaParameterizedType:
16604 printf (
"In getTargetFileType(): case V_SgJavaParameterizedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16607 if (classDeclaration != NULL)
16609 SgTemplateParameterPtrList* templateParameterList = NULL;
16610 SgTemplateArgumentPtrList* templateSpecializationArgumentList = NULL;
16614 ROSE_ASSERT(templateClassSymbolInTargetAST != NULL);
16616 returnType = templateClassSymbolInTargetAST->
get_type();
16620 if (javaParameterizedType != NULL)
16623 returnType = javaParameterizedType;
16625 SgType* internal_type = javaParameterizedType->get_raw_type();
16626 ROSE_ASSERT(internal_type != NULL);
16629 printf (
"SgJavaParameterizedType not yet tested! \n");
16633 case V_SgJavaQualifiedType:
16640 printf (
"In getTargetFileType(): case V_SgJavaQualifiedType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16643 if (javaQualifiedType != NULL)
16646 returnType = javaQualifiedType;
16648 SgType* internal_type_1 = javaQualifiedType->get_parent_type();
16649 ROSE_ASSERT(internal_type_1 != NULL);
16650 SgType* internal_type_2 = javaQualifiedType->get_type();
16651 ROSE_ASSERT(internal_type_2 != NULL);
16654 printf (
"SgJavaQualifiedType not yet tested! \n");
16658 case V_SgJavaWildcardType:
16667 printf (
"In getTargetFileType(): case V_SgJavaWildcardType: snippet_declaration = %p = %s \n",snippet_declaration,snippet_declaration->
class_name().c_str());
16670 if (javaWildcardType != NULL)
16673 returnType = javaWildcardType;
16675 SgType* internal_type_1 = javaWildcardType->get_bound_type();
16679 printf (
"SgJavaWildcardType not yet tested! \n");
16685 printf (
"Error: In getTargetFileType(): default reached in switch: namedType = %p = %s \n",namedType,namedType->
class_name().c_str());
16690 ROSE_ASSERT(returnType != NULL);
16692 printf (
"Exiting as a test! \n");
16705 SgType* new_type = returnType;
16709 if (new_type != NULL && typeList.size() > 1)
16711 int size = (int)typeList.size();
16712 for (
int i = size - 2; i >= 0; i--)
16715 printf (
"Rebuild type: typeList[i=%d] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
16718 switch(typeList[i]->variantT())
16720 case V_SgModifierType:
16723 ROSE_ASSERT(modifierType != NULL);
16724 if (modifierType->
get_typeModifier().get_constVolatileModifier().isConst() ==
true)
16726 ROSE_ASSERT(new_type != NULL);
16728 printf (
"Building a SgModifierType: calling buildConstType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
16735 printf (
"Modifier kind not handled (not implemented) check what sort of modifier this is: \n");
16742 case V_SgTypedefType:
16745 ROSE_ASSERT(typedefType != NULL);
16751 ROSE_ASSERT(new_typedefType != NULL);
16752 ROSE_ASSERT(isSgTypedefType(new_typedefType) != NULL);
16754 new_type = new_typedefType;
16756 printf (
"ERROSE: SgTypedefType kind not handled (not implemented) \n");
16762 case V_SgPointerType:
16765 ROSE_ASSERT(pointerType != NULL);
16767 printf (
"Building a SgPointerType: calling buildPointerType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
16769 ROSE_ASSERT(new_type != NULL);
16772 printf (
"ERROSE: SgPointerType kind not handled (not implemented) \n");
16780 printf (
"Error: default reached in evaluation of typelist: typeList[i] = %p = %s \n",typeList[i],typeList[i]->class_name().c_str());
16786 returnType = new_type;
16790 if (typeList.size() > 1)
16792 printf (
"Exiting as a test! \n");
16807 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());
16811 SgStatement* statement_copy = isSgStatement(node_copy);
16812 SgStatement* statement_original = isSgStatement(node_original);
16813 if (statement_copy != NULL)
16820 ROSE_ASSERT(statement_original != NULL);
16822 ROSE_ASSERT(scope_copy != NULL);
16823 ROSE_ASSERT(scope_original != NULL);
16830 printf (
"Warning: SgStatement: scope = %p = %s \n",scope_original,scope_original->
class_name().c_str());
16835 ROSE_ASSERT(snippetFile != NULL);
16836 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
16838 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
16841 if (failOnWarning ==
true)
16843 printf (
"Exit on warning! \n");
16848 SgNode* insertionPointScope = (insertionPointIsScope ==
true) ? insertionPoint : insertionPoint->get_parent();
16849 printf (
"insertionPointIsScope = %s insertionPointScope = %p = %s \n",insertionPointIsScope ?
"true" :
"false",insertionPointScope,insertionPointScope->
class_name().c_str());
16868 printf (
"SgClassDeclaration: Exiting as a test! \n");
16872 if (TransformationSupport::getFile(scope) != targetFile)
16874 printf (
"Warning: SgStatement: scope = %p = %s \n",scope,scope->
class_name().c_str());
16875 SgFile* snippetFile = TransformationSupport::getFile(scope);
16876 ROSE_ASSERT(snippetFile != NULL);
16877 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
16879 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
16889 if (declarationStatement_copy != NULL)
16899 if (snippetFile != NULL && snippetFile != targetFile)
16904 printf (
"Note: SgDeclarationStatement: firstNondefiningDeclaration_original is not in target file (allowed for merged ASTs) \n");
16907 if (failOnWarning ==
true)
16909 printf (
"Exit on warning! \n");
16916 if (snippetFile == NULL)
16918 printf (
"Note: firstNondefiningDeclaration_original = %p getEnclosingFileNode() returned NULL \n",firstNondefiningDeclaration_original);
16920 if (failOnWarning ==
true)
16922 printf (
"Exit on warning! \n");
16930 if (definingDeclaration_original != NULL)
16937 if (snippetFile != NULL && snippetFile != targetFile)
16940 printf (
"Warning: SgDeclarationStatement: definingDeclaration is not in target file \n");
16943 if (failOnWarning ==
true)
16945 printf (
"Exit on warning! \n");
16949 if (declarationStatement_original == definingDeclaration_original)
16958 if (snippetFile == NULL)
16960 printf (
"Note: definingDeclaration_original = %p getEnclosingFileNode() returned NULL \n",definingDeclaration_original);
16962 if (failOnWarning ==
true)
16964 printf (
"Exit on warning! \n");
16974 if (expression != NULL)
16984 ROSE_ASSERT(type != NULL);
16989 printf (
"Leaving errorCheckingTargetAST() \n");
17003 T* classDeclaration_copy_defining =
dynamic_cast<T*
>(classDeclaration_copy->get_definingDeclaration());
17004 T* classDeclaration_copy_nondefining =
dynamic_cast<T*
>(classDeclaration_copy->get_firstNondefiningDeclaration());
17005 T* classDeclaration_original_defining =
dynamic_cast<T*
>(classDeclaration_original->get_definingDeclaration());
17006 T* classDeclaration_original_nondefining =
dynamic_cast<T*
>(classDeclaration_original->get_firstNondefiningDeclaration());
17009 if (classDeclaration_copy_defining != NULL && classDeclaration_copy_defining->get_scope() == classDeclaration_original_defining->get_scope())
17012 printf (
"reset the scope of classDeclaration_copy_defining \n");
17014 classDeclaration_copy_defining->set_scope(targetScope);
17018 if (classDeclaration_copy_nondefining != NULL && classDeclaration_copy_nondefining->get_scope() == classDeclaration_original_nondefining->get_scope())
17021 printf (
"reset the scope of classDeclaration_copy_nondefining \n");
17023 classDeclaration_copy_nondefining->set_scope(targetScope);
17027 if (classDeclaration_copy_nondefining != NULL && classDeclaration_copy_nondefining->get_parent() == classDeclaration_original_nondefining->get_parent())
17030 printf (
"reset the parent of classDeclaration_copy_nondefining \n");
17032 classDeclaration_copy_nondefining->set_parent(classDeclaration_copy->get_parent());
17057 printf (
"In fixupCopyOfNodeFromSeperateFileInNewTargetAst: node_copy = %p = %s \n",node_copy,node_copy->
class_name().c_str());
17061 printf (
"Disabled fixupCopyOfNodeFromSeperateFileInNewTargetAst() \n");
17069 printf (
" --- targetFile = %p = %s \n",targetFile,targetFile->get_sourceFileNameWithPath().c_str());
17070 printf (
" --- insertionPointIsScope = %s \n",insertionPointIsScope ?
"true" :
"false");
17077 SgNode* insertionPointScope = (insertionPointIsScope ==
true) ? insertionPoint : insertionPoint->
get_parent();
17079 printf (
"insertionPointScope = %p = %s \n",insertionPointScope,insertionPointScope->class_name().c_str());
17082 ROSE_ASSERT(targetScope != NULL);
17094 SgStatement* statement_copy = isSgStatement(node_copy);
17095 SgStatement* statement_original = isSgStatement(node_original);
17096 if (statement_copy != NULL)
17104 ROSE_ASSERT(scope_copy != NULL);
17105 ROSE_ASSERT(scope_original != NULL);
17111 printf (
"Warning: SgStatement: scope = %p = %s \n",scope_original,scope_original->
class_name().c_str());
17115 ROSE_ASSERT(snippetFile != NULL);
17116 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
17118 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
17123 SgNode* insertionPointScope = (insertionPointIsScope ==
true) ? insertionPoint : insertionPoint->
get_parent();
17124 printf (
"insertionPointIsScope = %s insertionPointScope = %p = %s \n",insertionPointIsScope ?
"true" :
"false",insertionPointScope,insertionPointScope->
class_name().c_str());
17143 printf (
"SgClassDeclaration: Exiting as a test! \n");
17147 if (TransformationSupport::getFile(scope) != targetFile)
17149 printf (
"Warning: SgStatement: scope = %p = %s \n",scope,scope->
class_name().c_str());
17150 SgFile* snippetFile = TransformationSupport::getFile(scope);
17151 ROSE_ASSERT(snippetFile != NULL);
17152 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
17154 printf (
"Warning: SgStatement: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
17166 if (declarationStatement_copy != NULL)
17173 if (snippetFile != NULL && snippetFile != targetFile)
17178 printf (
"Note: SgDeclarationStatement: firstNondefiningDeclaration_original is not in target file (allowed for merged ASTs) \n");
17185 if (snippetFile == NULL)
17187 printf (
"Note: firstNondefiningDeclaration_original = %p getEnclosingFileNode() returned NULL \n",firstNondefiningDeclaration_original);
17194 if (definingDeclaration_original != NULL)
17199 if (snippetFile != NULL && snippetFile != targetFile)
17202 printf (
"Warning: SgDeclarationStatement: definingDeclaration is not in target file \n");
17205 if (declarationStatement_original == definingDeclaration_original)
17214 if (snippetFile == NULL)
17216 printf (
"Note: definingDeclaration_original = %p getEnclosingFileNode() returned NULL \n",definingDeclaration_original);
17228 if (expression != NULL)
17238 ROSE_ASSERT(type != NULL);
17243 if (new_type != NULL)
17253 case V_SgInitializedName:
17256 SgInitializedName* initializedName_original = isSgInitializedName(node_original);
17263 SgStatement* enclosingStatement_copy = TransformationSupport::getStatement(initializedName_copy);
17265 printf (
"enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
17271 ROSE_ASSERT(scope_copy != NULL);
17272 ROSE_ASSERT(scope_original != NULL);
17278 ROSE_ASSERT(initializedName_copy != NULL);
17279 printf (
"initializedName_copy = %p = %s \n",initializedName_copy,initializedName_copy->get_name().str());
17280 ROSE_ASSERT(initializedName_original != NULL);
17281 printf (
"initializedName_original = %p = %s \n",initializedName_original,initializedName_original->get_name().str());
17282 SgType* initializedName_original_type = initializedName_original->get_type();
17283 printf (
"initializedName_original_type = %p = %s \n",initializedName_original_type,initializedName_original_type->
class_name().c_str());
17284 SgClassType* classType = isSgClassType(initializedName_original_type);
17286 if (classType != NULL)
17288 SgClassDeclaration* classDeclaration = isSgClassDeclaration(classType->get_declaration());
17289 ROSE_ASSERT(classDeclaration != NULL);
17290 printf (
"classDeclaration = %p = %s \n",classDeclaration,classDeclaration->get_name().str());
17294 printf (
"Warning: case V_SgInitializedName: scope_copy = %p = %s \n",scope_copy,scope_copy->
class_name().c_str());
17295 printf (
"Warning: case V_SgInitializedName: scope_original = %p = %s \n",scope_original,scope_original->
class_name().c_str());
17297 printf (
"Warning: case V_SgInitializedName: initializedName_copy->get_parent() = %p \n",initializedName_copy->
get_parent());
17298 printf (
"Warning: case V_SgInitializedName: initializedName_original->get_parent() = %p \n",initializedName_original->
get_parent());
17303 ROSE_ASSERT(snippetFile != NULL);
17304 ROSE_ASSERT(snippetFile->get_sourceFileNameWithPath().empty() ==
false);
17306 printf (
"Warning: case V_SgInitializedName: scope not in target file (snippetFile = %p = %s) \n",snippetFile,snippetFile->get_sourceFileNameWithPath().c_str());
17312 SgType* type_copy = initializedName_copy->get_type();
17314 printf (
"(before type_copy->getInternalTypes()): type_copy = %p = %s \n",type_copy,type_copy->
class_name().c_str());
17324 for (
size_t i = 0; i < typeList.size(); i++)
17326 printf (
"Input type: typeList[i=%" PRIuPTR
"] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
17335 if (new_type != NULL && typeList.size() > 1)
17337 int size = (int)typeList.size();
17338 for (
int i = size - 2; i >= 0; i--)
17341 printf (
"Rebuild type: typeList[i=%d] = %p = %s \n",i,typeList[i],typeList[i]->class_name().c_str());
17344 switch(typeList[i]->variantT())
17346 case V_SgModifierType:
17349 ROSE_ASSERT(modifierType != NULL);
17350 if (modifierType->
get_typeModifier().get_constVolatileModifier().isConst() ==
true)
17352 ROSE_ASSERT(new_type != NULL);
17354 printf (
"Building a SgModifierType: calling buildConstType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
17361 printf (
"Modifier kind not handled (not implemented) check what sort of modifier this is: \n");
17370 case V_SgTypedefType:
17373 ROSE_ASSERT(typedefType != NULL);
17377 ROSE_ASSERT(new_typedefType != NULL);
17378 ROSE_ASSERT(isSgTypedefType(new_typedefType) != NULL);
17380 new_type = new_typedefType;
17382 printf (
"ERROSE: SgTypedefType kind not handled (not implemented) \n");
17390 case V_SgPointerType:
17393 ROSE_ASSERT(pointerType != NULL);
17395 printf (
"Building a SgPointerType: calling buildPointerType(): new_type = %p = %s \n",new_type,new_type->
class_name().c_str());
17397 ROSE_ASSERT(new_type != NULL);
17400 printf (
"ERROSE: SgPointerType kind not handled (not implemented) \n");
17410 printf (
"Error: default reached in evaluation of typelist: typeList[i] = %p = %s \n",typeList[i],typeList[i]->class_name().c_str());
17417 if (typeList.size() > 1)
17419 printf (
"Exiting as a test! \n");
17433 printf (
"new_type = %p \n",new_type);
17435 if (new_type != NULL)
17439 printf (
"Reset type for initializedName_copy = %p from type = %p to type = %p \n",initializedName_copy,initializedName_copy->get_type(),new_type);
17441 SgType* original_type = initializedName_copy->get_type();
17442 SgNamedType* original_named_type = isSgNamedType(original_type);
17443 SgNamedType* new_named_type = isSgNamedType(new_type);
17444 if (original_named_type != NULL)
17446 ROSE_ASSERT(new_named_type != NULL);
17447 SgClassDeclaration* original_classDeclaration = isSgClassDeclaration(original_named_type->get_declaration());
17448 SgClassDeclaration* new_classDeclaration = isSgClassDeclaration(new_named_type->get_declaration());
17449 if (original_classDeclaration != NULL)
17451 ROSE_ASSERT(new_classDeclaration != NULL);
17453 printf (
"original_classDeclaration = %p = %s \n",original_classDeclaration,original_classDeclaration->get_name().str());
17454 printf (
"new_classDeclaration = %p = %s \n",new_classDeclaration,new_classDeclaration->get_name().str());
17457 ROSE_ASSERT(new_classDeclaration->get_name() == original_classDeclaration->get_name());
17461 SgType* old_type = initializedName_copy->get_type();
17462 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());
17464 initializedName_copy->set_type(new_type);
17467 printf (
"enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
17470 if (functionParameterList != NULL)
17477 ROSE_ASSERT(functionDeclaration != NULL);
17479 if (functionDefinition != NULL)
17481 ROSE_ASSERT(initializedName_copy->get_scope() == functionDefinition);
17487 ROSE_ASSERT(globalScope != NULL);
17488 if (initializedName_copy->get_scope() != globalScope)
17491 printf (
"Reset scope for initializedName_copy = %p = %s \n",initializedName_copy,initializedName_copy->get_name().str());
17493 initializedName_copy->set_scope(globalScope);
17495 ROSE_ASSERT(initializedName_copy->get_scope() == globalScope);
17501 printf (
"initializedName_copy->get_scope() = %p = %s \n",initializedName_copy->get_scope(),initializedName_copy->get_scope()->
class_name().c_str());
17503 SgEnumDeclaration* enumDeclaration = isSgEnumDeclaration(enclosingStatement_copy);
17504 if (enumDeclaration != NULL)
17514 SgName name = initializedName_copy->get_name();
17515 SgSymbol* symbol = initializedName_copy->get_scope()->lookup_enum_field_symbol(name);
17516 ROSE_ASSERT(symbol != NULL);
17519 ROSE_ASSERT(enumFieldSymbol != NULL);
17524 ROSE_ASSERT(new_enumFieldSymbol != NULL);
17530 initializedName_copy->set_scope(targetScope);
17532 printf (
"Exiting as a test! \n");
17539 printf (
"enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
17542 if (catchOptionStatement != NULL)
17545 ROSE_ASSERT(variableDeclaration != NULL);
17548 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(initializedName_original);
17549 ROSE_ASSERT(enclosingStatement_original != NULL);
17554 if (symbol == NULL)
17556 printf (
"ERROR: (symbol == NULL): initializedName_copy->get_name() = %s \n",initializedName_copy->get_name().str());
17559 ROSE_ASSERT(symbol != NULL);
17561 initializedName_copy->set_scope(targetScope);
17564 ROSE_ASSERT(new_variableSymbol != NULL);
17567 targetScope->
insert_symbol(initializedName_copy->get_name(),new_variableSymbol);
17573 if (javaForEachStatement != NULL)
17576 ROSE_ASSERT(variableDeclaration != NULL);
17578 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(initializedName_original);
17579 ROSE_ASSERT(enclosingStatement_original != NULL);
17583 if (symbol == NULL)
17585 printf (
"ERROR: (symbol == NULL): initializedName_copy->get_name() = %s \n",initializedName_copy->get_name().str());
17588 ROSE_ASSERT(symbol != NULL);
17590 initializedName_copy->set_scope(targetScope);
17593 ROSE_ASSERT(new_variableSymbol != NULL);
17596 targetScope->
insert_symbol(initializedName_copy->get_name(),new_variableSymbol);
17598 printf (
"Need to handle case of SgJavaForEachStatement \n");
17606 if (symbol == NULL)
17608 printf (
"ERROR: enclosingStatement_copy = %p = %s \n",enclosingStatement_copy,enclosingStatement_copy->
class_name().c_str());
17609 ROSE_ASSERT(enclosingStatement_copy->
get_parent() != NULL);
17610 printf (
"ERROR: enclosingStatement_copy->get_parent() = %p = %s \n",enclosingStatement_copy->
get_parent(),enclosingStatement_copy->
get_parent()->
class_name().c_str());
17611 printf (
"ERROR: (symbol == NULL): initializedName_copy->get_name() = %s \n",initializedName_copy->get_name().str());
17612 initializedName_original->
get_file_info()->display(
"ERROR: (symbol == NULL): debug");
17615 SgScopeStatement* initializedName_copy_scope = isSgScopeStatement(initializedName_copy->get_scope());
17616 ROSE_ASSERT(initializedName_copy_scope != NULL);
17617 SgVariableSymbol* variableSymbol = initializedName_copy_scope->lookup_variable_symbol(initializedName_copy->get_name());
17618 ROSE_ASSERT(variableSymbol != NULL);
17620 symbol = variableSymbol;
17622 ROSE_ASSERT(symbol != NULL);
17625 ROSE_ASSERT(variableSymbol != NULL);
17627 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());
17632 ROSE_ASSERT(new_variableSymbol != NULL);
17635 targetScope->
insert_symbol(initializedName_copy->get_name(),new_variableSymbol);
17638 initializedName_copy->set_scope(targetScope);
17641 SgName mangledName = variableSymbol->get_mangled_name();
17642 printf (
"initializedName_copy: mangledName = %s \n",mangledName.str());
17646 if (initializedName_copy->get_scope() != targetScope)
17648 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());
17650 printf (
"I think this should be an error! \n");
17661 case V_SgVariableDeclaration:
17666 ROSE_ASSERT(variableDeclaration != NULL);
17671#define DEBUG_FUNCTION_DECLARATION 0
17673 case V_SgFunctionDeclaration:
17685 SgFunctionType* functionType_copy = functionDeclaration_copy->get_type();
17686 SgFunctionType* functionType_original = functionDeclaration_original->get_type();
17687 ROSE_ASSERT(functionType_copy != NULL);
17688 ROSE_ASSERT(functionType_original != NULL);
17689 ROSE_ASSERT(functionType_copy == functionType_original);
17690#if DEBUG_FUNCTION_DECLARATION
17691 printf (
"case SgFunctionDeclaration: part 1: Calling functionDeclaration_copy->search_for_symbol_from_symbol_table() \n");
17695 ROSE_ASSERT(symbol_original != NULL);
17696 SgFunctionSymbol* functionSymbol_original = isSgFunctionSymbol(symbol_original);
17697 ROSE_ASSERT(functionSymbol_original != NULL);
17700 ROSE_ASSERT(snippetFile != NULL);
17701 if (snippetFile != targetFile)
17703#if DEBUG_FUNCTION_DECLARATION
17704 printf (
"Warning: case V_SgFunctionDeclaration: functionSymbol_original not in target file \n");
17708 ROSE_ASSERT(isSgMemberFunctionSymbol(symbol_original) == NULL);
17714 SgName name = functionDeclaration_copy->get_name();
17715 SgType* functionType = functionDeclaration_copy->get_type();
17716 ROSE_ASSERT(functionType != NULL);
17717#if DEBUG_FUNCTION_DECLARATION
17718 printf (
"case V_SgFunctionDeclaration: name = %s \n",name.str());
17719 printf (
"case V_SgFunctionDeclaration: functionType = %p \n",functionType);
17720 printf (
"case V_SgFunctionDeclaration: functionType_original = %p \n",functionType_original);
17721 printf (
"case V_SgFunctionDeclaration: functionType_copy = %p \n",functionType_copy);
17725 ROSE_ASSERT(targetScope != NULL);
17726 functionDeclaration_copy->
set_scope(targetScope);
17733 if (functionSymbolInTargetAST == NULL)
17735#if DEBUG_FUNCTION_DECLARATION
17736 printf (
"functionSymbolInTargetAST not found in targetScope = %p = %s \n",targetScope,targetScope->
class_name().c_str());
17740 ROSE_ASSERT(otherPossibleScope != NULL);
17741#if DEBUG_FUNCTION_DECLARATION
17742 printf (
"case V_SgFunctionDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope,otherPossibleScope->
class_name().c_str());
17746 functionSymbolInTargetAST = otherPossibleScope->lookup_function_symbol(name,functionType);
17748 if (functionSymbolInTargetAST == NULL)
17750 printf (
"function symbol not found in otherPossibleScope = %p = %s \n",otherPossibleScope,otherPossibleScope->
class_name().c_str());
17753 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
17754#if DEBUG_FUNCTION_DECLARATION
17755 printf (
"(building a new SgFunctionSymbol): functionSymbolInTargetAST->get_declaration() = %p \n",functionSymbolInTargetAST->get_declaration());
17763 ROSE_ASSERT(new_symbol != NULL);
17767 functionSymbolInTargetAST = new_symbol;
17778#if DEBUG_FUNCTION_DECLARATION
17779 printf (
"(using existing symbol found in target scope): functionSymbolInTargetAST->get_declaration() = %p \n",functionSymbolInTargetAST->get_declaration());
17781 functionDeclaration_copy_firstNondefining = isSgFunctionDeclaration(functionSymbolInTargetAST->get_declaration());
17784 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
17787 ROSE_ASSERT(functionDeclaration_copy_firstNondefining != NULL);
17796 ROSE_ASSERT(functionDeclaration_original_firstNondefining != NULL);
17797 printf (
"functionSymbolInTargetAST->get_declaration() = %p \n",functionSymbolInTargetAST->get_declaration());
17799 printf (
"functionDeclaration_original = %p = %s \n",functionDeclaration_original,functionDeclaration_original->
class_name().c_str());
17800 printf (
"functionDeclaration_copy = %p = %s \n",functionDeclaration_copy,functionDeclaration_copy->
class_name().c_str());
17801 printf (
"functionDeclaration_original_firstNondefining = %p \n",functionDeclaration_original_firstNondefining);
17802 printf (
"functionDeclaration_copy_firstNondefining = %p \n",functionDeclaration_copy_firstNondefining);
17803 printf (
"functionDeclaration_original_defining = %p \n",functionDeclaration_original_defining);
17804 printf (
"functionDeclaration_copy_defining = %p \n",functionDeclaration_copy_defining);
17806 printf (
"functionDeclaration_original->get_scope() = %p = %s \n",functionDeclaration_original->
get_scope(),functionDeclaration_original->
get_scope()->
class_name().c_str());
17807 printf (
"functionDeclaration_copy->get_scope() = %p = %s \n",functionDeclaration_copy->
get_scope(),functionDeclaration_copy->
get_scope()->
class_name().c_str());
17808 printf (
"functionDeclaration_original_firstNondefining->get_scope() = %p = %s \n",functionDeclaration_original_firstNondefining->
get_scope(),functionDeclaration_original_firstNondefining->
get_scope()->
class_name().c_str());
17809 printf (
"functionDeclaration_copy_firstNondefining->get_scope() = %p = %s \n",functionDeclaration_copy_firstNondefining->
get_scope(),functionDeclaration_copy_firstNondefining->
get_scope()->
class_name().c_str());
17810 printf (
"functionDeclaration_original_defining->get_scope() = %p = %s \n",functionDeclaration_original_defining->
get_scope(),functionDeclaration_original_defining->
get_scope()->
class_name().c_str());
17811 printf (
"functionDeclaration_copy_defining->get_scope() = %p = %s \n",functionDeclaration_copy_defining->
get_scope(),functionDeclaration_copy_defining->
get_scope()->
class_name().c_str());
17812 printf (
"functionSymbolInTargetAST = %p = %s \n",functionSymbolInTargetAST,functionSymbolInTargetAST->
class_name().c_str());
17815 ROSE_ASSERT(targetScope->lookup_function_symbol(name,functionType) != NULL);
17829 bool isDefiningDeclaration (functionDeclaration_original->get_declaration() != NULL);
17830 if (isDefiningDeclaration ==
true)
17835 ROSE_ASSERT(nondefiningDeclarationFile != NULL);
17836 if (nondefiningDeclarationFile == targetFile)
17853 ROSE_ASSERT(func_symbol->get_symbol_basis() != NULL);
17861 resetDeclaration(functionDeclaration_copy,functionDeclaration_original,targetScope);
17863 printf (
"SageBuilder::fixupCopyOfNodeFromSeperateFileInNewTargetAst(): Need to be able to fixup the SgFunctionDeclaration \n");
17869 case V_SgClassDeclaration:
17873 SgClassDeclaration* classDeclaration_original = isSgClassDeclaration(node_original);
17874 SgClassType* classType = classDeclaration_copy->get_type();
17875 ROSE_ASSERT(classType != NULL);
17877 printf (
"Need to handle named types from class declarations \n");
17888 printf (
"Warning: case V_SgClassDeclaration: assume getEnclosingFileNode(classDeclaration_copy) != targetFile \n");
17900 SgName name = classDeclaration_copy->get_name();
17903 printf (
"case V_SgClassDeclaration: targetScope = %p classSymbol_copy->get_name() = %s \n",targetScope,classSymbol_copy->get_name().str());
17908 if (classSymbolInTargetAST == NULL)
17912 ROSE_ASSERT(otherPossibleScope != NULL);
17914 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p \n",otherPossibleScope);
17918 ROSE_ASSERT(classSymbolInTargetAST != NULL);
17922 ROSE_ASSERT(classDeclaration != NULL);
17924 ROSE_ASSERT(scope != NULL);
17925 classDeclaration_copy->
set_scope(scope);
17928 classDeclaration_copy->
set_scope(targetScope);
17932 ROSE_ASSERT(classSymbol != NULL);
17933 classSymbolInTargetAST = classSymbol;
17943 ROSE_ASSERT(classDeclaration != NULL);
17945 ROSE_ASSERT(scope != NULL);
17946 classDeclaration_copy->
set_scope(scope);
17949 ROSE_ASSERT(classSymbolInTargetAST != NULL);
17956 SgClassType* new_class_type = isSgClassType(new_type);
17957 if (new_class_type != NULL)
17960 classDeclaration_copy->set_type(new_class_type);
17962 printf (
"case V_SgClassDeclaration: built class type: part 1: classDeclaration_copy->get_type() = %p = %s \n",
17963 classDeclaration_copy->get_type(),classDeclaration_copy->get_type()->
class_name().c_str());
17967 resetDeclaration(classDeclaration_copy,classDeclaration_original,targetScope);
17969 printf (
"SgClassDeclaration: Exiting as a test! \n");
17975 case V_SgEnumDeclaration:
17979 SgEnumDeclaration* enumDeclaration_original = isSgEnumDeclaration(node_original);
17989 printf (
"case V_SgEnumDeclaration: targetScope = %p enumSymbol_copy->get_name() = %s \n",targetScope,name.str());
17993 if (enumSymbolInTargetAST == NULL)
17997 ROSE_ASSERT(otherPossibleScope != NULL);
17999 printf (
"case V_SgEnumDeclaration: otherPossibleScope = %p \n",otherPossibleScope);
18003 printf (
"Since the symbol has not been inserted yet, what symbol are we looking for? \n");
18007 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
18009 ROSE_ASSERT(enumDeclaration != NULL);
18011 ROSE_ASSERT(enumDeclaration != enumDeclaration_original);
18018 ROSE_ASSERT(enumSymbol != NULL);
18019 enumSymbolInTargetAST = enumSymbol;
18026 ROSE_ASSERT(scope != NULL);
18027 enumDeclaration_copy->
set_scope(scope);
18029 printf (
"case V_SgEnumDeclaration: insert_symbol(): name = %s enumSymbolInTargetAST = %p \n",name.str(),enumSymbolInTargetAST);
18038 printf (
"Found an existing enum declaration: name = %s enumSymbolInTargetAST = %p \n",name.str(),enumSymbolInTargetAST);
18042 ROSE_ASSERT(enumDeclaration != NULL);
18045 ROSE_ASSERT(scope != NULL);
18046 ROSE_ASSERT(scope == targetScope);
18054 ROSE_ASSERT(enumSymbolInTargetAST != NULL);
18057 printf (
"Exiting as a test 1! \n");
18061 ROSE_ASSERT(enumType != NULL);
18064 printf (
"Return type from getTargetFileType(): original enumType = %p new_type = %p \n",enumType,new_type);
18066 SgEnumType* new_enum_type = isSgEnumType(new_type);
18067 if (new_enum_type != NULL)
18071 printf (
"reset the type using the new enum type from the target AST \n");
18073 enumDeclaration_copy->
set_type(new_enum_type);
18076 printf (
"Exiting as a test 2! \n");
18080 resetDeclaration(enumDeclaration_copy,enumDeclaration_original,targetScope);
18085 case V_SgTemplateClassDeclaration:
18089 SgClassType* templateClassType = templateClassDeclaration->get_type();
18090 ROSE_ASSERT(templateClassType != NULL);
18094 SgClassType* new_templateClass_type = isSgClassType(new_type);
18095 if (new_templateClass_type != NULL)
18098 templateClassDeclaration->set_type(new_templateClass_type);
18100 printf (
"case V_SgTemplateClassDeclaration: built class type: part 1: templateClassDeclaration->get_type() = %p = %s \n",
18101 templateClassDeclaration->get_type(),templateClassDeclaration->get_type()->
class_name().c_str());
18108 case V_SgTypedefDeclaration:
18114 SgType* base_type = typedefDeclaration_copy->get_base_type();
18115 ROSE_ASSERT(base_type != NULL);
18117 if (new_base_type != NULL)
18120 typedefDeclaration_copy->set_base_type(new_base_type);
18125 SgName name = typedefDeclaration_copy->get_name();
18128 printf (
"case V_SgTypedefDeclaration: targetScope = %p typedefSymbol_copy->get_name() = %s \n",targetScope,name.str());
18132 if (typedefSymbolInTargetAST == NULL)
18136 ROSE_ASSERT(otherPossibleScope != NULL);
18138 printf (
"case V_SgTypedefDeclaration: otherPossibleScope = %p \n",otherPossibleScope);
18142 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
18144 ROSE_ASSERT(typedefDeclaration != NULL);
18147 ROSE_ASSERT(scope != NULL);
18148 typedefDeclaration_copy->
set_scope(scope);
18152 ROSE_ASSERT(typedefSymbol != NULL);
18153 typedefSymbolInTargetAST = typedefSymbol;
18155 printf (
"case V_SgTypedefDeclaration: insert_symbol(): name = %s typedefSymbolInTargetAST = %p \n",name.str(),typedefSymbolInTargetAST);
18164 printf (
"Found an existing typedef declaration: name = %s typedefSymbolInTargetAST = %p \n",name.str(),typedefSymbolInTargetAST);
18168 ROSE_ASSERT(typedefDeclaration != NULL);
18170 ROSE_ASSERT(scope != NULL);
18171 typedefDeclaration_copy->
set_scope(scope);
18174 ROSE_ASSERT(typedefSymbolInTargetAST != NULL);
18177 printf (
"Exiting as a test 1! \n");
18180 SgTypedefType* typedefType = typedefDeclaration_copy->get_type();
18181 ROSE_ASSERT(typedefType != NULL);
18183 SgTypedefType* new_typedef_type = isSgTypedefType(new_type);
18184 if (new_typedef_type != NULL)
18188 printf (
"reset the type using the new typedef type from the target AST \n");
18190 typedefDeclaration_copy->set_type(new_typedef_type);
18192 printf (
"case V_SgTypedefDeclaration: built class type: part 1: typedefDeclaration_copy->get_type() = %p = %s \n",
18193 typedefDeclaration_copy->get_type(),typedefDeclaration_copy->get_type()->
class_name().c_str());
18197 resetDeclaration(typedefDeclaration_copy,typedefDeclaration_original,targetScope);
18199 printf (
"Exiting as a test 2! \n");
18205 case V_SgVarRefExp:
18216 SgVarRefExp* varRefExp_copy = isSgVarRefExp(node_copy);
18217 SgVarRefExp* varRefExp_original = isSgVarRefExp(node_original);
18218 SgVariableSymbol* variableSymbol_copy = isSgVariableSymbol(varRefExp_copy->get_symbol());
18219 ROSE_ASSERT(variableSymbol_copy != NULL);
18224 printf (
"Warning: case V_SgVarRefExp: variableSymbol not in target file: name = %s \n",variableSymbol_copy->
get_name().str());
18227 printf (
"insertionPoint = %p = %s \n",insertionPoint,insertionPoint->
class_name().c_str());
18240 if (variableSymbolInTargetAST == NULL)
18246 printf (
"Error: The associated variable = %s should have been found in a parent scope of the target AST \n",variableSymbol_copy->
get_name().str());
18251 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(varRefExp_original);
18252 ROSE_ASSERT(enclosingStatement_original != NULL);
18254 printf (
"case V_SgVarRefExp: enclosingStatement_original = %p = %s \n",enclosingStatement_original,enclosingStatement_original->
class_name().c_str());
18257 ROSE_ASSERT(otherPossibleScope_original != NULL);
18260 ROSE_ASSERT(file != NULL);
18262 printf (
"enclosingStatement_original: associated file name = %s \n",file->get_sourceFileNameWithPath().c_str());
18265 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope_original,otherPossibleScope_original->
class_name().c_str());
18266 printf (
"case V_SgClassDeclaration: variableSymbol_copy->get_name() = %s \n",variableSymbol_copy->
get_name().str());
18269 if (variableSymbolInTargetAST == NULL)
18273 otherPossibleScope_original->
get_symbol_table()->
print(
"otherPossibleScope_original: symbol table");
18278 SgBinaryOp* parentBinaryOp = isSgBinaryOp(parentExpression);
18279 SgDotExp* parentDotExp = isSgDotExp(parentExpression);
18280 SgArrowExp* parentArrowExp = isSgArrowExp(parentExpression);
18281 if (parentDotExp != NULL || parentArrowExp != NULL)
18285 ROSE_ASSERT(lhs != NULL);
18289 ROSE_ASSERT(type != NULL);
18291 printf (
"type = %p = %s \n",type,type->
class_name().c_str());
18294 ROSE_ASSERT(namedType != NULL);
18296 ROSE_ASSERT(declaration != NULL);
18298 ROSE_ASSERT(classDeclaration != NULL);
18300 ROSE_ASSERT(definingClassDeclaration != NULL);
18301 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
18302 ROSE_ASSERT(classDefinition != NULL);
18304 printf (
"case V_SgClassDeclaration: classDefinition = %p = %s \n",classDefinition,classDefinition->
class_name().c_str());
18307 otherPossibleScope_original = classDefinition;
18313 ROSE_ASSERT(variableSymbolInTargetAST != NULL);
18314 SgInitializedName* initializedName = variableSymbolInTargetAST->get_declaration();
18315 ROSE_ASSERT(initializedName != NULL);
18317 ROSE_ASSERT(scope != NULL);
18320 initializedName->set_scope(scope);
18325 ROSE_ASSERT(variableSymbolInTargetAST != NULL);
18328 varRefExp_copy->set_symbol(variableSymbolInTargetAST);
18337 case V_SgFunctionRefExp:
18342 SgFunctionSymbol* functionSymbol_copy = isSgFunctionSymbol(functionRefExp_copy->get_symbol());
18343 ROSE_ASSERT(functionSymbol_copy != NULL);
18348 printf (
"Warning: case V_SgFunctionRefExp: functionSymbol_copy not in target file (find function = %s) \n",functionSymbol_copy->
get_name().str());
18352 printf (
"insertionPointIsScope = %s insertionPointScope = %p = %s \n",insertionPointIsScope ?
"true" :
"false",insertionPointScope,insertionPointScope->class_name().c_str());
18364 if (functionSymbolInTargetAST == NULL)
18375 fprintf (stderr,
"Error: The associated function = \"%s\" should have been found in a parent scope"
18376 " of the target AST\n", name.str());
18378 fprintf (stderr,
" targetScope = %p = %s \n",targetScope,targetScope->
class_name().c_str());
18379 SgGlobal* globalScope = TransformationSupport::getGlobalScope(targetScope);
18380 ROSE_ASSERT(globalScope != NULL);
18381 fprintf (stderr,
" globalScope = %p = %s \n",globalScope,globalScope->
class_name().c_str());
18383 targetScope->
get_file_info()->display(
"case V_SgFunctionRefExp: targetScope: debug");
18384 node_original->
get_file_info()->display(
"case V_SgFunctionRefExp: node_original: debug");
18390 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(functionRefExp_original);
18391 ROSE_ASSERT(enclosingStatement_original != NULL);
18393 printf (
"case V_SgFunctionRefExp: enclosingStatement_original = %p = %s \n",enclosingStatement_original,enclosingStatement_original->
class_name().c_str());
18396 ROSE_ASSERT(otherPossibleScope_original != NULL);
18399 ROSE_ASSERT(file != NULL);
18401 printf (
"enclosingStatement_original: associated file name = %s \n",file->get_sourceFileNameWithPath().c_str());
18404 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope_original,otherPossibleScope_original->
class_name().c_str());
18405 printf (
"case V_SgClassDeclaration: functionSymbol_copy->get_name() = %s \n",functionSymbol_copy->
get_name().str());
18409 if (functionSymbolInTargetAST == NULL)
18413 SgBinaryOp* parentBinaryOp = isSgBinaryOp(parentExpression);
18414 SgDotExp* parentDotExp = isSgDotExp(parentExpression);
18415 SgArrowExp* parentArrowExp = isSgArrowExp(parentExpression);
18416 if (parentDotExp != NULL || parentArrowExp != NULL)
18420 ROSE_ASSERT(lhs != NULL);
18421 ROSE_ASSERT(parentBinaryOp->
get_rhs_operand() == functionRefExp_copy);
18424 ROSE_ASSERT(type != NULL);
18426 printf (
"type = %p = %s \n",type,type->
class_name().c_str());
18429 ROSE_ASSERT(namedType != NULL);
18431 ROSE_ASSERT(declaration != NULL);
18433 ROSE_ASSERT(classDeclaration != NULL);
18435 ROSE_ASSERT(definingClassDeclaration != NULL);
18436 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
18437 ROSE_ASSERT(classDefinition != NULL);
18439 printf (
"case V_SgClassDeclaration: classDefinition = %p = %s \n",classDefinition,classDefinition->
class_name().c_str());
18442 otherPossibleScope_original = classDefinition;
18449 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
18451 ROSE_ASSERT(functionDeclaration != NULL);
18453 ROSE_ASSERT(scope != NULL);
18458 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
18463 ROSE_ASSERT(functionSymbolInTargetAST != NULL);
18466 functionRefExp_copy->set_symbol(functionSymbolInTargetAST);
18468 printf (
"Exiting as a test! \n");
18476#define DEBUG_MEMBER_FUNCTION_REF_EXP 0
18478 case V_SgMemberFunctionRefExp:
18483 SgMemberFunctionSymbol* memberFunctionSymbol_copy = isSgMemberFunctionSymbol(memberFunctionRefExp_copy->get_symbol());
18484 ROSE_ASSERT(memberFunctionSymbol_copy != NULL);
18489#if DEBUG_MEMBER_FUNCTION_REF_EXP
18490 printf (
"Warning: case V_SgMemberFunctionRefExp: memberFunctionSymbol_copy not in target file (find member function = %s) \n",memberFunctionSymbol_copy->
get_name().str());
18494 if (memberFunctionSymbolInTargetAST == NULL)
18499#if DEBUG_MEMBER_FUNCTION_REF_EXP
18500 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());
18505 SgStatement* enclosingStatement_original = TransformationSupport::getStatement(memberFunctionRefExp_original);
18506 ROSE_ASSERT(enclosingStatement_original != NULL);
18507#if DEBUG_MEMBER_FUNCTION_REF_EXP
18508 printf (
"case V_SgMemberFunctionRefExp: enclosingStatement_original = %p = %s \n",enclosingStatement_original,enclosingStatement_original->
class_name().c_str());
18511 ROSE_ASSERT(otherPossibleScope_original != NULL);
18514 ROSE_ASSERT(file != NULL);
18515#if DEBUG_MEMBER_FUNCTION_REF_EXP
18516 printf (
"enclosingStatement_original: associated file name = %s \n",file->get_sourceFileNameWithPath().c_str());
18519 printf (
"case V_SgClassDeclaration: otherPossibleScope = %p = %s \n",otherPossibleScope_original,otherPossibleScope_original->
class_name().c_str());
18520 printf (
"case V_SgClassDeclaration: memberFunctionSymbol_copy->get_name() = %s \n",memberFunctionSymbol_copy->
get_name().str());
18523 if (memberFunctionSymbolInTargetAST == NULL)
18525#if DEBUG_MEMBER_FUNCTION_REF_EXP
18526 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");
18531 ROSE_ASSERT(parentExpression != NULL);
18532#if DEBUG_MEMBER_FUNCTION_REF_EXP
18533 printf (
"parentExpression = %p = %s \n",parentExpression,parentExpression->
class_name().c_str());
18535 bool handle_as_java =
false;
18537 if (functionCallExp != NULL)
18541 handle_as_java =
true;
18545 ROSE_ASSERT(parentOfFunctionCallExpression != NULL);
18546#if DEBUG_MEMBER_FUNCTION_REF_EXP
18547 printf (
"parentOfFunctionCallExpression = %p = %s \n",parentOfFunctionCallExpression,parentOfFunctionCallExpression->
class_name().c_str());
18549 parentExpression = parentOfFunctionCallExpression;
18552 SgBinaryOp* parentBinaryOp = isSgBinaryOp(parentExpression);
18553 SgDotExp* parentDotExp = isSgDotExp(parentExpression);
18554 SgArrowExp* parentArrowExp = isSgArrowExp(parentExpression);
18555#if DEBUG_MEMBER_FUNCTION_REF_EXP
18556 printf (
"parentBinaryOp = %p \n",parentBinaryOp);
18557 printf (
"parentDotExp = %p \n",parentDotExp);
18558 printf (
"parentArrowExp = %p \n",parentArrowExp);
18560 if (parentDotExp != NULL || parentArrowExp != NULL)
18564 ROSE_ASSERT(lhs != NULL);
18567 if (handle_as_java ==
true)
18575 ROSE_ASSERT(parentBinaryOp->
get_rhs_operand() == memberFunctionRefExp_copy);
18577#if DEBUG_MEMBER_FUNCTION_REF_EXP
18578 printf (
"lhs = %p = %s \n",lhs,lhs->
class_name().c_str());
18584 if (varRefExp != NULL)
18586 SgVariableSymbol* variableSymbol = isSgVariableSymbol(varRefExp->get_symbol());
18587 ROSE_ASSERT(variableSymbol != NULL);
18589 ROSE_ASSERT(initializedName != NULL);
18591 SgType* initializedName_type = initializedName->get_type();
18592#if DEBUG_MEMBER_FUNCTION_REF_EXP
18593 printf (
"initializedName = %p = %s \n",initializedName,initializedName->get_name().str());
18594 printf (
"initializedName_type = %p \n",initializedName_type);
18596 SgClassType* classType = isSgClassType(initializedName_type);
18597 if (classType != NULL)
18599 SgClassDeclaration* classDeclaration = isSgClassDeclaration(classType->get_declaration());
18600 ROSE_ASSERT(classDeclaration != NULL);
18602 ROSE_ASSERT(definingClassDeclaration != NULL);
18603 printf (
"definingClassDeclaration->get_name() = %s \n",definingClassDeclaration->get_name().str());
18605 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
18606 ROSE_ASSERT(classDefinition != NULL);
18607 SgType* memberFunctionType = memberFunctionSymbol_copy->
get_type();
18608 SgName memberFunctionName = memberFunctionSymbol_copy->
get_name();
18609 ROSE_ASSERT(memberFunctionType != NULL);
18610 SgFunctionSymbol *functionSymbol = classDefinition->lookup_function_symbol(memberFunctionName,memberFunctionType);
18611 if (functionSymbol == NULL)
18613 printf (
"Symbol not found: output symbol table (size = %d): \n",classDefinition->
get_symbol_table()->
size());
18614#if DEBUG_MEMBER_FUNCTION_REF_EXP
18615 classDefinition->
get_symbol_table()->
print(
"Symbol not found: output symbol table: SgClassDefinition");
18620 printf (
"\n*************************************************************** \n");
18621 printf (
"ERROR: target has not be properly setup to receive the snippet. \n");
18622 printf (
"*************************************************************** \n");
18624 ROSE_ASSERT(functionSymbol != NULL);
18626 ROSE_ASSERT(memberFunctionSymbol != NULL);
18628 memberFunctionSymbolInTargetAST = memberFunctionSymbol;
18630 printf (
"Exiting as a test! \n");
18640 if (valueExp != NULL)
18642 memberFunctionSymbolInTargetAST = memberFunctionSymbol_copy;
18643 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18646 if (memberFunctionSymbolInTargetAST == NULL)
18650 ROSE_ASSERT(type != NULL);
18651#if DEBUG_MEMBER_FUNCTION_REF_EXP
18652 printf (
"type = %p = %s \n",type,type->
class_name().c_str());
18655 ROSE_ASSERT(namedType != NULL);
18657 ROSE_ASSERT(declaration != NULL);
18659 ROSE_ASSERT(classDeclaration != NULL);
18661 ROSE_ASSERT(definingClassDeclaration != NULL);
18662 SgClassDefinition* classDefinition = definingClassDeclaration->get_definition();
18663 ROSE_ASSERT(classDefinition != NULL);
18664#if DEBUG_MEMBER_FUNCTION_REF_EXP
18665 printf (
"case V_SgClassDeclaration: classDefinition = %p = %s \n",classDefinition,classDefinition->
class_name().c_str());
18668 otherPossibleScope_original = classDefinition;
18669#if DEBUG_MEMBER_FUNCTION_REF_EXP
18672#if DEBUG_MEMBER_FUNCTION_REF_EXP
18675 printf (
"associated_classDeclaration = %p name = %s \n",associated_classDeclaration,associated_classDeclaration->get_name().str());
18676 printf (
"functionSymbol = %p \n",functionSymbol);
18679 if (memberFunctionSymbolInTargetAST == NULL)
18682 printf (
"Error: (memberFunctionSymbolInTargetAST == NULL): memberFunctionSymbol_copy->get_name() = %s \n",memberFunctionSymbol_copy->
get_name().str());
18685 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18687 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18691 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18693 ROSE_ASSERT(functionDeclaration != NULL);
18695 ROSE_ASSERT(scope != NULL);
18700 ROSE_ASSERT(memberFunctionSymbolInTargetAST != NULL);
18703 memberFunctionRefExp_copy->set_symbol(memberFunctionSymbolInTargetAST);
18713 printf (
"Exiting as a test! (SgTryStmt) \n");
18720 case V_SgCatchStatementSeq:
18725 printf (
"Exiting as a test! (SgCatchStatementSeq) \n");
18732 case V_SgCatchOptionStmt:
18737 ROSE_ASSERT(catchOptionStatement_copy);
18739 printf (
"Need to check the symbol table of the SgCatchOptionStmt (which is a SgScopeStatement) \n");
18742 printf (
"Exiting as a test! (SgCatchOptionStmt) \n");
18749 case V_SgJavaPackageStatement:
18752 printf (
"Exiting as a test! (SgJavaPackageStatement) \n");
18762 printf (
"enum values contain a reference to the associated SgEnumDeclaration \n");
18764 SgEnumVal* enumVal_copy = isSgEnumVal(node_copy);
18765 SgEnumVal* enumVal_original = isSgEnumVal(node_original);
18767 printf (
" --- enumVal_original = %p = %d name = %s \n",enumVal_original,enumVal_original->get_value(),enumVal_original->get_name().str());
18769 SgEnumDeclaration* associatedEnumDeclaration_copy = isSgEnumDeclaration(enumVal_copy->get_declaration());
18770 SgEnumDeclaration* associatedEnumDeclaration_original = isSgEnumDeclaration(enumVal_original->get_declaration());
18773 bool isUnNamed = associatedEnumDeclaration_original->get_isUnNamed();
18774 if (isUnNamed ==
false)
18776 if (associatedEnumDeclaration_copy == associatedEnumDeclaration_original)
18779 printf (
" --- The stored reference to the enum declaration in the SgEnumVal must be reset \n");
18783 if (symbol == NULL)
18786 enumVal_original->
get_file_info()->display(
"case V_SgEnumVal: symbol == NULL: debug");
18788 ROSE_ASSERT(symbol != NULL);
18790 ROSE_ASSERT(enumSymbol != NULL);
18791 SgEnumDeclaration* new_associatedEnumDeclaration_copy = enumSymbol->get_declaration();
18792 ROSE_ASSERT(new_associatedEnumDeclaration_copy != NULL);
18795 ROSE_ASSERT(new_associatedEnumDeclaration_copy != associatedEnumDeclaration_original);
18797 ROSE_ASSERT(new_associatedEnumDeclaration_copy != associatedEnumDeclaration_original->
get_definingDeclaration());
18799 enumVal_copy->set_declaration(new_associatedEnumDeclaration_copy);
18801 printf (
"Exiting as a test! \n");
18810 printf (
"Warning: can't handle enum values from unnamed enum declarations \n");
18811 printf (
" --- enumVal_original = %p = %lld name = %s \n",enumVal_original,enumVal_original->get_value(),enumVal_original->get_name().str());
18845 ROSE_ASSERT(insertionPoint != NULL);
18846 ROSE_ASSERT(toInsert != NULL);
18847 ROSE_ASSERT(original_before_copy != NULL);
18851 SgSymbolTable::set_force_search_of_base_classes(
true);
18858 ROSE_ASSERT(targetFile != NULL);
18867 ROSE_ASSERT(snippetFile_of_copy == targetFile);
18872 ROSE_ASSERT(snippetFile_of_original != targetFile);
18875 printf (
" --- targetFile = %p = %s \n",targetFile,targetFile->get_sourceFileNameWithPath().c_str());
18876 printf (
" --- snippetFile_of_copy = %p = %s \n",snippetFile_of_copy,snippetFile_of_copy->get_sourceFileNameWithPath().c_str());
18877 printf (
" --- snippetFile_of_original = %p = %s \n",snippetFile_of_original,snippetFile_of_original->get_sourceFileNameWithPath().c_str());
18889 if (isStructurallyEquivalent ==
false)
18891 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");
18894 ROSE_ASSERT(isStructurallyEquivalent ==
true);
18904 RoseAst ast_of_copy(toInsert);
18905 RoseAst ast_of_original(original_before_copy);
18914 while (i_copy != ast_of_copy.
end())
18918 if ((*i_copy)->variantT() != (*i_original)->variantT())
18920 printf (
"ERROR: return from fixupCopyOfAstFromSeparateFileInNewTargetAst(): "
18921 "(*i_copy)->variantT() != (*i_original)->variantT() \n");
18923 printf (
"Making this an error! \n");
18936 ROSE_ASSERT(i_original != ast_of_original.
end());
18941 ROSE_ASSERT(i_copy == ast_of_copy.
end() && i_original == ast_of_original.
end());
18947 if (functionDeclaration != NULL)
18949 printf (
"functionDeclaration = %s \n",functionDeclaration->get_name().str());
18951 printf (
"Exiting as a test! \n");
18958 SgSymbolTable::set_force_search_of_base_classes(
false);
18968 ROSE_ASSERT (scope != NULL);
18978 ROSE_ASSERT(result != NULL);
18982 cerr<<
"Error. buildStatementFromString() cannot parse the input string:"<<s
18983 <<
"\n\t within the given scope:"<<scope->
class_name() <<endl;
19007 template <
class SgAstNode>
19010 static const bool explicitlySpecified =
true;
19028 res = createTemplateArg_(*isSgType(&n));
19029 else if (isSgExpression(&n))
19030 res = createTemplateArg_(*isSgExpression(&n));
19033 ROSE_ASSERT(isSgTemplateDeclaration(&n));
19034 res = createTemplateArg_(*isSgTemplateDeclaration(&n));
19041 SgName genTemplateName(
SgName base, Rose_STL_Container<SgNode*>& targs)
19043 Rose_STL_Container<SgNode*>::iterator aa = targs.begin();
19044 Rose_STL_Container<SgNode*>::iterator zz = targs.begin();
19045 std::string name(base.getString());
19048 for ( ; aa != zz; ++aa) name.append((*aa)->unparseToString());
19054 SgTemplateArgumentPtrList genTemplateArgumentList(Rose_STL_Container<SgNode*>& targs)
19056 Rose_STL_Container<SgNode*>::iterator aa = targs.begin();
19057 Rose_STL_Container<SgNode*>::iterator zz = targs.begin();
19058 SgTemplateArgumentPtrList lst;
19060 for ( ; aa != zz; ++aa)
19062 lst.push_back(createTemplateArg(**aa));
19070 ROSE_ASSERT(main_decl);
19076 ROSE_ASSERT(tdecl);
19082 ROSE_ASSERT(tclassdecl);
19103 ROSE_ASSERT(tdecl);
19108 struct TemplateArgumentParentSetter
19126Rose_STL_Container<SgNode *>& template_args)
19133Rose_STL_Container<SgNode *>& template_args)
19135 ROSE_ASSERT(template_decl);
19138 SgName name = template_decl->get_name();
19140 SgTemplateArgumentPtrList targs = genTemplateArgumentList(template_args);
19143 ROSE_ASSERT(tinst);
19147 ROSE_ASSERT(tclass);
19150 tinst->set_type(tclass);
19154 std::for_each(targs.begin(), targs.end(), TemplateArgumentParentSetter(tinst));
19160#ifdef ROSE_BUILD_JAVA_LANGUAGE_SUPPORT
19167 ROSE_ASSERT(Rose::Frontend::Java::lengthSymbol);
19179 if (parent_scope != NULL) {
19180 scope -> set_parent(parent_scope);
19210 pair -> set_value(value);
19211 value -> set_parent(pair);
19238 for (std::list<SgJavaMemberValuePair *>::iterator i = pair_list.begin(); i != pair_list.end(); i++) {
19240 member_value_pair -> set_parent(annotation);
19241 annotation -> append_value_pair(member_value_pair);
19264 return initialized_name;
19273 package_statement -> set_firstNondefiningDeclaration(package_statement);
19274 package_statement -> set_definingDeclaration(package_statement);
19275 return package_statement;
19284 import_statement -> set_firstNondefiningDeclaration(import_statement);
19285 import_statement -> set_definingDeclaration(import_statement);
19286 return import_statement;
19293 ROSE_ASSERT(scope);
19294 SgName class_name = name;
19295 ROSE_ASSERT(scope -> lookup_class_symbol(class_name) == NULL);
19298 bool buildTemplateInstantiation =
false;
19299 SgTemplateArgumentPtrList* templateArgumentsList = NULL;
19301 ROSE_ASSERT(class_declaration);
19302 class_declaration -> set_parent(scope);
19303 class_declaration -> set_scope(scope);
19306 ROSE_ASSERT(class_definition);
19310 class_definition -> setAttribute(
"extension_type_names",
new AstRegExAttribute());
19313 type_space -> set_parent(class_definition);
19315 class_declaration -> setAttribute(
"type_space",
new AstSgNodeAttribute(type_space));
19317 return class_declaration;
19326 string filename = directory_name +
"/" + type_name +
".java";
19327 ROSE_ASSERT((*project)[filename] == NULL);
19329 string command = string(
"touch ") + filename;
19330 int status = system(command.c_str());
19331 ROSE_ASSERT(status == 0);
19332 project -> get_sourceFileNameList().push_back(filename);
19333 Rose_STL_Container<std::string> arg_list = project -> get_originalCommandLineArgumentList();
19334 arg_list.push_back(filename);
19338 int error_code = 0;
19339 SgFile *file = determineFileType(arg_list, error_code, project);
19341 ROSE_ASSERT(sourcefile);
19342 sourcefile -> set_parent(project);
19343 project -> get_fileList_ptr() -> get_listOfFiles().push_back(sourcefile);
19344 ROSE_ASSERT(sourcefile == isSgSourceFile((*project)[filename]));
19350 ROSE_ASSERT(pkgDefDecl != NULL);
19352 package_statement->
set_parent(package_definition);
19353 sourcefile->set_package(package_statement);
19359 import_statement_list -> set_parent(sourcefile);
19360 sourcefile -> set_import_list(import_statement_list);
19366 class_declaration_list -> set_parent(package_definition);
19367 sourcefile -> set_class_list(class_declaration_list);
19377 ROSE_ASSERT(num_dimensions > 0);
19378 if (num_dimensions > 1) {
19382 ROSE_ASSERT(base_type != NULL);
19384 if (attribute == NULL) {
19386 array_type -> set_rank(num_dimensions);
19388 base_type -> setAttribute(
"array", attribute);
19391 return isSgArrayType(attribute -> getNode());
19402 generic_type -> setAttribute(
"parameterized types", attribute);
19404 ROSE_ASSERT(attribute);
19406 return attribute -> findOrInsertParameterizedType(new_args);
19417 type -> setAttribute(
"qualified types", attribute);
19419 ROSE_ASSERT(attribute);
19421 for (
int i = 0; i < attribute -> size(); i++) {
19423 ROSE_ASSERT(qualified_type);
19424 if (qualified_type -> get_parent_type() == parent_type && qualified_type -> get_type() == type) {
19425 return qualified_type;
19430 qualified_type -> set_parent_type(parent_type);
19431 qualified_type -> set_type(type);
19433 attribute -> addNode(qualified_type);
19435 return qualified_type;
19446 SgClassDeclaration *class_declaration = isSgClassDeclaration(Rose::Frontend::Java::ObjectClassType -> get_declaration());
19449 Rose::Frontend::Java::ObjectClassType -> setAttribute(
"unbound", attribute);
19452 return isSgJavaWildcardType(attribute -> getNode());
19465 ROSE_ASSERT(array_type || named_type);
19466 SgClassDeclaration *class_declaration = isSgClassDeclaration((array_type ? (
SgNamedType *) Rose::Frontend::Java::ObjectClassType : named_type) -> get_declaration());
19469 wildcard -> set_has_extends(
true);
19472 type -> setAttribute(
"extends", attribute);
19475 return isSgJavaWildcardType(attribute -> getNode());
19488 ROSE_ASSERT(array_type || named_type);
19489 SgClassDeclaration *class_declaration = isSgClassDeclaration((array_type ? (
SgNamedType *) Rose::Frontend::Java::ObjectClassType : named_type) -> get_declaration());
19492 wildcard -> set_has_super(
true);
19495 type -> setAttribute(
"super", attribute);
19498 return isSgJavaWildcardType(attribute -> getNode());
19508 namespace Builder {
19509 namespace Templates {
19512 if (t ==
nullptr)
return nullptr;
19518 if (e ==
nullptr)
return nullptr;
19538std::string strTemplateArgument(
int v) {
19539 std::ostringstream oss;
19544std::string strTemplateArgument(
bool v) {
19545 std::ostringstream oss;
19546 if (v) oss <<
"true";
19547 else oss <<
"false";
19551std::string strTemplateArgument(
SgNamedType * nt) {
19552 std::ostringstream oss;
19557std::string strTemplateArgument(
SgType * t) {
19558 std::ostringstream oss;
19564 std::ostringstream oss;
19569#define DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps 0
19573 std::vector<std::vector<SgTemplateParameter *>> & tpl_params,
19574 std::vector<std::vector<SgTemplateArgument *>> & tpl_args
19576#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19577 std::cout <<
"Rose::Builder::Templates::instantiateNonrealRefExps" << std::endl;
19578 std::cout <<
" expr = " << std::hex << expr <<
" : " << ( expr ? expr->
class_name() :
"" ) << std::endl;
19579 std::cout <<
" = " << ( expr ? expr->
unparseToString() :
"" ) << std::endl;
19583 }
else if (isSgNonrealRefExp(expr)) {
19584#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19585 std::cerr <<
"Error: In instantiateNonrealRefExps: case of a SgNonrealRefExp!!!" << std::endl;
19588 }
else if (isSgVarRefExp(expr)) {
19591 ROSE_ASSERT(iname);
19592#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19593 std::cout <<
" iname = " << std::hex << iname <<
" : " << ( iname ? iname->
class_name() :
"" ) << std::endl;
19594 std::cout <<
" iname->get_name() = " << iname->get_name() << std::endl;
19595 std::cout <<
" iname->get_initializer() = " << std::hex << iname->get_initializer() <<
" : " << ( iname->get_initializer() ? iname->get_initializer()->
class_name() :
"" ) << std::endl;
19599 unsigned depth = 0;
19601 for (
auto tpl_params_: tpl_params) {
19603 for (
auto tpl_param: tpl_params_) {
19604 if (tpl_param->get_initializedName()) {
19605#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19606 std::cout <<
" tpl_param->get_initializedName() = " << std::hex << tpl_param->get_initializedName() << std::endl;
19607 std::cout <<
" tpl_param->get_initializedName()->get_name() = " << tpl_param->get_initializedName()->get_name() << std::endl;
19609 if (tpl_param->get_initializedName()->get_name() == iname->get_name()) {
19610 iname = tpl_param->get_initializedName();
19619 if (depth < tpl_args.size() && pos < tpl_args[depth].size()) {
19620 SgExpression * res = tpl_args[depth][pos]->get_expression();
19623 }
else if (depth < tpl_params.size() && pos < tpl_params[depth].size()) {
19624 SgExpression * dft = tpl_params[depth][pos]->get_defaultExpressionParameter();
19626 dft = instantiateNonrealRefExps(dft, tpl_params, tpl_args);
19630#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19631 std::cerr <<
"Error: In instantiateNonrealRefExps: this should not be reached!!!" << std::endl;
19634 }
else if (isSgValueExp(expr)) {
19636 }
else if (isSgConditionalExp(expr)) {
19642 }
else if (isSgSizeOfOp(expr)) {
19644#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19645 std::cout <<
" szo->get_operand_expr() = " << std::hex << szo->get_operand_expr() <<
" : " << ( szo->get_operand_expr() ? szo->get_operand_expr()->
class_name() :
"" ) << std::endl;
19646 std::cout <<
" szo->get_operand_type() = " << std::hex << szo->get_operand_type() <<
" : " << ( szo->get_operand_type() ? szo->get_operand_type()->
class_name() :
"" ) << std::endl;
19648 SgExpression * eres = instantiateNonrealRefExps(szo->get_operand_expr(), tpl_params, tpl_args);
19649 ROSE_ASSERT(szo->get_operand_expr() ==
nullptr || eres !=
nullptr);
19650 szo->set_operand_expr(eres);
19652 SgType * tres = instantiateNonrealTypes(szo->get_operand_type(), tpl_params, tpl_args);
19653 ROSE_ASSERT(szo->get_operand_type() ==
nullptr || tres !=
nullptr);
19654 szo->set_operand_type(tres);
19656#if DEBUG_Rose_Builder_Templates_instantiateNonrealRefExps
19657 std::cout <<
" szo->get_operand_expr() = " << std::hex << szo->get_operand_expr() <<
" : " << ( szo->get_operand_expr() ? szo->get_operand_expr()->
class_name() :
"" ) << std::endl;
19658 std::cout <<
" szo->get_operand_type() = " << std::hex << szo->get_operand_type() <<
" : " << ( szo->get_operand_type() ? szo->get_operand_type()->
class_name() :
"" ) << std::endl;
19661 }
else if (isSgCastExp(expr)) {
19663 auto operand = instantiateNonrealRefExps(cast->
get_operand_i(), tpl_params, tpl_args);
19664 if (operand ==
nullptr)
return nullptr;
19665 auto type = instantiateNonrealTypes(cast->
get_type(), tpl_params, tpl_args);
19666 if (type ==
nullptr)
return operand;
19668 cast->set_type(type);
19670 }
else if (isSgUnaryOp(expr)) {
19674 }
else if (isSgBinaryOp(expr)) {
19680 std::cerr <<
"!!! expr = " << std::hex << expr <<
" : " << ( expr ? expr->
class_name() :
"" ) << std::endl;
19687 std::vector<SgTemplateParameter *> & tpl_params,
19688 std::vector<SgTemplateArgument *> & tpl_args
19690 std::vector<std::vector<SgTemplateParameter *>> tpl_params_{tpl_params};
19691 std::vector<std::vector<SgTemplateArgument *>> tpl_args_{tpl_args};
19692 return instantiateNonrealRefExps(expr, tpl_params_, tpl_args_);
19695#define DEBUG_Rose_Builder_Templates_instantiateNonrealTypes 0
19697SgType * instantiateNonrealTypes(
19699 std::vector<std::vector<SgTemplateParameter *>> & tpl_params,
19700 std::vector<std::vector<SgTemplateArgument *>> & tpl_args
19702#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19703 std::cout <<
"Rose::Builder::Templates::instantiateNonrealTypes" << std::endl;
19704 std::cout <<
" type = " << std::hex << type <<
" : " << ( type ? type->
class_name() :
"" ) << std::endl;
19705 std::cout <<
" = " << ( type ? type->
unparseToString() :
"" ) << std::endl;
19709 }
else if (isSgNonrealType(type)) {
19711 SgNonrealDecl * nrdecl = isSgNonrealDecl(nrtype->get_declaration());
19712 ROSE_ASSERT(nrdecl !=
nullptr);
19713#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19714 std::cout <<
" nrdecl = " << std::hex << nrdecl <<
" : " << nrdecl->
class_name() << std::endl;
19715 std::cout <<
" ->get_qualified_name() = " << nrdecl->get_qualified_name().getString() << std::endl;
19717 std::cout <<
" ->get_tpl_args() = " << std::dec << nrdecl->get_tpl_args().size() << std::endl;
19718 std::cout <<
" ->get_tpl_params() = " << std::dec << nrdecl->get_tpl_params().size() << std::endl;
19719 std::cout <<
" ->get_is_class_member() = " << ( nrdecl->get_is_class_member() ?
"true" :
"false" ) << std::endl;
19720 std::cout <<
" ->get_is_template_param() = " << ( nrdecl->get_is_template_param() ?
"true" :
"false" ) << std::endl;
19721 std::cout <<
" ->get_is_template_template_param() = " << ( nrdecl->get_is_template_template_param() ?
"true" :
"false" ) << std::endl;
19722 std::cout <<
" ->get_is_nonreal_template() = " << ( nrdecl->get_is_nonreal_template() ?
"true" :
"false" ) << std::endl;
19723 std::cout <<
" ->get_is_nonreal_function() = " << ( nrdecl->get_is_nonreal_function() ?
"true" :
"false" ) << std::endl;
19726 if (tpldecl !=
nullptr) {
19727#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19728 std::cout <<
" tpldecl = " << std::hex << tpldecl <<
" : " << tpldecl->
class_name() << std::endl;
19732 if (xtpldecl !=
nullptr) {
19733#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19734 std::cout <<
" xtpldecl->get_name() = " << xtpldecl->get_name() << std::endl;
19736 std::vector<SgTemplateArgument *> inst_tpl_args;
19738#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19739 std::cout <<
" tplarg = " << std::hex << tplarg <<
" : " << ( tplarg ? tplarg->class_name() :
"" ) << std::endl;
19740 std::cout <<
" ->get_argumentType() = " << tplarg->get_argumentType() << std::endl;
19742 switch (tplarg->get_argumentType()) {
19744#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19745 std::cout <<
" tplarg->get_type() = " << std::hex << tplarg->get_type() <<
" : " << ( tplarg->get_type() ? tplarg->get_type()->class_name() :
"" ) << std::endl;
19747 auto inst_tplarg = instantiateNonrealTypes(tplarg->get_type(), tpl_params, tpl_args);
19749 inst_tpl_args.push_back(buildTemplateArgument(inst_tplarg));
19753#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19754 std::cout <<
" tplarg->get_expression() = " << std::hex << tplarg->get_expression() <<
" : " << ( tplarg->get_expression() ? tplarg->get_expression()->class_name() :
"" ) << std::endl;
19755 std::cout <<
" ->unparseToString() = " << tplarg->get_expression()->unparseToString() << std::endl;
19758#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19759 std::cout <<
" inst_tplarg = " << std::hex << inst_tplarg <<
" : " << ( inst_tplarg ? inst_tplarg->class_name() :
"" ) << std::endl;
19760 std::cout <<
" inst_tplarg->unparseToString() = " << ( inst_tplarg ? inst_tplarg->unparseToString() :
"" ) << std::endl;
19763 inst_tpl_args.push_back(buildTemplateArgument(inst_tplarg));
19767#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19768 std::cout <<
" tplarg->get_templateDeclaration() = " << std::hex << tplarg->get_templateDeclaration() <<
" : " << ( tplarg->get_templateDeclaration() ? tplarg->get_templateDeclaration()->class_name() :
"" ) << std::endl;
19773#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19774 std::cout <<
" start_of_pack_expansion_argument" << std::endl;
19778 default: ROSE_ABORT();
19784 ROSE_ASSERT(inst_decl);
19785#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19786 std::cout <<
" inst_decl = " << std::hex << inst_decl <<
" : " << inst_decl->
class_name() << std::endl;
19788 std::cout <<
" inst_decl->get_definingDeclaration() = " << std::hex << inst_decl->
get_definingDeclaration() << std::endl;
19795 for (
auto inst_tpl_arg: inst_tpl_args) {
19796 inst_tpl_arg->set_parent(inst_decl);
19800 return inst_decl->get_type();
19804 }
else if (nrdecl->get_is_template_param()) {
19805 auto depth = nrdecl->get_template_parameter_depth();
19806 auto position = nrdecl->get_template_parameter_position();
19807#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19808 std::cout <<
" ->get_template_parameter_position() = " << std::dec <<
position << std::endl;
19809 std::cout <<
" ->get_template_parameter_depth() = " << std::dec << depth << std::endl;
19811 ROSE_ASSERT(depth > 0);
19812 ROSE_ASSERT(position > 0);
19813 if (std::size_t(depth) <= tpl_args.size() && std::size_t(position) <= tpl_args[depth-1].size()) {
19815#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19816 std::cout <<
" tpl_args[" << std::dec << depth-1 <<
"][" << std::dec <<
position-1 <<
"]->get_type() = " << std::dec << res << std::endl;
19819 }
else if (std::size_t(depth) <= tpl_params.size() && std::size_t(position) <= tpl_params[depth-1].size()) {
19820 SgType * dft_tpl_arg = tpl_params[depth-1][
position-1]->get_defaultTypeParameter();
19821#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19822 std::cout <<
" tpl_params[" << std::dec << depth-1 <<
"][" << std::dec <<
position-1 <<
"]->get_type() = " << std::dec << dft_tpl_arg << std::endl;
19824 dft_tpl_arg = instantiateNonrealTypes(dft_tpl_arg, tpl_params, tpl_args);
19825#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19826 std::cout <<
" dft_tpl_arg = " << std::dec << dft_tpl_arg << std::endl;
19828 return dft_tpl_arg;
19832 }
else if (nrdecl->get_is_class_member()) {
19833#if DEBUG_Rose_Builder_Templates_instantiateNonrealTypes
19834 std::cout <<
" Case of a non-real class member will return INT." << std::endl;
19846 }
else if (isSgTypeVoid(type) || isSgTypeUnsignedLong(type) || isSgTypeInt(type) || isSgTypeLong(type) || isSgTypeUnsignedInt(type) || isSgTypedefType(type) || isSgClassType(type)) {
19848 }
else if (isSgModifierType(type)) {
19850 SgType * btype = mtype->get_base_type();
19851 ROSE_ASSERT(btype !=
nullptr);
19853 ROSE_ASSERT(rtype !=
nullptr);
19857 std::cerr <<
"!!! type = " << std::hex << type <<
" : " << ( type ? type->
class_name() :
"" ) << std::endl;
19863SgType * instantiateNonrealTypes(
19865 std::vector<SgTemplateParameter *> & tpl_params,
19866 std::vector<SgTemplateArgument *> & tpl_args
19868 std::vector<std::vector<SgTemplateParameter *>> tpl_params_{tpl_params};
19869 std::vector<std::vector<SgTemplateArgument *>> tpl_args_{tpl_args};
19870 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.