Changes in / [85521c7:d0a045c7]


Ignore:
Files:
1 added
1 deleted
33 edited

Legend:

Unmodified
Added
Removed
  • doc/LaTeXmacros/common.tex

    r85521c7 rd0a045c7  
    1111%% Created On       : Sat Apr  9 10:06:17 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Wed Jan 31 23:10:28 2018
    14 %% Update Count     : 364
     13%% Last Modified On : Mon Aug 28 20:18:42 2017
     14%% Update Count     : 355
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    165165        {\ETC\xspace}%
    166166}%
    167 \newcommand{\ETAL}{\abbrevFont{et}\hspace{2pt}\abbrevFont{al}}
    168 \newcommand*{\etal}{%
    169         \@ifnextchar{.}{\protect\ETAL}%
    170                 {\abbrevFont{\protect\ETAL}.\xspace}%
     167\newcommand{\ETAL}{\abbrevFont{et\:al}}
     168\newcommand{\etal}{%
     169        \@ifnextchar{.}{\ETAL}%
     170                {\abbrevFont{\ETAL}.\xspace}%
    171171}%
    172172\newcommand{\VIZ}{\abbrevFont{viz}}
    173 \newcommand*{\viz}{%
     173\newcommand{\viz}{%
    174174        \@ifnextchar{.}{\VIZ}%
    175175                {\abbrevFont{\VIZ}.\xspace}%
  • doc/bibliography/pl.bib

    r85521c7 rd0a045c7  
    10341034}
    10351035
    1036 @manual{cforall-refrat,
     1036@manual{cforall,
    10371037    keywords    = {polymorphism},
    10381038    contributer = {gjditchfield@plg},
  • doc/papers/OOPSLA17/Makefile

    r85521c7 rd0a045c7  
    99
    1010MAKEFLAGS = --no-print-directory --silent #
    11 VPATH = ${Build} ${Figures} evaluation
     11VPATH = ${Figures} evaluation
    1212
    1313## Define the text source files.
     
    3636# Directives #
    3737
    38 .PHONY : all clean                                      # not file names
    39 
    4038all : ${DOCUMENT}
    4139
     
    5149        dvips ${Build}/$< -o $@
    5250
    53 ${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ../../bibliography/pl.bib
     51${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex ../../bibliography/pl.bib
    5452        # Must have *.aux file containing citations for bibtex
    5553        if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} ${basename $@}.tex ; fi
  • doc/papers/concurrency/Makefile

    r85521c7 rd0a045c7  
    99
    1010MAKEFLAGS = --no-print-directory --silent #
    11 VPATH = ${Build} ${Figures}
     11VPATH = ${Figures}
    1212
    1313## Define the text source files.
     
    5858        dvips ${Build}/$< -o $@
    5959
    60 ${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} \
     60${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex \
    6161                ${Macros}/common.tex ${Macros}/indexstyle annex/local.bib ../../bibliography/pl.bib
    6262        # Must have *.aux file containing citations for bibtex
  • doc/papers/general/Makefile

    r85521c7 rd0a045c7  
    99
    1010MAKEFLAGS = --no-print-directory --silent #
    11 VPATH = ${Build} ${Figures} evaluation
     11VPATH = ${Figures} evaluation
    1212
    1313## Define the text source files.
     
    5151        dvips ${Build}/$< -o $@
    5252
    53 ${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} \
     53${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex \
    5454                ${Macros}/common.tex ${Macros}/indexstyle ../../bibliography/pl.bib
    5555        # Must have *.aux file containing citations for bibtex
  • doc/refrat/Makefile

    r85521c7 rd0a045c7  
    99
    1010MAKEFLAGS = --no-print-directory --silent #
    11 VPATH = ${Build} ${Figures}
     11VPATH = ${Figures}
    1212
    1313## Define the text source files.
     
    5252        dvips ${Build}/$< -o $@
    5353
    54 ${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} \
     54${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex \
    5555                ${Macros}/common.tex ${Macros}/lstlang.sty ${Macros}/indexstyle ../bibliography/pl.bib
    5656        # Conditionally create an empty *.ind (index) file for inclusion until makeindex is run.
  • doc/theses/aaron_moss/comp_II/.gitignore

    r85521c7 rd0a045c7  
    11# generated by latex
    2 build/*
     2*.aux
     3*.bbl
     4*.blg
     5*.brf
     6*.dvi
     7*.idx
     8*.ilg
     9*.ind
     10*.log
     11*.out
    312*.pdf
    413*.ps
     14*.toc
  • doc/theses/aaron_moss/comp_II/Makefile

    r85521c7 rd0a045c7  
    1 ## Define the configuration variables.
     1## Define the appropriate configuration variables.
    22
    3 Build = build
    4 Figures = figures
    5 Macros = ../../../LaTeXmacros
    6 TeXLIB = .:${Macros}:${Build}:../../../bibliography:
    7 LaTeX  = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error -output-directory=${Build}
     3TeXLIB = .:../LaTeXmacros:../LaTeXmacros/listings:../LaTeXmacros/enumitem:../bibliography/:
     4LaTeX  = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error
    85BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex
    9 
    10 MAKEFLAGS = --no-print-directory --silent #
    11 VPATH = ${Build} ${Figures}
    126
    137## Define the text source files.
     
    3529# Directives #
    3630
    37 .PHONY : all clean                                      # not file names
    38 
    3931all : ${DOCUMENT}
    4032
    4133clean :
    42         @rm -frv ${DOCUMENT} ${basename ${DOCUMENT}}.ps ${Build}
     34        rm -f *.bbl *.aux *.dvi *.idx *.ilg *.ind *.brf *.out *.log *.toc *.blg *.pstex_t *.cf \
     35                ${FIGURES} ${PICTURES} ${PROGRAMS} ${GRAPHS} ${basename ${DOCUMENT}}.ps ${DOCUMENT}
    4336
    4437# File Dependencies #
     
    4841
    4942${basename ${DOCUMENT}}.ps : ${basename ${DOCUMENT}}.dvi
    50         dvips ${Build}/$< -o $@
     43        dvips $< -o $@
    5144
    52 ${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} \
    53                 ${Macros}/common.tex ${Macros}/indexstyle ../../../bibliography/pl.bib
     45${basename ${DOCUMENT}}.dvi : Makefile ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex \
     46                ../LaTeXmacros/common.tex ../LaTeXmacros/indexstyle ../bibliography/cfa.bib
     47        # Conditionally create an empty *.ind (index) file for inclusion until makeindex is run.
     48        if [ ! -r ${basename $@}.ind ] ; then touch ${basename $@}.ind ; fi
    5449        # Must have *.aux file containing citations for bibtex
    5550        if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} ${basename $@}.tex ; fi
    56         -${BibTeX} ${Build}/${basename $@}
    57         # Some citations reference others so run again to resolve these citations
     51        -${BibTeX} ${basename $@}
     52        # Some citations reference others so run steps again to resolve these citations
    5853        ${LaTeX} ${basename $@}.tex
    59         -${BibTeX} ${Build}/${basename $@}
    60         # Run again to finish citations
     54        -${BibTeX} ${basename $@}
     55        # Make index from *.aux entries and input index at end of document
     56        makeindex -s ../LaTeXmacros/indexstyle ${basename $@}.idx
    6157        ${LaTeX} ${basename $@}.tex
     58        # Run again to get index title into table of contents
     59        ${LaTeX} ${basename $@}.tex
     60
     61predefined :
     62        sed -f predefined.sed ${basename ${DOCUMENT}}.tex > ${basename $@}.cf
    6263
    6364## Define the default recipes.
    6465
    65 ${Build}:
    66         mkdir -p ${Build}
    67 
    6866%.tex : %.fig
    69         fig2dev -L eepic $< > ${Build}/$@
     67        fig2dev -L eepic $< > $@
    7068
    7169%.ps : %.fig
    72         fig2dev -L ps $< > ${Build}/$@
     70        fig2dev -L ps $< > $@
    7371
    7472%.pstex : %.fig
    75         fig2dev -L pstex $< > ${Build}/$@
    76         fig2dev -L pstex_t -p ${Build}/$@ $< > ${Build}/$@_t
     73        fig2dev -L pstex $< > $@
     74        fig2dev -L pstex_t -p $@ $< > $@_t
    7775
    7876# Local Variables: #
  • doc/theses/aaron_moss/comp_II/comp_II.tex

    r85521c7 rd0a045c7  
     1% inline code ©...© (copyright symbol) emacs: C-q M-)
     2% red highlighting ®...® (registered trademark symbol) emacs: C-q M-.
     3% blue highlighting ß...ß (sharp s symbol) emacs: C-q M-_
     4% green highlighting ¢...¢ (cent symbol) emacs: C-q M-"
     5% LaTex escape §...§ (section symbol) emacs: C-q M-'
     6% keyword escape ¶...¶ (pilcrow symbol) emacs: C-q M-^
     7% math escape $...$ (dollar symbol)
     8
    19\documentclass[twoside,11pt]{article}
    210
     
    1927\usepackage{mathptmx}                                   % better math font with "times"
    2028\usepackage[usenames]{color}
     29\usepackage[pagewise]{lineno}
     30\renewcommand{\linenumberfont}{\scriptsize\sffamily}
    2131\input{common}                                          % bespoke macros used in the document
    2232\usepackage[dvips,plainpages=false,pdfpagelabels,pdfpagemode=UseNone,colorlinks=true,pagebackref=true,linkcolor=blue,citecolor=blue,urlcolor=blue,pagebackref=true,breaklinks=true]{hyperref}
     
    2434\renewcommand{\UrlFont}{\small\sf}
    2535
    26 \usepackage[pagewise]{lineno}
    27 \renewcommand{\linenumberfont}{\scriptsize\sffamily}
    28 
    29 % Default underscore is too low and wide. Cannot use lstlisting "literate" as replacing underscore
    30 % removes it as a variable-name character so keywords in variables are highlighted. MUST APPEAR
    31 % AFTER HYPERREF.
    32 \renewcommand{\textunderscore}{\leavevmode\makebox[1.2ex][c]{\rule{1ex}{0.075ex}}}
    33 
    3436\setlength{\topmargin}{-0.45in}                                                 % move running title into header
    3537\setlength{\headsep}{0.25in}
    36 
    37 \CFAStyle                                                                                               % use default CFA format-style
    38 
    39 % inline code ©...© (copyright symbol) emacs: C-q M-)
    40 % red highlighting ®...® (registered trademark symbol) emacs: C-q M-.
    41 % blue highlighting ß...ß (sharp s symbol) emacs: C-q M-_
    42 % green highlighting ¢...¢ (cent symbol) emacs: C-q M-"
    43 % LaTex escape §...§ (section symbol) emacs: C-q M-'
    44 % keyword escape ¶...¶ (pilcrow symbol) emacs: C-q M-^
    45 % math escape $...$ (dollar symbol)
    4638
    4739\usepackage{caption}
     
    630622\addcontentsline{toc}{section}{\refname}
    631623\bibliographystyle{plain}
    632 \bibliography{pl}
     624\bibliography{cfa}
    633625
    634626%\addcontentsline{toc}{section}{\indexname} % add index name to table of contents
  • doc/theses/rob_schluntz/.gitignore

    r85521c7 rd0a045c7  
    11# generated by latex
    2 build/*
     2*.aux
     3*.bbl
     4*.blg
     5*.brf
     6*.dvi
     7*.idx
     8*.ilg
     9*.ind
     10*.log
     11*.out
    312*.pdf
    413*.ps
    5 
     14*.toc
     15*.lof
     16*.lot
     17*.synctex.gz
  • doc/theses/rob_schluntz/Makefile

    r85521c7 rd0a045c7  
    1 Build = build
    2 Macros = ../../LaTeXmacros
    3 TeXLIB = .:${Macros}:${Build}:../../bibliography:
    4 LaTeX  = TEXINPUTS=${TeXLIB} && export TEXINPUTS && pdflatex -halt-on-error -output-directory=${Build}
     1TeXLIB = .:../LaTeXmacros:../bibliography/:
     2LaTeX  = TEXINPUTS=${TeXLIB} && export TEXINPUTS && pdflatex -halt-on-error
    53BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex
    6 
    7 VPATH = ${Build}
    84
    95all : thesis.pdf
    106
    11 thesis.pdf : Makefile ${Build} ${Macros}/common.tex cfa-format.tex thesis.tex intro.tex ctordtor.tex tuples.tex variadic.tex conclusions.tex
     7thesis.pdf : Makefile ../LaTeXmacros/common.tex cfa-format.tex thesis.tex intro.tex ctordtor.tex tuples.tex variadic.tex conclusions.tex
    128        ${LaTeX} thesis
    13         ${BibTeX} ${Build}/thesis
     9        ${BibTeX} thesis
    1410        ${LaTeX} thesis
    1511        ${LaTeX} thesis
    16         cp -p ${Build}/thesis.pdf .
    1712        pdf2ps thesis.pdf thesis.ps
    1813
    19 ${Build}:
    20         mkdir -p ${Build}
    21 
    2214clean :
    23         @rm -frv ${Build}
     15        rm -f *.aux *.bbl *.blg *.lof *.log *.lot *.out *.toc
    2416
    2517spotless : clean
  • doc/theses/rob_schluntz/intro.tex

    r85521c7 rd0a045c7  
    290290\end{cfacode}
    291291Every if- and iteration-statement in C compares the condition with @0@, and every increment and decrement operator is semantically equivalent to adding or subtracting the value @1@ and storing the result.
    292 Due to these rewrite rules, the values @0@ and @1@ have the types \zero and \one in \CFA, which allow for overloading various operations that connect to @0@ and @1@ \footnote{In the original design of \CFA, @0@ and @1@ were overloadable names \cite[p.~7]{cforall-refrat}.}.
     292Due to these rewrite rules, the values @0@ and @1@ have the types \zero and \one in \CFA, which allow for overloading various operations that connect to @0@ and @1@ \footnote{In the original design of \CFA, @0@ and @1@ were overloadable names \cite[p.~7]{cforall}.}.
    293293The types \zero and \one have special built-in implicit conversions to the various integral types, and a conversion to pointer types for @0@, which allows standard C code involving @0@ and @1@ to work as normal.
    294294\begin{cfacode}
  • doc/theses/rob_schluntz/thesis.tex

    r85521c7 rd0a045c7  
    288288\addcontentsline{toc}{chapter}{\textbf{References}}
    289289
    290 \bibliography{pl,thesis}
     290\bibliography{cfa,thesis}
    291291% Tip 5: You can create multiple .bib files to organize your references.
    292292% Just list them all in the \bibliogaphy command, separated by commas (no spaces).
  • doc/theses/thierry_delisle/Makefile

    r85521c7 rd0a045c7  
    1 ## Define the configuration variables.
     1## Define the appropriate configuration variables.
    22
    3 Build = build
    4 Figures = figures
    5 Macros = ../../LaTeXmacros
    6 TeXLIB = .:style:text:annex:${Macros}:${Build}:../../bibliography:
    7 LaTeX  = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error -output-directory=${Build}
     3TeXLIB = .:./style:./text:./annex:./build:../../LaTeXmacros:../../LaTeXmacros/listings:../../LaTeXmacros/enumitem:~/bibliographies:/usr/local/bibliographies:
     4LaTeX  = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error -output-directory=build -interaction=nonstopmode
    85BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex -terse
    9 
    10 MAKEFLAGS = --no-print-directory --silent #
    11 VPATH = ${Build} ${Figures}
    126
    137## Define the text source files.
     
    3024}
    3125
    32 FIGURES = ${addsuffix .tex, \
    33 monitor \
    34 ext_monitor \
    35 int_monitor \
    36 dependency \
    37 }
     26FIGURES = ${addprefix build/, ${addsuffix .tex, \
     27        monitor \
     28        ext_monitor \
     29        int_monitor \
     30        dependency \
     31}}
    3832
    39 PICTURES = ${addsuffix .pstex, \
    40 system \
    41 monitor_structs \
    42 }
     33PICTURES = ${addprefix build/, ${addsuffix .pstex, \
     34        system \
     35        monitor_structs \
     36}}
    4337
    4438PROGRAMS = ${addsuffix .tex, \
     
    5448# Directives #
    5549
    56 .PHONY : all clean                                      # not file names
    57 
    5850all : ${DOCUMENT}
    5951
    6052clean :
    61         @rm -frv ${DOCUMENT} ${basename ${DOCUMENT}}.ps ${Build}
     53        @rm -fv ${DOCUMENT} \
     54        build/*.acn     \
     55        build/*.acr     \
     56        build/*.alg     \
     57        build/*.aux     \
     58        build/*.bbl     \
     59        build/*.blg     \
     60        build/*.brf     \
     61        build/*.cf      \
     62        build/*.dvi     \
     63        build/*.glg     \
     64        build/*.glo     \
     65        build/*.gls     \
     66        build/*.ist     \
     67        build/*.idx     \
     68        build/*.ilg     \
     69        build/*.ind     \
     70        build/*.log     \
     71        build/*.out     \
     72        build/*.ps      \
     73        build/*.pstex   \
     74        build/*.pstex_t \
     75        build/*.tex     \
     76        build/*.toc     \
     77        build/*.lof     \
     78        build/*.lol     \
     79        build/*.lot     \
     80        figures/*.tex   \
     81        *.png           \
     82
    6283
    6384# File Dependencies #
    6485
    65 ${DOCUMENT} : ${basename ${DOCUMENT}}.ps
     86${DOCUMENT} : build/${basename ${DOCUMENT}}.ps
    6687        ps2pdf $<
    6788
    68 ${basename ${DOCUMENT}}.ps : ${basename ${DOCUMENT}}.dvi
    69         dvips ${Build}/$< -o $@
     89build/${basename ${DOCUMENT}}.ps : build/${basename ${DOCUMENT}}.dvi
     90        dvips $< -o $@
    7091
    71 ${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} \
    72                 ${Macros}/common.tex ${Macros}/indexstyle annex/local.bib ../../bibliography/pl.bib
    73         # Must have *.aux file containing citations for bibtex
    74         if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} ${basename $@}.tex ; fi
    75         -${BibTeX} ${Build}/${basename $@}
    76         # Some citations reference others so run again to resolve these citations
    77         ${LaTeX} ${basename $@}.tex
    78         -${BibTeX} ${Build}/${basename $@}
    79         # Make index from *.aux entries and input index at end of document
    80         makeglossaries -q -s ${Build}/${basename $@}.ist ${Build}/${basename $@}
    81         -version.sh
    82         # Run again to finish citations
    83         ${LaTeX} ${basename $@}.tex
     92build/${basename ${DOCUMENT}}.dvi : Makefile ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex ../../LaTeXmacros/common.tex ../../LaTeXmacros/indexstyle annex/local.bib
     93
     94        @ if [ ! -r ${basename $@}.ind ] ; then touch ${basename $@}.ind ; fi                           # Conditionally create an empty *.ind (index) file for inclusion until makeindex is run.
     95        @ echo "Citation lookup"                                                                                        # Must have *.aux file containing citations for bibtex
     96        @ if [ ! -r ${basename $@}.aux ] ; then ${LaTeX} ${basename ${notdir $@}}.tex ; fi
     97        @ echo "Citation Pass 1"
     98        @ -${BibTeX} ${basename $@}                                                                                     # Some citations reference others so run steps again to resolve these citations
     99        @ echo "Citation Pass 2"
     100        @ ${LaTeX} ${basename ${notdir $@}}.tex
     101        @ -${BibTeX} ${basename $@}
     102        @ echo "Glossary"
     103        @ makeglossaries -q -s ${basename $@}.ist ${basename $@}                                                # Make index from *.aux entries and input index at end of document
     104        @ echo ".dvi generation"
     105        @ -build/bump_ver.sh
     106        @ ${LaTeX} ${basename ${notdir $@}}.tex                                                                 # Run again to get index title into table of contents
     107
     108
     109predefined :
     110        sed -f predefined.sed ${basename ${DOCUMENT}}.tex > ${basename $@}.cf
    84111
    85112## Define the default recipes.
    86113
    87 ${Build}:
    88         mkdir -p ${Build}
     114build/%.tex : figures/%.fig
     115        fig2dev -L eepic $< > $@
    89116
    90 %.tex : %.fig
    91         fig2dev -L eepic $< > ${Build}/$@
     117build/%.ps : figures/%.fig
     118        fig2dev -L ps $< > $@
    92119
    93 %.ps : %.fig
    94         fig2dev -L ps $< > ${Build}/$@
    95 
    96 %.pstex : %.fig
    97         fig2dev -L pstex $< > ${Build}/$@
    98         fig2dev -L pstex_t -p ${Build}/$@ $< > ${Build}/$@_t
     120build/%.pstex : figures/%.fig
     121        fig2dev -L pstex $< > $@
     122        fig2dev -L pstex_t -p $@ $< > $@_t
    99123
    100124#-----------------------------------------------------------------------------------
     
    121145                        "\end{document}" > $@
    122146
     147
     148
    123149# Local Variables: #
    124150# compile-command: "make" #
  • doc/theses/thierry_delisle/version

    r85521c7 rd0a045c7  
    1 0.11.409
     10.11.403
  • doc/user/Makefile

    r85521c7 rd0a045c7  
    99
    1010MAKEFLAGS = --no-print-directory --silent #
    11 VPATH = ${Build} ${Figures}
     11VPATH = ${Figures}
    1212
    1313## Define the text source files.
     
    5656        dvips ${Build}/$< -o $@
    5757
    58 ${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} \
     58${basename ${DOCUMENT}}.dvi : Makefile ${Build} ${GRAPHS} ${PROGRAMS} ${PICTURES} ${FIGURES} ${SOURCES} ${basename ${DOCUMENT}}.tex \
    5959                ${Macros}/common.tex ${Macros}/lstlang.sty ${Macros}/indexstyle ../bibliography/pl.bib
    6060        # Conditionally create an empty *.ind (index) file for inclusion until makeindex is run.
  • doc/user/user.tex

    r85521c7 rd0a045c7  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Wed Jan 31 22:29:25 2018
    14 %% Update Count     : 3147
     13%% Last Modified On : Wed Jan 31 07:59:24 2018
     14%% Update Count     : 3146
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
  • src/Common/PassVisitor.h

    r85521c7 rd0a045c7  
    291291        bool_ref * get_visit_children_ptr() { return visit_children_impl(pass, 0); }
    292292
    293         void indexerScopeEnter  ()                                    { indexer_impl_enterScope  ( pass, 0       ); }
    294         void indexerScopeLeave  ()                                    { indexer_impl_leaveScope  ( pass, 0       ); }
    295         void indexerAddId       ( DeclarationWithType       * node ) { indexer_impl_addId       ( pass, 0, node ); }
    296         void indexerAddType     ( NamedTypeDecl             * node ) { indexer_impl_addType     ( pass, 0, node ); }
    297         void indexerAddStruct   ( const std::string         & id    ) { indexer_impl_addStruct   ( pass, 0, id   ); }
    298         void indexerAddStruct   ( StructDecl                * node ) { indexer_impl_addStruct   ( pass, 0, node ); }
    299         void indexerAddStructFwd( StructDecl                * node ) { indexer_impl_addStructFwd( pass, 0, node ); }
    300         void indexerAddEnum     ( EnumDecl                  * node ) { indexer_impl_addEnum     ( pass, 0, node ); }
    301         void indexerAddUnion    ( const std::string         & id    ) { indexer_impl_addUnion    ( pass, 0, id   ); }
    302         void indexerAddUnion    ( UnionDecl                 * node ) { indexer_impl_addUnion    ( pass, 0, node ); }
    303         void indexerAddUnionFwd ( UnionDecl                 * node ) { indexer_impl_addUnionFwd ( pass, 0, node ); }
    304         void indexerAddTrait    ( TraitDecl                 * node ) { indexer_impl_addTrait    ( pass, 0, node ); }
    305         void indexerAddWith     ( std::list< Expression * > & exprs ) { indexer_impl_addWith     ( pass, 0, exprs ); }
     293        void indexerScopeEnter  ()                             { indexer_impl_enterScope  ( pass, 0       ); }
     294        void indexerScopeLeave  ()                             { indexer_impl_leaveScope  ( pass, 0       ); }
     295        void indexerAddId       ( DeclarationWithType * node ) { indexer_impl_addId       ( pass, 0, node ); }
     296        void indexerAddType     ( NamedTypeDecl       * node ) { indexer_impl_addType     ( pass, 0, node ); }
     297        void indexerAddStruct   ( const std::string   & id   ) { indexer_impl_addStruct   ( pass, 0, id   ); }
     298        void indexerAddStruct   ( StructDecl          * node ) { indexer_impl_addStruct   ( pass, 0, node ); }
     299        void indexerAddStructFwd( StructDecl          * node ) { indexer_impl_addStructFwd( pass, 0, node ); }
     300        void indexerAddEnum     ( EnumDecl            * node ) { indexer_impl_addEnum     ( pass, 0, node ); }
     301        void indexerAddUnion    ( const std::string   & id   ) { indexer_impl_addUnion    ( pass, 0, id   ); }
     302        void indexerAddUnion    ( UnionDecl           * node ) { indexer_impl_addUnion    ( pass, 0, node ); }
     303        void indexerAddUnionFwd ( UnionDecl           * node ) { indexer_impl_addUnionFwd ( pass, 0, node ); }
     304        void indexerAddTrait    ( TraitDecl           * node ) { indexer_impl_addTrait    ( pass, 0, node ); }
     305        void indexerAddWith     ( WithStmt            * node ) { indexer_impl_addWith    ( pass, 0, node ); }
    306306
    307307
  • src/Common/PassVisitor.impl.h

    r85521c7 rd0a045c7  
    365365        maybeAccept_impl   ( node->attributes   , *this );
    366366
    367         indexerAddId( node );
     367        if ( node->name != "" ) {
     368                indexerAddId( node );
     369        }
    368370
    369371        VISIT_END( node );
     
    379381        maybeMutate_impl   ( node->attributes   , *this );
    380382
    381         indexerAddId( node );
     383        if ( node->name != "" ) {
     384                indexerAddId( node );
     385        }
    382386
    383387        MUTATE_END( DeclarationWithType, node );
     
    390394        VISIT_START( node );
    391395
    392         indexerAddId( node );
    393 
    394         maybeAccept_impl( node->withExprs, *this );
    395         {
    396                 // with clause introduces a level of scope (for the with expression members).
    397                 // with clause exprs are added to the indexer before parameters so that parameters
    398                 // shadow with exprs and not the other way around.
    399                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    400                 indexerAddWith( node->withExprs );
    401                 {
    402                         auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    403                         // implicit add __func__ identifier as specified in the C manual 6.4.2.2
    404                         static ObjectDecl func(
    405                                 "__func__", noStorageClasses, LinkageSpec::C, nullptr,
    406                                 new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
    407                                 nullptr
    408                         );
    409                         indexerAddId( &func );
    410                         maybeAccept_impl( node->type, *this );
    411                         maybeAccept_impl( node->statements, *this );
    412                         maybeAccept_impl( node->attributes, *this );
    413                 }
     396        if ( node->name != "" ) {
     397                indexerAddId( node );
     398        }
     399
     400        {
     401                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     402                // implicit add __func__ identifier as specified in the C manual 6.4.2.2
     403                static ObjectDecl func(
     404                        "__func__", noStorageClasses, LinkageSpec::C, nullptr,
     405                        new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
     406                        nullptr
     407                );
     408                indexerAddId( &func );
     409                maybeAccept_impl( node->type, *this );
     410                maybeAccept_impl( node->statements, *this );
     411                maybeAccept_impl( node->attributes, *this );
    414412        }
    415413
     
    421419        MUTATE_START( node );
    422420
    423         indexerAddId( node );
    424 
    425         {
    426                 // with clause introduces a level of scope (for the with expression members).
    427                 // with clause exprs are added to the indexer before parameters so that parameters
    428                 // shadow with exprs and not the other way around.
    429                 auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    430                 indexerAddWith( node->withExprs );
    431                 {
    432                         auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    433                         // implicit add __func__ identifier as specified in the C manual 6.4.2.2
    434                         static ObjectDecl func(
    435                                 "__func__", noStorageClasses, LinkageSpec::C, nullptr,
    436                                 new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
    437                                 nullptr
    438                         );
    439                         indexerAddId( &func );
    440                         maybeMutate_impl( node->type, *this );
    441                         maybeMutate_impl( node->statements, *this );
    442                         maybeMutate_impl( node->attributes, *this );
    443                 }
     421        if ( node->name != "" ) {
     422                indexerAddId( node );
     423        }
     424
     425        {
     426                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     427                // implicit add __func__ identifier as specified in the C manual 6.4.2.2
     428                static ObjectDecl func(
     429                        "__func__", noStorageClasses, LinkageSpec::C, nullptr,
     430                        new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), nullptr, true, false ),
     431                        nullptr
     432                );
     433                indexerAddId( &func );
     434                maybeMutate_impl( node->type, *this );
     435                maybeMutate_impl( node->statements, *this );
     436                maybeMutate_impl( node->attributes, *this );
    444437        }
    445438
     
    737730template< typename pass_type >
    738731void PassVisitor< pass_type >::visit( AsmStmt * node ) {
    739         VISIT_START( node )
    740 
    741         maybeAccept_impl( node->instruction, *this );
    742         maybeAccept_impl( node->output, *this );
    743         maybeAccept_impl( node->input, *this );
    744         maybeAccept_impl( node->clobber, *this );
    745 
    746         VISIT_END( node );
     732        VISIT_BODY( node );
    747733}
    748734
    749735template< typename pass_type >
    750736Statement * PassVisitor< pass_type >::mutate( AsmStmt * node ) {
    751         MUTATE_START( node );
    752 
    753         maybeMutate_impl( node->instruction, *this );
    754         maybeMutate_impl( node->output, *this );
    755         maybeMutate_impl( node->input, *this );
    756         maybeMutate_impl( node->clobber, *this );
    757 
    758         MUTATE_END( Statement, node );
     737        MUTATE_BODY( Statement, node );
    759738}
    760739
     
    889868template< typename pass_type >
    890869void PassVisitor< pass_type >::visit( BranchStmt * node ) {
    891         VISIT_START( node );
    892         VISIT_END( node );
     870        VISIT_BODY( node );
    893871}
    894872
    895873template< typename pass_type >
    896874Statement * PassVisitor< pass_type >::mutate( BranchStmt * node ) {
    897         MUTATE_START( node );
     875        MUTATE_BODY( Statement, node );
     876}
     877
     878//--------------------------------------------------------------------------
     879// ReturnStmt
     880template< typename pass_type >
     881void PassVisitor< pass_type >::visit( ReturnStmt * node ) {
     882        VISIT_START( node );
     883
     884        visitExpression( node->expr );
     885
     886        VISIT_END( node );
     887}
     888
     889template< typename pass_type >
     890Statement * PassVisitor< pass_type >::mutate( ReturnStmt * node ) {
     891        MUTATE_START( node );
     892
     893        node->expr = mutateExpression( node->expr );
     894
    898895        MUTATE_END( Statement, node );
    899896}
    900897
    901898//--------------------------------------------------------------------------
    902 // ReturnStmt
    903 template< typename pass_type >
    904 void PassVisitor< pass_type >::visit( ReturnStmt * node ) {
    905         VISIT_START( node );
    906 
    907         visitExpression( node->expr );
    908 
    909         VISIT_END( node );
    910 }
    911 
    912 template< typename pass_type >
    913 Statement * PassVisitor< pass_type >::mutate( ReturnStmt * node ) {
    914         MUTATE_START( node );
    915 
    916         node->expr = mutateExpression( node->expr );
    917 
    918         MUTATE_END( Statement, node );
    919 }
    920 
    921 //--------------------------------------------------------------------------
    922899// ThrowStmt
    923900
    924901template< typename pass_type >
    925902void PassVisitor< pass_type >::visit( ThrowStmt * node ) {
    926         VISIT_START( node );
    927 
    928         maybeAccept_impl( node->expr, *this );
    929         maybeAccept_impl( node->target, *this );
    930 
    931         VISIT_END( node );
     903        VISIT_BODY( node );
    932904}
    933905
    934906template< typename pass_type >
    935907Statement * PassVisitor< pass_type >::mutate( ThrowStmt * node ) {
    936         MUTATE_START( node );
    937 
    938         maybeMutate_impl( node->expr, *this );
    939         maybeMutate_impl( node->target, *this );
    940 
    941         MUTATE_END( Statement, node );
     908        MUTATE_BODY( Statement, node );
    942909}
    943910
     
    1029996                // catch statements introduce a level of scope (for the caught exception)
    1030997                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1031                 indexerAddWith( node->exprs );
     998                indexerAddWith( node );
    1032999                maybeAccept_impl( node->stmt, *this );
    10331000        }
     
    10421009                // catch statements introduce a level of scope (for the caught exception)
    10431010                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
    1044                 indexerAddWith( node->exprs );
     1011                indexerAddWith( node );
    10451012                maybeMutate_impl( node->stmt, *this );
    10461013        }
  • src/Common/PassVisitor.proto.h

    r85521c7 rd0a045c7  
    202202static inline void indexer_impl_##func ( pass_type &, long, type ) { }                                                          \
    203203
    204 INDEXER_FUNC( addId     , DeclarationWithType *       );
    205 INDEXER_FUNC( addType   , NamedTypeDecl *             );
    206 INDEXER_FUNC( addStruct , StructDecl *                );
    207 INDEXER_FUNC( addEnum   , EnumDecl *                  );
    208 INDEXER_FUNC( addUnion  , UnionDecl *                 );
    209 INDEXER_FUNC( addTrait  , TraitDecl *                 );
    210 INDEXER_FUNC( addWith   , std::list< Expression * > & );
     204INDEXER_FUNC( addId     , DeclarationWithType * );
     205INDEXER_FUNC( addType   , NamedTypeDecl *       );
     206INDEXER_FUNC( addStruct , StructDecl *          );
     207INDEXER_FUNC( addEnum   , EnumDecl *            );
     208INDEXER_FUNC( addUnion  , UnionDecl *           );
     209INDEXER_FUNC( addTrait  , TraitDecl *           );
     210INDEXER_FUNC( addWith   , WithStmt *            );
    211211
    212212
  • src/Parser/DeclarationNode.cc

    r85521c7 rd0a045c7  
    723723}
    724724
    725 DeclarationNode * DeclarationNode::addFunctionBody( StatementNode * body, ExpressionNode * withExprs ) {
     725DeclarationNode * DeclarationNode::addFunctionBody( StatementNode * body, StatementNode * with ) {
    726726        assert( type );
    727727        assert( type->kind == TypeData::Function );
    728728        assert( ! type->function.body );
     729        if ( with ) {
     730                // convert
     731                //  void f(S s) with (s) { x = 0; }
     732                // to
     733                //  void f(S s) { with(s) { x = 0; } }
     734                WithStmt * withStmt = strict_dynamic_cast< WithStmt * >( with->build() );
     735                withStmt->stmt = body->build();
     736                delete body;
     737                delete with;
     738                body = new StatementNode( new CompoundStmt( { withStmt } ) );
     739        }
    729740        type->function.body = body;
    730         type->function.withExprs = withExprs;
    731741        return this;
    732742}
  • src/Parser/ParseNode.h

    r85521c7 rd0a045c7  
    262262        DeclarationNode * addBitfield( ExpressionNode * size );
    263263        DeclarationNode * addVarArgs();
    264         DeclarationNode * addFunctionBody( StatementNode * body, ExpressionNode * with = nullptr );
     264        DeclarationNode * addFunctionBody( StatementNode * body, StatementNode * with = nullptr );
    265265        DeclarationNode * addOldDeclList( DeclarationNode * list );
    266266        DeclarationNode * setBase( TypeData * newType );
  • src/Parser/TypeData.cc

    r85521c7 rd0a045c7  
    5555                function.body = nullptr;
    5656                function.newStyle = false;
    57                 function.withExprs = nullptr;
    5857                break;
    5958                // Enum is an Aggregate, so both structures are initialized together.
     
    123122                delete function.oldDeclList;
    124123                delete function.body;
    125                 delete function.withExprs;
    126124                // delete function;
    127125                break;
     
    196194                newtype->function.body = maybeClone( function.body );
    197195                newtype->function.newStyle = function.newStyle;
    198                 newtype->function.withExprs = maybeClone( function.withExprs );
    199196                break;
    200197          case Aggregate:
     
    864861                CompoundStmt * body = dynamic_cast< CompoundStmt * >( stmt );
    865862                decl = new FunctionDecl( name, scs, linkage, buildFunction( td ), body, attributes, funcSpec );
    866                 buildList( td->function.withExprs, decl->withExprs );
    867863                return decl->set_asmName( asmName );
    868864        } else if ( td->kind == TypeData::Aggregate ) {
  • src/Parser/TypeData.h

    r85521c7 rd0a045c7  
    6565                StatementNode * body;
    6666                bool newStyle;
    67                 ExpressionNode * withExprs;             // expressions from function's with_clause
    6867        };
    6968
  • src/Parser/parser.yy

    r85521c7 rd0a045c7  
    259259%type<sn> iteration_statement                   jump_statement
    260260%type<sn> expression_statement                  asm_statement
    261 %type<sn> with_statement
    262 %type<en> with_clause_opt
     261%type<sn> with_statement                                with_clause_opt
    263262%type<sn> exception_statement                   handler_clause                          finally_clause
    264263%type<catch_kind> handler_key
     
    24182417                { $$ = nullptr; }
    24192418        | WITH '(' tuple_expression_list ')'
    2420                 { $$ = $3; }
     2419                { $$ = new StatementNode( build_with( $3, nullptr ) ); }
    24212420        ;
    24222421
  • src/ResolvExpr/AlternativeFinder.cc

    r85521c7 rd0a045c7  
    15631563                // find alternatives for condition
    15641564                AlternativeFinder firstFinder( indexer, env );
    1565                 firstFinder.findWithAdjustment( conditionalExpr->arg1 );
     1565                firstFinder.findWithAdjustment( conditionalExpr->get_arg1() );
    15661566                if ( firstFinder.alternatives.empty() ) return;
    15671567                // find alternatives for true expression
    15681568                AlternativeFinder secondFinder( indexer, env );
    1569                 secondFinder.findWithAdjustment( conditionalExpr->arg2 );
     1569                secondFinder.findWithAdjustment( conditionalExpr->get_arg2() );
    15701570                if ( secondFinder.alternatives.empty() ) return;
    15711571                // find alterantives for false expression
    15721572                AlternativeFinder thirdFinder( indexer, env );
    1573                 thirdFinder.findWithAdjustment( conditionalExpr->arg3 );
     1573                thirdFinder.findWithAdjustment( conditionalExpr->get_arg3() );
    15741574                if ( thirdFinder.alternatives.empty() ) return;
    1575                 for ( const Alternative & first : firstFinder.alternatives ) {
    1576                         for ( const Alternative & second : secondFinder.alternatives ) {
    1577                                 for ( const Alternative & third : thirdFinder.alternatives ) {
     1575                for ( AltList::const_iterator first = firstFinder.alternatives.begin(); first != firstFinder.alternatives.end(); ++first ) {
     1576                        for ( AltList::const_iterator second = secondFinder.alternatives.begin(); second != secondFinder.alternatives.end(); ++second ) {
     1577                                for ( AltList::const_iterator third = thirdFinder.alternatives.begin(); third != thirdFinder.alternatives.end(); ++third ) {
    15781578                                        TypeEnvironment compositeEnv;
    1579                                         compositeEnv.simpleCombine( first.env );
    1580                                         compositeEnv.simpleCombine( second.env );
    1581                                         compositeEnv.simpleCombine( third.env );
     1579                                        compositeEnv.simpleCombine( first->env );
     1580                                        compositeEnv.simpleCombine( second->env );
     1581                                        compositeEnv.simpleCombine( third->env );
    15821582
    15831583                                        // unify true and false types, then infer parameters to produce new alternatives
    15841584                                        OpenVarSet openVars;
    15851585                                        AssertionSet needAssertions, haveAssertions;
    1586                                         Alternative newAlt( 0, compositeEnv, first.cost + second.cost + third.cost );
     1586                                        Alternative newAlt( 0, compositeEnv, first->cost + second->cost + third->cost );
    15871587                                        Type* commonType = nullptr;
    1588                                         if ( unify( second.expr->result, third.expr->result, newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
    1589                                                 ConditionalExpr *newExpr = new ConditionalExpr( first.expr->clone(), second.expr->clone(), third.expr->clone() );
    1590                                                 newExpr->result = commonType ? commonType : second.expr->result->clone();
     1588                                        if ( unify( second->expr->get_result(), third->expr->get_result(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
     1589                                                ConditionalExpr *newExpr = new ConditionalExpr( first->expr->clone(), second->expr->clone(), third->expr->clone() );
     1590                                                newExpr->set_result( commonType ? commonType : second->expr->get_result()->clone() );
    15911591                                                // convert both options to the conditional result type
    15921592                                                newAlt.cost += computeExpressionConversionCost( newExpr->arg2, newExpr->result, indexer, newAlt.env );
  • src/ResolvExpr/Resolver.cc

    r85521c7 rd0a045c7  
    8282                void previsit( ConstructorInit *ctorInit );
    8383          private:
    84                 typedef std::list< Initializer * >::iterator InitIterator;
     84        typedef std::list< Initializer * >::iterator InitIterator;
    8585
    8686                template< typename PtrType >
    8787                void handlePtrType( PtrType * type );
    8888
    89                 void resolveWithExprs( std::list< Expression * > & withExprs, std::list< Statement * > & newStmts );
    90                 void fallbackInit( ConstructorInit * ctorInit );
     89          void resolveAggrInit( ReferenceToType *, InitIterator &, InitIterator & );
     90          void resolveSingleAggrInit( Declaration *, InitIterator &, InitIterator &, TypeSubstitution sub );
     91          void fallbackInit( ConstructorInit * ctorInit );
    9192
    9293                Type * functionReturn = nullptr;
     
    268269                std::cerr << std::endl;
    269270#endif
    270                 Type *new_type = resolveTypeof( functionDecl->type, indexer );
     271                Type *new_type = resolveTypeof( functionDecl->get_type(), indexer );
    271272                functionDecl->set_type( new_type );
    272273                GuardValue( functionReturn );
    273                 functionReturn = ResolvExpr::extractResultType( functionDecl->type );
    274 
    275                 {
    276                         // resolve with-exprs with parameters in scope and add any newly generated declarations to the
    277                         // front of the function body.
    278                         auto guard = makeFuncGuard( [this]() { indexer.enterScope(); }, [this](){ indexer.leaveScope(); } );
    279                         indexer.addFunctionType( functionDecl->type );
    280                         std::list< Statement * > newStmts;
    281                         resolveWithExprs( functionDecl->withExprs, newStmts );
    282                         functionDecl->statements->kids.splice( functionDecl->statements->kids.begin(), newStmts );
    283                 }
     274                functionReturn = ResolvExpr::extractResultType( functionDecl->get_functionType() );
    284275        }
    285276
     
    288279                // xxx - it might be necessary to somehow keep the information from this environment, but I can't currently
    289280                // see how it's useful.
    290                 for ( Declaration * d : functionDecl->type->parameters ) {
     281                for ( Declaration * d : functionDecl->get_functionType()->get_parameters() ) {
    291282                        if ( ObjectDecl * obj = dynamic_cast< ObjectDecl * >( d ) ) {
    292                                 if ( SingleInit * init = dynamic_cast< SingleInit * >( obj->init ) ) {
    293                                         delete init->value->env;
    294                                         init->value->env = nullptr;
     283                                if ( SingleInit * init = dynamic_cast< SingleInit * >( obj->get_init() ) ) {
     284                                        delete init->get_value()->get_env();
     285                                        init->get_value()->set_env( nullptr );
    295286                                }
    296287                        }
     
    593584        }
    594585
    595         void Resolver::resolveWithExprs( std::list< Expression * > & withExprs, std::list< Statement * > & newStmts ) {
    596                 for ( Expression *& expr : withExprs )  {
     586
     587        void Resolver::previsit( WithStmt * withStmt ) {
     588                for ( Expression *& expr : withStmt->exprs )  {
    597589                        // only struct- and union-typed expressions are viable candidates
    598590                        findKindExpression( expr, indexer, "with statement", isStructOrUnion );
     
    603595                                ObjectDecl * tmp = ObjectDecl::newObject( tmpNamer.newName(), expr->result->clone(), new SingleInit( expr ) );
    604596                                expr = new VariableExpr( tmp );
    605                                 newStmts.push_back( new DeclStmt( tmp ) );
     597                                stmtsToAddBefore.push_back( new DeclStmt( tmp ) );
    606598                                if ( InitTweak::isConstructable( tmp->type ) ) {
    607599                                        // generate ctor/dtor and resolve them
     
    611603                        }
    612604                }
    613         }
    614 
    615         void Resolver::previsit( WithStmt * withStmt ) {
    616                 resolveWithExprs( withStmt->exprs, stmtsToAddBefore );
    617605        }
    618606
     
    728716                PassVisitor<Resolver> resolver( indexer );
    729717                stmtExpr->accept( resolver );
    730                 stmtExpr->computeResult();
    731718        }
    732719
  • src/SymTab/Indexer.cc

    r85521c7 rd0a045c7  
    409409
    410410        void Indexer::addId( DeclarationWithType *decl, Expression * baseExpr ) {
    411                 if ( decl->name == "" ) return;
    412411                debugPrint( "Adding Id " << decl->name << std::endl );
    413412                makeWritable();
     
    589588        }
    590589
    591         void Indexer::addWith( std::list< Expression * > & withExprs ) {
    592                 for ( Expression * expr : withExprs ) {
     590        void Indexer::addWith( WithStmt * stmt ) {
     591                for ( Expression * expr : stmt->exprs ) {
    593592                        if ( expr->result ) {
    594593                                AggregateDecl * aggr = expr->result->stripReferences()->getAggr();
  • src/SymTab/Indexer.h

    r85521c7 rd0a045c7  
    8484
    8585                /// adds all of the IDs from WithStmt exprs
    86                 void addWith( std::list< Expression * > & withExprs );
     86                void addWith( WithStmt * );
    8787
    8888                /// adds all of the members of the Aggregate (addWith helper)
  • src/SynTree/Declaration.h

    r85521c7 rd0a045c7  
    151151        FunctionType *type;
    152152        CompoundStmt *statements;
    153         std::list< Expression * > withExprs;
    154153
    155154        FunctionDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements,
  • src/SynTree/Expression.cc

    r85521c7 rd0a045c7  
    597597
    598598StmtExpr::StmtExpr( CompoundStmt *statements ) : statements( statements ) {
    599         computeResult();
     599        assert( statements );
     600        std::list< Statement * > & body = statements->get_kids();
     601        if ( ! body.empty() ) {
     602                if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( body.back() ) ) {
     603                        result = maybeClone( exprStmt->expr->result );
     604                }
     605        }
     606        // ensure that StmtExpr has a result type
     607        if ( ! result ) {
     608                result = new VoidType( Type::Qualifiers() );
     609        }
    600610}
    601611StmtExpr::StmtExpr( const StmtExpr &other ) : Expression( other ), statements( other.statements->clone() ) {
     
    607617        deleteAll( dtors );
    608618        deleteAll( returnDecls );
    609 }
    610 void StmtExpr::computeResult() {
    611         assert( statements );
    612         std::list< Statement * > & body = statements->kids;
    613         delete result;
    614         result = nullptr;
    615         if ( ! returnDecls.empty() ) {
    616                 // prioritize return decl for result type, since if a return decl exists, then
    617                 // the StmtExpr is currently in an intermediate state where the body will always
    618                 // give a void result type.
    619                 result = returnDecls.front()->get_type()->clone();
    620         } else if ( ! body.empty() ) {
    621                 if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( body.back() ) ) {
    622                         result = maybeClone( exprStmt->expr->result );
    623                 }
    624         }
    625         // ensure that StmtExpr has a result type
    626         if ( ! result ) {
    627                 result = new VoidType( Type::Qualifiers() );
    628         }
    629619}
    630620void StmtExpr::print( std::ostream &os, Indenter indent ) const {
  • src/SynTree/Expression.h

    r85521c7 rd0a045c7  
    728728        StmtExpr * set_statements( CompoundStmt * newValue ) { statements = newValue; return this; }
    729729
    730         // call to set the result type of this StmtExpr based on its body
    731         void computeResult();
    732 
    733730        std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; }
    734731        std::list< Expression * > & get_dtors() { return dtors; }
  • src/SynTree/FunctionDecl.cc

    r85521c7 rd0a045c7  
    5151                VarExprReplacer::replace( this, declMap );
    5252        }
    53         cloneAll( other.withExprs, withExprs );
    5453}
    5554
     
    5756        delete type;
    5857        delete statements;
    59         deleteAll( withExprs );
    6058}
    6159
Note: See TracChangeset for help on using the changeset viewer.