Changeset e99e43f for src


Ignore:
Timestamp:
Jan 10, 2019, 3:50:34 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
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)
Message:

Merge remote-tracking branch 'plg/master' into deferred_resn

Location:
src
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • src/CodeTools/ResolvProtoDump.cc

    raeb8f70 re99e43f  
    5151
    5252                /// Child constructor
    53                 ProtoDump(const ProtoDump* p, Type* r) 
     53                ProtoDump(const ProtoDump* p, Type* r)
    5454                        : decls(), exprs(), subs(), closed(p->closed), parent(p), rtnType(r) {}
    5555
    5656                // 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),
    5959                          rtnType(maybeClone(o.rtnType.get())) {}
    6060                ProtoDump( ProtoDump&& ) = default;
     
    6969                        parent = o.parent;
    7070                        rtnType.reset( maybeClone(o.rtnType.get()) );
    71                        
     71
    7272                        return *this;
    7373                }
    74                 ProtoDump& operator= (ProtoDump&&) = default;
     74                ProtoDump& operator= (ProtoDump&&) = delete;
    7575
    7676        private:
     
    9696                        subs.emplace_back( std::move(sub.pass) );
    9797                }
    98        
     98
    9999                /// Whether lists should be separated, terminated, or preceded by their separator
    100100                enum septype { separated, terminated, preceded };
     
    102102                /// builds space-separated list of types
    103103                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,
    105105                                septype mode = separated ) {
    106106                        if ( tys.empty() ) return;
     
    121121                /// builds list of types wrapped as tuple type
    122122                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,
    124124                                std::stringstream& ss ) {
    125125                        switch ( tys.size() ) {
     
    162162                        if ( name.compare( 0, 10, "_operator_" ) == 0 ) {
    163163                                ss << name.substr(10);
    164                         } else if ( name.compare( "_constructor" ) == 0 
     164                        } else if ( name.compare( "_constructor" ) == 0
    165165                                        || name.compare( "_destructor" ) == 0 ) {
    166166                                ss << name.substr(1);
     
    173173
    174174                /// 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,
    176176                                std::string&& pre = "" ) {
    177177                        // safety check for anonymous names
     
    187187                                op_name( info.outputName, ss );
    188188                                return;
    189                         } 
    190                        
     189                        }
     190
    191191                        // replace retval names
    192192                        if ( name.compare( 0, 8, "_retval_" ) == 0 ) {
     
    195195                                return;
    196196                        }
    197                        
     197
    198198                        // default to just name, with first character in lowercase
    199                         ss << pre 
     199                        ss << pre
    200200                           << (char)std::tolower( static_cast<unsigned char>(name[0]) )
    201201                           << (name.c_str() + 1);
     
    221221                        // strip trailing "_generic_" from autogen names (avoids some user-generation issues)
    222222                        char generic[] = "_generic_"; size_t n_generic = sizeof(generic) - 1;
    223                         if ( stripped.size() >= n_generic 
     223                        if ( stripped.size() >= n_generic
    224224                                        && stripped.substr( stripped.size() - n_generic ) == generic ) {
    225225                                stripped.resize( stripped.size() - n_generic );
     
    237237                        unsigned depth;                                 ///< Depth of nesting from root type
    238238
    239                         TypePrinter( const std::unordered_set<std::string>& closed, std::stringstream& ss ) 
     239                        TypePrinter( const std::unordered_set<std::string>& closed, std::stringstream& ss )
    240240                                : ss(ss), closed(closed), depth(0) {}
    241241
     
    337337                        }
    338338                };
    339        
     339
    340340                /// builds description of function
    341341                void build( const std::string& name, FunctionType* fnTy, std::stringstream& ss ) {
     
    350350                        for ( TypeDecl* tyvar : fnTy->forall ) {
    351351                                for ( DeclarationWithType* assn : tyvar->assertions ) {
    352                                         ss << " | "; 
     352                                        ss << " | ";
    353353                                        build( assn->name, assn->get_type(), ss );
    354354                                }
     
    360360                        // ignore top-level references
    361361                        Type *norefs = ty->stripReferences();
    362                        
     362
    363363                        // fall back to function declaration if function type
    364364                        if ( PointerType* pTy = dynamic_cast< PointerType* >(norefs) ) {
     
    409409                        std::stringstream& ss;                          ///< Output to print to
    410410
    411                         ExprPrinter( const std::unordered_set<std::string>& closed, std::stringstream& ss ) 
     411                        ExprPrinter( const std::unordered_set<std::string>& closed, std::stringstream& ss )
    412412                                : closed(closed), ss(ss) {}
    413413
     
    476476                                visit_children = false;
    477477                        }
    478                        
     478
    479479                        /// Member access handled as function from aggregate to member
    480480                        void previsit( UntypedMemberExpr* expr ) {
     
    662662                                        }
    663663                                }
    664                                
     664
    665665                                // add named parameters and returns to local scope
    666666                                body.pass.addAll( decl->type->returnVals );
     
    679679                void previsit( StructDecl* sd ) { addAggregateFields(sd); }
    680680                void previsit( UnionDecl* ud ) { addAggregateFields(ud); }
    681                
     681
    682682                void previsit( EnumDecl* ed ) {
    683                         std::unique_ptr<Type> eType = 
     683                        std::unique_ptr<Type> eType =
    684684                                std::make_unique<BasicType>( Type::Qualifiers{}, BasicType::SignedInt );
    685                        
     685
    686686                        // add field names directly to enclosing scope
    687687                        for ( Declaration* member : ed->members ) {
  • src/Makefile.am

    raeb8f70 re99e43f  
    1717# create object files in directory with source files
    1818AUTOMAKE_OPTIONS = foreign subdir-objects
     19ACLOCAL_AMFLAGS  = -I automake
    1920
    2021SRC = main.cc \
  • src/Makefile.in

    raeb8f70 re99e43f  
    141141subdir = src
    142142ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
    143 am__aclocal_m4_deps = $(top_srcdir)/automake/cfa.m4 \
    144         $(top_srcdir)/configure.ac
     143am__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
    145149am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
    146150        $(ACLOCAL_M4)
     
    151155CONFIG_CLEAN_VPATH_FILES =
    152156LIBRARIES = $(noinst_LIBRARIES)
    153 AR = ar
    154157AM_V_AR = $(am__v_AR_@AM_V@)
    155158am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
     
    295298___driver_cfa_cpp_OBJECTS = $(am____driver_cfa_cpp_OBJECTS)
    296299___driver_cfa_cpp_DEPENDENCIES =
     300AM_V_lt = $(am__v_lt_@AM_V@)
     301am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
     302am__v_lt_0 = --silent
     303am__v_lt_1 =
    297304am_demangler_OBJECTS = SymTab/demangler.$(OBJEXT)
    298305demangler_OBJECTS = $(am_demangler_OBJECTS)
     
    316323CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
    317324        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
     325LTCXXCOMPILE = $(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)
    318329AM_V_CXX = $(am__v_CXX_@AM_V@)
    319330am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
     
    321332am__v_CXX_1 =
    322333CXXLD = $(CXX)
    323 CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
    324         -o $@
     334CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
     335        $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
     336        $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
    325337AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
    326338am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
     
    328340am__v_CXXLD_1 =
    329341LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS)
     342LTLEXCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \
     343        $(LIBTOOLFLAGS) --mode=compile $(LEX) $(AM_LFLAGS) $(LFLAGS)
    330344AM_V_LEX = $(am__v_LEX_@AM_V@)
    331345am__v_LEX_ = $(am__v_LEX_@AM_DEFAULT_V@)
     
    336350                   -e s/c++$$/h++/ -e s/c$$/h/
    337351YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS)
     352LTYACCCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \
     353        $(LIBTOOLFLAGS) --mode=compile $(YACC) $(AM_YFLAGS) $(YFLAGS)
    338354AM_V_YACC = $(am__v_YACC_@AM_V@)
    339355am__v_YACC_ = $(am__v_YACC_@AM_DEFAULT_V@)
     
    342358COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
    343359        $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
     360LTCOMPILE = $(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)
    344364AM_V_CC = $(am__v_CC_@AM_V@)
    345365am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
     
    347367am__v_CC_1 =
    348368CCLD = $(CC)
    349 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
     369LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
     370        $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
     371        $(AM_LDFLAGS) $(LDFLAGS) -o $@
    350372AM_V_CCLD = $(am__v_CCLD_@AM_V@)
    351373am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
     
    397419AMTAR = @AMTAR@
    398420AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
     421AR = @AR@
    399422AUTOCONF = @AUTOCONF@
    400423AUTOHEADER = @AUTOHEADER@
    401424AUTOMAKE = @AUTOMAKE@
    402425AWK = @AWK@
    403 BACKEND_CC = @BACKEND_CC@
    404426BUILD_IN_TREE_FLAGS = @BUILD_IN_TREE_FLAGS@
    405427CC = @CC@
     
    421443CPPFLAGS = @CPPFLAGS@
    422444CXX = @CXX@
     445CXXCPP = @CXXCPP@
    423446CXXDEPMODE = @CXXDEPMODE@
    424447CXXFLAGS = @CXXFLAGS@
     
    426449DEFS = @DEFS@
    427450DEPDIR = @DEPDIR@
     451DLLTOOL = @DLLTOOL@
    428452DRIVER_DIR = @DRIVER_DIR@
     453DSYMUTIL = @DSYMUTIL@
     454DUMPBIN = @DUMPBIN@
    429455ECHO_C = @ECHO_C@
    430456ECHO_N = @ECHO_N@
     
    432458EGREP = @EGREP@
    433459EXEEXT = @EXEEXT@
     460FGREP = @FGREP@
    434461GREP = @GREP@
    435462HOST_FLAGS = @HOST_FLAGS@
     
    439466INSTALL_SCRIPT = @INSTALL_SCRIPT@
    440467INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
     468LD = @LD@
    441469LDFLAGS = @LDFLAGS@
    442470LEX = @LEX@
     
    447475LIBOBJS = @LIBOBJS@
    448476LIBS = @LIBS@
     477LIBTOOL = @LIBTOOL@
     478LIPO = @LIPO@
     479LN_S = @LN_S@
    449480LTLIBOBJS = @LTLIBOBJS@
     481LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
    450482MAKEINFO = @MAKEINFO@
     483MANIFEST_TOOL = @MANIFEST_TOOL@
    451484MKDIR_P = @MKDIR_P@
     485NM = @NM@
     486NMEDIT = @NMEDIT@
     487OBJDUMP = @OBJDUMP@
    452488OBJEXT = @OBJEXT@
     489OTOOL = @OTOOL@
     490OTOOL64 = @OTOOL64@
    453491PACKAGE = @PACKAGE@
    454492PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
     
    460498PATH_SEPARATOR = @PATH_SEPARATOR@
    461499RANLIB = @RANLIB@
     500SED = @SED@
    462501SET_MAKE = @SET_MAKE@
    463502SHELL = @SHELL@
     
    471510abs_top_builddir = @abs_top_builddir@
    472511abs_top_srcdir = @abs_top_srcdir@
     512ac_ct_AR = @ac_ct_AR@
    473513ac_ct_CC = @ac_ct_CC@
    474514ac_ct_CXX = @ac_ct_CXX@
     515ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
    475516am__include = @am__include@
    476517am__leading_dot = @am__leading_dot@
     
    522563# create object files in directory with source files
    523564AUTOMAKE_OPTIONS = foreign subdir-objects
     565ACLOCAL_AMFLAGS = -I automake
    524566SRC = main.cc MakeLibCfa.cc CompilationState.cc CodeGen/Generate.cc \
    525567        CodeGen/CodeGenerator.cc CodeGen/GenType.cc \
     
    681723
    682724.SUFFIXES:
    683 .SUFFIXES: .cc .ll .o .obj .yy
     725.SUFFIXES: .cc .ll .lo .o .obj .yy
    684726$(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)
    685727        @for dep in $?; do \
     
    9701012        sed 's/$(EXEEXT)$$//' | \
    9711013        while read p p1; do if test -f $$p \
     1014         || test -f $$p1 \
    9721015          ; then echo "$$p"; echo "$$p"; else :; fi; \
    9731016        done | \
     
    9841027            if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
    9851028            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 $$?; \
    9881031            } \
    9891032        ; done
     
    10011044
    10021045clean-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
    10041053CodeGen/Generate.$(OBJEXT): CodeGen/$(am__dirstamp) \
    10051054        CodeGen/$(DEPDIR)/$(am__dirstamp)
     
    12411290@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
    12421291
     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
    12431300.ll.cc:
    12441301        $(AM_V_LEX)$(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE)
     
    12461303.yy.cc:
    12471304        $(AM_V_YACC)$(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h `echo $@ | $(am__yacc_c2h)` y.output $*.output -- $(YACCCOMPILE)
     1305
     1306mostlyclean-libtool:
     1307        -rm -f *.lo
     1308
     1309clean-libtool:
     1310        -rm -rf .libs _libs
     1311        -rm -rf ../driver/.libs ../driver/_libs
    12481312
    12491313ID: $(am__tagged_files)
     
    14051469clean: clean-am
    14061470
    1407 clean-am: clean-cfa_cpplibPROGRAMS clean-generic clean-noinstLIBRARIES \
    1408         mostlyclean-am
     1471clean-am: clean-cfa_cpplibPROGRAMS clean-generic clean-libtool \
     1472        clean-noinstLIBRARIES mostlyclean-am
    14091473
    14101474distclean: distclean-am
     
    14611525mostlyclean: mostlyclean-am
    14621526
    1463 mostlyclean-am: mostlyclean-compile mostlyclean-generic
     1527mostlyclean-am: mostlyclean-compile mostlyclean-generic \
     1528        mostlyclean-libtool
    14641529
    14651530pdf: pdf-am
     
    14761541
    14771542.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 \
    14901556        uninstall-cfa_cpplibPROGRAMS
    14911557
  • src/Parser/DeclarationNode.cc

    raeb8f70 re99e43f  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 20 14:56:54 2018
    13 // Update Count     : 1107
     12// Last Modified On : Thu Nov  1 20:54:26 2018
     13// Update Count     : 1108
    1414//
    1515
     
    402402}
    403403
    404 DeclarationNode * DeclarationNode::newTypeof( ExpressionNode * expr ) {
    405         DeclarationNode * newnode = new DeclarationNode;
    406         newnode->type = new TypeData( TypeData::Typeof );
     404DeclarationNode * DeclarationNode::newTypeof( ExpressionNode * expr, bool basetypeof ) {
     405        DeclarationNode * newnode = new DeclarationNode;
     406        newnode->type = new TypeData( basetypeof ? TypeData::Basetypeof : TypeData::Typeof );
    407407        newnode->type->typeexpr = expr;
    408408        return newnode;
  • src/Parser/ParseNode.h

    raeb8f70 re99e43f  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Aug  4 09:39:40 2018
    13 // Update Count     : 853
     12// Last Modified On : Thu Nov  1 20:54:53 2018
     13// Update Count     : 854
    1414//
    1515
     
    249249        static DeclarationNode * newBitfield( ExpressionNode * size );
    250250        static DeclarationNode * newTuple( DeclarationNode * members );
    251         static DeclarationNode * newTypeof( ExpressionNode * expr );
     251        static DeclarationNode * newTypeof( ExpressionNode * expr, bool basetypeof = false );
    252252        static DeclarationNode * newAttr( const std::string *, ExpressionNode * expr ); // @ attributes
    253253        static DeclarationNode * newAttr( const std::string *, DeclarationNode * type ); // @ attributes
  • src/Parser/TypeData.cc

    raeb8f70 re99e43f  
    1010// Created On       : Sat May 16 15:12:51 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 20 14:39:31 2018
    13 // Update Count     : 622
     12// Last Modified On : Fri Nov  2 07:54:26 2018
     13// Update Count     : 624
    1414//
    1515
     
    9696                break;
    9797          case Typeof:
     98          case Basetypeof:
    9899                // typeexpr = new Typeof_t;
    99100                typeexpr = nullptr;
     
    166167                break;
    167168          case Typeof:
     169          case Basetypeof:
    168170                // delete typeexpr->expr;
    169171                delete typeexpr;
     
    245247                break;
    246248          case Typeof:
     249          case Basetypeof:
    247250                newtype->typeexpr = maybeClone( typeexpr );
    248251                break;
     
    419422                } // if
    420423                break;
     424          case Basetypeof:
     425                os << "base-";
     426                #if defined(__GNUC__) && __GNUC__ >= 7
     427                        __attribute__((fallthrough));
     428                #endif
    421429          case Typeof:
    422430                os << "type-of expression ";
     
    457465          case Tuple:
    458466          case Typeof:
     467          case Basetypeof:
    459468          case Builtin:
    460469                assertf(false, "Tried to get leaf name from kind without a name: %d", kind);
     
    513522        switch ( td->kind ) {
    514523          case TypeData::Unknown:
    515                 // fill in implicit int
    516                 return new BasicType( buildQualifiers( td ), BasicType::SignedInt );
     524                        // fill in implicit int
     525                        return new BasicType( buildQualifiers( td ), BasicType::SignedInt );
    517526          case TypeData::Basic:
    518                 return buildBasicType( td );
     527                        return buildBasicType( td );
    519528          case TypeData::Pointer:
    520                 return buildPointer( td );
     529                        return buildPointer( td );
    521530          case TypeData::Array:
    522                 return buildArray( td );
     531                        return buildArray( td );
    523532          case TypeData::Reference:
    524                 return buildReference( td );
     533                        return buildReference( td );
    525534          case TypeData::Function:
    526                 return buildFunction( td );
     535                        return buildFunction( td );
    527536          case TypeData::AggregateInst:
    528                 return buildAggInst( td );
     537                        return buildAggInst( td );
    529538          case TypeData::EnumConstant:
    530                 // the name gets filled in later -- by SymTab::Validate
    531                 return new EnumInstType( buildQualifiers( td ), "" );
     539                        // the name gets filled in later -- by SymTab::Validate
     540                        return new EnumInstType( buildQualifiers( td ), "" );
    532541          case TypeData::SymbolicInst:
    533                 return buildSymbolicInst( td );
     542                        return buildSymbolicInst( td );
    534543          case TypeData::Tuple:
    535                 return buildTuple( td );
     544                        return buildTuple( td );
    536545          case TypeData::Typeof:
    537                 return buildTypeof( td );
     546          case TypeData::Basetypeof:
     547                        return buildTypeof( td );
    538548          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                        }
    548558          case TypeData::GlobalScope:
    549                 return new GlobalScopeType();
     559                        return new GlobalScopeType();
    550560                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 ) );
    552562          case TypeData::Symbolic:
    553563          case TypeData::Enum:
    554564          case TypeData::Aggregate:
    555                 assert( false );
     565                        assert( false );
    556566        } // switch
    557567
     
    929939
    930940TypeofType * buildTypeof( const TypeData * td ) {
    931         assert( td->kind == TypeData::Typeof );
     941        assert( td->kind == TypeData::Typeof || td->kind == TypeData::Basetypeof );
    932942        assert( td->typeexpr );
    933943        // 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 };
    935946} // buildTypeof
    936947
  • src/Parser/TypeData.h

    raeb8f70 re99e43f  
    1010// Created On       : Sat May 16 15:18:36 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Jul 20 13:56:40 2018
    13 // Update Count     : 195
     12// Last Modified On : Thu Nov  1 20:56:46 2018
     13// Update Count     : 196
    1414//
    1515
     
    2727struct TypeData {
    2828        enum Kind { Basic, Pointer, Reference, Array, Function, Aggregate, AggregateInst, Enum, EnumConstant, Symbolic,
    29                                 SymbolicInst, Tuple, Typeof, Builtin, GlobalScope, Qualified, Unknown };
     29                                SymbolicInst, Tuple, Typeof, Basetypeof, Builtin, GlobalScope, Qualified, Unknown };
    3030
    3131        struct Aggregate_t {
  • src/Parser/lex.ll

    raeb8f70 re99e43f  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Wed Aug 29 15:02:41 2018
    13  * Update Count     : 686
     12 * Last Modified On : Thu Nov  1 20:57:35 2018
     13 * Update Count     : 687
    1414 */
    1515
     
    209209__attribute__   { KEYWORD_RETURN(ATTRIBUTE); }                  // GCC
    210210auto                    { KEYWORD_RETURN(AUTO); }
     211basetypeof              { KEYWORD_RETURN(BASETYPEOF); }                 // CFA
    211212_Bool                   { KEYWORD_RETURN(BOOL); }                               // C99
    212213break                   { KEYWORD_RETURN(BREAK); }
  • src/Parser/parser.yy

    raeb8f70 re99e43f  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Aug 30 17:02:25 2018
    13 // Update Count     : 4029
     12// Last Modified On : Thu Nov  8 18:08:23 2018
     13// Update Count     : 4052
    1414//
    1515
     
    186186} // fieldDecl
    187187
    188 ExpressionNode *forInc( const OperKinds op ) {
    189         return new ExpressionNode( build_constantInteger( *new string( op == OperKinds::LThan || op == OperKinds::LEThan ? "1" : "-1" ) ) );
    190 } // forInc
    191 
    192188ForCtrl * 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());
    194190        if ( constant && (constant->get_constant()->get_value() == "0" || constant->get_constant()->get_value() == "1") ) {
    195191        type = new ExpressionNode( new CastExpr( maybeMoveBuild< Expression >(type), new BasicType( Type::Qualifiers(), BasicType::SignedInt ) ) );
    196192        } // if
    197193        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 ) ) ),
    199195                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
     200ForCtrl * 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
    201206} // forCtrl
    202207
     
    261266%token ZERO_T ONE_T                                                                             // CFA
    262267%token VALIST                                                                                   // GCC
    263 %token TYPEOF LABEL                                                                             // GCC
     268%token TYPEOF BASETYPEOF LABEL                                                  // GCC
    264269%token ENUM STRUCT UNION
    265270%token EXCEPTION                                                                                // CFA
     
    636641                { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $4 ) ) ); }
    637642        | 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 ) ) ); }
    641644        | postfix_expression ARROW INTEGERconstant                      // CFA, tuple index
    642645                { $$ = new ExpressionNode( build_pfieldSel( $1, build_constantInteger( *$3 ) ) ); }
     
    11371140        | FOR '(' push for_control_expression ')' statement pop
    11381141                { $$ = 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 ) ); }
    11391144        ;
    11401145
    11411146for_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" ) ) ) ); }
    11511150        | 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" ) ) ) ); }
    11531152        | constant_expression inclexcl constant_expression '~' constant_expression // CFA
    11541153                { $$ = 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
    11951162                { $$ = new ForCtrl( $1, $3, $5 ); }
     1163        | ';' comma_expression_opt ';' comma_expression_opt
     1164                { $$ = new ForCtrl( (ExpressionNode * )nullptr, $2, $4 ); }
    11961165        | declaration comma_expression_opt ';' comma_expression_opt // C99, declaration has ';'
    11971166                { $$ = new ForCtrl( $1, $2, $4 ); }
     
    18551824
    18561825indirect_type:
    1857         TYPEOF '(' type ')'                                                                     // GCC: typeof(x) y;
     1826        TYPEOF '(' type ')'                                                                     // GCC: typeof( x ) y;
    18581827                { $$ = $3; }
    1859         | TYPEOF '(' comma_expression ')'                                       // GCC: typeof(a+b) y;
     1828        | TYPEOF '(' comma_expression ')'                                       // GCC: typeof( a+b ) y;
    18601829                { $$ = 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;
    18621835                { $$ = 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;
    18641837                { $$ = DeclarationNode::newAttr( $1, $3 ); }
    18651838        | ZERO_T                                                                                        // CFA
  • src/ResolvExpr/Alternative.cc

    raeb8f70 re99e43f  
    120120                        os << "Null expression!" << std::endl;
    121121                } // if
    122                 os << indent << "Environment: ";
     122                os << indent << "Environment:";
    123123                env.print( os, indent+1 );
    124124                os << std::endl;
  • src/ResolvExpr/AlternativeFinder.cc

    raeb8f70 re99e43f  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sat May 16 23:52:08 2015
    11 // Last Modified By : Aaron B. Moss
    12 // Last Modified On : Fri Oct -5 10:01:00 2018
    13 // Update Count     : 34
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Nov  1 21:00:56 2018
     13// Update Count     : 35
    1414//
    1515
     
    500500                                needAssertions[ *assert ].isUsed = true;
    501501                        }
    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        }
    609504
    610505        /// Unique identifier for matching expression resolutions to their requesting expression
     
    613508        template< typename OutputIterator >
    614509        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 
    626510                // Set need bindings for any unbound assertions
    627511                UniqueId crntResnSlot = 0;  // matching ID for this expression's assertions
     
    13731257                /// Gets name from untyped member expression (member must be NameExpr)
    13741258                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
    13751262                        NameExpr * nameExpr = dynamic_cast< NameExpr * >( memberExpr->get_member() );
    13761263                        assert( nameExpr );
  • src/ResolvExpr/ResolveTypeof.cc

    raeb8f70 re99e43f  
    6767                std::cerr << std::endl;
    6868#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
    7083                        Expression * newExpr = resolveInVoidContext( typeofType->expr, indexer );
    7184                        assert( newExpr->result && ! newExpr->result->isVoid() );
    72                         Type * newType = newExpr->result;
     85                        newType = newExpr->result;
    7386                        newExpr->result = nullptr;
    7487                        delete typeofType;
    7588                        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;
    79108        }
    80109} // namespace ResolvExpr
  • src/SynTree/Expression.cc

    raeb8f70 re99e43f  
    376376        os << "Untyped Member Expression, with field: " << std::endl << indent+1;
    377377        member->print(os, indent+1 );
    378         os << indent << "... from aggregate: " << std::endl << indent+1;
     378        os << indent << "... from aggregate:" << std::endl << indent+1;
    379379        aggregate->print(os, indent+1);
    380380        Expression::print( os, indent );
     
    405405
    406406void MemberExpr::print( std::ostream &os, Indenter indent ) const {
    407         os << "Member Expression, with field: " << std::endl;
     407        os << "Member Expression, with field:" << std::endl;
    408408        os << indent+1;
    409409        member->print( os, indent+1 );
    410         os << std::endl << indent << "... from aggregate: " << std::endl << indent+1;
     410        os << std::endl << indent << "... from aggregate:" << std::endl << indent+1;
    411411        aggregate->print(os, indent + 1);
    412412        Expression::print( os, indent );
  • src/SynTree/FunctionDecl.cc

    raeb8f70 re99e43f  
    8787
    8888        if ( statements ) {
    89                 os << indent << "... with body " << endl << indent+1;
     89                os << indent << "... with body" << endl << indent+1;
    9090                statements->print( os, indent+1 );
    9191        } // if
  • src/SynTree/FunctionType.cc

    raeb8f70 re99e43f  
    6666                os << indent+1 << "accepting unspecified arguments" << endl;
    6767        } // if
    68         os << indent << "... returning ";
     68        os << indent << "... returning";
    6969        if ( returnVals.empty() ) {
    70                 os << "nothing " << endl;
     70                os << " nothing" << endl;
    7171        } else {
    7272                os << endl;
  • src/SynTree/ObjectDecl.cc

    raeb8f70 re99e43f  
    6666
    6767        if ( ! attributes.empty() ) {
    68                 os << std::endl << indent << "... with attributes: " << std::endl;
     68                os << std::endl << indent << "... with attributes:" << std::endl;
    6969                printAll( attributes, os, indent+1 );
    7070        }
  • src/SynTree/ReferenceToType.cc

    raeb8f70 re99e43f  
    9393        else {
    9494                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();
    9696                if ( ! parameters.empty() ) {
    9797                        os << endl << indent << "... with parameters" << endl;
     
    136136        else {
    137137                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();
    139139                if ( ! parameters.empty() ) {
    140140                        os << endl << indent << "... with parameters" << endl;
     
    160160        else {
    161161                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();
    163163        } // if
    164164}
  • src/SynTree/Type.h

    raeb8f70 re99e43f  
    598598class TypeofType : public Type {
    599599  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 * >() );
    603606        TypeofType( const TypeofType& );
    604607        virtual ~TypeofType();
  • src/SynTree/TypeofType.cc

    raeb8f70 re99e43f  
    2323class Attribute;
    2424
    25 TypeofType::TypeofType( const Type::Qualifiers &tq, Expression *expr, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), expr( expr ) {
    26 }
     25TypeofType::TypeofType( const Type::Qualifiers &tq, Expression *expr,
     26        const std::list< Attribute * > & attributes )
     27: Type( tq, attributes ), expr( expr ), is_basetypeof(false) {}
    2728
    28 TypeofType::TypeofType( const TypeofType &other ) : Type( other ), expr( maybeClone( other.expr ) ) {
    29 }
     29TypeofType::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
     33TypeofType::TypeofType( const TypeofType &other )
     34: Type( other ), expr( maybeClone( other.expr ) ), is_basetypeof( other.is_basetypeof ) {}
    3035
    3136TypeofType::~TypeofType() {
     
    3540void TypeofType::print( std::ostream &os, Indenter indent ) const {
    3641        Type::print( os, indent );
     42        if ( is_basetypeof ) { os << "base-"; }
    3743        os << "type-of expression ";
    3844        if ( expr ) {
  • src/cfa.make

    raeb8f70 re99e43f  
     1
     2
    13CFACOMPILE = $(CFACC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CFAFLAGS) $(CFAFLAGS) $(AM_CFLAGS) $(CFLAGS)
     4LTCFACOMPILE = $(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)
    28
    39AM_V_CFA = $(am__v_CFA_@AM_V@)
     
    1016        $(CFACOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
    1117        $(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
     24AM_V_JAVAC = $(am__v_JAVAC_@AM_V@)
     25am__v_JAVAC_ = $(am__v_JAVAC_@AM_DEFAULT_V@)
     26am__v_JAVAC_0 = @echo "  JAVAC   " $@;
     27am__v_JAVAC_1 =
     28
     29AM_V_GOC = $(am__v_GOC_@AM_V@)
     30am__v_GOC_ = $(am__v_GOC_@AM_DEFAULT_V@)
     31am__v_GOC_0 = @echo "  GOC     " $@;
     32am__v_GOC_1 =
     33
     34
     35UPPCOMPILE = $(UPPCC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_UPPFLAGS) $(UPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_CFLAGS) $(CFLAGS)
     36
     37AM_V_UPP = $(am__v_UPP_@AM_V@)
     38am__v_UPP_ = $(am__v_UPP_@AM_DEFAULT_V@)
     39am__v_UPP_0 = @echo "  UPP     " $@;
     40am__v_UPP_1 =
  • src/config.h.in

    raeb8f70 re99e43f  
    77#undef CFA_64_CPU
    88
    9 /* Location of include files. */
     9/* Backend compiler to use. */
    1010#undef CFA_BACKEND_CC
    1111
     
    6767#undef HAVE_ALLOCA_H
    6868
     69/* Define to 1 if you have the <dlfcn.h> header file. */
     70#undef HAVE_DLFCN_H
     71
    6972/* Define to 1 if you have the <fenv.h> header file. */
    7073#undef HAVE_FENV_H
     
    129132/* Define to 1 if the system has the type `_Bool'. */
    130133#undef HAVE__BOOL
     134
     135/* Define to the sub-directory where libtool stores uninstalled libraries. */
     136#undef LT_OBJDIR
    131137
    132138/* Name of package */
  • src/main.cc

    raeb8f70 re99e43f  
    487487                        resolvep = true;
    488488                        break;
    489                         case 'R':                                                                               // dump resolv-proto instance
     489                  case 'R':                                                                             // dump resolv-proto instance
    490490                        resolvprotop = true;
    491491                        break;
Note: See TracChangeset for help on using the changeset viewer.