source: src/Parser/LinkageSpec.cc @ 4999940

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 4999940 was 79970ed, checked in by Rob Schluntz <rschlunt@…>, 8 years ago

implement warnings for missing struct member constructor calls, remove bad clones

  • Property mode set to 100644
File size: 2.3 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 : Sun Aug 21 12:32:53 2016
13// Update Count     : 17
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 &spec ) {
23        if ( spec == "\"Cforall\"" ) {
24                return Cforall;
25        } else if ( spec == "\"C\"" ) {
26                return C;
27        } else {
28                throw SemanticError( "Invalid linkage specifier " + spec );
29        } // if
30        delete &spec;                                                                           // allocated by lexer
31}
32
33std::string LinkageSpec::toString( LinkageSpec::Spec linkage ) {
34        assert( linkage >= 0 && linkage < LinkageSpec::NoOfSpecs );
35        static const char *linkageKinds[LinkageSpec::NoOfSpecs] = {
36                "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in",
37        };
38        return linkageKinds[linkage];
39}
40
41bool LinkageSpec::isDecoratable( Spec spec ) {
42        assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
43        static bool decoratable[LinkageSpec::NoOfSpecs] = {
44                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
45                        true,           true,           false,  true,           false,
46        };
47        return decoratable[spec];
48}
49
50bool LinkageSpec::isGeneratable( Spec spec ) {
51        assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
52        static bool generatable[LinkageSpec::NoOfSpecs] = {
53                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
54                        true,           true,           true,   true,           false,
55        };
56        return generatable[spec];
57}
58
59bool LinkageSpec::isOverridable( Spec spec ) {
60        assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
61        static bool overridable[LinkageSpec::NoOfSpecs] = {
62                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
63                        true,           false,          false,  true,           false,
64        };
65        return overridable[spec];
66}
67
68bool LinkageSpec::isBuiltin( Spec spec ) {
69        assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
70        static bool builtin[LinkageSpec::NoOfSpecs] = {
71                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
72                        true,           false,          false,  false,          true,
73        };
74        return builtin[spec];
75}
76
77// Local Variables: //
78// tab-width: 4 //
79// mode: c++ //
80// compile-command: "make install" //
81// End: //
Note: See TracBrowser for help on using the repository browser.