ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change
on this file since 8c17ab0 was
51b7345,
checked in by Peter A. Buhr <pabuhr@…>, 10 years ago
|
initial commit
|
-
Property mode set to
100644
|
File size:
1.7 KB
|
Line | |
---|
1 | /* |
---|
2 | * This file is part of the Cforall project |
---|
3 | * |
---|
4 | * $Id: LinkageSpec.cc,v 1.3 2003/01/29 14:55:08 rcbilson Exp $ |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include <string> |
---|
9 | #include <cassert> |
---|
10 | |
---|
11 | #include "LinkageSpec.h" |
---|
12 | #include "SemanticError.h" |
---|
13 | |
---|
14 | /* static class method */ |
---|
15 | LinkageSpec::Type |
---|
16 | LinkageSpec::fromString( const std::string &stringSpec ) |
---|
17 | { |
---|
18 | if( stringSpec == "\"Cforall\"" ) { |
---|
19 | return Cforall; |
---|
20 | } else if( stringSpec == "\"C\"" ) { |
---|
21 | return C; |
---|
22 | } else { |
---|
23 | throw SemanticError( "Invalid linkage specifier " + stringSpec ); |
---|
24 | } |
---|
25 | } |
---|
26 | |
---|
27 | /* static class method */ |
---|
28 | std::string |
---|
29 | LinkageSpec::toString( LinkageSpec::Type linkage ) |
---|
30 | { |
---|
31 | switch( linkage ) { |
---|
32 | case Intrinsic: |
---|
33 | return "intrinsic"; |
---|
34 | |
---|
35 | case Cforall: |
---|
36 | return "Cforall"; |
---|
37 | |
---|
38 | case C: |
---|
39 | return "C"; |
---|
40 | |
---|
41 | case AutoGen: |
---|
42 | return "automatically generated"; |
---|
43 | |
---|
44 | case Compiler: |
---|
45 | return "compiler built-in"; |
---|
46 | } |
---|
47 | assert( false ); |
---|
48 | return ""; |
---|
49 | } |
---|
50 | |
---|
51 | /* static class method */ |
---|
52 | bool |
---|
53 | LinkageSpec::isDecoratable( Type t ) |
---|
54 | { |
---|
55 | switch( t ) { |
---|
56 | case Intrinsic: |
---|
57 | case Cforall: |
---|
58 | case AutoGen: |
---|
59 | return true; |
---|
60 | |
---|
61 | case C: |
---|
62 | case Compiler: |
---|
63 | return false; |
---|
64 | } |
---|
65 | assert( false ); |
---|
66 | return false; |
---|
67 | } |
---|
68 | |
---|
69 | /* static class method */ |
---|
70 | bool |
---|
71 | LinkageSpec::isGeneratable( Type t ) |
---|
72 | { |
---|
73 | switch( t ) { |
---|
74 | case Intrinsic: |
---|
75 | case Cforall: |
---|
76 | case AutoGen: |
---|
77 | case C: |
---|
78 | return true; |
---|
79 | |
---|
80 | case Compiler: |
---|
81 | return false; |
---|
82 | } |
---|
83 | assert( false ); |
---|
84 | return false; |
---|
85 | } |
---|
86 | |
---|
87 | /* static class method */ |
---|
88 | bool |
---|
89 | LinkageSpec::isOverloadable( Type t ) |
---|
90 | { |
---|
91 | return isDecoratable( t ); |
---|
92 | } |
---|
93 | |
---|
94 | /* static class method */ |
---|
95 | bool |
---|
96 | LinkageSpec::isBuiltin( Type t ) |
---|
97 | { |
---|
98 | switch( t ) { |
---|
99 | case Cforall: |
---|
100 | case AutoGen: |
---|
101 | case C: |
---|
102 | return false; |
---|
103 | |
---|
104 | case Intrinsic: |
---|
105 | case Compiler: |
---|
106 | return true; |
---|
107 | } |
---|
108 | assert( false ); |
---|
109 | return false; |
---|
110 | } |
---|
111 | |
---|
Note: See
TracBrowser
for help on using the repository browser.