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 02e9ae2 was
3848e0e,
checked in by Peter A. Buhr <pabuhr@…>, 10 years ago
|
underscore changes, ptrdiff_t changes, formating, _Bool prelude
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Line | |
---|
1 | #include <string> |
---|
2 | #include <cassert> |
---|
3 | |
---|
4 | #include "LinkageSpec.h" |
---|
5 | #include "SemanticError.h" |
---|
6 | |
---|
7 | LinkageSpec::Type LinkageSpec::fromString( const std::string &stringSpec ) { |
---|
8 | if ( stringSpec == "\"Cforall\"" ) { |
---|
9 | return Cforall; |
---|
10 | } else if ( stringSpec == "\"C\"" ) { |
---|
11 | return C; |
---|
12 | } else { |
---|
13 | throw SemanticError( "Invalid linkage specifier " + stringSpec ); |
---|
14 | } |
---|
15 | } |
---|
16 | |
---|
17 | std::string LinkageSpec::toString( LinkageSpec::Type linkage ) { |
---|
18 | switch ( linkage ) { |
---|
19 | case Intrinsic: |
---|
20 | return "intrinsic"; |
---|
21 | case Cforall: |
---|
22 | return "Cforall"; |
---|
23 | case C: |
---|
24 | return "C"; |
---|
25 | case AutoGen: |
---|
26 | return "automatically generated"; |
---|
27 | case Compiler: |
---|
28 | return "compiler built-in"; |
---|
29 | } |
---|
30 | assert( false ); |
---|
31 | return ""; |
---|
32 | } |
---|
33 | |
---|
34 | bool LinkageSpec::isDecoratable( Type t ) { |
---|
35 | switch ( t ) { |
---|
36 | case Intrinsic: |
---|
37 | case Cforall: |
---|
38 | case AutoGen: |
---|
39 | return true; |
---|
40 | case C: |
---|
41 | case Compiler: |
---|
42 | return false; |
---|
43 | } |
---|
44 | assert( false ); |
---|
45 | return false; |
---|
46 | } |
---|
47 | |
---|
48 | bool LinkageSpec::isGeneratable( Type t ) { |
---|
49 | switch ( t ) { |
---|
50 | case Intrinsic: |
---|
51 | case Cforall: |
---|
52 | case AutoGen: |
---|
53 | case C: |
---|
54 | return true; |
---|
55 | case Compiler: |
---|
56 | return false; |
---|
57 | } |
---|
58 | assert( false ); |
---|
59 | return false; |
---|
60 | } |
---|
61 | |
---|
62 | bool LinkageSpec::isOverloadable( Type t ) { |
---|
63 | return isDecoratable( t ); |
---|
64 | } |
---|
65 | |
---|
66 | bool LinkageSpec::isBuiltin( Type t ) { |
---|
67 | switch ( t ) { |
---|
68 | case Cforall: |
---|
69 | case AutoGen: |
---|
70 | case C: |
---|
71 | return false; |
---|
72 | case Intrinsic: |
---|
73 | case Compiler: |
---|
74 | return true; |
---|
75 | } |
---|
76 | assert( false ); |
---|
77 | return false; |
---|
78 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.