- Timestamp:
- Jan 10, 2019, 3:50:34 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- d97c3a4
- Parents:
- aeb8f70 (diff), 08222c7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- Aaron Moss <a3moss@…> (01/10/19 14:46:09)
- git-committer:
- Aaron Moss <a3moss@…> (01/10/19 15:50:34)
- Location:
- src
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeTools/ResolvProtoDump.cc
raeb8f70 re99e43f 51 51 52 52 /// Child constructor 53 ProtoDump(const ProtoDump* p, Type* r) 53 ProtoDump(const ProtoDump* p, Type* r) 54 54 : decls(), exprs(), subs(), closed(p->closed), parent(p), rtnType(r) {} 55 55 56 56 // Fix copy issues 57 ProtoDump(const ProtoDump& o) 58 : decls(o.decls), exprs(o.exprs), subs(o.subs), closed(o.closed), parent(o.parent), 57 ProtoDump(const ProtoDump& o) 58 : decls(o.decls), exprs(o.exprs), subs(o.subs), closed(o.closed), parent(o.parent), 59 59 rtnType(maybeClone(o.rtnType.get())) {} 60 60 ProtoDump( ProtoDump&& ) = default; … … 69 69 parent = o.parent; 70 70 rtnType.reset( maybeClone(o.rtnType.get()) ); 71 71 72 72 return *this; 73 73 } 74 ProtoDump& operator= (ProtoDump&&) = de fault;74 ProtoDump& operator= (ProtoDump&&) = delete; 75 75 76 76 private: … … 96 96 subs.emplace_back( std::move(sub.pass) ); 97 97 } 98 98 99 99 /// Whether lists should be separated, terminated, or preceded by their separator 100 100 enum septype { separated, terminated, preceded }; … … 102 102 /// builds space-separated list of types 103 103 template<typename V> 104 static void build( V& visitor, const std::list< Type* >& tys, std::stringstream& ss, 104 static void build( V& visitor, const std::list< Type* >& tys, std::stringstream& ss, 105 105 septype mode = separated ) { 106 106 if ( tys.empty() ) return; … … 121 121 /// builds list of types wrapped as tuple type 122 122 template<typename V> 123 static void buildAsTuple( V& visitor, const std::list< Type* >& tys, 123 static void buildAsTuple( V& visitor, const std::list< Type* >& tys, 124 124 std::stringstream& ss ) { 125 125 switch ( tys.size() ) { … … 162 162 if ( name.compare( 0, 10, "_operator_" ) == 0 ) { 163 163 ss << name.substr(10); 164 } else if ( name.compare( "_constructor" ) == 0 164 } else if ( name.compare( "_constructor" ) == 0 165 165 || name.compare( "_destructor" ) == 0 ) { 166 166 ss << name.substr(1); … … 173 173 174 174 /// replaces operators with resolv-proto names 175 static void rp_name( const std::string& name, std::stringstream& ss, 175 static void rp_name( const std::string& name, std::stringstream& ss, 176 176 std::string&& pre = "" ) { 177 177 // safety check for anonymous names … … 187 187 op_name( info.outputName, ss ); 188 188 return; 189 } 190 189 } 190 191 191 // replace retval names 192 192 if ( name.compare( 0, 8, "_retval_" ) == 0 ) { … … 195 195 return; 196 196 } 197 197 198 198 // default to just name, with first character in lowercase 199 ss << pre 199 ss << pre 200 200 << (char)std::tolower( static_cast<unsigned char>(name[0]) ) 201 201 << (name.c_str() + 1); … … 221 221 // strip trailing "_generic_" from autogen names (avoids some user-generation issues) 222 222 char generic[] = "_generic_"; size_t n_generic = sizeof(generic) - 1; 223 if ( stripped.size() >= n_generic 223 if ( stripped.size() >= n_generic 224 224 && stripped.substr( stripped.size() - n_generic ) == generic ) { 225 225 stripped.resize( stripped.size() - n_generic ); … … 237 237 unsigned depth; ///< Depth of nesting from root type 238 238 239 TypePrinter( const std::unordered_set<std::string>& closed, std::stringstream& ss ) 239 TypePrinter( const std::unordered_set<std::string>& closed, std::stringstream& ss ) 240 240 : ss(ss), closed(closed), depth(0) {} 241 241 … … 337 337 } 338 338 }; 339 339 340 340 /// builds description of function 341 341 void build( const std::string& name, FunctionType* fnTy, std::stringstream& ss ) { … … 350 350 for ( TypeDecl* tyvar : fnTy->forall ) { 351 351 for ( DeclarationWithType* assn : tyvar->assertions ) { 352 ss << " | "; 352 ss << " | "; 353 353 build( assn->name, assn->get_type(), ss ); 354 354 } … … 360 360 // ignore top-level references 361 361 Type *norefs = ty->stripReferences(); 362 362 363 363 // fall back to function declaration if function type 364 364 if ( PointerType* pTy = dynamic_cast< PointerType* >(norefs) ) { … … 409 409 std::stringstream& ss; ///< Output to print to 410 410 411 ExprPrinter( const std::unordered_set<std::string>& closed, std::stringstream& ss ) 411 ExprPrinter( const std::unordered_set<std::string>& closed, std::stringstream& ss ) 412 412 : closed(closed), ss(ss) {} 413 413 … … 476 476 visit_children = false; 477 477 } 478 478 479 479 /// Member access handled as function from aggregate to member 480 480 void previsit( UntypedMemberExpr* expr ) { … … 662 662 } 663 663 } 664 664 665 665 // add named parameters and returns to local scope 666 666 body.pass.addAll( decl->type->returnVals ); … … 679 679 void previsit( StructDecl* sd ) { addAggregateFields(sd); } 680 680 void previsit( UnionDecl* ud ) { addAggregateFields(ud); } 681 681 682 682 void previsit( EnumDecl* ed ) { 683 std::unique_ptr<Type> eType = 683 std::unique_ptr<Type> eType = 684 684 std::make_unique<BasicType>( Type::Qualifiers{}, BasicType::SignedInt ); 685 685 686 686 // add field names directly to enclosing scope 687 687 for ( Declaration* member : ed->members ) { -
src/Makefile.am
raeb8f70 re99e43f 17 17 # create object files in directory with source files 18 18 AUTOMAKE_OPTIONS = foreign subdir-objects 19 ACLOCAL_AMFLAGS = -I automake 19 20 20 21 SRC = main.cc \ -
src/Makefile.in
raeb8f70 re99e43f 141 141 subdir = src 142 142 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 143 am__aclocal_m4_deps = $(top_srcdir)/automake/cfa.m4 \ 144 $(top_srcdir)/configure.ac 143 am__aclocal_m4_deps = $(top_srcdir)/automake/libtool.m4 \ 144 $(top_srcdir)/automake/ltoptions.m4 \ 145 $(top_srcdir)/automake/ltsugar.m4 \ 146 $(top_srcdir)/automake/ltversion.m4 \ 147 $(top_srcdir)/automake/lt~obsolete.m4 \ 148 $(top_srcdir)/automake/cfa.m4 $(top_srcdir)/configure.ac 145 149 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 146 150 $(ACLOCAL_M4) … … 151 155 CONFIG_CLEAN_VPATH_FILES = 152 156 LIBRARIES = $(noinst_LIBRARIES) 153 AR = ar154 157 AM_V_AR = $(am__v_AR_@AM_V@) 155 158 am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@) … … 295 298 ___driver_cfa_cpp_OBJECTS = $(am____driver_cfa_cpp_OBJECTS) 296 299 ___driver_cfa_cpp_DEPENDENCIES = 300 AM_V_lt = $(am__v_lt_@AM_V@) 301 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) 302 am__v_lt_0 = --silent 303 am__v_lt_1 = 297 304 am_demangler_OBJECTS = SymTab/demangler.$(OBJEXT) 298 305 demangler_OBJECTS = $(am_demangler_OBJECTS) … … 316 323 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 317 324 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) 325 LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ 326 $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ 327 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ 328 $(AM_CXXFLAGS) $(CXXFLAGS) 318 329 AM_V_CXX = $(am__v_CXX_@AM_V@) 319 330 am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) … … 321 332 am__v_CXX_1 = 322 333 CXXLD = $(CXX) 323 CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ 324 -o $@ 334 CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ 335 $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ 336 $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ 325 337 AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) 326 338 am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) … … 328 340 am__v_CXXLD_1 = 329 341 LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS) 342 LTLEXCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ 343 $(LIBTOOLFLAGS) --mode=compile $(LEX) $(AM_LFLAGS) $(LFLAGS) 330 344 AM_V_LEX = $(am__v_LEX_@AM_V@) 331 345 am__v_LEX_ = $(am__v_LEX_@AM_DEFAULT_V@) … … 336 350 -e s/c++$$/h++/ -e s/c$$/h/ 337 351 YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS) 352 LTYACCCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ 353 $(LIBTOOLFLAGS) --mode=compile $(YACC) $(AM_YFLAGS) $(YFLAGS) 338 354 AM_V_YACC = $(am__v_YACC_@AM_V@) 339 355 am__v_YACC_ = $(am__v_YACC_@AM_DEFAULT_V@) … … 342 358 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 343 359 $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 360 LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ 361 $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ 362 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ 363 $(AM_CFLAGS) $(CFLAGS) 344 364 AM_V_CC = $(am__v_CC_@AM_V@) 345 365 am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) … … 347 367 am__v_CC_1 = 348 368 CCLD = $(CC) 349 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ 369 LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ 370 $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ 371 $(AM_LDFLAGS) $(LDFLAGS) -o $@ 350 372 AM_V_CCLD = $(am__v_CCLD_@AM_V@) 351 373 am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) … … 397 419 AMTAR = @AMTAR@ 398 420 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ 421 AR = @AR@ 399 422 AUTOCONF = @AUTOCONF@ 400 423 AUTOHEADER = @AUTOHEADER@ 401 424 AUTOMAKE = @AUTOMAKE@ 402 425 AWK = @AWK@ 403 BACKEND_CC = @BACKEND_CC@404 426 BUILD_IN_TREE_FLAGS = @BUILD_IN_TREE_FLAGS@ 405 427 CC = @CC@ … … 421 443 CPPFLAGS = @CPPFLAGS@ 422 444 CXX = @CXX@ 445 CXXCPP = @CXXCPP@ 423 446 CXXDEPMODE = @CXXDEPMODE@ 424 447 CXXFLAGS = @CXXFLAGS@ … … 426 449 DEFS = @DEFS@ 427 450 DEPDIR = @DEPDIR@ 451 DLLTOOL = @DLLTOOL@ 428 452 DRIVER_DIR = @DRIVER_DIR@ 453 DSYMUTIL = @DSYMUTIL@ 454 DUMPBIN = @DUMPBIN@ 429 455 ECHO_C = @ECHO_C@ 430 456 ECHO_N = @ECHO_N@ … … 432 458 EGREP = @EGREP@ 433 459 EXEEXT = @EXEEXT@ 460 FGREP = @FGREP@ 434 461 GREP = @GREP@ 435 462 HOST_FLAGS = @HOST_FLAGS@ … … 439 466 INSTALL_SCRIPT = @INSTALL_SCRIPT@ 440 467 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 468 LD = @LD@ 441 469 LDFLAGS = @LDFLAGS@ 442 470 LEX = @LEX@ … … 447 475 LIBOBJS = @LIBOBJS@ 448 476 LIBS = @LIBS@ 477 LIBTOOL = @LIBTOOL@ 478 LIPO = @LIPO@ 479 LN_S = @LN_S@ 449 480 LTLIBOBJS = @LTLIBOBJS@ 481 LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ 450 482 MAKEINFO = @MAKEINFO@ 483 MANIFEST_TOOL = @MANIFEST_TOOL@ 451 484 MKDIR_P = @MKDIR_P@ 485 NM = @NM@ 486 NMEDIT = @NMEDIT@ 487 OBJDUMP = @OBJDUMP@ 452 488 OBJEXT = @OBJEXT@ 489 OTOOL = @OTOOL@ 490 OTOOL64 = @OTOOL64@ 453 491 PACKAGE = @PACKAGE@ 454 492 PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ … … 460 498 PATH_SEPARATOR = @PATH_SEPARATOR@ 461 499 RANLIB = @RANLIB@ 500 SED = @SED@ 462 501 SET_MAKE = @SET_MAKE@ 463 502 SHELL = @SHELL@ … … 471 510 abs_top_builddir = @abs_top_builddir@ 472 511 abs_top_srcdir = @abs_top_srcdir@ 512 ac_ct_AR = @ac_ct_AR@ 473 513 ac_ct_CC = @ac_ct_CC@ 474 514 ac_ct_CXX = @ac_ct_CXX@ 515 ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ 475 516 am__include = @am__include@ 476 517 am__leading_dot = @am__leading_dot@ … … 522 563 # create object files in directory with source files 523 564 AUTOMAKE_OPTIONS = foreign subdir-objects 565 ACLOCAL_AMFLAGS = -I automake 524 566 SRC = main.cc MakeLibCfa.cc CompilationState.cc CodeGen/Generate.cc \ 525 567 CodeGen/CodeGenerator.cc CodeGen/GenType.cc \ … … 681 723 682 724 .SUFFIXES: 683 .SUFFIXES: .cc .ll . o .obj .yy725 .SUFFIXES: .cc .ll .lo .o .obj .yy 684 726 $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/CodeGen/module.mk $(srcdir)/CodeTools/module.mk $(srcdir)/Concurrency/module.mk $(srcdir)/Common/module.mk $(srcdir)/ControlStruct/module.mk $(srcdir)/GenPoly/module.mk $(srcdir)/InitTweak/module.mk $(srcdir)/Parser/module.mk $(srcdir)/ResolvExpr/module.mk $(srcdir)/SymTab/module.mk $(srcdir)/SynTree/module.mk $(srcdir)/Tuples/module.mk $(srcdir)/Validate/module.mk $(srcdir)/Virtual/module.mk $(am__configure_deps) 685 727 @for dep in $?; do \ … … 970 1012 sed 's/$(EXEEXT)$$//' | \ 971 1013 while read p p1; do if test -f $$p \ 1014 || test -f $$p1 \ 972 1015 ; then echo "$$p"; echo "$$p"; else :; fi; \ 973 1016 done | \ … … 984 1027 if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ 985 1028 test -z "$$files" || { \ 986 echo " $(INSTALL_PROGRAM_ENV)$(INSTALL_PROGRAM) $$files '$(DESTDIR)$(cfa_cpplibdir)$$dir'"; \987 $(INSTALL_PROGRAM_ENV)$(INSTALL_PROGRAM) $$files "$(DESTDIR)$(cfa_cpplibdir)$$dir" || exit $$?; \1029 echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(cfa_cpplibdir)$$dir'"; \ 1030 $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(cfa_cpplibdir)$$dir" || exit $$?; \ 988 1031 } \ 989 1032 ; done … … 1001 1044 1002 1045 clean-cfa_cpplibPROGRAMS: 1003 -test -z "$(cfa_cpplib_PROGRAMS)" || rm -f $(cfa_cpplib_PROGRAMS) 1046 @list='$(cfa_cpplib_PROGRAMS)'; test -n "$$list" || exit 0; \ 1047 echo " rm -f" $$list; \ 1048 rm -f $$list || exit $$?; \ 1049 test -n "$(EXEEXT)" || exit 0; \ 1050 list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ 1051 echo " rm -f" $$list; \ 1052 rm -f $$list 1004 1053 CodeGen/Generate.$(OBJEXT): CodeGen/$(am__dirstamp) \ 1005 1054 CodeGen/$(DEPDIR)/$(am__dirstamp) … … 1241 1290 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` 1242 1291 1292 .cc.lo: 1293 @am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ 1294 @am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ 1295 @am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo 1296 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ 1297 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1298 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< 1299 1243 1300 .ll.cc: 1244 1301 $(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE) … … 1246 1303 .yy.cc: 1247 1304 $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h `echo $@ | $(am__yacc_c2h)` y.output $*.output -- $(YACCCOMPILE) 1305 1306 mostlyclean-libtool: 1307 -rm -f *.lo 1308 1309 clean-libtool: 1310 -rm -rf .libs _libs 1311 -rm -rf ../driver/.libs ../driver/_libs 1248 1312 1249 1313 ID: $(am__tagged_files) … … 1405 1469 clean: clean-am 1406 1470 1407 clean-am: clean-cfa_cpplibPROGRAMS clean-generic clean- noinstLIBRARIES\1408 mostlyclean-am1471 clean-am: clean-cfa_cpplibPROGRAMS clean-generic clean-libtool \ 1472 clean-noinstLIBRARIES mostlyclean-am 1409 1473 1410 1474 distclean: distclean-am … … 1461 1525 mostlyclean: mostlyclean-am 1462 1526 1463 mostlyclean-am: mostlyclean-compile mostlyclean-generic 1527 mostlyclean-am: mostlyclean-compile mostlyclean-generic \ 1528 mostlyclean-libtool 1464 1529 1465 1530 pdf: pdf-am … … 1476 1541 1477 1542 .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \ 1478 clean-cfa_cpplibPROGRAMS clean-generic clean-noinstLIBRARIES \ 1479 cscopelist-am ctags ctags-am distclean distclean-compile \ 1480 distclean-generic distclean-tags distdir dvi dvi-am html \ 1481 html-am info info-am install install-am \ 1482 install-cfa_cpplibPROGRAMS install-data install-data-am \ 1483 install-dvi install-dvi-am install-exec install-exec-am \ 1484 install-html install-html-am install-info install-info-am \ 1485 install-man install-pdf install-pdf-am install-ps \ 1486 install-ps-am install-strip installcheck installcheck-am \ 1487 installdirs maintainer-clean maintainer-clean-generic \ 1488 mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ 1489 ps ps-am tags tags-am uninstall uninstall-am \ 1543 clean-cfa_cpplibPROGRAMS clean-generic clean-libtool \ 1544 clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \ 1545 distclean-compile distclean-generic distclean-libtool \ 1546 distclean-tags distdir dvi dvi-am html html-am info info-am \ 1547 install install-am install-cfa_cpplibPROGRAMS install-data \ 1548 install-data-am install-dvi install-dvi-am install-exec \ 1549 install-exec-am install-html install-html-am install-info \ 1550 install-info-am install-man install-pdf install-pdf-am \ 1551 install-ps install-ps-am install-strip installcheck \ 1552 installcheck-am installdirs maintainer-clean \ 1553 maintainer-clean-generic mostlyclean mostlyclean-compile \ 1554 mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ 1555 tags tags-am uninstall uninstall-am \ 1490 1556 uninstall-cfa_cpplibPROGRAMS 1491 1557 -
src/Parser/DeclarationNode.cc
raeb8f70 re99e43f 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 20 14:56:54201813 // Update Count : 110 712 // Last Modified On : Thu Nov 1 20:54:26 2018 13 // Update Count : 1108 14 14 // 15 15 … … 402 402 } 403 403 404 DeclarationNode * DeclarationNode::newTypeof( ExpressionNode * expr ) {405 DeclarationNode * newnode = new DeclarationNode; 406 newnode->type = new TypeData( TypeData::Typeof );404 DeclarationNode * DeclarationNode::newTypeof( ExpressionNode * expr, bool basetypeof ) { 405 DeclarationNode * newnode = new DeclarationNode; 406 newnode->type = new TypeData( basetypeof ? TypeData::Basetypeof : TypeData::Typeof ); 407 407 newnode->type->typeexpr = expr; 408 408 return newnode; -
src/Parser/ParseNode.h
raeb8f70 re99e43f 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 4 09:39:40201813 // Update Count : 85 312 // Last Modified On : Thu Nov 1 20:54:53 2018 13 // Update Count : 854 14 14 // 15 15 … … 249 249 static DeclarationNode * newBitfield( ExpressionNode * size ); 250 250 static DeclarationNode * newTuple( DeclarationNode * members ); 251 static DeclarationNode * newTypeof( ExpressionNode * expr );251 static DeclarationNode * newTypeof( ExpressionNode * expr, bool basetypeof = false ); 252 252 static DeclarationNode * newAttr( const std::string *, ExpressionNode * expr ); // @ attributes 253 253 static DeclarationNode * newAttr( const std::string *, DeclarationNode * type ); // @ attributes -
src/Parser/TypeData.cc
raeb8f70 re99e43f 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 20 14:39:31201813 // Update Count : 62 212 // Last Modified On : Fri Nov 2 07:54:26 2018 13 // Update Count : 624 14 14 // 15 15 … … 96 96 break; 97 97 case Typeof: 98 case Basetypeof: 98 99 // typeexpr = new Typeof_t; 99 100 typeexpr = nullptr; … … 166 167 break; 167 168 case Typeof: 169 case Basetypeof: 168 170 // delete typeexpr->expr; 169 171 delete typeexpr; … … 245 247 break; 246 248 case Typeof: 249 case Basetypeof: 247 250 newtype->typeexpr = maybeClone( typeexpr ); 248 251 break; … … 419 422 } // if 420 423 break; 424 case Basetypeof: 425 os << "base-"; 426 #if defined(__GNUC__) && __GNUC__ >= 7 427 __attribute__((fallthrough)); 428 #endif 421 429 case Typeof: 422 430 os << "type-of expression "; … … 457 465 case Tuple: 458 466 case Typeof: 467 case Basetypeof: 459 468 case Builtin: 460 469 assertf(false, "Tried to get leaf name from kind without a name: %d", kind); … … 513 522 switch ( td->kind ) { 514 523 case TypeData::Unknown: 515 // fill in implicit int516 return new BasicType( buildQualifiers( td ), BasicType::SignedInt );524 // fill in implicit int 525 return new BasicType( buildQualifiers( td ), BasicType::SignedInt ); 517 526 case TypeData::Basic: 518 return buildBasicType( td );527 return buildBasicType( td ); 519 528 case TypeData::Pointer: 520 return buildPointer( td );529 return buildPointer( td ); 521 530 case TypeData::Array: 522 return buildArray( td );531 return buildArray( td ); 523 532 case TypeData::Reference: 524 return buildReference( td );533 return buildReference( td ); 525 534 case TypeData::Function: 526 return buildFunction( td );535 return buildFunction( td ); 527 536 case TypeData::AggregateInst: 528 return buildAggInst( td );537 return buildAggInst( td ); 529 538 case TypeData::EnumConstant: 530 // the name gets filled in later -- by SymTab::Validate531 return new EnumInstType( buildQualifiers( td ), "" );539 // the name gets filled in later -- by SymTab::Validate 540 return new EnumInstType( buildQualifiers( td ), "" ); 532 541 case TypeData::SymbolicInst: 533 return buildSymbolicInst( td );542 return buildSymbolicInst( td ); 534 543 case TypeData::Tuple: 535 return buildTuple( td );544 return buildTuple( td ); 536 545 case TypeData::Typeof: 537 return buildTypeof( td ); 546 case TypeData::Basetypeof: 547 return buildTypeof( td ); 538 548 case TypeData::Builtin: 539 if(td->builtintype == DeclarationNode::Zero) {540 return new ZeroType( noQualifiers );541 }542 else if(td->builtintype == DeclarationNode::One) {543 return new OneType( noQualifiers );544 }545 else {546 return new VarArgsType( buildQualifiers( td ) );547 }549 if (td->builtintype == DeclarationNode::Zero) { 550 return new ZeroType( noQualifiers ); 551 } 552 else if (td->builtintype == DeclarationNode::One) { 553 return new OneType( noQualifiers ); 554 } 555 else { 556 return new VarArgsType( buildQualifiers( td ) ); 557 } 548 558 case TypeData::GlobalScope: 549 return new GlobalScopeType();559 return new GlobalScopeType(); 550 560 case TypeData::Qualified: 551 return new QualifiedType( buildQualifiers( td ), typebuild( td->qualified.parent ), typebuild( td->qualified.child ) );561 return new QualifiedType( buildQualifiers( td ), typebuild( td->qualified.parent ), typebuild( td->qualified.child ) ); 552 562 case TypeData::Symbolic: 553 563 case TypeData::Enum: 554 564 case TypeData::Aggregate: 555 assert( false );565 assert( false ); 556 566 } // switch 557 567 … … 929 939 930 940 TypeofType * buildTypeof( const TypeData * td ) { 931 assert( td->kind == TypeData::Typeof );941 assert( td->kind == TypeData::Typeof || td->kind == TypeData::Basetypeof ); 932 942 assert( td->typeexpr ); 933 943 // assert( td->typeexpr->expr ); 934 return new TypeofType( buildQualifiers( td ), td->typeexpr->build() ); 944 return new TypeofType{ 945 buildQualifiers( td ), td->typeexpr->build(), td->kind == TypeData::Basetypeof }; 935 946 } // buildTypeof 936 947 -
src/Parser/TypeData.h
raeb8f70 re99e43f 10 10 // Created On : Sat May 16 15:18:36 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 20 13:56:40201813 // Update Count : 19 512 // Last Modified On : Thu Nov 1 20:56:46 2018 13 // Update Count : 196 14 14 // 15 15 … … 27 27 struct TypeData { 28 28 enum Kind { Basic, Pointer, Reference, Array, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic, 29 SymbolicInst, Tuple, Typeof, B uiltin, GlobalScope, Qualified, Unknown };29 SymbolicInst, Tuple, Typeof, Basetypeof, Builtin, GlobalScope, Qualified, Unknown }; 30 30 31 31 struct Aggregate_t { -
src/Parser/lex.ll
raeb8f70 re99e43f 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Wed Aug 29 15:02:41201813 * Update Count : 68 612 * Last Modified On : Thu Nov 1 20:57:35 2018 13 * Update Count : 687 14 14 */ 15 15 … … 209 209 __attribute__ { KEYWORD_RETURN(ATTRIBUTE); } // GCC 210 210 auto { KEYWORD_RETURN(AUTO); } 211 basetypeof { KEYWORD_RETURN(BASETYPEOF); } // CFA 211 212 _Bool { KEYWORD_RETURN(BOOL); } // C99 212 213 break { KEYWORD_RETURN(BREAK); } -
src/Parser/parser.yy
raeb8f70 re99e43f 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 30 17:02:25201813 // Update Count : 40 2912 // Last Modified On : Thu Nov 8 18:08:23 2018 13 // Update Count : 4052 14 14 // 15 15 … … 186 186 } // fieldDecl 187 187 188 ExpressionNode *forInc( const OperKinds op ) {189 return new ExpressionNode( build_constantInteger( *new string( op == OperKinds::LThan || op == OperKinds::LEThan ? "1" : "-1" ) ) );190 } // forInc191 192 188 ForCtrl * forCtrl( ExpressionNode * type, string * index, ExpressionNode * start, enum OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) { 193 ConstantExpr * constant = dynamic_cast<ConstantExpr *>(type->get_expr());189 ConstantExpr * constant = dynamic_cast<ConstantExpr *>(type->get_expr()); 194 190 if ( constant && (constant->get_constant()->get_value() == "0" || constant->get_constant()->get_value() == "1") ) { 195 191 type = new ExpressionNode( new CastExpr( maybeMoveBuild< Expression >(type), new BasicType( Type::Qualifiers(), BasicType::SignedInt ) ) ); 196 192 } // if 197 193 return new ForCtrl( 198 distAttr( DeclarationNode::newTypeof( type ), DeclarationNode::newName( index )->addInitializer( new InitializerNode( start ) ) ),194 distAttr( DeclarationNode::newTypeof( type, true ), DeclarationNode::newName( index )->addInitializer( new InitializerNode( start ) ) ), 199 195 new ExpressionNode( build_binary_val( compop, new ExpressionNode( build_varref( new string( *index ) ) ), comp ) ), 200 new ExpressionNode( build_binary_val( OperKinds::PlusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) ); 196 new ExpressionNode( build_binary_val( compop == OperKinds::LThan || compop == OperKinds::LEThan ? // choose += or -= for upto/downto 197 OperKinds::PlusAssn : OperKinds::MinusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) ); 198 } // forCtrl 199 200 ForCtrl * forCtrl( ExpressionNode * type, ExpressionNode * index, ExpressionNode * start, enum OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) { 201 if ( NameExpr * identifier = dynamic_cast<NameExpr *>(index->get_expr()) ) { 202 return forCtrl( type, new string( identifier->name ), start, compop, comp, inc ); 203 } else { 204 SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); return nullptr; 205 } // if 201 206 } // forCtrl 202 207 … … 261 266 %token ZERO_T ONE_T // CFA 262 267 %token VALIST // GCC 263 %token TYPEOF LABEL// GCC268 %token TYPEOF BASETYPEOF LABEL // GCC 264 269 %token ENUM STRUCT UNION 265 270 %token EXCEPTION // CFA … … 636 641 { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $4 ) ) ); } 637 642 | postfix_expression ARROW no_attr_identifier 638 { 639 $$ = new ExpressionNode( build_pfieldSel( $1, *$3 == "0" || *$3 == "1" ? build_constantInteger( *$3 ) : build_varref( $3 ) ) ); 640 } 643 { $$ = new ExpressionNode( build_pfieldSel( $1, build_varref( $3 ) ) ); } 641 644 | postfix_expression ARROW INTEGERconstant // CFA, tuple index 642 645 { $$ = new ExpressionNode( build_pfieldSel( $1, build_constantInteger( *$3 ) ) ); } … … 1137 1140 | FOR '(' push for_control_expression ')' statement pop 1138 1141 { $$ = new StatementNode( build_for( $4, $6 ) ); } 1142 | FOR '(' ')' statement // CFA => for ( ;; ) 1143 { $$ = new StatementNode( build_for( new ForCtrl( (ExpressionNode * )nullptr, (ExpressionNode * )nullptr, (ExpressionNode * )nullptr ), $4 ) ); } 1139 1144 ; 1140 1145 1141 1146 for_control_expression: 1142 comma_expression_opt // CFA 1143 { 1144 if ( ! $1 ) { // => for ( ;; ) 1145 $$ = new ForCtrl( (ExpressionNode * )nullptr, (ExpressionNode * )nullptr, (ExpressionNode * )nullptr ); 1146 } else { 1147 $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1148 OperKinds::LThan, $1->clone(), forInc( OperKinds::LThan ) ); 1149 } // if 1150 } 1147 comma_expression // CFA 1148 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1149 OperKinds::LThan, $1->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } 1151 1150 | constant_expression inclexcl constant_expression // CFA 1152 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, forInc( $2) ); }1151 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } 1153 1152 | constant_expression inclexcl constant_expression '~' constant_expression // CFA 1154 1153 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, $5 ); } 1155 | comma_expression_opt ';' comma_expression // CFA 1156 { 1157 if ( ! $1 ) { 1158 SemanticError( yylloc, "Missing loop index." ); $$ = nullptr; 1159 } else if ( ! $3 ) { 1160 SemanticError( yylloc, "Missing loop range." ); $$ = nullptr; 1161 } else { 1162 if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) { 1163 $$ = forCtrl( $3, new string( identifier->name ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1164 OperKinds::LThan, $3->clone(), forInc( OperKinds::LThan ) ); 1165 } else { 1166 SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr; 1167 } // if 1168 } // if 1169 } 1170 | comma_expression_opt ';' constant_expression inclexcl constant_expression // CFA 1171 { 1172 if ( ! $1 ) { 1173 SemanticError( yylloc, "Missing loop index." ); $$ = nullptr; 1174 } else { 1175 if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) { 1176 $$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $4, $5, forInc( $4 ) ); 1177 } else { 1178 SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr; 1179 } // if 1180 } // if 1181 } 1182 | comma_expression_opt ';' constant_expression inclexcl constant_expression '~' constant_expression // CFA 1183 { 1184 if ( ! $1 ) { 1185 SemanticError( yylloc, "Missing loop index." ); $$ = nullptr; 1186 } else { 1187 if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) { 1188 $$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $4, $5, $7 ); 1189 } else { 1190 SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr; 1191 } // if 1192 } // if 1193 } 1194 | comma_expression_opt ';' comma_expression_opt ';' comma_expression_opt 1154 | comma_expression ';' comma_expression // CFA 1155 { $$ = forCtrl( $3, $1, new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1156 OperKinds::LThan, $3->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } 1157 | comma_expression ';' constant_expression inclexcl constant_expression // CFA 1158 { $$ = forCtrl( $3, $1, $3->clone(), $4, $5, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } 1159 | comma_expression ';' constant_expression inclexcl constant_expression '~' constant_expression // CFA 1160 { $$ = forCtrl( $3, $1, $3->clone(), $4, $5, $7 ); } 1161 | comma_expression ';' comma_expression_opt ';' comma_expression_opt 1195 1162 { $$ = new ForCtrl( $1, $3, $5 ); } 1163 | ';' comma_expression_opt ';' comma_expression_opt 1164 { $$ = new ForCtrl( (ExpressionNode * )nullptr, $2, $4 ); } 1196 1165 | declaration comma_expression_opt ';' comma_expression_opt // C99, declaration has ';' 1197 1166 { $$ = new ForCtrl( $1, $2, $4 ); } … … 1855 1824 1856 1825 indirect_type: 1857 TYPEOF '(' type ')' // GCC: typeof( x) y;1826 TYPEOF '(' type ')' // GCC: typeof( x ) y; 1858 1827 { $$ = $3; } 1859 | TYPEOF '(' comma_expression ')' // GCC: typeof( a+b) y;1828 | TYPEOF '(' comma_expression ')' // GCC: typeof( a+b ) y; 1860 1829 { $$ = DeclarationNode::newTypeof( $3 ); } 1861 | ATTR_TYPEGENname '(' type ')' // CFA: e.g., @type(x) y; 1830 | BASETYPEOF '(' type ')' // CFA: basetypeof( x ) y; 1831 { $$ = DeclarationNode::newTypeof( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ), true ); } 1832 | BASETYPEOF '(' comma_expression ')' // CFA: basetypeof( a+b ) y; 1833 { $$ = DeclarationNode::newTypeof( $3, true ); } 1834 | ATTR_TYPEGENname '(' type ')' // CFA: e.g., @type( x ) y; 1862 1835 { $$ = DeclarationNode::newAttr( $1, $3 ); } 1863 | ATTR_TYPEGENname '(' comma_expression ')' // CFA: e.g., @type( a+b) y;1836 | ATTR_TYPEGENname '(' comma_expression ')' // CFA: e.g., @type( a+b ) y; 1864 1837 { $$ = DeclarationNode::newAttr( $1, $3 ); } 1865 1838 | ZERO_T // CFA -
src/ResolvExpr/Alternative.cc
raeb8f70 re99e43f 120 120 os << "Null expression!" << std::endl; 121 121 } // if 122 os << indent << "Environment: 122 os << indent << "Environment:"; 123 123 env.print( os, indent+1 ); 124 124 os << std::endl; -
src/ResolvExpr/AlternativeFinder.cc
raeb8f70 re99e43f 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sat May 16 23:52:08 2015 11 // Last Modified By : Aaron B. Moss12 // Last Modified On : Fri Oct -5 10:01:00201813 // Update Count : 3 411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Nov 1 21:00:56 2018 13 // Update Count : 35 14 14 // 15 15 … … 500 500 needAssertions[ *assert ].isUsed = true; 501 501 } 502 /// needAssertions.insert( needAssertions.end(), (*tyvar)->get_assertions().begin(), (*tyvar)->get_assertions().end() ); 503 } 504 } 505 506 // template< typename ForwardIterator, typename OutputIterator > 507 // void inferRecursive( ForwardIterator begin, ForwardIterator end, const Alternative &newAlt, OpenVarSet &openVars, const SymTab::Indexer &decls, const AssertionSet &newNeed, int level, const SymTab::Indexer &indexer, OutputIterator out ) { 508 // if ( newAlt.cost == Cost::infinity ) return; // don't proceed down this dead end 509 // if ( begin == end ) { 510 // if ( newNeed.empty() ) { 511 // PRINT( 512 // std::cerr << "all assertions satisfied, output alternative: "; 513 // newAlt.print( std::cerr ); 514 // std::cerr << std::endl; 515 // ); 516 // *out++ = newAlt; 517 // return; 518 // } else if ( level >= recursionLimit ) { 519 // SemanticError( newAlt.expr->location, "Too many recursive assertions" ); 520 // } else { 521 // AssertionSet newerNeed; 522 // PRINT( 523 // std::cerr << "recursing with new set:" << std::endl; 524 // printAssertionSet( newNeed, std::cerr, 8 ); 525 // ) 526 // inferRecursive( newNeed.begin(), newNeed.end(), newAlt, openVars, decls, newerNeed, level+1, indexer, out ); 527 // return; 528 // } 529 // } 530 531 // ForwardIterator cur = begin++; 532 // if ( ! cur->second.isUsed ) { 533 // inferRecursive( begin, end, newAlt, openVars, decls, newNeed, level, indexer, out ); 534 // return; // xxx - should this continue? previously this wasn't here, and it looks like it should be 535 // } 536 // DeclarationWithType *curDecl = cur->first; 537 538 // PRINT( 539 // std::cerr << "inferRecursive: assertion is "; 540 // curDecl->print( std::cerr ); 541 // std::cerr << std::endl; 542 // ) 543 // std::list< SymTab::Indexer::IdData > candidates; 544 // decls.lookupId( curDecl->get_name(), candidates ); 545 // /// if ( candidates.empty() ) { std::cerr << "no candidates!" << std::endl; } 546 // for ( const auto & data : candidates ) { 547 // DeclarationWithType * candidate = data.id; 548 // PRINT( 549 // std::cerr << "inferRecursive: candidate is "; 550 // candidate->print( std::cerr ); 551 // std::cerr << std::endl; 552 // ) 553 554 // AssertionSet newHave, newerNeed( newNeed ); 555 // TypeEnvironment newEnv( newAlt.env ); 556 // OpenVarSet newOpenVars( openVars ); 557 // Type *adjType = candidate->get_type()->clone(); 558 // adjustExprType( adjType, newEnv, indexer ); 559 // renameTyVars( adjType ); 560 // PRINT( 561 // std::cerr << "unifying "; 562 // curDecl->get_type()->print( std::cerr ); 563 // std::cerr << " with "; 564 // adjType->print( std::cerr ); 565 // std::cerr << std::endl; 566 // ) 567 // if ( unify( curDecl->get_type(), adjType, newEnv, newerNeed, newHave, newOpenVars, indexer ) ) { 568 // PRINT( 569 // std::cerr << "success!" << std::endl; 570 // ) 571 // SymTab::Indexer newDecls( decls ); 572 // addToIndexer( newHave, newDecls ); 573 // Alternative newerAlt( newAlt ); 574 // newerAlt.env = newEnv; 575 // assertf( candidate->get_uniqueId(), "Assertion candidate does not have a unique ID: %s", toString( candidate ).c_str() ); 576 577 // // everything with an empty idChain was pulled in by the current assertion. 578 // // add current assertion's idChain + current assertion's ID so that the correct inferParameters can be found. 579 // for ( auto & a : newerNeed ) { 580 // if ( a.second.idChain.empty() ) { 581 // a.second.idChain = cur->second.idChain; 582 // a.second.idChain.push_back( curDecl->get_uniqueId() ); 583 // } 584 // } 585 586 // Expression *varExpr = data.combine( newerAlt.cvtCost ); 587 // delete varExpr->get_result(); 588 // varExpr->set_result( adjType->clone() ); 589 // PRINT( 590 // std::cerr << "satisfying assertion " << curDecl->get_uniqueId() << " "; 591 // curDecl->print( std::cerr ); 592 // std::cerr << " with declaration " << candidate->get_uniqueId() << " "; 593 // candidate->print( std::cerr ); 594 // std::cerr << std::endl; 595 // ) 596 // // follow the current assertion's ID chain to find the correct set of inferred parameters to add the candidate to (i.e. the set of inferred parameters belonging to the entity which requested the assertion parameter). 597 // InferredParams * inferParameters = &newerAlt.expr->inferParams; 598 // for ( UniqueId id : cur->second.idChain ) { 599 // inferParameters = (*inferParameters)[ id ].inferParams.get(); 600 // } 601 // // XXX: this is a memory leak, but adjType can't be deleted because it might contain assertions 602 // (*inferParameters)[ curDecl->get_uniqueId() ] = ParamEntry( candidate->get_uniqueId(), adjType->clone(), curDecl->get_type()->clone(), varExpr ); 603 // inferRecursive( begin, end, newerAlt, newOpenVars, newDecls, newerNeed, level, indexer, out ); 604 // } else { 605 // delete adjType; 606 // } 607 // } 608 // } 502 } 503 } 609 504 610 505 /// Unique identifier for matching expression resolutions to their requesting expression … … 613 508 template< typename OutputIterator > 614 509 void AlternativeFinder::Finder::inferParameters( Alternative &newAlt, OutputIterator out ) { 615 // SymTab::Indexer decls( indexer );616 // addToIndexer( have, decls );617 // AssertionSet newNeed;618 // PRINT(619 // std::cerr << "env is: " << std::endl;620 // newAlt.env.print( std::cerr, 0 );621 // std::cerr << std::endl;622 // )623 624 // inferRecursive( need.begin(), need.end(), newAlt, openVars, decls, newNeed, 0, indexer, out );625 626 510 // Set need bindings for any unbound assertions 627 511 UniqueId crntResnSlot = 0; // matching ID for this expression's assertions … … 1373 1257 /// Gets name from untyped member expression (member must be NameExpr) 1374 1258 const std::string& get_member_name( UntypedMemberExpr *memberExpr ) { 1259 if ( dynamic_cast< ConstantExpr * >( memberExpr->get_member() ) ) { 1260 SemanticError( memberExpr, "Indexed access to struct fields unsupported: " ); 1261 } // if 1375 1262 NameExpr * nameExpr = dynamic_cast< NameExpr * >( memberExpr->get_member() ); 1376 1263 assert( nameExpr ); -
src/ResolvExpr/ResolveTypeof.cc
raeb8f70 re99e43f 67 67 std::cerr << std::endl; 68 68 #endif 69 if ( typeofType->expr ) { 69 // pass on null expression 70 if ( ! typeofType->expr ) return typeofType; 71 72 bool isBasetypeof = typeofType->is_basetypeof; 73 auto oldQuals = typeofType->get_qualifiers().val; 74 75 Type* newType; 76 if ( TypeExpr* tyExpr = dynamic_cast<TypeExpr*>(typeofType->expr) ) { 77 // typeof wrapping type 78 newType = tyExpr->type; 79 tyExpr->type = nullptr; 80 delete tyExpr; 81 } else { 82 // typeof wrapping expression 70 83 Expression * newExpr = resolveInVoidContext( typeofType->expr, indexer ); 71 84 assert( newExpr->result && ! newExpr->result->isVoid() ); 72 Type *newType = newExpr->result;85 newType = newExpr->result; 73 86 newExpr->result = nullptr; 74 87 delete typeofType; 75 88 delete newExpr; 76 return newType; 77 } // if 78 return typeofType; 89 } 90 91 // clear qualifiers for base, combine with typeoftype quals in any case 92 if ( isBasetypeof ) { 93 // replace basetypeof(<enum>) by int 94 if ( dynamic_cast<EnumInstType*>(newType) ) { 95 Type* newerType = 96 new BasicType{ newType->get_qualifiers(), BasicType::SignedInt, 97 newType->attributes }; 98 delete newType; 99 newType = newerType; 100 } 101 newType->get_qualifiers().val 102 = ( newType->get_qualifiers().val & ~Type::Qualifiers::Mask ) | oldQuals; 103 } else { 104 newType->get_qualifiers().val |= oldQuals; 105 } 106 107 return newType; 79 108 } 80 109 } // namespace ResolvExpr -
src/SynTree/Expression.cc
raeb8f70 re99e43f 376 376 os << "Untyped Member Expression, with field: " << std::endl << indent+1; 377 377 member->print(os, indent+1 ); 378 os << indent << "... from aggregate: 378 os << indent << "... from aggregate:" << std::endl << indent+1; 379 379 aggregate->print(os, indent+1); 380 380 Expression::print( os, indent ); … … 405 405 406 406 void MemberExpr::print( std::ostream &os, Indenter indent ) const { 407 os << "Member Expression, with field: 407 os << "Member Expression, with field:" << std::endl; 408 408 os << indent+1; 409 409 member->print( os, indent+1 ); 410 os << std::endl << indent << "... from aggregate: 410 os << std::endl << indent << "... from aggregate:" << std::endl << indent+1; 411 411 aggregate->print(os, indent + 1); 412 412 Expression::print( os, indent ); -
src/SynTree/FunctionDecl.cc
raeb8f70 re99e43f 87 87 88 88 if ( statements ) { 89 os << indent << "... with body 89 os << indent << "... with body" << endl << indent+1; 90 90 statements->print( os, indent+1 ); 91 91 } // if -
src/SynTree/FunctionType.cc
raeb8f70 re99e43f 66 66 os << indent+1 << "accepting unspecified arguments" << endl; 67 67 } // if 68 os << indent << "... returning 68 os << indent << "... returning"; 69 69 if ( returnVals.empty() ) { 70 os << " nothing" << endl;70 os << " nothing" << endl; 71 71 } else { 72 72 os << endl; -
src/SynTree/ObjectDecl.cc
raeb8f70 re99e43f 66 66 67 67 if ( ! attributes.empty() ) { 68 os << std::endl << indent << "... with attributes: 68 os << std::endl << indent << "... with attributes:" << std::endl; 69 69 printAll( attributes, os, indent+1 ); 70 70 } -
src/SynTree/ReferenceToType.cc
raeb8f70 re99e43f 93 93 else { 94 94 Type::print( os, indent ); 95 os << "instance of " << typeString() << " " << name << " with body " << baseStruct->has_body() << " ";95 os << "instance of " << typeString() << " " << name << " with body " << baseStruct->has_body(); 96 96 if ( ! parameters.empty() ) { 97 97 os << endl << indent << "... with parameters" << endl; … … 136 136 else { 137 137 Type::print( os, indent ); 138 os << "instance of " << typeString() << " " << name << " with body " << baseUnion->has_body() << " ";138 os << "instance of " << typeString() << " " << name << " with body " << baseUnion->has_body(); 139 139 if ( ! parameters.empty() ) { 140 140 os << endl << indent << "... with parameters" << endl; … … 160 160 else { 161 161 Type::print( os, indent ); 162 os << "instance of " << typeString() << " " << name << " with body " << baseEnum->has_body() << " ";162 os << "instance of " << typeString() << " " << name << " with body " << baseEnum->has_body(); 163 163 } // if 164 164 } -
src/SynTree/Type.h
raeb8f70 re99e43f 598 598 class TypeofType : public Type { 599 599 public: 600 Expression *expr; 601 602 TypeofType( const Type::Qualifiers & tq, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 600 Expression *expr; ///< expression to take the type of 601 bool is_basetypeof; ///< true iff is basetypeof type 602 603 TypeofType( const Type::Qualifiers & tq, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 604 TypeofType( const Type::Qualifiers & tq, Expression *expr, bool is_basetypeof, 605 const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 603 606 TypeofType( const TypeofType& ); 604 607 virtual ~TypeofType(); -
src/SynTree/TypeofType.cc
raeb8f70 re99e43f 23 23 class Attribute; 24 24 25 TypeofType::TypeofType( const Type::Qualifiers &tq, Expression *expr, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), expr( expr ) { 26 } 25 TypeofType::TypeofType( const Type::Qualifiers &tq, Expression *expr, 26 const std::list< Attribute * > & attributes ) 27 : Type( tq, attributes ), expr( expr ), is_basetypeof(false) {} 27 28 28 TypeofType::TypeofType( const TypeofType &other ) : Type( other ), expr( maybeClone( other.expr ) ) { 29 } 29 TypeofType::TypeofType( const Type::Qualifiers &tq, Expression *expr, bool is_basetypeof, 30 const std::list< Attribute * > & attributes ) 31 : Type( tq, attributes ), expr( expr ), is_basetypeof( is_basetypeof ) {} 32 33 TypeofType::TypeofType( const TypeofType &other ) 34 : Type( other ), expr( maybeClone( other.expr ) ), is_basetypeof( other.is_basetypeof ) {} 30 35 31 36 TypeofType::~TypeofType() { … … 35 40 void TypeofType::print( std::ostream &os, Indenter indent ) const { 36 41 Type::print( os, indent ); 42 if ( is_basetypeof ) { os << "base-"; } 37 43 os << "type-of expression "; 38 44 if ( expr ) { -
src/cfa.make
raeb8f70 re99e43f 1 2 1 3 CFACOMPILE = $(CFACC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) $(AM_CFLAGS) $(CFLAGS) 4 LTCFACOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ 5 $(LIBTOOLFLAGS) --mode=compile $(CFACC) $(DEFS) \ 6 $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) \ 7 $(AM_CFLAGS) $(CFLAGS) 2 8 3 9 AM_V_CFA = $(am__v_CFA_@AM_V@) … … 10 16 $(CFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ 11 17 $(am__mv) $$depbase.Tpo $$depbase.Po 18 19 .cfa.lo: 20 $(AM_V_CFA)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ 21 $(LTCFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ 22 $(am__mv) $$depbase.Tpo $$depbase.Plo 23 24 AM_V_JAVAC = $(am__v_JAVAC_@AM_V@) 25 am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@) 26 am__v_JAVAC_0 = @echo " JAVAC " $@; 27 am__v_JAVAC_1 = 28 29 AM_V_GOC = $(am__v_GOC_@AM_V@) 30 am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@) 31 am__v_GOC_0 = @echo " GOC " $@; 32 am__v_GOC_1 = 33 34 35 UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS) 36 37 AM_V_UPP = $(am__v_UPP_@AM_V@) 38 am__v_UPP_ = $(am__v_UPP_@AM_DEFAULT_V@) 39 am__v_UPP_0 = @echo " UPP " $@; 40 am__v_UPP_1 = -
src/config.h.in
raeb8f70 re99e43f 7 7 #undef CFA_64_CPU 8 8 9 /* Location of include files. */9 /* Backend compiler to use. */ 10 10 #undef CFA_BACKEND_CC 11 11 … … 67 67 #undef HAVE_ALLOCA_H 68 68 69 /* Define to 1 if you have the <dlfcn.h> header file. */ 70 #undef HAVE_DLFCN_H 71 69 72 /* Define to 1 if you have the <fenv.h> header file. */ 70 73 #undef HAVE_FENV_H … … 129 132 /* Define to 1 if the system has the type `_Bool'. */ 130 133 #undef HAVE__BOOL 134 135 /* Define to the sub-directory where libtool stores uninstalled libraries. */ 136 #undef LT_OBJDIR 131 137 132 138 /* Name of package */ -
src/main.cc
raeb8f70 re99e43f 487 487 resolvep = true; 488 488 break; 489 489 case 'R': // dump resolv-proto instance 490 490 resolvprotop = true; 491 491 break;
Note:
See TracChangeset
for help on using the changeset viewer.