source: src/Parser/LinkageSpec.cc@ 258eb5c9

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors ctor deferred_resn demangler enum forall-pointer-decay gc_noraii jacob/cs343-translation jenkins-sandbox memory new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new string with_gc
Last change on this file since 258eb5c9 was 843054c2, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

licencing: seventh groups of files

  • Property mode set to 100644
File size: 1.9 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 : Peter A. Buhr
12// Last Modified On : Sat May 16 13:23:21 2015
13// Update Count : 2
14//
15
16#include <string>
17#include <cassert>
18
19#include "LinkageSpec.h"
20#include "SemanticError.h"
21
22LinkageSpec::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
32std::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
49bool 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
63bool 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
77bool LinkageSpec::isOverloadable( Type t ) {
78 return isDecoratable( t );
79}
80
81bool LinkageSpec::isBuiltin( Type t ) {
82 switch ( t ) {
83 case Cforall:
84 case AutoGen:
85 case C:
86 return false;
87 case Intrinsic:
88 case Compiler:
89 return true;
90 }
91 assert( false );
92 return false;
93}
94
95// Local Variables: //
96// tab-width: 4 //
97// mode: c++ //
98// compile-command: "make install" //
99// End: //
Note: See TracBrowser for help on using the repository browser.