ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since ac911f4 was
d3b7937,
checked in by Peter A. Buhr <pabuhr@…>, 9 years ago
|
building runtime library (first attempt)
|
-
Property mode set to
100644
|
File size:
2.1 KB
|
Line | |
---|
1 | // |
---|
2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo |
---|
3 | // |
---|
4 | // The contents of this file are covered under the licence agreement in the |
---|
5 | // file "LICENCE" distributed with Cforall. |
---|
6 | // |
---|
7 | // LinkageSpec.cc -- |
---|
8 | // |
---|
9 | // Author : Rodolfo G. Esteves |
---|
10 | // Created On : Sat May 16 13:22:09 2015 |
---|
11 | // Last Modified By : Rob Schluntz |
---|
12 | // Last Modified On : Wed Aug 19 15:53:05 2015 |
---|
13 | // Update Count : 5 |
---|
14 | // |
---|
15 | |
---|
16 | #include <string> |
---|
17 | #include <cassert> |
---|
18 | |
---|
19 | #include "LinkageSpec.h" |
---|
20 | #include "Common/SemanticError.h" |
---|
21 | |
---|
22 | LinkageSpec::Type LinkageSpec::fromString( const std::string &stringSpec ) { |
---|
23 | if ( stringSpec == "\"Cforall\"" ) { |
---|
24 | return Cforall; |
---|
25 | } else if ( stringSpec == "\"C\"" ) { |
---|
26 | return C; |
---|
27 | } else { |
---|
28 | throw SemanticError( "Invalid linkage specifier " + stringSpec ); |
---|
29 | } |
---|
30 | } |
---|
31 | |
---|
32 | std::string LinkageSpec::toString( LinkageSpec::Type linkage ) { |
---|
33 | switch ( linkage ) { |
---|
34 | case Intrinsic: |
---|
35 | return "intrinsic"; |
---|
36 | case Cforall: |
---|
37 | return "Cforall"; |
---|
38 | case C: |
---|
39 | return "C"; |
---|
40 | case AutoGen: |
---|
41 | return "automatically generated"; |
---|
42 | case Compiler: |
---|
43 | return "compiler built-in"; |
---|
44 | } |
---|
45 | assert( false ); |
---|
46 | return ""; |
---|
47 | } |
---|
48 | |
---|
49 | bool LinkageSpec::isDecoratable( Type t ) { |
---|
50 | switch ( t ) { |
---|
51 | case Intrinsic: |
---|
52 | case Cforall: |
---|
53 | case AutoGen: |
---|
54 | return true; |
---|
55 | case C: |
---|
56 | case Compiler: |
---|
57 | return false; |
---|
58 | } |
---|
59 | assert( false ); |
---|
60 | return false; |
---|
61 | } |
---|
62 | |
---|
63 | bool LinkageSpec::isGeneratable( Type t ) { |
---|
64 | switch ( t ) { |
---|
65 | case Intrinsic: |
---|
66 | case Cforall: |
---|
67 | case AutoGen: |
---|
68 | case C: |
---|
69 | return true; |
---|
70 | case Compiler: |
---|
71 | return false; |
---|
72 | } |
---|
73 | assert( false ); |
---|
74 | return false; |
---|
75 | } |
---|
76 | |
---|
77 | bool LinkageSpec::isOverloadable( Type t ) { |
---|
78 | return isDecoratable( t ); |
---|
79 | } |
---|
80 | |
---|
81 | |
---|
82 | bool LinkageSpec::isOverridable( Type t ) { |
---|
83 | switch ( t ) { |
---|
84 | case Intrinsic: |
---|
85 | case AutoGen: |
---|
86 | return true; |
---|
87 | case Cforall: |
---|
88 | case C: |
---|
89 | case Compiler: |
---|
90 | return false; |
---|
91 | } |
---|
92 | assert( false ); |
---|
93 | return false; |
---|
94 | } |
---|
95 | |
---|
96 | bool LinkageSpec::isBuiltin( Type t ) { |
---|
97 | switch ( t ) { |
---|
98 | case Cforall: |
---|
99 | case AutoGen: |
---|
100 | case C: |
---|
101 | return false; |
---|
102 | case Intrinsic: |
---|
103 | case Compiler: |
---|
104 | return true; |
---|
105 | } |
---|
106 | assert( false ); |
---|
107 | return false; |
---|
108 | } |
---|
109 | |
---|
110 | // Local Variables: // |
---|
111 | // tab-width: 4 // |
---|
112 | // mode: c++ // |
---|
113 | // compile-command: "make install" // |
---|
114 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.