source: src/Parser/LinkageSpec.cc @ 8b7ee09

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 8b7ee09 was 8b7ee09, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

rename type LinkageSpec::Type to LinkageSpec::Spec, which affects many files

  • Property mode set to 100644
File size: 2.0 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 : Thu Aug 18 23:47:14 2016
13// Update Count     : 12
14//
15
16#include <string>
17#include <cassert>
18
19#include "LinkageSpec.h"
20#include "Common/SemanticError.h"
21
22LinkageSpec::Spec 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::Spec linkage ) {
33        static const char *linkageKinds[LinkageSpec::NoOfSpecs] = {
34                "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in",
35        };
36        return linkageKinds[linkage];
37}
38
39bool LinkageSpec::isDecoratable( Spec t ) {
40        static bool decoratable[LinkageSpec::NoOfSpecs] = {
41                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
42                        true,           true,           false,  true,           false, 
43        };
44        return decoratable[t];
45}
46
47bool LinkageSpec::isGeneratable( Spec t ) {
48        static bool generatable[LinkageSpec::NoOfSpecs] = {
49                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
50                        true,           true,           true,   true,           false, 
51        };
52        return generatable[t];
53}
54
55bool LinkageSpec::isOverloadable( Spec t ) {
56        return isDecoratable( t );
57}
58
59
60bool LinkageSpec::isOverridable( Spec t ) {
61        static bool overridable[LinkageSpec::NoOfSpecs] = {
62                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
63                        true,           false,          false,  true,           false, 
64        };
65        return overridable[t];
66}
67
68bool LinkageSpec::isBuiltin( Spec t ) {
69        static bool builtin[LinkageSpec::NoOfSpecs] = {
70                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
71                        true,           false,          false,  false,          true, 
72        };
73        return builtin[t];
74}
75
76// Local Variables: //
77// tab-width: 4 //
78// mode: c++ //
79// compile-command: "make install" //
80// End: //
Note: See TracBrowser for help on using the repository browser.