Changes in / [e0a653d:33218c6]
- Files:
-
- 8 added
- 29 deleted
- 180 edited
Legend:
- Unmodified
- Added
- Removed
-
configure
re0a653d r33218c6 3471 3471 case $host_cpu in 3472 3472 i386) 3473 CFLAGS+=" -m32"3474 CXXFLAGS+=" -m32"3475 CFAFLAGS+=" -m32"3476 LDFLAGS+=" -m32"3473 CFLAGS+=" -m32 " 3474 CXXFLAGS+=" -m32 " 3475 CFAFLAGS+=" -m32 " 3476 LDFLAGS+=" -m32 " 3477 3477 ;; 3478 3478 i686) 3479 CFLAGS+=" -m32"3480 CXXFLAGS+="-m32"3481 CFAFLAGS+="-m32"3482 LDFLAGS+="-m32"3479 CFLAGS+=" -m32 " 3480 CXXFLAGS+=" -m32 " 3481 CFAFLAGS+=" -m32 " 3482 LDFLAGS+=" -m32 " 3483 3483 ;; 3484 3484 x86_64) 3485 CFLAGS+=" -m64"3486 CXXFLAGS+="-m64"3487 CFAFLAGS+="-m64"3488 LDFLAGS+="-m64"3485 CFLAGS+=" -m64 " 3486 CXXFLAGS+=" -m64 " 3487 CFAFLAGS+=" -m64 " 3488 LDFLAGS+=" -m64 " 3489 3489 ;; 3490 3490 esac -
configure.ac
re0a653d r33218c6 167 167 AC_SUBST([MACHINE_TYPE],[$host_cpu]) 168 168 169 if ! test "$host_cpu" = "$build_cpu"; then 169 if ! test "$host_cpu" = "$build_cpu"; then 170 170 case $host_cpu in 171 171 i386) 172 CFLAGS+=" -m32"173 CXXFLAGS+=" -m32"174 CFAFLAGS+=" -m32"175 LDFLAGS+=" -m32"172 CFLAGS+=" -m32 " 173 CXXFLAGS+=" -m32 " 174 CFAFLAGS+=" -m32 " 175 LDFLAGS+=" -m32 " 176 176 ;; 177 177 i686) 178 CFLAGS+=" -m32"179 CXXFLAGS+="-m32"180 CFAFLAGS+="-m32"181 LDFLAGS+="-m32"178 CFLAGS+=" -m32 " 179 CXXFLAGS+=" -m32 " 180 CFAFLAGS+=" -m32 " 181 LDFLAGS+=" -m32 " 182 182 ;; 183 183 x86_64) 184 CFLAGS+=" -m64"185 CXXFLAGS+="-m64"186 CFAFLAGS+="-m64"187 LDFLAGS+="-m64"184 CFLAGS+=" -m64 " 185 CXXFLAGS+=" -m64 " 186 CFAFLAGS+=" -m64 " 187 LDFLAGS+=" -m64 " 188 188 ;; 189 189 esac -
doc/LaTeXmacros/common.tex
re0a653d r33218c6 11 11 %% Created On : Sat Apr 9 10:06:17 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Sun Jun 18 20:32:32201714 %% Update Count : 3 1913 %% Last Modified On : Mon Jul 17 10:21:17 2017 14 %% Update Count : 348 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 36 36 % Names used in the document. 37 37 38 \newcommand{\CFAIcon}{\text rm{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}\xspace} % Cforall symbolic name38 \newcommand{\CFAIcon}{\textsf{C}\raisebox{\depth}{\rotatebox{180}{\textsf{A}}}\xspace} % Cforall symbolic name 39 39 \newcommand{\CFA}{\protect\CFAIcon} % safe for section/caption 40 40 \newcommand{\CFL}{\textrm{Cforall}\xspace} % Cforall symbolic name … … 55 55 \setlength{\parindentlnth}{\parindent} 56 56 57 \newcommand{\LstKeywordStyle}[1]{{\lst@basicstyle{\lst@keywordstyle{#1}}}} 58 \newcommand{\LstCommentStyle}[1]{{\lst@basicstyle{\lst@commentstyle{#1}}}} 59 57 60 \newlength{\gcolumnposn} % temporary hack because lstlisting does not handle tabs correctly 58 61 \newlength{\columnposn} 59 62 \setlength{\gcolumnposn}{2.5in} 60 63 \setlength{\columnposn}{\gcolumnposn} 61 \newcommand{\C}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\lst@ commentstyle{#2}}}64 \newcommand{\C}[2][\@empty]{\ifx#1\@empty\else\global\setlength{\columnposn}{#1}\global\columnposn=\columnposn\fi\hfill\makebox[\textwidth-\columnposn][l]{\lst@basicstyle{\LstCommentStyle{#2}}}} 62 65 \newcommand{\CRT}{\global\columnposn=\gcolumnposn} 63 66 … … 131 134 132 135 % inline text and code index (cannot use ©) 133 \newcommand{\Indexc}[ 1]{\lstinline$#1$\index{#1@\lstinline$#1$}}136 \newcommand{\Indexc}[2][\@empty]{\lstinline[#1]$#2$\index{#2@\lstinline[#1]$#2$}} 134 137 % code index (cannot use ©) 135 \newcommand{\indexc}[ 1]{\index{#1@\lstinline$#1$}}138 \newcommand{\indexc}[2][\@empty]{\index{#2@\lstinline[#1]$#2$}} 136 139 137 140 % Denote newterms in particular font and index them without particular font and in lowercase, e.g., \newterm{abc}. … … 231 234 basicstyle=\linespread{0.9}\sf, % reduce line spacing and use sanserif font 232 235 stringstyle=\tt, % use typewriter font 233 tabsize= 4, % 4space tabbing236 tabsize=6, % N space tabbing 234 237 xleftmargin=\parindentlnth, % indent code to paragraph indentation 235 238 extendedchars=true, % allow ASCII characters in the range 128-255 -
doc/LaTeXmacros/lstlang.sty
re0a653d r33218c6 8 8 %% Created On : Sat May 13 16:34:42 2017 9 9 %% Last Modified By : Peter A. Buhr 10 %% Last Modified On : Thu Jun 22 07:40:31201711 %% Update Count : 1 010 %% Last Modified On : Wed Jul 12 22:42:09 2017 11 %% Update Count : 12 12 12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 13 13 … … 112 112 finally, forall, ftype, _Generic, _Imaginary, inline, __label__, lvalue, _Noreturn, one_t, 113 113 otype, restrict, _Static_assert, throw, throwResume, trait, try, ttype, typeof, __typeof, 114 __typeof__, zero_t},114 __typeof__, with, zero_t}, 115 115 morekeywords=[2]{ 116 116 _Atomic, coroutine, is_coroutine, is_monitor, is_thread, monitor, mutex, nomutex, … … 118 118 moredirectives={defined,include_next}% 119 119 } 120 121 % C++ programming language 122 \lstdefinelanguage{C++}[ANSI]{C++}{} 120 123 121 124 % uC++ programming language, based on ANSI C++ -
doc/bibliography/cfa.bib
re0a653d r33218c6 2273 2273 @manual{JavaScript, 2274 2274 keywords = {JavaScript}, 2275 contributer = {pabuhr },2275 contributer = {pabuhr@plg}, 2276 2276 title = {ECMAScript 2015 Language Specification {JavaScript}}, 2277 2277 organization= {ECAM International}, … … 2446 2446 @manual{Erlang, 2447 2447 keywords = {Erlang}, 2448 contributer = {pabuhr },2448 contributer = {pabuhr@plg}, 2449 2449 title = {Erlang Reference Manual User's Guide, Vertion 7.0}, 2450 2450 organization= {Erlang/OTP System Documentation}, … … 2771 2771 publisher = {ACM}, 2772 2772 address = {New York, NY, USA}, 2773 } 2774 2775 @article{Yang95, 2776 keywords = {software solutions, N-thread, mutual exclusions}, 2777 contributer = {pabuhr@plg}, 2778 author = {Jae-Heon Yang and James H. Anderson}, 2779 title = {A Fast, Scalable Mutual Exclusion Algorithm}, 2780 journal = {Distributed Computing}, 2781 publisher = {Springer-Verlag}, 2782 volume = {9}, 2783 number = {1}, 2784 year = {1995}, 2785 pages = {51-60}, 2773 2786 } 2774 2787 … … 5052 5065 contributer = {pabuhr@plg}, 5053 5066 author = {Kathleen Jensen and Niklaus Wirth}, 5054 title = {{P}ascal User Manual and Report },5067 title = {{P}ascal User Manual and Report, ISO Pascal Standard}, 5055 5068 publisher = {Springer--Verlag}, 5056 year = 19 85,5057 edition = { 3rd},5058 note = {Revised by Andrew B. Mickel and James F. Miner , ISO Pascal Standard}5069 year = 1991, 5070 edition = {4th}, 5071 note = {Revised by Andrew B. Mickel and James F. Miner} 5059 5072 } 5060 5073 -
doc/proposals/virtual.txt
re0a653d r33218c6 1 1 Proposal for virtual functionality 2 3 There are two types of virtual inheritance in this proposal, relaxed 4 (implicit) and strict (explicit). Relaxed is the simpler case that uses the 5 existing trait system with the addition of trait references and vtables. 6 Strict adds some constraints and requires some additional notation but allows 7 for down-casting. 8 9 Relaxed Virtual Inheritance: 2 10 3 11 Imagine the following code : … … 20 28 void draw(line*); 21 29 22 While all the members of this simple UI support drawing creating a UI that easily23 supports both these UI requires some tedious boiler-plate code:30 While all the members of this simple UI support drawing, creating a UI that 31 easily supports both these UI requires some tedious boiler-plate code: 24 32 25 33 enum type_t { text, line }; … … 41 49 } 42 50 43 While this code will work as indented, adding any new widgets or any new widget behaviors 44 requires changing existing code to add the desired functionality. To ease this maintenance 45 effort required CFA introduces the concept of dynamic types, in a manner similar to C++. 46 47 A simple usage of dynamic type with the previous example would look like : 48 49 drawable* objects[10]; 51 While this code will work as implemented, adding any new widgets or any new 52 widget behaviors requires changing existing code to add the desired 53 functionality. To ease this maintenance effort required CFA introduces the 54 concept of trait references. 55 56 Using trait references to implement the above gives the following : 57 58 trait drawable objects[10]; 50 59 fill_objects(objects); 51 60 52 61 while(running) { 53 for(drawable *object : objects) {62 for(drawable object : objects) { 54 63 draw(object); 55 64 } 56 65 } 57 66 58 However, this is not currently do-able in the current CFA and furthermore is not 59 possible to implement statically. Therefore we need to add a new feature to handle 60 having dynamic types like this (That is types that are found dynamically not types 61 that change dynamically). 62 63 C++ uses inheritance and virtual functions to find the 64 desired type dynamically. CFA takes inspiration from this solution. 65 66 What we really want to do is express the fact that calling draw() on a object 67 should find the dynamic type of the parameter before calling the routine, much like the 68 hand written example given above. We can express this by adding the virtual keyword on 69 the parameter of the constraints on our trait: 67 The keyword trait is optional (by the same rules as the struct keyword). This 68 is not currently supported in CFA and the lookup is not possible to implement 69 statically. Therefore we need to add a new feature to handle having dynamic 70 lookups like this. 71 72 What we really want to do is express the fact that calling draw() on a trait 73 reference should find the underlying type of the given parameter and find how 74 it implements the routine, as in the example with the enumeration and union. 75 76 For instance specifying that the drawable trait reference looks up the type 77 of the first argument to find the implementation would be : 70 78 71 79 trait drawable(otype T) { … … 73 81 }; 74 82 75 This expresses the idea that drawable is similar to an abstract base class in C++ and 76 also gives meaning to trying to take a pointer of drawable. That is anything that can 77 be cast to a drawable pointer has the necessary information to call the draw routine on 78 that type. Before that drawable was only a abstract type while now it also points to a 79 piece of storage which specify which behavior the object will have at run time. 80 81 This storage needs to be allocate somewhere. C++ just adds an invisible pointer at 82 the beginning of the struct but we can do something more explicit for users, actually 83 have a visible special field : 84 85 struct text { 86 char* text; 87 vtable drawable; 88 }; 89 90 struct line{ 91 vtable drawable; 92 vec2 start; 93 vec2 end; 94 }; 95 96 With these semantics, adding a "vtable drawable" means that text pointers and line pointers are now 97 convertible to drawable pointers. This conversion will not necessarily be a type only change however, indeed, 98 the drawable pointer will point to the field "vtable drawable" not the head of the struct. However, since all 99 the types are known at compile time, converting pointers becomes a simple offset operations. 100 101 The vtable field contains a pointer to a vtable which contains all the information needed for the caller 102 to find the function pointer of the desired behavior. 103 104 One of the limitations of this design is that it does not support double dispatching, which 105 concretely means traits cannot have routines with more than one virtual parameter. This design 106 would have many ambiguities if it did support multiple virtual parameter. A futher limitation is 107 that traits over more than one type cannot have vtables meaningfully defined for them, as the 108 particular vtable to use would be a function of the other type(s) the trait is defined over. 109 110 It is worth noting that the function pointers in these vtables are bound at object construction, rather than 111 function call-site, as in Cforall's existing polymorphic functions. As such, it is possible that two objects 112 with the same static type would have a different vtable (consider what happens if draw(line*) is overridden 113 between the definitions of two line objects). Given that the virtual drawable* erases static types though, 114 this should not be confusing in practice. A more distressing possibility is that of creating an object that 115 outlives the scope of one of the functions in its vtable. This is certainly a possible bug, but it is of a 116 type that C programmers are familiar with, and should be able to avoid by the usual methods. 117 118 Extensibility. 119 120 One of the obvious critics of this implementation is that it lacks extensibility for classes 121 that cannot be modified (ex: Linux C headers). However this solution can be extended to 122 allow more extensibility by adding "Fat pointers". 123 124 Indeed, users could already "solve" this issue by writing their own fat pointers as such: 125 126 trait MyContext(otype T) { 127 void* get_stack(virtual T*) 128 }; 129 130 void* get_stack(ucontext_t *context); 131 132 struct fat_ucontext_t { 133 vtable MyContext; 134 ucontext_t *context; 135 } 136 137 //Tedious forwarding routine 138 void* get_stack(fat_ucontext_t *ptr) { 139 return get_stack(ptr->context); 140 } 141 142 However, users would have to write all the virtual methods they want to override and make 143 them all simply forward to the existing method that takes the corresponding POCO(Plain Old C Object). 144 145 The alternative we propose is to use language level fat pointers : 146 147 trait MyContext(otype T) { 148 void* get_stack(virtual T*) 149 }; 150 151 void* get_stack(ucontext_t *context); 152 153 //The type vptr(ucontext_t) all 154 vptr(ucontext_t) context; 155 156 These behave exactly as the previous example but all the forwarding routines are automatically generated. 157 158 Bikeshedding. 159 160 It may be desirable to add fewer new keywords than discussed in this proposal; it is possible that "virtual" 161 could replace both "vtable" and "vptr" above with unambiguous contextual meaning. However, for purposes of 162 clarity in the design discussion it is beneficial to keep the keywords for separate concepts distinct. 163 83 This could be implied in simple cases like this one (single parameter on the 84 trait and single generic parameter on the function). In more complex cases it 85 would have to be explicitly given, or a strong convention would have to be 86 enforced (e.g. implementation of trait functions is always drawn from the 87 first polymorphic parameter). 88 89 Once a function in a trait has been marked as virtual it defines a new 90 function that takes in that trait's reference and then dynamically calls the 91 underlying type implementation. Hence a trait reference becomes a kind of 92 abstract type, cannot be directly instantiated but can still be used. 93 94 One of the limitations of this design is that it does not support double 95 dispatching, which concretely means traits cannot have routines with more than 96 one virtual parameter. The program must have a single table to look up the 97 function on. Using trait references with traits with more than one parameter 98 is also restricted, initially forbidden, see extension. 99 100 Extension: Multi-parameter Virtual Traits: 101 102 This implementation can be extended to traits with multiple parameters if 103 one is called out as being the virtual trait. For example : 104 105 trait iterator(otype T, dtype Item) { 106 Maybe(Item) next(virtual T *); 107 } 108 109 iterator(int) generators[10]; 110 111 Which creates a collection of iterators that produce integers, regardless of 112 how those iterators are implemented. This may require a note that this trait 113 is virtual on T and not Item, but noting it on the functions may be enough. 114 115 116 Strict Virtual Inheritance: 117 118 One powerful feature relaxed virtual does not support is the idea of down 119 casting. Once something has been converted into a trait reference there is 120 very little we can do to recover and of the type information, only the trait's 121 required function implementations are kept. 122 123 To allow down casting strict virtual requires that all traits and structures 124 involved be organized into a tree. Each trait or struct must have a unique 125 position on this tree (no multiple inheritance). 126 127 This is declared as follows : 128 129 trait error(otype T) virtual { 130 const char * msg(T *); 131 } 132 133 trait io_error(otype T) virtual error { 134 FILE * src(T *); 135 } 136 137 struct eof_error virtual io_error { 138 FILE * fd; 139 }; 140 141 So the trait error is the head of a new tree and io_error is a child of it. 142 143 Also the parent trait is implicitly part of the assertions of the children, 144 so all children implement the same operations as the parent. By the unique 145 path down the tree, we can also uniquely order them so that a prefix of a 146 child's vtable has the same format as its parent's. 147 148 This gives us an important extra feature, runtime checking of the parent-child 149 relationship with a C++ dynamic_cast like operation. Allowing checked 150 conversions from trait references to more particular references, which works 151 if the underlying type is, or is a child of, the new trait type. 152 153 Extension: Multiple Parents 154 155 Although each trait/struct must have a unique position on each tree, it could 156 have positions on multiple trees. All this requires is the ability to give 157 multiple parents, as here : 158 159 trait region(otype T) virtual drawable, collider; 160 161 The restriction being, the parents must come from different trees. This 162 object (and all of its children) can be cast to either tree. This is handled 163 by generating a separate vtable for each tree the structure is in. 164 165 Extension: Multi-parameter Strict Virtual 166 167 If a trait has multiple parameters then one must be called out to be the one 168 we generate separate vtables for, as in : 169 170 trait example(otype T, otype U) virtual(T) ... 171 172 This can generate a separate vtable for each U for which all the T+U 173 implementations are provided. These are then separate nodes in the tree (or 174 the root of different trees) as if each was created individually. Providing a 175 single unique instance of these nodes would be the most difficult aspect of 176 this extension, possibly intractable, though with sufficient hoisting and 177 link-once duplication it may be possible. 178 179 Example: 180 181 trait argument(otype T) virtual { 182 char short_name(virtual T *); 183 bool is_set(virtual T *); 184 }; 185 186 trait value_argument(otype T, otype U) virtual(T) argument { 187 U get_value(virtual T *); 188 }; 189 190 Extension: Structural Inheritance 191 192 Currently traits must be the internal nodes and structs the leaf nodes. 193 Structs could be made internal nodes as well, in which case the child structs 194 would likely structurally inherit the fields of their parents. 195 196 197 Storing the Virtual Lookup Table (vtable): 198 199 We have so far been silent on how the vtable is created, stored and accessed. 200 201 Creation happens at compile time. Function pointers are found by using the 202 same best match rules as elsewhere (additional rules for defaults from the 203 parent may or may not be required). For strict virtual this must happen at the 204 global scope and forbidding static functions, to ensure that a single unique 205 vtable is created. Similarly, there may have to be stricter matching rules 206 for the functions that go into the vtable, possibly requiring an exact match. 207 Relaxed virtual could relax both restrictions, if we allow different vtable 208 at different conversion (struct to trait reference) sites. If it is allowed 209 local functions being bound to a vtable could cause issues when they go out 210 of scope, however this should follow the lifetime rules most C programs 211 already follow implicitly. 212 213 Most vtables should be stored statically, the only exception being some of 214 the relaxed vtables that could have local function pointers. These may be able 215 to be stack allocated. All vtables should be immutable and require no manual 216 cleanup. 217 218 Access has two main options: 219 220 The first is through the use of fat pointers, or a tuple of pointers. When the 221 object is converted to a trait reference, the pointers to its vtables are 222 stored along side it. 223 224 This allows for compatibility with existing structures (such as those imported 225 from C) and is the default storage method unless a different one is given. 226 227 The other is by inlining the vtable pointer as "intrusive vtables". This adds 228 a field to the structure to the vtable. The trait reference then has a single 229 pointer to this field, the vtable includes an offset to find the beginning of 230 the structure again. 231 232 This is used if you specify a vtable field in the structure. If given in the 233 trait the vtable pointer in the trait reference can then become a single 234 pointer to the vtable field and use that to recover the original object 235 pointer as well as retrieve all operations. 236 237 trait drawable(otype T) { 238 vtable drawable; 239 }; 240 241 struct line { 242 vtable drawable; 243 vec2 start; 244 vec2 end; 245 }; 246 247 This inline code allows trait references to be converted to plain pointers 248 (although they still must be called specially). The vtable field may just be 249 an opaque block of memory or it may allow user access to the vtable. If so 250 then there should be some way to retrieve the type of the vtable, which will be 251 autogenerated and often unique. 252 253 254 Keyword Usage: 255 256 It may be desirable to add fewer new keywords than discussed in this proposal. 257 It is possible that "virtual" could replace both "vtable" above with 258 unambiguous contextual meaning. However, for purposes of clarity in the design 259 discussion it is beneficial to keep the keywords for separate concepts distinct. 260 261 262 Trait References and Operations: 263 264 sizeof(drawable) will return the size of the trait object itself. However : 265 266 line a_line; 267 drawable widget = a_line; 268 sizeof(widget); 269 270 Will instead return the sizeof the underlying object, although the trait must 271 require that its implementation is sized for there to be a meaningful value 272 to return. You may also get the size of the trait reference with 273 274 sizeof(&widget); 275 276 Calling free on a trait reference will free the memory for the object. It will 277 leave the vtables alone, as those are (always?) statically allocated. -
doc/user/EHMHierarchy.fig
re0a653d r33218c6 1 #FIG 3.2 Produced by xfig version 3.2.5 b1 #FIG 3.2 Produced by xfig version 3.2.5c 2 2 Landscape 3 3 Center … … 19 19 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 1 0 2 20 20 1 1 1.00 60.00 90.00 21 1950 1425 3000120021 1950 1425 2925 1200 22 22 2 1 0 1 0 7 100 0 -1 0.000 0 0 -1 1 0 2 23 23 1 1 1.00 60.00 90.00 … … 29 29 1 1 1.00 60.00 90.00 30 30 4950 1950 4950 1725 31 4 1 0 100 0 0 12 0.0000 0 135 195 1950 1650 IO\00132 4 1 0 100 0 0 12 0.0000 0 135 8704950 1650 Arithmetic\00133 4 1 0 100 0 0 12 0.0000 0 135 3151350 2100 File\00134 4 1 0 100 0 0 12 0.0000 0 135 6902550 2100 Network\00135 4 1 0 100 0 0 12 0.0000 0 180 11703750 2100 DivideByZero\00136 4 1 0 100 0 0 12 0.0000 0 135 750 4950 2100 Overflow\00137 4 1 0 100 0 0 12 0.0000 0 135 855 6000 2100 Underflow\00138 4 1 0 100 0 0 12 0.0000 0 180 8403450 1200 Exception\00131 4 1 0 50 -1 0 13 0.0000 2 135 225 1950 1650 IO\001 32 4 1 0 50 -1 0 13 0.0000 2 135 915 4950 1650 Arithmetic\001 33 4 1 0 50 -1 0 13 0.0000 2 150 330 1350 2100 File\001 34 4 1 0 50 -1 0 13 0.0000 2 135 735 2550 2100 Network\001 35 4 1 0 50 -1 0 13 0.0000 2 180 1215 3750 2100 DivideByZero\001 36 4 1 0 50 -1 0 13 0.0000 2 150 810 4950 2100 Overflow\001 37 4 1 0 50 -1 0 13 0.0000 2 150 915 6000 2100 Underflow\001 38 4 1 0 50 -1 0 13 0.0000 2 180 855 3450 1200 Exception\001 -
doc/user/Makefile
re0a653d r33218c6 1 1 ## Define the appropriate configuration variables. 2 2 3 TeXLIB = .:../LaTeXmacros:../ LaTeXmacros/listings:../LaTeXmacros/enumitem:../bibliography/:3 TeXLIB = .:../LaTeXmacros:../bibliography/: 4 4 LaTeX = TEXINPUTS=${TeXLIB} && export TEXINPUTS && latex -halt-on-error 5 5 BibTeX = BIBINPUTS=${TeXLIB} && export BIBINPUTS && bibtex -
doc/user/user.tex
re0a653d r33218c6 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Fri Jul 7 10:36:39 201714 %% Update Count : 2 54713 %% Last Modified On : Sat Jul 22 11:01:19 2017 14 %% Update Count : 2878 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 57 57 \CFAStyle % use default CFA format-style 58 58 59 \lstnewenvironment{C++}[1][] 60 {\lstset{language=C++,moredelim=**[is][\protect\color{red}]{®}{®}#1}} 61 {} 62 59 63 % inline code ©...© (copyright symbol) emacs: C-q M-) 60 64 % red highlighting ®...® (registered trademark symbol) emacs: C-q M-. … … 137 141 138 142 \CFA{}\index{cforall@\CFA}\footnote{Pronounced ``\Index*{C-for-all}'', and written \CFA, CFA, or \CFL.} is a modern general-purpose programming-language, designed as an evolutionary step forward for the C programming language. 139 The syntax of the \CFA language builds from C,and should look immediately familiar to C/\Index*[C++]{\CC{}} programmers.143 The syntax of \CFA builds from C and should look immediately familiar to C/\Index*[C++]{\CC{}} programmers. 140 144 % Any language feature that is not described here can be assumed to be using the standard \Celeven syntax. 141 \CFA adds many modern programming-language features that directly lead to increased \emph{\Index{safety}} and \emph{\Index{productivity}}, while maintaining interoperability with existing C programs and achieving Cperformance.142 Like C, \CFA is a statically typed, procedural language with a low-overhead runtime, meaning there is no global \Index{garbage-collection}, but \Index{regional garbage-collection}\index{garbage-collection!regional} is possible.145 \CFA adds many modern programming-language features that directly lead to increased \emph{\Index{safety}} and \emph{\Index{productivity}}, while maintaining interoperability with existing C programs and achieving similar performance. 146 Like C, \CFA is a statically typed, procedural (non-\Index{object-oriented}) language with a low-overhead runtime, meaning there is no global \Index{garbage-collection}, but \Index{regional garbage-collection}\index{garbage-collection!regional} is possible. 143 147 The primary new features include parametric-polymorphic routines and types, exceptions, concurrency, and modules. 144 148 145 One of the main design philosophies of \CFA is to ``describe not prescribe'', which means \CFA tries to provide a pathway from low-level C programming to high-level \CFA programming, but it does not force programmers to ``do the right thing''. 146 Programmers can cautiously add \CFA extensions to their C programs in any order and at any time to incrementally move towards safer, higher-level programming features. 147 A programmer is always free to reach back to C from \CFA for any reason, and in many cases, new \CFA features have a fallback to a C mechanism. 148 There is no notion or requirement for rewriting a legacy C program in \CFA; 149 instead, a programmer evolves an existing C program into \CFA by incrementally incorporating \CFA features. 150 New programs can be written in \CFA using a combination of C and \CFA features. 151 \Index*[C++]{\CC{}} had a similar goal 30 years ago, but currently has the disadvantages of multiple legacy design-choices that cannot be updated and active divergence of the language model from C, requiring significant effort and training to incrementally add \CC to a C-based project. 149 One of the main design philosophies of \CFA is to ``\Index{describe not prescribe}'', which means \CFA tries to provide a pathway from low-level C programming to high-level \CFA programming, but it does not force programmers to ``do the right thing''. 150 Programmers can cautiously add \CFA extensions to their C programs in any order and at any time to incrementally move towards safer, higher-level programming. 151 A programmer is always free to reach back to C from \CFA, for any reason, and in many cases, new \CFA features can be locally switched back to there C counterpart. 152 There is no notion or requirement for \emph{rewriting} a legacy C program in \CFA; 153 instead, a programmer evolves a legacy program into \CFA by incrementally incorporating \CFA features. 154 As well, new programs can be written in \CFA using a combination of C and \CFA features. 155 156 \Index*[C++]{\CC{}} had a similar goal 30 years ago, allowing object-oriented programming to be incrementally added to C. 157 However, \CC currently has the disadvantages of a strong object-oriented bias, multiple legacy design-choices that cannot be updated, and active divergence of the language model from C, all of which requires significant effort and training to incrementally add \CC to a C-based project. 152 158 In contrast, \CFA has 30 years of hindsight and a clean starting point. 153 159 … … 156 162 \begin{quote2} 157 163 \begin{tabular}{@{}l@{\hspace{1.5em}}l@{\hspace{1.5em}}l@{}} 158 \multicolumn{1}{c@{\hspace{1.5em}}}{\textbf{\CFA}} & \multicolumn{1}{c}{\textbf{C}} & \multicolumn{1}{c}{\textbf{\CC}} \\ 159 \begin{cfa} 160 #include <fstream>§\indexc{fstream}§ 161 162 int main( void ) { 163 int x = 0, y = 1, z = 2; 164 ®sout | x | y | z | endl;® 165 } 166 \end{cfa} 167 & 168 \begin{lstlisting} 164 \multicolumn{1}{c@{\hspace{1.5em}}}{\textbf{C}} & \multicolumn{1}{c}{\textbf{\CFA}} & \multicolumn{1}{c}{\textbf{\CC}} \\ 165 \begin{cfa} 169 166 #include <stdio.h>§\indexc{stdio.h}§ 170 167 … … 173 170 ®printf( "%d %d %d\n", x, y, z );® 174 171 } 175 \end{ lstlisting}172 \end{cfa} 176 173 & 177 \begin{lstlisting} 174 \begin{cfa} 175 #include <fstream>§\indexc{fstream}§ 176 177 int main( void ) { 178 int x = 0, y = 1, z = 2; 179 ®sout | x | y | z | endl;®§\indexc{sout}§ 180 } 181 \end{cfa} 182 & 183 \begin{cfa} 178 184 #include <iostream>§\indexc{iostream}§ 179 185 using namespace std; … … 182 188 ®cout<<x<<" "<<y<<" "<<z<<endl;® 183 189 } 184 \end{ lstlisting}190 \end{cfa} 185 191 \end{tabular} 186 192 \end{quote2} 187 193 While the \CFA I/O looks similar to the \Index*[C++]{\CC{}} output style, there are important differences, such as automatic spacing between variables as in \Index*{Python} (see~\VRef{s:IOLibrary}). 188 194 195 \subsection{Background} 196 189 197 This document is a programmer reference-manual for the \CFA programming language. 190 198 The manual covers the core features of the language and runtime-system, with simple examples illustrating syntax and semantics of each feature. 191 199 The manual does not teach programming, i.e., how to combine the new constructs to build complex programs. 192 A reader should already have an intermediate knowledge of control flow, data structures, and concurrency issues to understand the ideas presented as well as some experience programming in C/\CC.193 Implementers mayrefer to the \CFA Programming Language Specification for details about the language syntax and semantics.200 A reader should already have an intermediate knowledge of control flow, data structures, and concurrency issues to understand the ideas presented, as well as some experience programming in C/\CC. 201 Implementers should refer to the \CFA Programming Language Specification for details about the language syntax and semantics. 194 202 Changes to the syntax and additional features are expected to be included in later revisions. 195 203 … … 200 208 This installation base and the programmers producing it represent a massive software-engineering investment spanning decades and likely to continue for decades more. 201 209 Even with all its problems, C continues to be popular because it allows writing software at virtually any level in a computer system without restriction. 202 For system programming, where direct access to hardware and dealing with real-time issues is a requirement, C is usually thelanguage of choice.210 For system programming, where direct access to hardware, storage management, and real-time issues are a requirement, C is usually the only language of choice. 203 211 The TIOBE index~\cite{TIOBE} for March 2016 showed the following programming-language popularity: \Index*{Java} 20.5\%, C 14.5\%, \Index*[C++]{\CC{}} 6.7\%, \Csharp 4.3\%, \Index*{Python} 4.3\%, where the next 50 languages are less than 3\% each with a long tail. 204 212 As well, for 30 years, C has been the number 1 and 2 most popular programming language: … … 216 224 \end{center} 217 225 Hence, C is still an extremely important programming language, with double the usage of \Index*[C++]{\CC{}}; in many cases, \CC is often used solely as a better C. 218 Love it or hate it, C has been an important and influential part of computer science for 40 years and sitappeal is not diminishing.219 Unfortunately, C has too many problems and omissions to make it anacceptable programming language for modern needs.220 221 As stated, the goal of the \CFA project is to engineer modern language 226 Love it or hate it, C has been an important and influential part of computer science for 40 years and its appeal is not diminishing. 227 Unfortunately, C has many problems and omissions that make it an unacceptable programming language for modern needs. 228 229 As stated, the goal of the \CFA project is to engineer modern language-features into C in an evolutionary rather than revolutionary way. 222 230 \CC~\cite{C++14,C++} is an example of a similar project; 223 however, it largely extended the language, and did not address manyexisting problems.\footnote{%231 however, it largely extended the C language, and did not address most of C's existing problems.\footnote{% 224 232 Two important existing problems addressed were changing the type of character literals from ©int© to ©char© and enumerator from ©int© to the type of its enumerators.} 225 \Index*{Fortran}~\cite{Fortran08}, \Index*{Ada}~\cite{Ada12}, and \Index*{Cobol}~\cite{Cobol14} are examples of programming languages that took an evolutionary approach, where modern language 233 \Index*{Fortran}~\cite{Fortran08}, \Index*{Ada}~\cite{Ada12}, and \Index*{Cobol}~\cite{Cobol14} are examples of programming languages that took an evolutionary approach, where modern language-features (\eg objects, concurrency) are added and problems fixed within the framework of the existing language. 226 234 \Index*{Java}~\cite{Java8}, \Index*{Go}~\cite{Go}, \Index*{Rust}~\cite{Rust} and \Index*{D}~\cite{D} are examples of the revolutionary approach for modernizing C/\CC, resulting in a new language rather than an extension of the descendent. 227 These languages have different syntax and semantics from C, and do not interoperate directly with C, largely because ofgarbage collection.235 These languages have different syntax and semantics from C, do not interoperate directly with C, and are not systems languages because of restrictive memory-management or garbage collection. 228 236 As a result, there is a significant learning curve to move to these languages, and C legacy-code must be rewritten. 229 These costs can be prohibitive for many companies with a large software base in C/\CC, and a significant number of programmers requiring retraining to anew programming language.230 231 The result of this project is a language that is largely backwards compatible with \Index*[C11]{\Celeven{}}~\cite{C11}, but fix ing some of the well known C problems and containing many modern languagefeatures.237 These costs can be prohibitive for many companies with a large software-base in C/\CC, and a significant number of programmers require retraining to the new programming language. 238 239 The result of this project is a language that is largely backwards compatible with \Index*[C11]{\Celeven{}}~\cite{C11}, but fixes many of the well known C problems while containing modern language-features. 232 240 Without significant extension to the C programming language, it is becoming unable to cope with the needs of modern programming problems and programmers; 233 241 as a result, it will fade into disuse. 234 242 Considering the large body of existing C code and programmers, there is significant impetus to ensure C is transformed into a modern programming language. 235 While \Index*[C11]{\Celeven{}} made a few simple extensions to the language, nothing was added to address existing problems in the language or to augment the language with modern language 236 While some may argue that modern language 243 While \Index*[C11]{\Celeven{}} made a few simple extensions to the language, nothing was added to address existing problems in the language or to augment the language with modern language-features. 244 While some may argue that modern language-features may make C complex and inefficient, it is clear a language without modern capabilities is insufficient for the advanced programming problems existing today. 237 245 238 246 239 247 \section{History} 240 248 241 The \CFA project started with \Index*{K-W C}~\cite{Buhr94a,Till89}, which extended C with new declaration syntax, multiple return values from routines, and extended assignment capabilities using the notion of tuples.249 The \CFA project started with \Index*{K-W C}~\cite{Buhr94a,Till89}, which extended C with new declaration syntax, multiple return values from routines, and advanced assignment capabilities using the notion of tuples. 242 250 (See~\cite{Werther96} for similar work in \Index*[C++]{\CC{}}.) 243 A first \CFA implementation of these extensions was by Esteves~\cite{Esteves04}. 244 The signature feature of \CFA is parametric-polymorphic functions~\cite{forceone:impl,Cormack90,Duggan96} with functions generalized using a ©forall© clause (giving the language its name): 251 The first \CFA implementation of these extensions was by Esteves~\cite{Esteves04}. 252 253 The signature feature of \CFA is \emph{\Index{overload}able} \Index{parametric-polymorphic} functions~\cite{forceone:impl,Cormack90,Duggan96} with functions generalized using a ©forall© clause (giving the language its name): 245 254 \begin{lstlisting} 246 255 ®forall( otype T )® T identity( T val ) { return val; } … … 248 257 \end{lstlisting} 249 258 % extending the C type system with parametric polymorphism and overloading, as opposed to the \Index*[C++]{\CC{}} approach of object-oriented extensions. 250 \CFA{}\hspace{1pt}'s polymorphism was originally formalized by Ditchfi led~\cite{Ditchfield92}, and first implemented by Bilson~\cite{Bilson03}.259 \CFA{}\hspace{1pt}'s polymorphism was originally formalized by Ditchfield~\cite{Ditchfield92}, and first implemented by Bilson~\cite{Bilson03}. 251 260 However, at that time, there was little interesting in extending C, so work did not continue. 252 As the saying goes, `` What goes around, comes around.'', and there is now renewed interest in the C programming language because of legacy code-bases, so the \CFA project has been restarted.261 As the saying goes, ``\Index*{What goes around, comes around.}'', and there is now renewed interest in the C programming language because of legacy code-bases, so the \CFA project has been restarted. 253 262 254 263 … … 257 266 258 267 \CFA is designed to integrate directly with existing C programs and libraries. 259 The most important feature of \Index{interoperability} is using the same \Index{calling convention}s, so there is no overhead to call existing C routines.268 The most important feature of \Index{interoperability} is using the same \Index{calling convention}s, so there is no complex interface or overhead to call existing C routines. 260 269 This feature allows \CFA programmers to take advantage of the existing panoply of C libraries to access thousands of external software features. 261 270 Language developers often state that adequate \Index{library support} takes more work than designing and implementing the language itself. 262 271 Fortunately, \CFA, like \Index*[C++]{\CC{}}, starts with immediate access to all exiting C libraries, and in many cases, can easily wrap library routines with simpler and safer interfaces, at very low cost. 263 Hence, \CFA begins by leveraging the large repository of C libraries with little cost.272 Hence, \CFA begins by leveraging the large repository of C libraries, and than allows programmers to incrementally augment their C programs with modern \Index{backward-compatible} features. 264 273 265 274 \begin{comment} … … 304 313 \end{comment} 305 314 306 However, it is necessary to differentiate between C and \CFA code because of name overloading, as for \CC.315 However, it is necessary to differentiate between C and \CFA code because of name \Index{overload}ing, as for \CC. 307 316 For example, the C math-library provides the following routines for computing the absolute value of the basic types: ©abs©, ©labs©, ©llabs©, ©fabs©, ©fabsf©, ©fabsl©, ©cabsf©, ©cabs©, and ©cabsl©. 308 Whereas, \CFA wraps each of these routines into ones with the commonname ©abs©:317 Whereas, \CFA wraps each of these routines into ones with the overloaded name ©abs©: 309 318 \begin{cfa} 310 319 char abs( char ); 311 ®extern "C" {® 312 int abs( int ); §\C{// use default C routine for int}§ 313 ®}® // extern "C" 320 ®extern "C" {® int abs( int ); ®}® §\C{// use default C routine for int}§ 314 321 long int abs( long int ); 315 322 long long int abs( long long int ); … … 326 333 Hence, there is the same need as in \CC, to know if a name is a C or \CFA name, so it can be correctly formed. 327 334 There is no way around this problem, other than C's approach of creating unique names for each pairing of operation and type. 328 This example strongly illustrates a core idea in \CFA: \emph{the power of a name}. 335 336 This example strongly illustrates a core idea in \CFA: \emph{the \Index{power of a name}}. 329 337 The name ``©abs©'' evokes the notion of absolute value, and many mathematical types provide the notion of absolute value. 330 Hence, knowing the name ©abs© should besufficient to apply it to any type where it is applicable.331 The time savings and safety of using one name uniformly versus $N$ unique names shouldnot be underestimated.332 333 334 \section[Compiling CFA Program]{Compiling\CFA Program}335 336 The command ©cfa© is used to compile \CFA program(s), and is based on the GNU\Indexc{gcc} command, \eg:337 \begin{cfa} 338 cfa§\indexc{cfa}\index{compilation!cfa@©cfa©}§ [ gcc-options ] C/§\CFA §-files [ assembler/loader-files ]338 Hence, knowing the name ©abs© is sufficient to apply it to any type where it is applicable. 339 The time savings and safety of using one name uniformly versus $N$ unique names cannot be underestimated. 340 341 342 \section[Compiling a CFA Program]{Compiling a \CFA Program} 343 344 The command ©cfa© is used to compile a \CFA program and is based on the \Index{GNU} \Indexc{gcc} command, \eg: 345 \begin{cfa} 346 cfa§\indexc{cfa}\index{compilation!cfa@©cfa©}§ [ gcc-options ] C/§\CFA{}§-files [ assembler/loader-files ] 339 347 \end{cfa} 340 348 \CFA programs having the following ©gcc© flags turned on: … … 344 352 The 1999 C standard plus GNU extensions. 345 353 \item 346 {\lstset{deletekeywords={inline}} 347 \Indexc{-fgnu89-inline}\index{compilation option!-fgnu89-inline@{©-fgnu89-inline©}} 354 \Indexc[deletekeywords=inline]{-fgnu89-inline}\index{compilation option!-fgnu89-inline@{\lstinline[deletekeywords=inline]$-fgnu89-inline$}} 348 355 Use the traditional GNU semantics for inline routines in C99 mode, which allows inline routines in header files. 349 }%350 356 \end{description} 351 357 The following new \CFA options are available: … … 354 360 \Indexc{-CFA}\index{compilation option!-CFA@©-CFA©} 355 361 Only the C preprocessor and the \CFA translator steps are performed and the transformed program is written to standard output, which makes it possible to examine the code generated by the \CFA translator. 356 The generated code start ed with the standard \CFA prelude.362 The generated code starts with the standard \CFA \Index{prelude}. 357 363 358 364 \item 359 365 \Indexc{-debug}\index{compilation option!-debug@©-debug©} 360 366 The program is linked with the debugging version of the runtime system. 361 The debug version performs runtime checks to help during the debugging phase of a \CFA program, but substantially slows the execution of the program.367 The debug version performs runtime checks to help during the debugging phase of a \CFA program, but can substantially slow program execution. 362 368 The runtime checks should only be removed after the program is completely debugged. 363 369 \textbf{This option is the default.} … … 366 372 \Indexc{-nodebug}\index{compilation option!-nodebug@©-nodebug©} 367 373 The program is linked with the non-debugging version of the runtime system, so the execution of the program is faster. 368 \Emph{However, no runtime checks or ©assert©s are performed so errors usually result in abnormal program termination.}374 \Emph{However, no runtime checks or ©assert©s are performed so errors usually result in abnormal program behaviour or termination.} 369 375 370 376 \item … … 386 392 \textbf{This option is the default.} 387 393 394 \begin{comment} 388 395 \item 389 396 \Indexc{-no-include-stdhdr}\index{compilation option!-no-include-stdhdr@©-no-include-stdhdr©} 390 397 Do not supply ©extern "C"© wrappers for \Celeven standard include files (see~\VRef{s:StandardHeaders}). 391 398 \textbf{This option is \emph{not} the default.} 399 \end{comment} 392 400 \end{description} 393 401 … … 410 418 \item 411 419 \Indexc{__CFA__}\index{preprocessor variables!__CFA__@©__CFA__©}, 412 \Indexc{__CFORALL__}\index{preprocessor variables!__CFORALL__@©__CFORALL__©} and420 \Indexc{__CFORALL__}\index{preprocessor variables!__CFORALL__@©__CFORALL__©}, and 413 421 \Indexc{__cforall}\index{preprocessor variables!__cforall@©__cforall©} 414 422 are always available during preprocessing and have no value. 415 423 \end{description} 416 424 These preprocessor variables allow conditional compilation of programs that must work differently in these situations. 417 For example, to toggle between C and \CFA extensions, us ingthe following:425 For example, to toggle between C and \CFA extensions, use the following: 418 426 \begin{cfa} 419 427 #ifndef __CFORALL__ … … 426 434 427 435 428 \section{Constant sUnderscores}429 430 Numeric constants are extended to allow \Index{underscore}s within constants\index{constant!underscore}, \eg:436 \section{Constant Underscores} 437 438 Numeric constants are extended to allow \Index{underscore}s\index{constant!underscore}, \eg: 431 439 \begin{cfa} 432 440 2®_®147®_®483®_®648; §\C{// decimal constant}§ … … 441 449 L®_®§"\texttt{\textbackslash{x}}§®_®§\texttt{ff}§®_®§\texttt{ee}"§; §\C{// wide character constant}§ 442 450 \end{cfa} 443 The rules for placement of underscores is as follows:444 \begin{enumerate} 451 The rules for placement of underscores are: 452 \begin{enumerate}[topsep=5pt,itemsep=5pt,parsep=0pt] 445 453 \item 446 454 A sequence of underscores is disallowed, \eg ©12__34© is invalid. … … 463 471 \label{s:BackquoteIdentifiers} 464 472 465 \CFA accommodates keyword clashes with existing C variable-names by syntactic transformations using the \CFA backquote escape-mechanism: 473 \CFA introduces several new keywords (see \VRef{s:CFAKeywords}) that can clash with existing C variable-names in legacy code. 474 Keyword clashes are accommodated by syntactic transformations using the \CFA backquote escape-mechanism: 466 475 \begin{cfa} 467 476 int ®`®otype®`® = 3; §\C{// make keyword an identifier}§ 468 477 double ®`®forall®`® = 3.5; 469 478 \end{cfa} 479 470 480 Existing C programs with keyword clashes can be converted by enclosing keyword identifiers in backquotes, and eventually the identifier name can be changed to a non-keyword name. 471 \VRef[Figure]{f:InterpositionHeaderFile} shows how clashes in C header files (see~\VRef{s:StandardHeaders}) can be handled using preprocessor \newterm{interposition}: ©#include_next© and ©-I filename©: 481 \VRef[Figure]{f:HeaderFileInterposition} shows how clashes in existing C header-files (see~\VRef{s:StandardHeaders}) can be handled using preprocessor \newterm{interposition}: ©#include_next© and ©-I filename©. 482 Several common C header-files with keyword clashes are fixed in the standard \CFA header-library, so there is a seamless programming-experience. 472 483 473 484 \begin{figure} 474 485 \begin{cfa} 475 // include file uses the CFA keyword " otype".476 #if ! defined( otype) §\C{// nesting ?}§477 #define otype ®`®otype®`®§\C{// make keyword an identifier}§486 // include file uses the CFA keyword "with". 487 #if ! defined( with ) §\C{// nesting ?}§ 488 #define with ®`®with®`® §\C{// make keyword an identifier}§ 478 489 #define __CFA_BFD_H__ 479 #endif // ! otype480 481 #®include_next® <bfd.h>§\C{// must have internal check for multiple expansion}§482 483 #if defined( otype) && defined( __CFA_BFD_H__ ) §\C{// reset only if set}§484 #undef otype490 #endif 491 492 ®#include_next <bfdlink.h> §\C{// must have internal check for multiple expansion}§ 493 ® 494 #if defined( with ) && defined( __CFA_BFD_H__ ) §\C{// reset only if set}§ 495 #undef with 485 496 #undef __CFA_BFD_H__ 486 #endif // otype && __CFA_BFD_H__487 \end{cfa} 488 \caption{ Interposition of Header File}489 \label{f: InterpositionHeaderFile}497 #endif 498 \end{cfa} 499 \caption{Header-File Interposition} 500 \label{f:HeaderFileInterposition} 490 501 \end{figure} 491 502 492 503 493 \section{ Labelled Continue/Break}504 \section{\texorpdfstring{Labelled \LstKeywordStyle{continue} / \LstKeywordStyle{break}}{Labelled continue / break}} 494 505 495 506 While C provides ©continue© and ©break© statements for altering control flow, both are restricted to one level of nesting for a particular control structure. 496 507 Unfortunately, this restriction forces programmers to use \Indexc{goto} to achieve the equivalent control-flow for more than one level of nesting. 497 To prevent having to switch to the ©goto©, \CFA extends the \Indexc{continue}\index{continue@\lstinline $continue$!labelled}\index{labelled!continue@©continue©} and \Indexc{break}\index{break@\lstinline $break$!labelled}\index{labelled!break@©break©} with a target label to support static multi-level exit\index{multi-level exit}\index{static multi-level exit}~\cite{Buhr85 ,Java}.508 To prevent having to switch to the ©goto©, \CFA extends the \Indexc{continue}\index{continue@\lstinline $continue$!labelled}\index{labelled!continue@©continue©} and \Indexc{break}\index{break@\lstinline $break$!labelled}\index{labelled!break@©break©} with a target label to support static multi-level exit\index{multi-level exit}\index{static multi-level exit}~\cite{Buhr85}, as in Java. 498 509 For both ©continue© and ©break©, the target label must be directly associated with a ©for©, ©while© or ©do© statement; 499 510 for ©break©, the target label can also be associated with a ©switch©, ©if© or compound (©{}©) statement. … … 512 523 ®LF:® for ( ... ) { 513 524 ®LW:® while ( ... ) { 514 ... break ®LC®; ... 515 ... break ®LS®; ... 516 ... break ®LIF®; ... 517 ... continue ®LF;® ... 518 ... break ®LF®; ... 519 ... continue ®LW®; ... 520 ... break ®LW®; ... 525 ... break ®LC®; ... // terminate compound 526 ... break ®LS®; ... // terminate switch 527 ... break ®LIF®; ... // terminate if 528 ... continue ®LF;® ... // resume loop 529 ... break ®LF®; ... // terminate loop 530 ... continue ®LW®; ... // resume loop 531 ... break ®LW®; ... // terminate loop 521 532 } // while 522 533 } // for 523 534 } else { 524 ... break ®LIF®; ... 535 ... break ®LIF®; ... // terminate if 525 536 } // if 526 537 } // switch … … 564 575 LF: for ( ;; ) { 565 576 LW: while ( 1 ) { 566 break LC; 567 break LS; 568 break LIF; 569 continue LF; 570 break LF; 571 continue LW; 572 break LW; 577 break LC; // terminate compound 578 break LS; // terminate switch 579 break LIF; // terminate if 580 continue LF; // resume loop 581 break LF; // terminate loop 582 continue LW; // resume loop 583 break LW; // terminate loop 573 584 } // while 574 585 } // for 575 586 } else { 576 break LIF; 587 break LIF; // terminate if 577 588 } // if 578 589 } // switch … … 613 624 \item 614 625 They cannot branch into a control structure. 615 This restriction prevents missing initializationat the start of a control structure resulting in undefined behaviour.626 This restriction prevents missing declarations and/or initializations at the start of a control structure resulting in undefined behaviour. 616 627 \end{itemize} 617 628 The advantage of the labelled ©continue©/©break© is allowing static multi-level exits without having to use the ©goto© statement, and tying control flow to the target control structure rather than an arbitrary point in a program. 618 Furthermore, the location of the label at the \emph{beginning} of the target control structure informs the reader that complex control-flow is occurring in the body of the control structure.629 Furthermore, the location of the label at the \emph{beginning} of the target control structure informs the reader (\Index{eye candy}) that complex control-flow is occurring in the body of the control structure. 619 630 With ©goto©, the label is at the end of the control structure, which fails to convey this important clue early enough to the reader. 620 631 Finally, using an explicit target for the transfer instead of an implicit target allows new constructs to be added or removed without affecting existing constructs. … … 622 633 623 634 624 \section{ Switch Statement}635 \section{\texorpdfstring{\LstKeywordStyle{switch} Statement}{switch Statement}} 625 636 626 637 C allows a number of questionable forms for the ©switch© statement: … … 663 674 ®// open input file 664 675 ®} else if ( argc == 2 ) { 665 ®// open input file 676 ®// open input file (duplicate) 666 677 667 678 ®} else { … … 676 687 \begin{cfa} 677 688 switch ( i ) { 678 case 1: case 3: case 5:// odd values679 // sameaction689 ®case 1: case 3: case 5:® // odd values 690 // odd action 680 691 break; 681 case 2: case 4: case 6:// even values682 // sameaction692 ®case 2: case 4: case 6:® // even values 693 // even action 683 694 break; 684 695 } … … 686 697 However, this situation is handled in other languages without fall-through by allowing a list of case values. 687 698 While fall-through itself is not a problem, the problem occurs when fall-through is the default, as this semantics is unintuitive to many programmers and is different from virtually all other programming languages with a ©switch© statement. 688 Hence, default fall-through semantics results in a large number of programming errors as programmers often forgetthe ©break© statement at the end of a ©case© clause, resulting in inadvertent fall-through.699 Hence, default fall-through semantics results in a large number of programming errors as programmers often \emph{forget} the ©break© statement at the end of a ©case© clause, resulting in inadvertent fall-through. 689 700 690 701 \item … … 708 719 The problem with this usage is branching into control structures, which is known to cause both comprehension and technical difficulties. 709 720 The comprehension problem occurs from the inability to determine how control reaches a particular point due to the number of branches leading to it. 710 The technical problem results from the inability to ensure allocation and initialization of variables when blocks are not entered at the beginning. 711 Often transferring into a block can bypass variable declaration and/or its initialization, which results in subsequent errors. 712 There are virtually no positive arguments for this kind of control flow, and therefore, there is a strong impetus to eliminate it. 721 The technical problem results from the inability to ensure declaration and initialization of variables when blocks are not entered at the beginning. 722 There are no positive arguments for this kind of control flow, and therefore, there is a strong impetus to eliminate it. 713 723 Nevertheless, C does have an idiom where this capability is used, known as ``\Index*{Duff's device}''~\cite{Duff83}: 714 724 \begin{cfa} … … 770 780 and there is only a medium amount of fall-through from one ©case© clause to the next, and most of these result from a list of case values executing common code, rather than a sequence of case actions that compound. 771 781 \end{itemize} 772 These observations help to put the \CFA changes to the ©switch© into perspective.782 These observations put into perspective the \CFA changes to the ©switch©. 773 783 \begin{enumerate} 774 784 \item … … 791 801 case 7: 792 802 ... 793 ®break® §\C{// explicit end of switch}§803 ®break® §\C{// redundant explicit end of switch}§ 794 804 default: 795 805 j = 3; … … 797 807 \end{cfa} 798 808 Like the ©switch© statement, the ©choose© statement retains the fall-through semantics for a list of ©case© clauses; 799 theimplicit ©break© is applied only at the end of the \emph{statements} following a ©case© clause.800 Theexplicit ©fallthru© is retained because it is a C-idiom most C programmers expect, and its absence might discourage programmers from using the ©choose© statement.809 An implicit ©break© is applied only at the end of the \emph{statements} following a ©case© clause. 810 An explicit ©fallthru© is retained because it is a C-idiom most C programmers expect, and its absence might discourage programmers from using the ©choose© statement. 801 811 As well, allowing an explicit ©break© from the ©choose© is a carry over from the ©switch© statement, and expected by C programmers. 802 812 \item … … 827 837 828 838 829 \section{ Case Clause}839 \section{\texorpdfstring{\LstKeywordStyle{case} Clause}{case Clause}} 830 840 831 841 C restricts the ©case© clause of a ©switch© statement to a single value. … … 903 913 904 914 915 \section{\texorpdfstring{\LstKeywordStyle{with} Clause / Statement}{with Clause / Statement}} 916 \label{s:WithClauseStatement} 917 918 In \Index{object-oriented} programming, there is an implicit first parameter, often names \textbf{©self©} or \textbf{©this©}, which is elided. 919 \begin{C++} 920 class C { 921 int i, j; 922 int mem() { ®// implicit "this" parameter 923 ® i = 1; ®// this->i 924 ® j = 3; ®// this->j 925 ® } 926 } 927 \end{C++} 928 Since CFA is non-object-oriented, the equivalent object-oriented program looks like: 929 \begin{cfa} 930 struct S { int i, j; }; 931 int mem( S &this ) { // explicit "this" parameter 932 ®this.®i = 1; // "this" is not elided 933 ®this.®j = 2; 934 } 935 \end{cfa} 936 but it is cumbersome having to write "©this.©" many times in a member. 937 938 \CFA provides a ©with© clause/statement (see Pascal~\cite[\S~4.F]{Pascal}) to elided the "©this.©" by opening a scope containing field identifiers, changing the qualified fields into variables and giving an opportunity for optimizing qualified references. 939 \begin{cfa} 940 int mem( S &this ) ®with this® { // with clause 941 i = 1; ®// this.i 942 ® j = 2; ®// this.j 943 ®} 944 \end{cfa} 945 which extends to multiple routine parameters: 946 \begin{cfa} 947 struct T { double m, n; }; 948 int mem2( S &this1, T &this2 ) ®with this1, this2® { 949 i = 1; j = 2; 950 m = 1.0; n = 2.0; 951 } 952 \end{cfa} 953 954 The statement form is used within a block: 955 \begin{cfa} 956 int foo() { 957 struct S1 { ... } s1; 958 struct S2 { ... } s2; 959 ®with s1® { // with statement 960 // access fields of s1 without qualification 961 ®with s2® { // nesting 962 // access fields of s1 and s2 without qualification 963 } 964 } 965 ®with s1, s2® { 966 // access unambiguous fields of s1 and s2 without qualification 967 } 968 } 969 \end{cfa} 970 971 When opening multiple structures, fields with the same name and type are ambiguous and must be fully qualified. 972 For fields with the same name but different type, context/cast can be used to disambiguate. 973 \begin{cfa} 974 struct S { int i; int j; double m; } a, c; 975 struct T { int i; int k; int m } b, c; 976 ®with a, b® { 977 j + k; §\C{// unambiguous, unique names define unique types}§ 978 i; §\C{// ambiguous, same name and type}§ 979 a.i + b.i; §\C{// unambiguous, qualification defines unique names}§ 980 m; §\C{// ambiguous, same name and no context to define unique type}§ 981 m = 5.0; §\C{// unambiguous, same name and context defines unique type}§ 982 m = 1; §\C{// unambiguous, same name and context defines unique type}§ 983 } 984 ®with c® { ... } §\C{// ambiguous, same name and no context}§ 985 ®with (S)c® { ... } §\C{// unambiguous, same name and cast defines unique type}§ 986 \end{cfa} 987 988 905 989 \section{Exception Handling} 990 \label{s:ExceptionHandling} 906 991 907 992 Exception handling provides two mechanism: change of control flow from a raise to a handler, and communication from the raise to the handler. 908 \begin{cfa} 909 exception void h( int i ); 910 exception int h( int i, double d ); 911 993 Transfer of control can be local, within a routine, or non-local, among routines. 994 Non-local transfer can cause stack unwinding, i.e., non-local routine termination, depending on the kind of raise. 995 \begin{cfa} 996 exception_t E {}; §\C{// exception type}§ 912 997 void f(...) { 913 ... throw h( 3 ); 914 ... i = resume h( 3, 5.1 ); 915 } 916 998 ... throw E{}; ... §\C{// termination}§ 999 ... throwResume E{}; ... §\C{// resumption}§ 1000 } 917 1001 try { 918 1002 f(...); 919 } catch h( int w ) {920 // re set921 } resume h( int p, double x ) {922 return 17; // recover1003 } catch( E e : §boolean-predicate§ ) { §\C{// termination handler}§ 1004 // recover and continue 1005 } catchResume( E e : §boolean-predicate§ ) { §\C{// resumption handler}§ 1006 // repair and return 923 1007 } finally { 924 } 925 \end{cfa} 926 So the type raised would be the mangled name of the exception prototype and that name would be matched at the handler clauses by comparing the strings. 927 The arguments for the call would have to be packed in a message and unpacked at handler clause and then a call made to the handler. 1008 // always executed 1009 } 1010 \end{cfa} 1011 The kind of raise and handler match: ©throw© with ©catch© and ©throwResume© with ©catchResume©. 1012 Then the exception type must match along with any additonal predicate must be true. 1013 The ©catch© and ©catchResume© handlers may appear in any oder. 1014 However, the ©finally© clause must appear at the end of the ©try© statement. 928 1015 929 1016 … … 1136 1223 1137 1224 1138 \section{Pointer/Reference} 1225 \section{Exponentiation Operator} 1226 1227 C, \CC, and Java (and many other programming languages) have no exponentiation operator\index{exponentiation!operator}\index{operator!exponentiation}, \ie $x^y$, and instead use a routine, like \Indexc{pow}, to perform the exponentiation operation. 1228 \CFA extends the basic operators with the exponentiation operator ©?\?©\index{?\\?@\lstinline$?\?$} and ©?\=?©\index{?\\=?@\lstinline$?\=?$}, as in, ©x \ y© and ©x \= y©, which means $x^y$ and $x \leftarrow x^y$. 1229 The priority of the exponentiation operator is between the cast and multiplicative operators, so that ©w * (int)x \ (int)y * z© is parenthesized as ©((w * (((int)x) \ ((int)y))) * z)©. 1230 1231 As for \Index{division}, there are exponentiation operators for integral and floating-point types, including the builtin \Index{complex} types. 1232 Unsigned integral exponentiation\index{exponentiation!unsigned integral} is performed with repeated multiplication (or shifting if the base is 2). 1233 Signed integral exponentiation\index{exponentiation!signed integral} is performed with repeated multiplication (or shifting if the base is 2), but yields a floating-point result because $b^{-e}=1/b^e$. 1234 Hence, it is important to designate exponent integral-constants as unsigned or signed: ©3 \ 3u© return an integral result, while ©3 \ 3© returns a floating-point result. 1235 Floating-point exponentiation\index{exponentiation!floating point} is performed using \Index{logarithm}s\index{exponentiation!logarithm}, so the base cannot be negative. 1236 \begin{cfa} 1237 sout | 2 ®\® 8u | 4 ®\® 3u | -4 ®\® 3u | 4 ®\® -3 | -4 ®\® -3 | 4.0 ®\® 2.1 | (1.0f+2.0fi) ®\® (3.0f+2.0fi) | endl; 1238 256 64 -64 0.015625 -0.015625 18.3791736799526 0.264715-1.1922i 1239 \end{cfa} 1240 Parenthesis are necessary for the complex constants or the expresion is parsed as ©1.0f+(2.0fi \ 3.0f)+2.0fi©. 1241 The exponentiation operator is available for all the basic types, but for user-defined types, only the integral-computation versions are available. 1242 For returning an integral value, the user type ©T© must define multiplication, ©*©, and one, ©1©; 1243 for returning a floating-point value, an additional divide of type ©T© into a ©double© returning a ©double© (©double ?/?( double, T )©) is necessary for negative exponents. 1244 1245 1246 \section{Pointer / Reference} 1139 1247 1140 1248 C provides a \newterm{pointer type}; … … 1144 1252 An integer constant expression with the value 0, or such an expression cast to type ©void *©, is called a \newterm{null-pointer constant}.\footnote{ 1145 1253 One way to conceptualize the null pointer is that no variable is placed at this address, so the null-pointer address can be used to denote an uninitialized pointer/reference object; 1146 \ie the null pointer is guaranteed to compare unequal to a pointer to any object or routine.} 1254 \ie the null pointer is guaranteed to compare unequal to a pointer to any object or routine. 1255 In general, a value with special meaning among a set of values is called a \emph{\Index{sentinel value}}, \eg ©-1© as a return code value.} 1147 1256 An address is \newterm{sound}, if it points to a valid memory location in scope, \ie within the program's execution-environment and has not been freed. 1148 1257 Dereferencing an \newterm{unsound} address, including the null pointer, is \Index{undefined}, often resulting in a \Index{memory fault}. … … 1179 1288 \hline 1180 1289 \begin{cfa} 1181 lda r1,100 1182 ld r2,(r1) 1183 lda r3,104 1184 st r2,(r3) 1290 lda r1,100 // load address of x 1291 ld r2,(r1) // load value of x 1292 lda r3,104 // load address of y 1293 st r2,(r3) // store x into y 1185 1294 \end{cfa} 1186 1295 & 1187 1296 \begin{cfa} 1188 1297 1189 ld r2,(100) 1190 1191 st r2,(104) 1298 ld r2,(100) // load value of x 1299 1300 st r2,(104) // store x into y 1192 1301 \end{cfa} 1193 1302 \end{tabular} … … 1485 1594 1486 1595 \item 1487 lvalue to reference conversion: \lstinline[deletekeywords= {lvalue}]@lvalue-type cv1 T@converts to ©cv2 T &©, which allows implicitly converting variables to references.1596 lvalue to reference conversion: \lstinline[deletekeywords=lvalue]$lvalue-type cv1 T$ converts to ©cv2 T &©, which allows implicitly converting variables to references. 1488 1597 \begin{cfa} 1489 1598 int x, &r = ®x®, f( int & p ); // lvalue variable (int) convert to reference (int &) … … 2594 2703 \begin{cfa}[belowskip=0pt] 2595 2704 char store[®sepSize®]; §\C{// sepSize is the maximum separator size}§ 2596 strcpy( store, sepGet( sout ) ); 2597 sepSet( sout, "_" ); 2705 strcpy( store, sepGet( sout ) ); §\C{// copy current separator}§ 2706 sepSet( sout, "_" ); §\C{// change separator to underscore}§ 2598 2707 sout | 1 | 2 | 3 | endl; 2599 2708 \end{cfa} … … 2602 2711 \end{cfa} 2603 2712 \begin{cfa}[belowskip=0pt] 2604 sepSet( sout, store ); 2713 sepSet( sout, store ); §\C{// change separator back to original}§ 2605 2714 sout | 1 | 2 | 3 | endl; 2606 2715 \end{cfa} … … 3159 3268 \Indexc{gcc} provides ©typeof© to declare a secondary variable from a primary variable. 3160 3269 \CFA also relies heavily on the specification of the left-hand side of assignment for type inferencing, so in many cases it is crucial to specify the type of the left-hand side to select the correct type of the right-hand expression. 3161 Only for overloaded routines with the same return typeis variable type-inferencing possible.3270 Only for overloaded routines \emph{with the same return type} is variable type-inferencing possible. 3162 3271 Finally, ©auto© presents the programming problem of tracking down a type when the type is actually needed. 3163 3272 For example, given … … 5258 5367 5259 5368 5260 \section{\ CFA Keywords}5369 \section{\texorpdfstring{\CFA Keywords}{Cforall Keywords}} 5261 5370 \label{s:CFAKeywords} 5262 5371 5372 \CFA introduces the following new keywords. 5373 5263 5374 \begin{quote2} 5264 \begin{tabular}{llll }5375 \begin{tabular}{lllll} 5265 5376 \begin{tabular}{@{}l@{}} 5266 ©_A T© \\5377 ©_At© \\ 5267 5378 ©catch© \\ 5268 5379 ©catchResume© \\ 5269 5380 ©choose© \\ 5270 5381 ©coroutine© \\ 5271 ©disable© \\5272 5382 \end{tabular} 5273 5383 & 5274 5384 \begin{tabular}{@{}l@{}} 5385 ©disable© \\ 5275 5386 ©dtype© \\ 5276 5387 ©enable© \\ 5277 5388 ©fallthrough© \\ 5278 5389 ©fallthru© \\ 5279 ©finally© \\5280 ©forall© \\5281 5390 \end{tabular} 5282 5391 & 5283 5392 \begin{tabular}{@{}l@{}} 5393 ©finally© \\ 5394 ©forall© \\ 5284 5395 ©ftype© \\ 5285 5396 ©lvalue© \\ 5286 5397 ©monitor© \\ 5398 \end{tabular} 5399 & 5400 \begin{tabular}{@{}l@{}} 5287 5401 ©mutex© \\ 5288 5402 ©one_t© \\ 5289 5403 ©otype© \\ 5404 ©throw© \\ 5405 ©throwResume© \\ 5290 5406 \end{tabular} 5291 5407 & 5292 5408 \begin{tabular}{@{}l@{}} 5293 ©throw© \\5294 ©throwResume© \\5295 5409 ©trait© \\ 5296 5410 ©try© \\ 5297 5411 ©ttype© \\ 5412 ©with© \\ 5298 5413 ©zero_t© \\ 5299 5414 \end{tabular} … … 5330 5445 g( p1, p2 ) int p1, p2; §\C{// int g( int p1, int p2 );}§ 5331 5446 \end{cfa} 5332 \CFA supportsK\&R routine definitions:5447 \CFA continues to support K\&R routine definitions: 5333 5448 \begin{cfa} 5334 5449 f( a, b, c ) §\C{// default int return}§ … … 5471 5586 \Celeven prescribes the following standard header-files~\cite[\S~7.1.2]{C11} and \CFA adds to this list: 5472 5587 \begin{quote2} 5473 \lstset{deletekeywords={float}} 5474 \begin{tabular}{@{}llll|l@{}} 5475 \multicolumn{4}{c|}{C11} & \multicolumn{1}{c}{\CFA} \\ 5588 \begin{tabular}{@{}lllll|l@{}} 5589 \multicolumn{5}{c|}{C11} & \multicolumn{1}{c}{\CFA} \\ 5476 5590 \hline 5477 5591 \begin{tabular}{@{}l@{}} … … 5481 5595 \Indexc{errno.h} \\ 5482 5596 \Indexc{fenv.h} \\ 5483 \Indexc{float.h} \\ 5484 \Indexc{inttypes.h} \\ 5485 \Indexc{iso646.h} \\ 5597 \Indexc[deletekeywords=float]{float.h} \\ 5486 5598 \end{tabular} 5487 5599 & 5488 5600 \begin{tabular}{@{}l@{}} 5601 \Indexc{inttypes.h} \\ 5602 \Indexc{iso646.h} \\ 5489 5603 \Indexc{limits.h} \\ 5490 5604 \Indexc{locale.h} \\ 5491 5605 \Indexc{math.h} \\ 5492 5606 \Indexc{setjmp.h} \\ 5607 \end{tabular} 5608 & 5609 \begin{tabular}{@{}l@{}} 5493 5610 \Indexc{signal.h} \\ 5494 5611 \Indexc{stdalign.h} \\ 5495 5612 \Indexc{stdarg.h} \\ 5496 5613 \Indexc{stdatomic.h} \\ 5614 \Indexc{stdbool.h} \\ 5615 \Indexc{stddef.h} \\ 5497 5616 \end{tabular} 5498 5617 & 5499 5618 \begin{tabular}{@{}l@{}} 5500 \Indexc{stdbool.h} \\5501 \Indexc{stddef.h} \\5502 5619 \Indexc{stdint.h} \\ 5503 5620 \Indexc{stdio.h} \\ … … 5515 5632 \Indexc{wctype.h} \\ 5516 5633 \\ 5517 \\5518 \\5519 5634 \end{tabular} 5520 5635 & … … 5522 5637 \Indexc{unistd.h} \\ 5523 5638 \Indexc{gmp.h} \\ 5524 \\5525 \\5526 5639 \\ 5527 5640 \\ … … 5563 5676 The table shows allocation routines supporting different combinations of storage-management capabilities: 5564 5677 \begin{center} 5565 \begin{tabular}{@{} lr|l|l|l|l@{}}5566 && \multicolumn{1}{c|}{fill} & resize & alignment & array \\5678 \begin{tabular}{@{}r|r|l|l|l|l@{}} 5679 \multicolumn{1}{c}{}& & \multicolumn{1}{c|}{fill} & resize & alignment & array \\ 5567 5680 \hline 5568 5681 C & ©malloc© & no & no & no & no \\ … … 5571 5684 & ©memalign© & no & no & yes & no \\ 5572 5685 & ©posix_memalign© & no & no & yes & no \\ 5686 \hline 5573 5687 C11 & ©aligned_alloc© & no & no & yes & no \\ 5688 \hline 5574 5689 \CFA & ©alloc© & no/copy/yes & no/yes & no & yes \\ 5575 5690 & ©align_alloc© & no/yes & no & yes & yes \\ -
src/CodeGen/CodeGenerator.h
re0a653d r33218c6 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Thu Jun 8 15:48:00201713 // Update Count : 5 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:16:21 2017 13 // Update Count : 53 14 14 // 15 15 16 #ifndef CODEGENV_H 17 #define CODEGENV_H 16 #pragma once 18 17 19 18 #include <list> // for list … … 166 165 } // namespace CodeGen 167 166 168 #endif // CODEGENV_H169 170 167 // Local Variables: // 171 168 // tab-width: 4 // -
src/CodeGen/FixMain.h
re0a653d r33218c6 9 9 // Author : Thierry Delisle 10 10 // Created On : Thr Jan 12 14:11:09 2017 11 // Last Modified By : 12 // Last Modified On : 13 // Update Count : 011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:16:59 2017 13 // Update Count : 1 14 14 // 15 15 16 #ifndef FIXMAIN_H 17 #define FIXMAIN_H 16 #pragma once 18 17 19 18 #include <iosfwd> … … 44 43 }; 45 44 }; 46 47 #endif //FIXMAIN_H -
src/CodeGen/FixNames.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 18 23:37:32 201513 // Update Count : 212 // Last Modified On : Fri Jul 21 22:17:33 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef FIXNAMES_H 17 #define FIXNAMES_H 16 #pragma once 18 17 19 18 #include <list> // for list … … 26 25 } // namespace CodeGen 27 26 28 #endif // FIXNAMES_H29 30 27 // Local Variables: // 31 28 // tab-width: 4 // -
src/CodeGen/GenType.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 18 23:38:53 201513 // Update Count : 112 // Last Modified On : Fri Jul 21 22:17:23 2017 13 // Update Count : 2 14 14 // 15 15 16 #ifndef _GENTYPE_H 17 #define _GENTYPE_H 16 #pragma once 18 17 19 18 #include <string> // for string … … 26 25 } // namespace CodeGen 27 26 28 #endif // _GENTYPE_H29 30 27 // Local Variables: // 31 28 // tab-width: 4 // -
src/CodeGen/Generate.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 18 23:39:51 201513 // Update Count : 112 // Last Modified On : Fri Jul 21 22:16:35 2017 13 // Update Count : 2 14 14 // 15 15 16 #ifndef GENERATE_H 17 #define GENERATE_H 16 #pragma once 18 17 19 18 #include <iostream> // for ostream … … 31 30 } // namespace CodeGen 32 31 33 #endif // GENERATE_H34 35 32 // Local Variables: // 36 33 // tab-width: 4 // -
src/CodeGen/OperatorTable.cc
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Dec 13 14:33:05 201613 // Update Count : 1 012 // Last Modified On : Sat Jul 15 17:12:22 2017 13 // Update Count : 15 14 14 // 15 15 … … 35 35 { "++?", "++", "_operator_preincr", OT_PREFIXASSIGN }, 36 36 { "--?", "--", "_operator_predecr", OT_PREFIXASSIGN }, 37 { "?\\?", "\\", "_operator_exponential", OT_INFIX }, 37 38 { "?*?", "*", "_operator_multiply", OT_INFIX }, 38 39 { "?/?", "/", "_operator_divide", OT_INFIX }, … … 52 53 { "?|?", "|", "_operator_bitor", OT_INFIX }, 53 54 { "?=?", "=", "_operator_assign", OT_INFIXASSIGN }, 55 { "?\\=?", "\\=", "_operator_expassign", OT_INFIXASSIGN }, 54 56 { "?*=?", "*=", "_operator_multassign", OT_INFIXASSIGN }, 55 57 { "?/=?", "/=", "_operator_divassign", OT_INFIXASSIGN }, -
src/CodeGen/OperatorTable.h
re0a653d r33218c6 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Wed Jun 24 16:17:57 201513 // Update Count : 511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:17:11 2017 13 // Update Count : 6 14 14 // 15 15 16 #ifndef _OPERATORTABLE_H 17 #define _OPERATORTABLE_H 16 #pragma once 18 17 19 18 #include <string> … … 45 44 } // namespace CodeGen 46 45 47 #endif // _OPERATORTABLE_H48 49 46 // Local Variables: // 50 47 // tab-width: 4 // -
src/CodeTools/DeclStats.h
re0a653d r33218c6 9 9 // Author : Aaron Moss 10 10 // Created On : Wed Jan 31 16:40:00 2016 11 // Last Modified By : Aaron Moss12 // Last Modified On : Wed Jan 31 16:40:00 201613 // Update Count : 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:17:56 2017 13 // Update Count : 2 14 14 // 15 15 16 #ifndef DECLSTATS_H 17 #define DECLSTATS_H 16 #pragma once 18 17 19 18 #include <list> // for list … … 28 27 } // namespace CodeTools 29 28 30 #endif // DECLSTATS_H31 32 29 // Local Variables: // 33 30 // tab-width: 4 // -
src/CodeTools/TrackLoc.h
re0a653d r33218c6 9 9 // Author : Andrew Beach 10 10 // Created On : Tues May 2 15:40:00 2017 11 // Last Modified By : Andrew Beach12 // Last Modified On : Wed May 3 14:42:00201713 // Update Count : 011 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:17:44 2017 13 // Update Count : 1 14 14 // 15 15 16 #ifndef TRACKLOC_H 17 #define TRACKLOC_H 16 #pragma once 18 17 19 18 #include <cstddef> // for size_t … … 31 30 } // namespace CodeTools 32 31 33 #endif // TRACKLOC_H34 35 32 // Local Variables: // 36 33 // tab-width: 4 // -
src/Common/CompilerError.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 18 23:41:30 201613 // Update Count : 312 // Last Modified On : Fri Jul 21 22:18:07 2017 13 // Update Count : 4 14 14 // 15 15 16 #ifndef COMPILER_ERROR_H 17 #define COMPILER_ERROR_H 16 #pragma once 18 17 19 18 #include <string> … … 31 30 }; 32 31 33 #endif // COMPILER_ERROR_H34 35 32 // Local Variables: // 36 33 // tab-width: 4 // -
src/Common/ScopedMap.h
re0a653d r33218c6 9 9 // Author : Aaron B. Moss 10 10 // Created On : Wed Dec 2 11:37:00 2015 11 // Last Modified By : Aaron B. Moss 12 // Last Modified On : Wed Dec 2 11:37:00 2015 13 // Update Count : 1 14 // 15 16 #ifndef _SCOPEDMAP_H 17 #define _SCOPEDMAP_H 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:18:24 2017 13 // Update Count : 2 14 // 15 16 #pragma once 18 17 19 18 #include <cassert> … … 305 304 }; 306 305 307 #endif // _SCOPEDMAP_H308 309 306 // Local Variables: // 310 307 // tab-width: 4 // -
src/Common/SemanticError.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Sep 24 15:13:42 201613 // Update Count : 512 // Last Modified On : Fri Jul 21 22:18:59 2017 13 // Update Count : 6 14 14 // 15 15 16 #ifndef SEMANTICERROR_H 17 #define SEMANTICERROR_H 16 #pragma once 18 17 19 18 #include <exception> // for exception … … 62 61 } 63 62 64 #endif // SEMANTICERROR_H65 66 63 // Local Variables: // 67 64 // tab-width: 4 // -
src/Common/UnimplementedError.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 19 07:23:08 201513 // Update Count : 112 // Last Modified On : Fri Jul 21 22:18:35 2017 13 // Update Count : 2 14 14 // 15 15 16 #ifndef _UNIMPLEMENTEDERROR_H 17 #define _UNIMPLEMENTEDERROR_H 16 #pragma once 18 17 19 18 #include <string> … … 31 30 }; 32 31 33 #endif // _UNIMPLEMENTEDERROR_H34 35 32 // Local Variables: // 36 33 // tab-width: 4 // -
src/Common/UniqueName.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 19 07:24:20 201513 // Update Count : 112 // Last Modified On : Fri Jul 21 22:18:45 2017 13 // Update Count : 2 14 14 // 15 15 16 #ifndef UNIQUENAME_H 17 #define UNIQUENAME_H 16 #pragma once 18 17 19 18 #include <string> … … 28 27 }; 29 28 30 #endif // UNIQUENAME_H31 32 29 // Local Variables: // 33 30 // tab-width: 4 // -
src/Common/VectorMap.h
re0a653d r33218c6 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ScopedMap.h --7 // VectorMap.h -- 8 8 // 9 9 // Author : Aaron B. Moss 10 10 // Created On : Wed Feb 1 16:55:00 2017 11 // Last Modified By : Aaron B. Moss 12 // Last Modified On : Wed Feb 1 16:55:00 2017 13 // Update Count : 1 14 // 15 16 #ifndef _VECTORMAP_H 17 #define _VECTORMAP_H 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:19:29 2017 13 // Update Count : 2 14 // 15 16 #pragma once 18 17 19 18 #include <iterator> … … 245 244 } 246 245 247 #endif // _VECTORMAP_H248 249 246 // Local Variables: // 250 247 // tab-width: 4 // -
src/Common/utility.h
re0a653d r33218c6 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri May 5 11:03:00 2017 13 // Update Count : 32 14 // 15 16 #ifndef _UTILITY_H 17 #define _UTILITY_H 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jul 21 22:19:13 2017 13 // Update Count : 33 14 // 15 16 #pragma once 18 17 19 18 #include <cctype> … … 376 375 } 377 376 378 #endif // _UTILITY_H379 380 377 // Local Variables: // 381 378 // tab-width: 4 // -
src/Concurrency/Keywords.cc
re0a653d r33218c6 1 // -*- Mode: CPP -*-2 1 // 3 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 12 11 // Last Modified By : 13 12 // Last Modified On : 14 // Update Count : 313 // Update Count : 5 15 14 // 16 15 … … 549 548 } 550 549 }; 550 551 // Local Variables: // 552 // mode: c // 553 // tab-width: 4 // 554 // End: // -
src/Concurrency/Keywords.h
re0a653d r33218c6 1 // -*- Mode: CPP -*-2 1 // 3 2 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo … … 12 11 // Last Modified By : 13 12 // Last Modified On : 14 // Update Count : 013 // Update Count : 1 15 14 // 16 15 17 #ifndef KEYWORDS_H 18 #define KEYWORDS_H 16 #pragma once 19 17 20 18 #include <list> // for list … … 28 26 }; 29 27 30 #endif //KEYWORDS_H 28 // Local Variables: // 29 // tab-width: 4 // 30 // mode: c++ // 31 // compile-command: "make install" // 32 // End: // -
src/ControlStruct/ExceptTranslate.cc
re0a653d r33218c6 10 10 // Created On : Wed Jun 14 16:49:00 2017 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jul 12 15:07:00 201713 // Update Count : 312 // Last Modified On : Tus Jul 18 10:09:00 2017 13 // Update Count : 4 14 14 // 15 15 … … 50 50 LinkageSpec::Cforall, 51 51 /*bitfieldWidth*/ NULL, 52 new BasicType( emptyQualifiers, BasicType::SignedInt ),52 new BasicType( noQualifiers, BasicType::SignedInt ), 53 53 /*init*/ NULL 54 54 ); … … 59 59 /*bitfieldWidth*/ NULL, 60 60 new PointerType( 61 emptyQualifiers,62 new BasicType( emptyQualifiers, BasicType::SignedInt )61 noQualifiers, 62 new BasicType( noQualifiers, BasicType::SignedInt ) 63 63 ), 64 64 /*init*/ NULL … … 69 69 LinkageSpec::Cforall, 70 70 /*bitfieldWidth*/ NULL, 71 new BasicType( emptyQualifiers, BasicType::Bool),71 new BasicType(noQualifiers, BasicType::Bool), 72 72 /*init*/ NULL 73 73 ); … … 78 78 NULL, 79 79 new PointerType( 80 emptyQualifiers,80 noQualifiers, 81 81 new VoidType( 82 emptyQualifiers82 noQualifiers 83 83 ), 84 84 std::list<Attribute *>{new Attribute("unused")} … … 143 143 LinkageSpec::Cforall, 144 144 NULL, 145 new BasicType( emptyQualifiers, BasicType::SignedInt ),145 new BasicType( noQualifiers, BasicType::SignedInt ), 146 146 new SingleInit( throwStmt->get_expr() ) 147 147 ); … … 444 444 nullptr, 445 445 new StructInstType( 446 emptyQualifiers,446 noQualifiers, 447 447 hook_decl 448 448 ), -
src/ControlStruct/ExceptTranslate.h
re0a653d r33218c6 9 9 // Author : Andrew Beach 10 10 // Created On : Tus Jun 06 10:13:00 2017 11 // Last Modified By : Andrew Beach12 // Last Modified On : Fri Jun 30 10:20:00201713 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:19:23 2017 13 // Update Count : 4 14 14 // 15 15 16 #ifndef EXCEPT_TRANSLATE_H 17 #define EXCEPT_TRANSLATE_H 16 #pragma once 18 17 19 18 #include <list> … … 22 21 namespace ControlStruct { 23 22 void translateEHM( std::list< Declaration *> & translationUnit ); 24 /* Converts exception handling structures into their underlying C code. 25 * Translation does use the exception handling header, make sure it is 26 * visible wherever translation occurs. 27 */ 23 // Converts exception handling structures into their underlying C code. Translation does use the exception 24 // handling header, make sure it is visible wherever translation occurs. 28 25 } 29 26 30 #endif // EXCEPT_TRANSLATE_H 27 // Local Variables: // 28 // tab-width: 4 // 29 // mode: c++ // 30 // compile-command: "make install" // 31 // End: // -
src/ControlStruct/ForExprMutator.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jan 25 21:22:13 201613 // Update Count : 312 // Last Modified On : Sat Jul 22 09:17:08 2017 13 // Update Count : 4 14 14 // 15 15 16 #ifndef FOR_MUTATOR_H 17 #define FOR_MUTATOR_H 16 #pragma once 18 17 19 18 #include "SynTree/Mutator.h" … … 27 26 } // namespace ControlStruct 28 27 29 #endif // CHOOSE_MUTATOR_H30 31 28 // Local Variables: // 32 29 // tab-width: 4 // -
src/ControlStruct/LabelFixer.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 12 17:36:16 201613 // Update Count : 3 312 // Last Modified On : Sat Jul 22 09:17:24 2017 13 // Update Count : 34 14 14 // 15 15 16 #ifndef LABEL_FIXER_H 17 #define LABEL_FIXER_H 16 #pragma once 18 17 19 18 #include "Common/utility.h" … … 83 82 } // namespace ControlStruct 84 83 85 #endif // LABEL_FIXER_H86 87 84 // Local Variables: // 88 85 // tab-width: 4 // -
src/ControlStruct/LabelGenerator.h
re0a653d r33218c6 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Wed Jun 03 14:16:26 201513 // Update Count : 511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:20:14 2017 13 // Update Count : 6 14 14 // 15 15 16 #ifndef LABEL_GENERATOR_H 17 #define LABEL_GENERATOR_H 16 #pragma once 18 17 19 18 #include "SynTree/SynTree.h" … … 35 34 } // namespace ControlStruct 36 35 37 #endif // LABEL_GENERATOR_H38 39 36 // Local Variables: // 40 37 // tab-width: 4 // -
src/ControlStruct/MLEMutator.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 12 17:37:01 201613 // Update Count : 3 412 // Last Modified On : Sat Jul 22 09:19:59 2017 13 // Update Count : 35 14 14 // 15 15 16 #ifndef MLE_MUTATOR_H 17 #define MLE_MUTATOR_H 16 #pragma once 18 17 19 18 #include <map> … … 89 88 } // namespace ControlStruct 90 89 91 #endif // MLE_MUTATOR_H92 93 90 // Local Variables: // 94 91 // tab-width: 4 // -
src/ControlStruct/Mutate.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 19 15:31:20 201513 // Update Count : 212 // Last Modified On : Sat Jul 22 09:17:59 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef CTRLS_MUTATE_H 17 #define CTRLS_MUTATE_H 16 #pragma once 18 17 19 18 #include <list> … … 27 26 } // namespace ControlStruct 28 27 29 #endif // CTRLS_MUTATE_H30 31 28 // Local Variables: // 32 29 // tab-width: 4 // -
src/GenPoly/Box.cc
re0a653d r33218c6 202 202 }; 203 203 204 /// Replaces initialization of polymorphic values with alloca, declaration of dtype/ftype with appropriate void expression, and sizeof expressions of polymorphic types with the proper variable204 /// Replaces initialization of polymorphic values with alloca, declaration of dtype/ftype with appropriate void expression, sizeof expressions of polymorphic types with the proper variable, and strips fields from generic struct declarations. 205 205 class Pass3 final : public PolyMutator { 206 206 public: … … 210 210 using PolyMutator::mutate; 211 211 virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ) override; 212 virtual Declaration *mutate( StructDecl *structDecl ) override; 213 virtual Declaration *mutate( UnionDecl *unionDecl ) override; 212 214 virtual ObjectDecl *mutate( ObjectDecl *objectDecl ) override; 213 215 virtual TypedefDecl *mutate( TypedefDecl *objectDecl ) override; … … 1868 1870 } 1869 1871 1872 /// Strips the members from a generic aggregate 1873 void stripGenericMembers(AggregateDecl* decl) { 1874 if ( ! decl->get_parameters().empty() ) decl->get_members().clear(); 1875 } 1876 1877 Declaration *Pass3::mutate( StructDecl *structDecl ) { 1878 stripGenericMembers( structDecl ); 1879 return structDecl; 1880 } 1881 1882 Declaration *Pass3::mutate( UnionDecl *unionDecl ) { 1883 stripGenericMembers( unionDecl ); 1884 return unionDecl; 1885 } 1886 1870 1887 TypeDecl * Pass3::mutate( TypeDecl *typeDecl ) { 1871 1888 // Initializer *init = 0; -
src/GenPoly/Box.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Nov 19 17:24:01 201513 // Update Count : 512 // Last Modified On : Sat Jul 22 09:23:52 2017 13 // Update Count : 6 14 14 // 15 15 16 #ifndef _BOX_H 17 #define _BOX_H 16 #pragma once 18 17 19 18 #include <list> … … 25 24 } // namespace GenPoly 26 25 27 #endif // _BOX_H28 29 26 // Local Variables: // 30 27 // tab-width: 4 // -
src/GenPoly/CopyParams.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 19 07:34:25 201513 // Update Count : 112 // Last Modified On : Sat Jul 22 09:23:09 2017 13 // Update Count : 2 14 14 // 15 15 16 #ifndef _COPYPARAMS_H 17 #define _COPYPARAMS_H 16 #pragma once 18 17 19 18 #include "SynTree/SynTree.h" … … 24 23 } // namespace GenPoly 25 24 26 #endif // _COPYPARAMS_H27 28 25 // Local Variables: // 29 26 // tab-width: 4 // -
src/GenPoly/DeclMutator.h
re0a653d r33218c6 10 10 // Created On : Fri Nov 27 14:44:00 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 12 17:39:01 201613 // Update Count : 212 // Last Modified On : Sat Jul 22 09:21:12 2017 13 // Update Count : 4 14 14 // 15 15 16 #ifndef _DECLMUTATOR_H 17 #define _DECLMUTATOR_H 16 #pragma once 18 17 19 18 #include <list> … … 27 26 /// Mutates a list of declarations, providing a means of adding new declarations into the list 28 27 class DeclMutator : public Mutator { 29 public:28 public: 30 29 typedef Mutator Parent; 31 30 … … 50 49 /// Called on exit from a scope; overriders should call this as a super-class call 51 50 virtual void doEndScope(); 52 protected:51 protected: 53 52 /// Mutate a statement that forms its own scope 54 53 Statement* mutateStatement( Statement *stmt ); … … 59 58 /// Add a declaration to the list to be added after the current position 60 59 void addDeclarationAfter( Declaration* decl ); 61 private:60 private: 62 61 /// A stack of declarations to add before the current declaration or statement 63 62 std::vector< std::list< Declaration* > > declsToAdd; … … 67 66 } // namespace 68 67 69 #endif // _DECLMUTATOR_H70 71 68 // Local Variables: // 72 69 // tab-width: 4 // -
src/GenPoly/ErasableScopedMap.h
re0a653d r33218c6 9 9 // Author : Aaron B. Moss 10 10 // Created On : Wed Dec 2 11:37:00 2015 11 // Last Modified By : Aaron B. Moss 12 // Last Modified On : Wed Dec 2 11:37:00 2015 13 // Update Count : 1 14 // 15 16 #ifndef _ERASABLESCOPEDMAP_H 17 #define _ERASABLESCOPEDMAP_H 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:23:24 2017 13 // Update Count : 2 14 // 15 16 #pragma once 18 17 19 18 #include <cassert> … … 278 277 } // namespace GenPoly 279 278 280 #endif // _ERASABLESCOPEDMAP_H281 282 279 // Local Variables: // 283 280 // tab-width: 4 // -
src/GenPoly/FindFunction.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 19 07:36:35 201513 // Update Count : 112 // Last Modified On : Sat Jul 22 09:23:36 2017 13 // Update Count : 2 14 14 // 15 15 16 #ifndef FINDFUNCTION_H 17 #define FINDFUNCTION_H 16 #pragma once 18 17 19 18 #include "SynTree/SynTree.h" … … 29 28 } // namespace GenPoly 30 29 31 #endif // FINDFUNCTION_H32 33 30 // Local Variables: // 34 31 // tab-width: 4 // -
src/GenPoly/GenPoly.h
re0a653d r33218c6 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Tue Nov 24 15:24:38 201513 // Update Count : 611 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:22:57 2017 13 // Update Count : 7 14 14 // 15 15 16 #ifndef GENPOLY_H 17 #define GENPOLY_H 16 #pragma once 18 17 19 18 #include <string> … … 111 110 } // namespace GenPoly 112 111 113 #endif // GENPOLY_H114 115 112 // Local Variables: // 116 113 // tab-width: 4 // -
src/GenPoly/InstantiateGeneric.h
re0a653d r33218c6 9 9 // Author : Aaron B. Moss 10 10 // Created On : Thu Aug 04 18:33:00 2016 11 // Last Modified By : Aaron B. Moss12 // Last Modified On : Thu Aug 04 18:33:00 201613 // Update Count : 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:22:42 2017 13 // Update Count : 2 14 14 // 15 15 16 #ifndef _INSTANTIATEGENERIC_H 17 #define _INSTANTIATEGENERIC_H 16 #pragma once 18 17 19 18 #include "SynTree/SynTree.h" … … 26 25 } // namespace GenPoly 27 26 28 #endif // _INSTANTIATEGENERIC_H29 30 27 // Local Variables: // 31 28 // tab-width: 4 // -
src/GenPoly/Lvalue.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 19 07:42:09 201513 // Update Count : 112 // Last Modified On : Sat Jul 22 09:21:59 2017 13 // Update Count : 2 14 14 // 15 15 16 #ifndef _LVALUE_H 17 #define _LVALUE_H 16 #pragma once 18 17 19 18 #include <list> … … 26 25 } // namespace GenPoly 27 26 28 #endif // _LVALUE_H29 30 27 // Local Variables: // 31 28 // tab-width: 4 // -
src/GenPoly/PolyMutator.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 12 17:39:41 201613 // Update Count : 612 // Last Modified On : Sat Jul 22 09:20:31 2017 13 // Update Count : 7 14 14 // 15 15 16 #ifndef _POLYMUTATOR_H 17 #define _POLYMUTATOR_H 16 #pragma once 18 17 19 18 #include <map> … … 66 65 } // namespace 67 66 68 #endif // _POLYMUTATOR_H69 70 67 // Local Variables: // 71 68 // tab-width: 4 // -
src/GenPoly/ScopedSet.h
re0a653d r33218c6 9 9 // Author : Aaron B. Moss 10 10 // Created On : Thu Dec 3 11:51:00 2015 11 // Last Modified By : Aaron B. Moss 12 // Last Modified On : Thu Dec 3 11:51:00 2015 13 // Update Count : 1 14 // 15 16 #ifndef _SCOPEDSET_H 17 #define _SCOPEDSET_H 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:22:17 2017 13 // Update Count : 2 14 // 15 16 #pragma once 18 17 19 18 #include <iterator> … … 247 246 } // namespace GenPoly 248 247 249 #endif // _SCOPEDSET_H250 251 248 // Local Variables: // 252 249 // tab-width: 4 // -
src/GenPoly/ScrubTyVars.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 19 07:48:14 201513 // Update Count : 112 // Last Modified On : Sat Jul 22 09:21:47 2017 13 // Update Count : 2 14 14 // 15 15 16 #ifndef _SCRUBTYVARS_H 17 #define _SCRUBTYVARS_H 16 #pragma once 18 17 19 18 #include <string> … … 95 94 } // namespace GenPoly 96 95 97 #endif // _SCRUBTYVARS_H98 99 96 // Local Variables: // 100 97 // tab-width: 4 // -
src/GenPoly/Specialize.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 19 07:53:58 201513 // Update Count : 112 // Last Modified On : Sat Jul 22 09:22:31 2017 13 // Update Count : 2 14 14 // 15 15 16 #ifndef _SPECIALIZE_H 17 #define _SPECIALIZE_H 16 #pragma once 18 17 19 18 #include <list> … … 26 25 } // namespace GenPoly 27 26 28 #endif // _SPECIALIZE_H29 30 27 // Local Variables: // 31 28 // tab-width: 4 // -
src/InitTweak/FixGlobalInit.h
re0a653d r33218c6 9 9 // Author : Rob Schluntz 10 10 // Created On : Mon May 04 15:14:56 2016 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri May 06 16:07:47 201613 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:30:54 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef FIX_GLOBAL_INIT_H 17 #define FIX_GLOBAL_INIT_H 16 #pragma once 18 17 19 18 #include <string> … … 34 33 } // namespace 35 34 36 #endif // GENPOLY_POLYMUTATOR_H37 38 35 // Local Variables: // 39 36 // tab-width: 4 // -
src/InitTweak/FixInit.h
re0a653d r33218c6 9 9 // Author : Rob Schluntz 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri May 13 11:27:52 201613 // Update Count : 511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:31:06 2017 13 // Update Count : 6 14 14 // 15 15 16 #ifndef FIX_INIT_H 17 #define FIX_INIT_H 16 #pragma once 18 17 19 18 #include <string> … … 30 29 } // namespace 31 30 32 #endif // GENPOLY_POLYMUTATOR_H33 34 31 // Local Variables: // 35 32 // tab-width: 4 // -
src/InitTweak/GenInit.h
re0a653d r33218c6 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri May 13 11:27:19 201613 // Update Count : 311 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:31:19 2017 13 // Update Count : 4 14 14 // 15 15 16 #ifndef GEN_INIT_H 17 #define GEN_INIT_H 16 #pragma once 18 17 19 18 #include <string> … … 35 34 } // namespace 36 35 37 #endif // INITTWEAK_GENINIT_H38 39 36 // Local Variables: // 40 37 // tab-width: 4 // -
src/InitTweak/InitTweak.h
re0a653d r33218c6 9 9 // Author : Rob Schluntz 10 10 // Created On : Fri May 13 11:26:36 2016 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri May 13 11:35:36 201613 // Update Count : 311 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:30:33 2017 13 // Update Count : 4 14 14 // 15 15 16 #ifndef INIT_TWEAK_H 17 #define INIT_TWEAK_H 16 #pragma once 18 17 19 18 #include <string> … … 116 115 } // namespace 117 116 118 #endif // INITTWEAK_GENINIT_H119 120 117 // Local Variables: // 121 118 // tab-width: 4 // -
src/MakeLibCfa.h
re0a653d r33218c6 10 10 // Created On : Sat May 16 10:42:14 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat May 16 10:43:29 201513 // Update Count : 112 // Last Modified On : Sat Jul 22 09:31:35 2017 13 // Update Count : 2 14 14 // 15 15 16 #ifndef LIBCFA_MAKELIBCFA_H 17 #define LIBCFA_MAKELIBCFA_H 16 #pragma once 18 17 19 18 #include <list> // for list … … 25 24 } // namespace LibCfa 26 25 27 #endif // LIBCFA_MAKELIBCFA_H28 29 26 // Local Variables: // 30 27 // tab-width: 4 // -
src/Makefile.in
re0a653d r33218c6 216 216 SymTab/driver_cfa_cpp-TypeEquality.$(OBJEXT) \ 217 217 SymTab/driver_cfa_cpp-Autogen.$(OBJEXT) \ 218 SymTab/driver_cfa_cpp-TreeStruct.$(OBJEXT) \ 218 219 SynTree/driver_cfa_cpp-Type.$(OBJEXT) \ 219 220 SynTree/driver_cfa_cpp-VoidType.$(OBJEXT) \ … … 514 515 SymTab/Indexer.cc SymTab/Mangler.cc SymTab/Validate.cc \ 515 516 SymTab/FixFunction.cc SymTab/ImplementationType.cc \ 516 SymTab/TypeEquality.cc SymTab/Autogen.cc Sy nTree/Type.cc \517 SynTree/ VoidType.cc SynTree/BasicType.cc \517 SymTab/TypeEquality.cc SymTab/Autogen.cc SymTab/TreeStruct.cc \ 518 SynTree/Type.cc SynTree/VoidType.cc SynTree/BasicType.cc \ 518 519 SynTree/PointerType.cc SynTree/ArrayType.cc \ 519 520 SynTree/FunctionType.cc SynTree/ReferenceToType.cc \ … … 848 849 SymTab/driver_cfa_cpp-Autogen.$(OBJEXT): SymTab/$(am__dirstamp) \ 849 850 SymTab/$(DEPDIR)/$(am__dirstamp) 851 SymTab/driver_cfa_cpp-TreeStruct.$(OBJEXT): SymTab/$(am__dirstamp) \ 852 SymTab/$(DEPDIR)/$(am__dirstamp) 850 853 SynTree/$(am__dirstamp): 851 854 @$(MKDIR_P) SynTree … … 1033 1036 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Indexer.Po@am__quote@ 1034 1037 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Mangler.Po@am__quote@ 1038 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po@am__quote@ 1035 1039 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-TypeEquality.Po@am__quote@ 1036 1040 @AMDEP_TRUE@@am__include@ @am__quote@SymTab/$(DEPDIR)/driver_cfa_cpp-Validate.Po@am__quote@ … … 2084 2088 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2085 2089 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-Autogen.obj `if test -f 'SymTab/Autogen.cc'; then $(CYGPATH_W) 'SymTab/Autogen.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/Autogen.cc'; fi` 2090 2091 SymTab/driver_cfa_cpp-TreeStruct.o: SymTab/TreeStruct.cc 2092 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-TreeStruct.o -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo -c -o SymTab/driver_cfa_cpp-TreeStruct.o `test -f 'SymTab/TreeStruct.cc' || echo '$(srcdir)/'`SymTab/TreeStruct.cc 2093 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po 2094 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='SymTab/TreeStruct.cc' object='SymTab/driver_cfa_cpp-TreeStruct.o' libtool=no @AMDEPBACKSLASH@ 2095 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2096 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-TreeStruct.o `test -f 'SymTab/TreeStruct.cc' || echo '$(srcdir)/'`SymTab/TreeStruct.cc 2097 2098 SymTab/driver_cfa_cpp-TreeStruct.obj: SymTab/TreeStruct.cc 2099 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SymTab/driver_cfa_cpp-TreeStruct.obj -MD -MP -MF SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo -c -o SymTab/driver_cfa_cpp-TreeStruct.obj `if test -f 'SymTab/TreeStruct.cc'; then $(CYGPATH_W) 'SymTab/TreeStruct.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/TreeStruct.cc'; fi` 2100 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Tpo SymTab/$(DEPDIR)/driver_cfa_cpp-TreeStruct.Po 2101 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='SymTab/TreeStruct.cc' object='SymTab/driver_cfa_cpp-TreeStruct.obj' libtool=no @AMDEPBACKSLASH@ 2102 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2103 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SymTab/driver_cfa_cpp-TreeStruct.obj `if test -f 'SymTab/TreeStruct.cc'; then $(CYGPATH_W) 'SymTab/TreeStruct.cc'; else $(CYGPATH_W) '$(srcdir)/SymTab/TreeStruct.cc'; fi` 2086 2104 2087 2105 SynTree/driver_cfa_cpp-Type.o: SynTree/Type.cc -
src/Parser/DeclarationNode.cc
re0a653d r33218c6 10 10 // Created On : Sat May 16 12:34:05 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:27:00 201713 // Update Count : 10 1912 // Last Modified On : Fri Jul 14 16:55:00 2017 13 // Update Count : 1020 14 14 // 15 15 … … 253 253 newnode->type->aggregate.fields = fields; 254 254 newnode->type->aggregate.body = body; 255 newnode->type->aggregate.tagged = false; 256 newnode->type->aggregate.parent = nullptr; 255 257 return newnode; 256 258 } // DeclarationNode::newAggregate … … 273 275 return newnode; 274 276 } // DeclarationNode::newEnumConstant 277 278 DeclarationNode * DeclarationNode::newTreeStruct( Aggregate kind, const string * name, const string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body ) { 279 assert( name ); 280 DeclarationNode * newnode = new DeclarationNode; 281 newnode->type = new TypeData( TypeData::Aggregate ); 282 newnode->type->aggregate.kind = kind; 283 newnode->type->aggregate.name = name; 284 newnode->type->aggregate.actuals = actuals; 285 newnode->type->aggregate.fields = fields; 286 newnode->type->aggregate.body = body; 287 newnode->type->aggregate.tagged = true; 288 newnode->type->aggregate.parent = parent; 289 return newnode; 290 } // DeclarationNode::newTreeStruct 275 291 276 292 DeclarationNode * DeclarationNode::newName( string * name ) { -
src/Parser/ExpressionNode.cc
re0a653d r33218c6 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:17:07 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed Jun 28 21:08:15201713 // Update Count : 5 4211 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus Jul 18 10:08:00 2017 13 // Update Count : 550 14 14 // 15 15 … … 46 46 // type. 47 47 48 Type::Qualifiers emptyQualifiers; // no qualifiers on constants48 Type::Qualifiers noQualifiers; // no qualifiers on constants 49 49 50 50 static inline bool checkU( char c ) { return c == 'u' || c == 'U'; } … … 118 118 } // if 119 119 120 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[Unsigned][size] ), str, v ) );120 Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[Unsigned][size] ), str, v ) ); 121 121 delete &str; // created by lex 122 122 return ret; … … 153 153 } // if 154 154 155 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[complx][size] ), str, v ) );155 Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, kind[complx][size] ), str, v ) ); 156 156 delete &str; // created by lex 157 157 return ret; … … 159 159 160 160 Expression *build_constantChar( const std::string & str ) { 161 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::Char ), str, (unsigned long long int)(unsigned char)str[1] ) );161 Expression * ret = new ConstantExpr( Constant( new BasicType( noQualifiers, BasicType::Char ), str, (unsigned long long int)(unsigned char)str[1] ) ); 162 162 delete &str; // created by lex 163 163 return ret; … … 166 166 ConstantExpr *build_constantStr( const std::string & str ) { 167 167 // string should probably be a primitive type 168 ArrayType *at = new ArrayType( emptyQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ),168 ArrayType *at = new ArrayType( noQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), 169 169 new ConstantExpr( Constant::from_ulong( str.size() + 1 - 2 ) ), // +1 for '\0' and -2 for '"' 170 170 false, false ); … … 176 176 177 177 Expression *build_constantZeroOne( const std::string & str ) { 178 Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( emptyQualifiers ) : (Type*)new OneType( emptyQualifiers ), str,178 Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( noQualifiers ) : (Type*)new OneType( noQualifiers ), str, 179 179 str == "0" ? (unsigned long long int)0 : (unsigned long long int)1 ) ); 180 180 delete &str; // created by lex … … 231 231 } 232 232 233 // Must harmonize with OperKinds. 233 234 static const char *OperName[] = { 234 235 // diadic 235 "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "? *?", "?/?", "?%?", "||", "&&",236 "SizeOf", "AlignOf", "OffsetOf", "?+?", "?-?", "?\\?", "?*?", "?/?", "?%?", "||", "&&", 236 237 "?|?", "?&?", "?^?", "Cast", "?<<?", "?>>?", "?<?", "?>?", "?<=?", "?>=?", "?==?", "?!=?", 237 "?=?", "?@=?", "? *=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?",238 "?=?", "?@=?", "?\\=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?", 238 239 "?[?]", "...", 239 240 // monadic -
src/Parser/LinkageSpec.h
re0a653d r33218c6 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:24:28 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Fri Jul 7 11:03:00201713 // Update Count : 1 311 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:32:16 2017 13 // Update Count : 14 14 14 // 15 15 16 #ifndef LINKAGESPEC_H 17 #define LINKAGESPEC_H 16 #pragma once 18 17 19 18 #include <string> … … 78 77 }; 79 78 80 #endif // LINKAGESPEC_H81 82 79 // Local Variables: // 83 80 // tab-width: 4 // -
src/Parser/ParseNode.h
re0a653d r33218c6 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:28:16 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Mon Jun 12 13:00:00 201713 // Update Count : 7 7911 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:32:30 2017 13 // Update Count : 786 14 14 // 15 15 16 #ifndef PARSENODE_H 17 #define PARSENODE_H 16 #pragma once 18 17 19 18 #include <string> … … 141 140 }; 142 141 142 // Must harmonize with OperName. 143 143 enum class OperKinds { 144 144 // diadic 145 SizeOf, AlignOf, OffsetOf, Plus, Minus, Mul, Div, Mod, Or, And,145 SizeOf, AlignOf, OffsetOf, Plus, Minus, Exp, Mul, Div, Mod, Or, And, 146 146 BitOr, BitAnd, Xor, Cast, LShift, RShift, LThan, GThan, LEThan, GEThan, Eq, Neq, 147 Assign, AtAssn, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, ERAssn, OrAssn,147 Assign, AtAssn, ExpAssn, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, ERAssn, OrAssn, 148 148 Index, Range, 149 149 // monadic … … 248 248 static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement 249 249 250 // Perhaps this would best fold into newAggragate. 251 static DeclarationNode * newTreeStruct( Aggregate kind, const std::string * name, const std::string * parent, ExpressionNode * actuals, DeclarationNode * fields, bool body ); 252 250 253 DeclarationNode(); 251 254 ~DeclarationNode(); … … 332 335 333 336 static UniqueName anonymous; 337 338 // Temp to test TreeStruct 339 const std::string * parent_name; 334 340 }; // DeclarationNode 335 341 … … 443 449 std::ostream & operator<<( std::ostream & out, const ParseNode * node ); 444 450 445 #endif // PARSENODE_H446 447 451 // Local Variables: // 448 452 // tab-width: 4 // -
src/Parser/ParserTypes.h
re0a653d r33218c6 10 10 // Created On : Sat Sep 22 08:58:10 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 28 22:10:17201713 // Update Count : 3 4912 // Last Modified On : Sat Jul 22 09:33:28 2017 13 // Update Count : 350 14 14 // 15 15 16 #ifndef PARSER_HH 17 #define PARSER_HH 16 #pragma once 18 17 19 18 int yylex(); … … 42 41 }; // Token 43 42 44 #endif // PARSER_HH45 46 43 // Local Variables: // 47 44 // tab-width: 4 // -
src/Parser/TypeData.cc
re0a653d r33218c6 10 10 // Created On : Sat May 16 15:12:51 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:28:00 201713 // Update Count : 56 412 // Last Modified On : Tus Jul 18 10:10:00 2017 13 // Update Count : 566 14 14 // 15 15 … … 63 63 aggregate.fields = nullptr; 64 64 aggregate.body = false; 65 aggregate.tagged = false; 66 aggregate.parent = nullptr; 65 67 break; 66 68 case AggregateInst: … … 121 123 delete aggregate.actuals; 122 124 delete aggregate.fields; 125 delete aggregate.parent; 123 126 // delete aggregate; 124 127 break; … … 192 195 newtype->aggregate.kind = aggregate.kind; 193 196 newtype->aggregate.body = aggregate.body; 197 newtype->aggregate.tagged = aggregate.tagged; 198 newtype->aggregate.parent = aggregate.parent ? new string( *aggregate.parent ) : nullptr; 194 199 break; 195 200 case AggregateInst: … … 449 454 case TypeData::Builtin: 450 455 if(td->builtintype == DeclarationNode::Zero) { 451 return new ZeroType( emptyQualifiers );456 return new ZeroType( noQualifiers ); 452 457 } 453 458 else if(td->builtintype == DeclarationNode::One) { 454 return new OneType( emptyQualifiers );459 return new OneType( noQualifiers ); 455 460 } 456 461 else { … … 619 624 switch ( td->aggregate.kind ) { 620 625 case DeclarationNode::Struct: 626 if ( td->aggregate.tagged ) { 627 at = new StructDecl( *td->aggregate.name, td->aggregate.parent, attributes, linkage ); 628 buildForall( td->aggregate.params, at->get_parameters() ); 629 break; 630 } 621 631 case DeclarationNode::Coroutine: 622 632 case DeclarationNode::Monitor: -
src/Parser/TypeData.h
re0a653d r33218c6 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:18:36 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Wed Jun 28 15:29:00201713 // Update Count : 18 611 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:32:47 2017 13 // Update Count : 188 14 14 // 15 15 16 #ifndef TYPEDATA_H 17 #define TYPEDATA_H 16 #pragma once 18 17 19 18 #include "ParseNode.h" … … 31 30 DeclarationNode * fields; 32 31 bool body; 32 33 bool tagged; 34 const std::string * parent; 33 35 }; 34 36 … … 113 115 void buildKRFunction( const TypeData::Function_t & function ); 114 116 115 #endif // TYPEDATA_H116 117 117 // Local Variables: // 118 118 // tab-width: 4 // -
src/Parser/TypedefTable.h
re0a653d r33218c6 10 10 // Created On : Sat May 16 15:24:36 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 28 21:56:34 201713 // Update Count : 3 312 // Last Modified On : Sat Jul 22 09:33:14 2017 13 // Update Count : 34 14 14 // 15 15 16 #ifndef TYPEDEFTABLE_H 17 #define TYPEDEFTABLE_H 16 #pragma once 18 17 19 18 #include <map> … … 91 90 }; 92 91 93 #endif // TYPEDEFTABLE_H94 95 92 // Local Variables: // 96 93 // tab-width: 4 // -
src/Parser/lex.ll
re0a653d r33218c6 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Tue Jul 11 21:30:51201713 * Update Count : 5 3412 * Last Modified On : Mon Jul 24 08:27:23 2017 13 * Update Count : 545 14 14 */ 15 15 … … 125 125 op_unary {op_unary_only}|{op_unary_binary}|{op_unary_pre_post} 126 126 127 op_binary_only "/"|"%"|" ^"|"&"|"|"|"<"|">"|"="|"=="|"!="|"<<"|">>"|"<="|">="|"+="|"-="|"*="|"/="|"%="|"&="|"|="|"^="|"<<="|">>="127 op_binary_only "/"|"%"|"\\"|"^"|"&"|"|"|"<"|">"|"="|"=="|"!="|"<<"|">>"|"<="|">="|"+="|"-="|"*="|"/="|"%="|"\\="|"&="|"|="|"^="|"<<="|">>=" 128 128 op_binary_over {op_unary_binary}|{op_binary_only} 129 129 // op_binary_not_over "?"|"->"|"."|"&&"|"||"|"@=" … … 136 136 137 137 %% 138 138 /* line directives */ 139 139 ^{h_white}*"#"{h_white}*[0-9]+{h_white}*["][^"\n]+["].*"\n" { 140 140 /* " stop highlighting */ … … 232 232 int { KEYWORD_RETURN(INT); } 233 233 __int128 { KEYWORD_RETURN(INT); } // GCC 234 __int128_t { KEYWORD_RETURN(INT); } // GCC 234 235 __label__ { KEYWORD_RETURN(LABEL); } // GCC 235 236 long { KEYWORD_RETURN(LONG); } … … 266 267 __typeof { KEYWORD_RETURN(TYPEOF); } // GCC 267 268 __typeof__ { KEYWORD_RETURN(TYPEOF); } // GCC 269 __uint128_t { KEYWORD_RETURN(INT); } // GCC 268 270 union { KEYWORD_RETURN(UNION); } 269 271 unsigned { KEYWORD_RETURN(UNSIGNED); } 270 272 __builtin_va_list { KEYWORD_RETURN(VALIST); } // GCC 273 virtual { KEYWORD_RETURN(VIRTUAL); } // CFA 271 274 void { KEYWORD_RETURN(VOID); } 272 275 volatile { KEYWORD_RETURN(VOLATILE); } … … 274 277 __volatile__ { KEYWORD_RETURN(VOLATILE); } // GCC 275 278 while { KEYWORD_RETURN(WHILE); } 279 with { KEYWORD_RETURN(WITH); } // CFA 276 280 zero_t { NUMERIC_RETURN(ZERO_T); } // CFA 277 281 … … 336 340 "-" { ASCIIOP_RETURN(); } 337 341 "*" { ASCIIOP_RETURN(); } 342 "\\" { ASCIIOP_RETURN(); } // CFA, exponentiation 338 343 "/" { ASCIIOP_RETURN(); } 339 344 "%" { ASCIIOP_RETURN(); } … … 360 365 "+=" { NAMEDOP_RETURN(PLUSassign); } 361 366 "-=" { NAMEDOP_RETURN(MINUSassign); } 367 "\\=" { NAMEDOP_RETURN(EXPassign); } // CFA, exponentiation 362 368 "*=" { NAMEDOP_RETURN(MULTassign); } 363 369 "/=" { NAMEDOP_RETURN(DIVassign); } -
src/Parser/parser.yy
re0a653d r33218c6 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 // Last Modified By : Andrew Beach12 // Last Modified On : Tus Jul 11 13:39:00201713 // Update Count : 24 1611 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jul 24 09:01:14 2017 13 // Update Count : 2463 14 14 // 15 15 … … 118 118 %token RESTRICT // C99 119 119 %token ATOMIC // C11 120 %token FORALL LVALUE MUTEX // CFA 121 %token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED ZERO_T ONE_T 120 %token FORALL LVALUE MUTEX VIRTUAL // CFA 121 %token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED 122 %token BOOL COMPLEX IMAGINARY // C99 123 %token ZERO_T ONE_T // CFA 122 124 %token VALIST // GCC 123 %token BOOL COMPLEX IMAGINARY // C99124 125 %token TYPEOF LABEL // GCC 125 126 %token ENUM STRUCT UNION … … 129 130 %token ATTRIBUTE EXTENSION // GCC 130 131 %token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN 131 %token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT // CFA132 %token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH // CFA 132 133 %token ASM // C99, extension ISO/IEC 9899:1999 Section J.5.10(1) 133 134 %token ALIGNAS ALIGNOF GENERIC STATICASSERT // C11 … … 151 152 %token ELLIPSIS // ... 152 153 153 %token MULTassign DIVassign MODassign // *= /= %=/154 %token EXPassign MULTassign DIVassign MODassign // \= *= /= %= 154 155 %token PLUSassign MINUSassign // += -= 155 156 %token LSassign RSassign // <<= >>= … … 168 169 %type<op> ptrref_operator unary_operator assignment_operator 169 170 %type<en> primary_expression postfix_expression unary_expression 170 %type<en> cast_expression multiplicative_expression additive_expression shift_expression 171 %type<en> relational_expression equality_expression AND_expression exclusive_OR_expression 172 %type<en> inclusive_OR_expression logical_AND_expression logical_OR_expression conditional_expression 173 %type<en> constant_expression assignment_expression assignment_expression_opt 171 %type<en> cast_expression exponential_expression multiplicative_expression additive_expression 172 %type<en> shift_expression relational_expression equality_expression 173 %type<en> AND_expression exclusive_OR_expression inclusive_OR_expression 174 %type<en> logical_AND_expression logical_OR_expression 175 %type<en> conditional_expression constant_expression assignment_expression assignment_expression_opt 174 176 %type<en> comma_expression comma_expression_opt 175 %type<en> argument_expression_list argument_expression assignment_opt177 %type<en> argument_expression_list argument_expression default_initialize_opt 176 178 %type<fctl> for_control_expression 177 179 %type<en> subrange … … 184 186 // statements 185 187 %type<sn> labeled_statement compound_statement expression_statement selection_statement 186 %type<sn> iteration_statement jump_statement exception_statement asm_statement 188 %type<sn> iteration_statement jump_statement 189 %type<sn> with_statement exception_statement asm_statement 187 190 %type<sn> fall_through_opt fall_through 188 191 %type<sn> statement statement_list 189 192 %type<sn> block_item_list block_item 190 %type<sn> case_clause193 %type<sn> with_clause_opt 191 194 %type<en> case_value 192 %type<sn> case_ value_list case_label case_label_list195 %type<sn> case_clause case_value_list case_label case_label_list 193 196 %type<sn> switch_clause_list_opt switch_clause_list choose_clause_list_opt choose_clause_list 194 197 %type<sn> /* handler_list */ handler_clause finally_clause … … 568 571 | '(' type_no_function ')' cast_expression 569 572 { $$ = new ExpressionNode( build_cast( $2, $4 ) ); } 573 // VIRTUAL cannot be opt because of look ahead issues 574 | '(' VIRTUAL ')' cast_expression 575 { $$ = new ExpressionNode( build_cast( nullptr, $4 ) ); } 576 | '(' VIRTUAL type_no_function ')' cast_expression 577 { $$ = new ExpressionNode( build_cast( $3, $5 ) ); } 570 578 // | '(' type_no_function ')' tuple 571 579 // { $$ = new ExpressionNode( build_cast( $2, $4 ) ); } 572 580 ; 573 581 582 exponential_expression: 583 cast_expression 584 | exponential_expression '\\' cast_expression 585 { $$ = new ExpressionNode( build_binary_val( OperKinds::Exp, $1, $3 ) ); } 586 ; 587 574 588 multiplicative_expression: 575 cast_expression576 | multiplicative_expression '*' cast_expression589 exponential_expression 590 | multiplicative_expression '*' exponential_expression 577 591 { $$ = new ExpressionNode( build_binary_val( OperKinds::Mul, $1, $3 ) ); } 578 | multiplicative_expression '/' cast_expression592 | multiplicative_expression '/' exponential_expression 579 593 { $$ = new ExpressionNode( build_binary_val( OperKinds::Div, $1, $3 ) ); } 580 | multiplicative_expression '%' cast_expression594 | multiplicative_expression '%' exponential_expression 581 595 { $$ = new ExpressionNode( build_binary_val( OperKinds::Mod, $1, $3 ) ); } 582 596 ; … … 677 691 '=' { $$ = OperKinds::Assign; } 678 692 | ATassign { $$ = OperKinds::AtAssn; } 693 | EXPassign { $$ = OperKinds::ExpAssn; } 679 694 | MULTassign { $$ = OperKinds::MulAssn; } 680 695 | DIVassign { $$ = OperKinds::DivAssn; } … … 729 744 | iteration_statement 730 745 | jump_statement 746 | with_statement 731 747 | exception_statement 732 748 | asm_statement … … 936 952 ; 937 953 954 with_statement: 955 WITH '(' tuple_expression_list ')' compound_statement 956 { $$ = (StatementNode *)0; } // FIX ME 957 ; 958 938 959 exception_statement: 939 960 TRY compound_statement handler_clause … … 965 986 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, nullptr, new ExpressionNode( build_constantInteger( *$6 ) ), $9 ) ) ); } 966 987 967 | handler_key '(' push push exception_declaration pop ')' compound_statement pop 968 { $$ = new StatementNode( build_catch( $1, $5, nullptr, $8 ) ); } 969 | handler_clause handler_key '(' push push exception_declaration pop ')' compound_statement pop 970 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, nullptr, $9 ) ) ); } 988 | handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop 989 { $$ = new StatementNode( build_catch( $1, $5, nullptr, $9 ) ); } 990 | handler_clause handler_key '(' push push exception_declaration pop handler_predicate_opt ')' compound_statement pop 991 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( $2, $6, nullptr, $10 ) ) ); } 992 ; 993 994 handler_predicate_opt: 995 //empty 996 | ';' conditional_expression 971 997 ; 972 998 … … 1495 1521 | IMAGINARY // C99 1496 1522 { $$ = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); } 1497 | VALIST // GCC, __builtin_va_list1498 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }1499 1523 | ZERO_T 1500 1524 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Zero ); } 1501 1525 | ONE_T 1502 1526 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::One ); } 1527 | VALIST // GCC, __builtin_va_list 1528 { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); } 1503 1529 ; 1504 1530 … … 1660 1686 | aggregate_key attribute_list_opt typegen_name // CFA 1661 1687 { $$ = $3->addQualifiers( $2 ); } 1688 1689 // Temp, testing TreeStruct 1690 | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name 1691 { 1692 typedefTable.makeTypedef( *$4 ); // create typedef 1693 if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $ 1694 forall = false; // reset 1695 } 1696 '{' field_declaration_list '}' 1697 { 1698 $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct, 1699 $4, nullptr, nullptr, $7, true )->addQualifiers( $3 ); 1700 } 1701 | STRUCT TRY attribute_list_opt no_attr_identifier_or_type_name TYPEDEFname 1702 { 1703 typedefTable.makeTypedef( *$4 ); // create typedef 1704 if ( forall ) typedefTable.changeKind( *$4, TypedefTable::TG ); // $ 1705 forall = false; // reset 1706 } 1707 '{' field_declaration_list '}' 1708 { 1709 $$ = DeclarationNode::newTreeStruct( DeclarationNode::Struct, 1710 $4, $5, nullptr, $8, true )->addQualifiers( $3 ); 1711 } 1662 1712 ; 1663 1713 … … 1838 1888 cfa_parameter_declaration: // CFA, new & old style parameter declaration 1839 1889 parameter_declaration 1840 | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name assignment_opt1890 | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initialize_opt 1841 1891 { $$ = $1->addName( $2 ); } 1842 | cfa_abstract_tuple identifier_or_type_name assignment_opt1892 | cfa_abstract_tuple identifier_or_type_name default_initialize_opt 1843 1893 // To obtain LR(1), these rules must be duplicated here (see cfa_abstract_declarator). 1844 1894 { $$ = $1->addName( $2 ); } 1845 | type_qualifier_list cfa_abstract_tuple identifier_or_type_name assignment_opt1895 | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initialize_opt 1846 1896 { $$ = $2->addName( $3 )->addQualifiers( $1 ); } 1847 1897 | cfa_function_specifier … … 1860 1910 parameter_declaration: 1861 1911 // No SUE declaration in parameter list. 1862 declaration_specifier_nobody identifier_parameter_declarator assignment_opt1912 declaration_specifier_nobody identifier_parameter_declarator default_initialize_opt 1863 1913 { 1864 1914 typedefTable.addToEnclosingScope( TypedefTable::ID ); 1865 1915 $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); 1866 1916 } 1867 | declaration_specifier_nobody type_parameter_redeclarator assignment_opt1917 | declaration_specifier_nobody type_parameter_redeclarator default_initialize_opt 1868 1918 { 1869 1919 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 1873 1923 1874 1924 abstract_parameter_declaration: 1875 declaration_specifier_nobody assignment_opt1925 declaration_specifier_nobody default_initialize_opt 1876 1926 { $$ = $1->addInitializer( $2 ? new InitializerNode( $2 ) : nullptr ); } 1877 | declaration_specifier_nobody abstract_parameter_declarator assignment_opt1927 | declaration_specifier_nobody abstract_parameter_declarator default_initialize_opt 1878 1928 { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); } 1879 1929 ; … … 2212 2262 ; 2213 2263 2264 with_clause_opt: 2265 // empty 2266 { $$ = (StatementNode *)0; } // FIX ME 2267 | WITH '(' tuple_expression_list ')' 2268 { $$ = (StatementNode *)0; } // FIX ME 2269 ; 2270 2214 2271 function_definition: 2215 cfa_function_declaration compound_statement// CFA2272 cfa_function_declaration with_clause_opt compound_statement // CFA 2216 2273 { 2217 2274 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2218 2275 typedefTable.leaveScope(); 2219 $$ = $1->addFunctionBody( $ 2);2220 } 2221 | declaration_specifier function_declarator compound_statement2276 $$ = $1->addFunctionBody( $3 ); 2277 } 2278 | declaration_specifier function_declarator with_clause_opt compound_statement 2222 2279 { 2223 2280 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2224 2281 typedefTable.leaveScope(); 2225 $$ = $2->addFunctionBody( $ 3)->addType( $1 );2226 } 2227 | type_qualifier_list function_declarator compound_statement2282 $$ = $2->addFunctionBody( $4 )->addType( $1 ); 2283 } 2284 | type_qualifier_list function_declarator with_clause_opt compound_statement 2228 2285 { 2229 2286 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2230 2287 typedefTable.leaveScope(); 2231 $$ = $2->addFunctionBody( $ 3)->addQualifiers( $1 );2232 } 2233 | declaration_qualifier_list function_declarator compound_statement2288 $$ = $2->addFunctionBody( $4 )->addQualifiers( $1 ); 2289 } 2290 | declaration_qualifier_list function_declarator with_clause_opt compound_statement 2234 2291 { 2235 2292 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2236 2293 typedefTable.leaveScope(); 2237 $$ = $2->addFunctionBody( $ 3)->addQualifiers( $1 );2238 } 2239 | declaration_qualifier_list type_qualifier_list function_declarator compound_statement2294 $$ = $2->addFunctionBody( $4 )->addQualifiers( $1 ); 2295 } 2296 | declaration_qualifier_list type_qualifier_list function_declarator with_clause_opt compound_statement 2240 2297 { 2241 2298 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2242 2299 typedefTable.leaveScope(); 2243 $$ = $3->addFunctionBody( $ 4)->addQualifiers( $2 )->addQualifiers( $1 );2300 $$ = $3->addFunctionBody( $5 )->addQualifiers( $2 )->addQualifiers( $1 ); 2244 2301 } 2245 2302 2246 2303 // Old-style K&R function definition, OBSOLESCENT (see 4) 2247 | declaration_specifier KR_function_declarator push KR_declaration_list_opt compound_statement2304 | declaration_specifier KR_function_declarator push KR_declaration_list_opt with_clause_opt compound_statement 2248 2305 { 2249 2306 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2250 2307 typedefTable.leaveScope(); 2251 $$ = $2->addOldDeclList( $4 )->addFunctionBody( $ 5)->addType( $1 );2252 } 2253 | type_qualifier_list KR_function_declarator push KR_declaration_list_opt compound_statement2308 $$ = $2->addOldDeclList( $4 )->addFunctionBody( $6 )->addType( $1 ); 2309 } 2310 | type_qualifier_list KR_function_declarator push KR_declaration_list_opt with_clause_opt compound_statement 2254 2311 { 2255 2312 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2256 2313 typedefTable.leaveScope(); 2257 $$ = $2->addOldDeclList( $4 )->addFunctionBody( $ 5)->addQualifiers( $1 );2314 $$ = $2->addOldDeclList( $4 )->addFunctionBody( $6 )->addQualifiers( $1 ); 2258 2315 } 2259 2316 2260 2317 // Old-style K&R function definition with "implicit int" type_specifier, OBSOLESCENT (see 4) 2261 | declaration_qualifier_list KR_function_declarator push KR_declaration_list_opt compound_statement2318 | declaration_qualifier_list KR_function_declarator push KR_declaration_list_opt with_clause_opt compound_statement 2262 2319 { 2263 2320 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2264 2321 typedefTable.leaveScope(); 2265 $$ = $2->addOldDeclList( $4 )->addFunctionBody( $ 5)->addQualifiers( $1 );2266 } 2267 | declaration_qualifier_list type_qualifier_list KR_function_declarator push KR_declaration_list_opt compound_statement2322 $$ = $2->addOldDeclList( $4 )->addFunctionBody( $6 )->addQualifiers( $1 ); 2323 } 2324 | declaration_qualifier_list type_qualifier_list KR_function_declarator push KR_declaration_list_opt with_clause_opt compound_statement 2268 2325 { 2269 2326 typedefTable.addToEnclosingScope( TypedefTable::ID ); 2270 2327 typedefTable.leaveScope(); 2271 $$ = $3->addOldDeclList( $5 )->addFunctionBody( $ 6)->addQualifiers( $2 )->addQualifiers( $1 );2328 $$ = $3->addOldDeclList( $5 )->addFunctionBody( $7 )->addQualifiers( $2 )->addQualifiers( $1 ); 2272 2329 } 2273 2330 ; … … 3031 3088 ; 3032 3089 3033 assignment_opt:3090 default_initialize_opt: 3034 3091 // empty 3035 3092 { $$ = nullptr; } -
src/Parser/parserutility.cc
re0a653d r33218c6 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:30:39 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed Jun 28 22:11:32201713 // Update Count : 711 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus Jul 18 10:12:00 2017 13 // Update Count : 8 14 14 // 15 15 … … 26 26 UntypedExpr *comparison = new UntypedExpr( new NameExpr( "?!=?" ) ); 27 27 comparison->get_args().push_back( orig ); 28 comparison->get_args().push_back( new ConstantExpr( Constant( new ZeroType( emptyQualifiers ), "0", (unsigned long long int)0 ) ) );28 comparison->get_args().push_back( new ConstantExpr( Constant( new ZeroType( noQualifiers ), "0", (unsigned long long int)0 ) ) ); 29 29 return new CastExpr( comparison, new BasicType( Type::Qualifiers(), BasicType::SignedInt ) ); 30 30 } -
src/Parser/parserutility.h
re0a653d r33218c6 10 10 // Created On : Sat May 16 15:31:46 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 28 22:11:40201713 // Update Count : 312 // Last Modified On : Sat Jul 22 09:32:58 2017 13 // Update Count : 4 14 14 // 15 15 16 #ifndef PARSEUTILITY_H 17 #define PARSEUTILITY_H 16 #pragma once 18 17 19 18 #include "SynTree/SynTree.h" 20 19 21 20 Expression *notZeroExpr( Expression *orig ); 22 23 #endif // PARSEUTILITY_H24 21 25 22 // Local Variables: // -
src/ResolvExpr/Alternative.h
re0a653d r33218c6 10 10 // Created On : Sat May 16 23:45:43 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat May 16 23:54:39 201513 // Update Count : 212 // Last Modified On : Sat Jul 22 09:36:36 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef ALTERNATIVE_H 17 #define ALTERNATIVE_H 16 #pragma once 18 17 19 18 #include <list> … … 47 46 } // namespace ResolvExpr 48 47 49 #endif // ALTERNATIVE_H50 51 48 // Local Variables: // 52 49 // tab-width: 4 // -
src/ResolvExpr/AlternativeFinder.h
re0a653d r33218c6 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sat May 16 23:56:12 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Tue Apr 19 11:44:53 201613 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:35:32 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef ALTERNATIVEFINDER_H 17 #define ALTERNATIVEFINDER_H 16 #pragma once 18 17 19 18 #include <set> … … 132 131 } // namespace ResolvExpr 133 132 134 #endif // ALTERNATIVEFINDER_H135 136 133 // Local Variables: // 137 134 // tab-width: 4 // -
src/ResolvExpr/AlternativePrinter.h
re0a653d r33218c6 10 10 // Created On : Sun May 17 06:55:43 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un May 17 06:57:12 201513 // Update Count : 312 // Last Modified On : Sat Jul 22 09:37:09 2017 13 // Update Count : 4 14 14 // 15 15 16 #ifndef ALTERNATIVEPRINTER_H 17 #define ALTERNATIVEPRINTER_H 16 #pragma once 18 17 19 18 #include <iostream> … … 34 33 } // namespace ResolvExpr 35 34 36 #endif // ALTERNATIVEPRINTER_H37 38 35 // Local Variables: // 39 36 // tab-width: 4 // -
src/ResolvExpr/ConversionCost.h
re0a653d r33218c6 10 10 // Created On : Sun May 17 09:37:28 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 17:35:56 201613 // Update Count : 312 // Last Modified On : Sat Jul 22 09:38:24 2017 13 // Update Count : 4 14 14 // 15 15 16 #ifndef CONVERSIONCOST_H 17 #define CONVERSIONCOST_H 16 #pragma once 18 17 19 18 #include "SynTree/Visitor.h" … … 51 50 } // namespace ResolvExpr 52 51 53 #endif // CONVERSIONCOST_H */54 55 52 // Local Variables: // 56 53 // tab-width: 4 // -
src/ResolvExpr/Cost.h
re0a653d r33218c6 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 09:39:50 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Wed Jul 22 16:43:10 201513 // Update Count : 411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:35:55 2017 13 // Update Count : 5 14 14 // 15 15 16 #ifndef COST_H 17 #define COST_H 16 #pragma once 18 17 19 18 #include <iostream> … … 114 113 } // namespace ResolvExpr 115 114 116 #endif // COST_H117 118 115 // Local Variables: // 119 116 // tab-width: 4 // -
src/ResolvExpr/CurrentObject.h
re0a653d r33218c6 9 9 // Author : Rob Schluntz 10 10 // Created On : Thu Jun 8 11:07:25 2017 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Thu Jun 8 11:07:41201713 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:36:48 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef CURRENT_OBJECT_H 17 #define CURRENT_OBJECT_H 16 #pragma once 18 17 19 18 #include <stack> … … 50 49 } // namespace ResolvExpr 51 50 52 #endif // CURRENT_OBJECT_H53 54 51 // Local Variables: // 55 52 // tab-width: 4 // -
src/ResolvExpr/FindOpenVars.h
re0a653d r33218c6 10 10 // Created On : Sun May 17 09:46:04 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un May 17 09:47:20 201513 // Update Count : 212 // Last Modified On : Sat Jul 22 09:35:18 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef FINDOPENVARS_H 17 #define FINDOPENVARS_H 16 #pragma once 18 17 19 18 #include "Unify.h" … … 25 24 } // namespace ResolvExpr 26 25 27 #endif // FINDOPENVARS_H28 29 26 // Local Variables: // 30 27 // tab-width: 4 // -
src/ResolvExpr/RenameVars.h
re0a653d r33218c6 10 10 // Created On : Sun May 17 12:10:28 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 17:36:39 201613 // Update Count : 312 // Last Modified On : Sat Jul 22 09:33:54 2017 13 // Update Count : 4 14 14 // 15 15 16 #ifndef RESOLVEXPR_RENAMEVARS_H 17 #define RESOLVEXPR_RENAMEVARS_H 16 #pragma once 18 17 19 18 #include <list> … … 56 55 } // namespace ResolvExpr 57 56 58 #endif // RENAMEVARS_H59 60 57 // Local Variables: // 61 58 // tab-width: 4 // -
src/ResolvExpr/ResolveTypeof.h
re0a653d r33218c6 10 10 // Created On : Sun May 17 12:14:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un May 17 12:16:29 201513 // Update Count : 212 // Last Modified On : Sat Jul 22 09:38:35 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef RESOLVETYPEOF_H 17 #define RESOLVETYPEOF_H 16 #pragma once 18 17 19 18 #include "SynTree/SynTree.h" … … 24 23 } // namespace ResolvExpr 25 24 26 #endif // RESOLVETYPEOF_H27 28 25 // Local Variables: // 29 26 // tab-width: 4 // -
src/ResolvExpr/Resolver.h
re0a653d r33218c6 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 12:18:34 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Thu Apr 14 15:06:53 201613 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:36:57 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef RESOLVER_H 17 #define RESOLVER_H 16 #pragma once 18 17 19 18 #include "SynTree/SynTree.h" … … 29 28 } // namespace ResolvExpr 30 29 31 #endif // RESOLVER_H32 33 30 // Local Variables: // 34 31 // tab-width: 4 // -
src/ResolvExpr/TypeEnvironment.h
re0a653d r33218c6 10 10 // Created On : Sun May 17 12:24:58 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un May 17 12:26:52 201513 // Update Count : 212 // Last Modified On : Sat Jul 22 09:35:45 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef TYPEENVIRONMENT_H 17 #define TYPEENVIRONMENT_H 16 #pragma once 18 17 19 18 #include <string> … … 99 98 } // namespace ResolvExpr 100 99 101 #endif // TYPEENVIRONMENT_H */102 103 100 // Local Variables: // 104 101 // tab-width: 4 // -
src/ResolvExpr/TypeMap.h
re0a653d r33218c6 9 9 // Author : Aaron B. Moss 10 10 // Created On : Fri Feb 19 13:55:00 2016 11 // Last Modified By : Aaron B. Moss 12 // Last Modified On : Fri Feb 19 13:55:00 2016 13 // Update Count : 1 14 // 15 16 #ifndef _TYPEMAP_H 17 #define _TYPEMAP_H 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:37:19 2017 13 // Update Count : 2 14 // 15 16 #pragma once 18 17 19 18 #include <map> … … 204 203 } // namespace ResolvExpr 205 204 206 #endif // _TYPEMAP_H207 208 205 // Local Variables: // 209 206 // tab-width: 4 // -
src/ResolvExpr/Unify.h
re0a653d r33218c6 10 10 // Created On : Sun May 17 13:09:04 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun May 17 13:10:34 201513 // Update Count : 212 // Last Modified On : Fri Jul 21 23:09:34 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef UNIFY_H 17 #define UNIFY_H 16 #pragma once 18 17 19 18 #include <map> … … 72 71 } // namespace ResolvExpr 73 72 74 #endif // UNIFY_H75 76 73 // Local Variables: // 77 74 // tab-width: 4 // -
src/ResolvExpr/typeops.h
re0a653d r33218c6 10 10 // Created On : Sun May 17 07:28:22 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un May 17 07:33:11 201513 // Update Count : 212 // Last Modified On : Sat Jul 22 09:36:18 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef TYPEOPS_H 17 #define TYPEOPS_H 16 #pragma once 18 17 19 18 #include "SynTree/SynTree.h" … … 157 156 } // namespace ResolvExpr 158 157 159 #endif // TYPEOPS_H160 161 158 // Local Variables: // 162 159 // tab-width: 4 // -
src/SymTab/Autogen.cc
re0a653d r33218c6 10 10 // Created On : Thu Mar 03 15:45:56 2016 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:30:00 201713 // Update Count : 6 112 // Last Modified On : Fri Jul 14 16:41:00 2017 13 // Update Count : 62 14 14 // 15 15 #include "Autogen.h" … … 407 407 void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd, const std::vector< FuncData > & data ) { 408 408 // Builtins do not use autogeneration. 409 if ( aggregateDecl->get_linkage() == LinkageSpec::Builtin ||409 if ( aggregateDecl->get_linkage() == LinkageSpec::BuiltinCFA || 410 410 aggregateDecl->get_linkage() == LinkageSpec::BuiltinC ) { 411 411 return; -
src/SymTab/Autogen.h
re0a653d r33218c6 10 10 // Created On : Sun May 17 21:53:34 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 21 17:25:26201713 // Update Count : 1 412 // Last Modified On : Sat Jul 22 09:50:25 2017 13 // Update Count : 15 14 14 // 15 15 16 #ifndef AUTOGEN_H 17 #define AUTOGEN_H 16 #pragma once 18 17 19 18 #include <cassert> // for assert … … 183 182 } 184 183 } // namespace SymTab 185 #endif // AUTOGEN_H 184 185 // Local Variables: // 186 // tab-width: 4 // 187 // mode: c++ // 188 // compile-command: "make install" // 189 // End: // 190 -
src/SymTab/FixFunction.h
re0a653d r33218c6 10 10 // Created On : Sun May 17 17:02:08 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 17:34:06 201613 // Update Count : 312 // Last Modified On : Sat Jul 22 09:45:55 2017 13 // Update Count : 4 14 14 // 15 15 16 #ifndef FIXFUNCTION_H 17 #define FIXFUNCTION_H 16 #pragma once 18 17 19 18 #include "SynTree/Mutator.h" // for Mutator … … 50 49 } // namespace SymTab 51 50 52 #endif // FIXFUNCTION_H53 54 51 // Local Variables: // 55 52 // tab-width: 4 // -
src/SymTab/ImplementationType.h
re0a653d r33218c6 10 10 // Created On : Sun May 17 21:35:41 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un May 17 21:37:15 201513 // Update Count : 212 // Last Modified On : Sat Jul 22 09:46:19 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef IMPLEMENTATIONTYPE_H 17 #define IMPLEMENTATIONTYPE_H 16 #pragma once 18 17 19 18 class Type; … … 32 31 } // namespace SymTab 33 32 34 #endif // IMPLEMENTATIONTYPE_H35 36 33 // Local Variables: // 37 34 // tab-width: 4 // -
src/SymTab/Indexer.h
re0a653d r33218c6 10 10 // Created On : Sun May 17 21:38:55 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 17:34:14 201613 // Update Count : 612 // Last Modified On : Sat Jul 22 09:46:34 2017 13 // Update Count : 7 14 14 // 15 15 16 #ifndef INDEXER_H 17 #define INDEXER_H 16 #pragma once 18 17 19 18 #include <iosfwd> // for ostream … … 148 147 } // namespace SymTab 149 148 150 #endif // INDEXER_H151 152 149 // Local Variables: // 153 150 // tab-width: 4 // -
src/SymTab/Mangler.h
re0a653d r33218c6 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 21:44:03 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Wed Aug 19 15:48:46 201513 // Update Count : 1 411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:45:30 2017 13 // Update Count : 15 14 14 // 15 15 16 #ifndef MANGLER_H 17 #define MANGLER_H 16 #pragma once 18 17 19 18 #include <map> // for map, map<>::value_compare … … 81 80 } // SymTab 82 81 83 #endif // MANGLER_H84 85 82 // Local Variables: // 86 83 // tab-width: 4 // -
src/SymTab/Validate.h
re0a653d r33218c6 11 11 // Created On : Sun May 17 21:53:34 2015 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Tue May 19 16:49:43 201514 // Update Count : 313 // Last Modified On : Sat Jul 22 09:46:07 2017 14 // Update Count : 4 15 15 // 16 16 17 #ifndef VALIDATE_H 18 #define VALIDATE_H 17 #pragma once 19 18 20 19 #include <list> // for list … … 31 30 } // namespace SymTab 32 31 33 #endif // VALIDATE_H34 35 32 // Local Variables: // 36 33 // tab-width: 4 // -
src/SymTab/module.mk
re0a653d r33218c6 10 10 ## Author : Richard C. Bilson 11 11 ## Created On : Mon Jun 1 17:49:17 2015 12 ## Last Modified By : Rob Schluntz13 ## Last Modified On : Tue Jul 07 16:22:23 201514 ## Update Count : 212 ## Last Modified By : Andrew Beach 13 ## Last Modified On : Wed Jul 12 13:06:00 2017 14 ## Update Count : 3 15 15 ############################################################################### 16 16 … … 21 21 SymTab/ImplementationType.cc \ 22 22 SymTab/TypeEquality.cc \ 23 SymTab/Autogen.cc 23 SymTab/Autogen.cc \ 24 SymTab/TreeStruct.cc -
src/SynTree/AddStmtVisitor.h
re0a653d r33218c6 10 10 // Created On : Wed Jun 22 12:05:48 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 12 17:50:32 201613 // Update Count : 812 // Last Modified On : Sat Jul 22 09:51:08 2017 13 // Update Count : 9 14 14 // 15 15 16 #ifndef ADD_STATEMENT_VISITOR_H 17 #define ADD_STATEMENT_VISITOR_H 16 #pragma once 18 17 19 18 #include <list> … … 42 41 }; 43 42 44 #endif // ADD_STATEMENT_VISITOR_H 43 // Local Variables: // 44 // tab-width: 4 // 45 // mode: c++ // 46 // compile-command: "make install" // 47 // End: // -
src/SynTree/Attribute.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jan 18 16:27:11201713 // Update Count : 3 812 // Last Modified On : Sat Jul 22 09:54:14 2017 13 // Update Count : 39 14 14 // 15 15 16 #ifndef GCC_ATTRIBUTE_H 17 #define GCC_ATTRIBUTE_H 16 #pragma once 18 17 19 18 #include "SynTree.h" … … 42 41 const std::list< Attribute * > noAttributes; 43 42 44 #endif45 46 43 // Local Variables: // 47 44 // tab-width: 4 // -
src/SynTree/BaseSyntaxNode.h
re0a653d r33218c6 14 14 // 15 15 16 #ifndef BASE_SYNTAX_NODE_H 17 #define BASE_SYNTAX_NODE_H 16 #pragma once 18 17 19 18 #include "Common/utility.h" … … 29 28 }; 30 29 31 #endif // BASE_SYNTAX_NODE_H32 33 30 // Local Variables: // 34 31 // tab-width: 4 // -
src/SynTree/Constant.cc
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Jun 22 10:11:00 201713 // Update Count : 2 812 // Last Modified On : Fri Jul 14 14:50:00 2017 13 // Update Count : 29 14 14 // 15 15 … … 46 46 } 47 47 48 Constant Constant::null( Type * ptrtype ) { 49 if ( nullptr == ptrtype ) { 50 ptrtype = new PointerType( 51 Type::Qualifiers(), 52 new VoidType( Type::Qualifiers() ) 53 ); 54 } 55 56 return Constant( ptrtype, "0", (unsigned long long int)0 ); 57 } 58 48 59 unsigned long long Constant::get_ival() const { 49 60 assertf( safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." ); -
src/SynTree/Constant.h
re0a653d r33218c6 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Thr Jun 22 10:13:00201713 // Update Count : 1 511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:54:46 2017 13 // Update Count : 17 14 14 // 15 15 16 #ifndef CONSTANT_H 17 #define CONSTANT_H 16 #pragma once 18 17 19 18 #include "SynTree.h" … … 44 43 static Constant from_double( double d ); 45 44 45 /// generates a null pointer value for the given type. void * if omitted. 46 static Constant null( Type * ptrtype = nullptr ); 47 46 48 virtual void accept( Visitor & v ) { v.visit( this ); } 47 49 virtual Constant * acceptMutator( Mutator & m ) { return m.mutate( this ); } … … 58 60 }; 59 61 60 #endif // CONSTANT_H61 62 62 // Local Variables: // 63 63 // tab-width: 4 // -
src/SynTree/Declaration.h
re0a653d r33218c6 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus Jun 27 15:31:00 2017 13 // Update Count : 122 14 // 15 16 #ifndef DECLARATION_H 17 #define DECLARATION_H 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:52:59 2017 13 // Update Count : 124 14 // 15 16 #pragma once 18 17 19 18 #include <string> … … 266 265 typedef AggregateDecl Parent; 267 266 public: 268 StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ) {} 267 StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ), tagged( false ), parent_name( "" ) {} 268 StructDecl( const std::string &name, const std::string *parent, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( DeclarationNode::Struct ), tagged( true ), parent_name( parent ? *parent : "" ) {} 269 269 StructDecl( const StructDecl &other ) : Parent( other ) {} 270 270 … … 273 273 bool is_thread() { return kind == DeclarationNode::Thread; } 274 274 275 // Tagged/Tree Structure Excetion 276 bool get_tagged() { return tagged; } 277 void set_tagged( bool newValue ) { tagged = newValue; } 278 bool has_parent() { return parent_name != ""; } 279 std::string get_parentName() { return parent_name; } 280 275 281 virtual StructDecl *clone() const { return new StructDecl( *this ); } 276 282 virtual void accept( Visitor &v ) { v.visit( this ); } … … 279 285 DeclarationNode::Aggregate kind; 280 286 virtual std::string typeString() const; 287 288 bool tagged; 289 std::string parent_name; 281 290 }; 282 291 … … 342 351 std::ostream & operator<<( std::ostream & out, const Declaration * decl ); 343 352 std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data ); 344 345 #endif // DECLARATION_H346 353 347 354 // Local Variables: // -
src/SynTree/Expression.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 30 16:44:00201713 // Update Count : 4 112 // Last Modified On : Sat Jul 22 09:53:16 2017 13 // Update Count : 42 14 14 // 15 15 16 #ifndef EXPRESSION_H 17 #define EXPRESSION_H 16 #pragma once 18 17 19 18 #include <map> … … 798 797 std::ostream & operator<<( std::ostream & out, const Expression * expr ); 799 798 800 #endif // EXPRESSION_H801 802 799 // Local Variables: // 803 800 // tab-width: 4 // -
src/SynTree/Initializer.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 23 16:12:42 201713 // Update Count : 2 012 // Last Modified On : Sat Jul 22 09:52:02 2017 13 // Update Count : 21 14 14 // 15 15 16 #ifndef INITIALIZER_H 17 #define INITIALIZER_H 16 #pragma once 18 17 19 18 #include <cassert> … … 141 140 std::ostream & operator<<( std::ostream & out, const Designation * des ); 142 141 143 #endif // INITIALIZER_H144 145 142 // Local Variables: // 146 143 // tab-width: 4 // -
src/SynTree/Label.h
re0a653d r33218c6 10 10 // Created On : Wed Jun 8 12:53:12 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Aug 7 14:44:29 201613 // Update Count : 212 // Last Modified On : Sat Jul 22 09:52:44 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef LABEL_H 17 #define LABEL_H 16 #pragma once 18 17 19 18 #include <string> … … 51 50 static const std::list< Label > noLabels; 52 51 53 #endif // LABEL_H54 55 52 // Local Variables: // 56 53 // tab-width: 4 // -
src/SynTree/Mutator.h
re0a653d r33218c6 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Thu Jun 8 15:45:00 201713 // Update Count : 1 411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:51:30 2017 13 // Update Count : 15 14 14 // 15 15 #include <cassert> … … 18 18 #include "Common/SemanticError.h" 19 19 20 #ifndef MUTATOR_H 21 #define MUTATOR_H 20 #pragma once 22 21 23 22 class Mutator { … … 150 149 } 151 150 152 #endif // MUTATOR_H153 154 151 // Local Variables: // 155 152 // tab-width: 4 // -
src/SynTree/Statement.h
re0a653d r33218c6 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Mon Jun 12 13:35:00201713 // Update Count : 6 711 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:54:32 2017 13 // Update Count : 68 14 14 // 15 15 16 #ifndef STATEMENT_H 17 #define STATEMENT_H 16 #pragma once 18 17 19 18 #include "BaseSyntaxNode.h" … … 428 427 std::ostream & operator<<( std::ostream & out, const Statement * statement ); 429 428 430 #endif // STATEMENT_H431 432 429 // Local Variables: // 433 430 // tab-width: 4 // -
src/SynTree/SynTree.h
re0a653d r33218c6 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Thu Jun 8 17:00:00201713 // Update Count : 911 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:51:46 2017 13 // Update Count : 10 14 14 // 15 15 16 #ifndef SYNTREE_H 17 #define SYNTREE_H 16 #pragma once 18 17 19 18 #include <string> … … 135 134 class Attribute; 136 135 137 #endif // SYNTREE_H138 139 136 // Local Variables: // 140 137 // tab-width: 4 // -
src/SynTree/Type.h
re0a653d r33218c6 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Mar 23 16:16:36201713 // Update Count : 1 4912 // Last Modified On : Sat Jul 22 09:53:29 2017 13 // Update Count : 151 14 14 // 15 15 16 #ifndef TYPE_H 17 #define TYPE_H 16 #pragma once 18 17 19 18 #include "BaseSyntaxNode.h" … … 172 171 }; 173 172 174 extern Type::Qualifiers emptyQualifiers; // no qualifiers on constants173 extern Type::Qualifiers noQualifiers; // no qualifiers on constants 175 174 176 175 class VoidType : public Type { … … 602 601 std::ostream & operator<<( std::ostream & out, const Type * type ); 603 602 604 #endif // TYPE_H605 606 603 // Local Variables: // 607 604 // tab-width: 4 // -
src/SynTree/TypeSubstitution.h
re0a653d r33218c6 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri Apr 29 15:00:20 201613 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:52:24 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef TYPESUBSTITUTION_H 17 #define TYPESUBSTITUTION_H 16 #pragma once 18 17 19 18 #include <map> … … 180 179 std::ostream & operator<<( std::ostream & out, const TypeSubstitution & sub ); 181 180 182 #endif // TYPESUBSTITUTION_H183 184 181 // Local Variables: // 185 182 // tab-width: 4 // -
src/SynTree/VarExprReplacer.h
re0a653d r33218c6 9 9 // Author : Rob Schluntz 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri May 13 11:27:52 201613 // Update Count : 511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:53:41 2017 13 // Update Count : 6 14 14 // 15 15 16 #ifndef VAR_EXPR_REPLACER_H 17 #define VAR_EXPR_REPLACER_H 16 #pragma once 18 17 19 18 #include <map> … … 35 34 }; 36 35 37 #endif // VAR_EXPR_REPLACER_H38 39 36 // Local Variables: // 40 37 // tab-width: 4 // -
src/SynTree/Visitor.h
re0a653d r33218c6 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Thr Jun 08 15:45:00201713 // Update Count : 1 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:54:04 2017 13 // Update Count : 12 14 14 // 15 15