source: translator/Parser.old/LinkageSpec.cc @ 1db2c5be

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 1db2c5be 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 */
15LinkageSpec::Type
16LinkageSpec::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 */
28std::string
29LinkageSpec::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 */
52bool 
53LinkageSpec::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 */
70bool 
71LinkageSpec::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 */
88bool 
89LinkageSpec::isOverloadable( Type t )
90{
91  return isDecoratable( t );
92}
93
94/* static class method */
95bool 
96LinkageSpec::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.