source: src/Parser/LinkageSpec.cc@ e85a8631

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

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

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[b87a5ed]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
[3b8e52c]11// Last Modified By : Peter A. Buhr
[8b7ee09]12// Last Modified On : Thu Aug 18 23:47:14 2016
13// Update Count : 12
[b87a5ed]14//
15
[51b73452]16#include <string>
17#include <cassert>
18
19#include "LinkageSpec.h"
[d3b7937]20#include "Common/SemanticError.h"
[51b73452]21
[8b7ee09]22LinkageSpec::Spec LinkageSpec::fromString( const std::string &stringSpec ) {
[b87a5ed]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 }
[51b73452]30}
31
[8b7ee09]32std::string LinkageSpec::toString( LinkageSpec::Spec linkage ) {
33 static const char *linkageKinds[LinkageSpec::NoOfSpecs] = {
[3b8e52c]34 "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in",
35 };
36 return linkageKinds[linkage];
[51b73452]37}
38
[8b7ee09]39bool LinkageSpec::isDecoratable( Spec t ) {
40 static bool decoratable[LinkageSpec::NoOfSpecs] = {
[3b8e52c]41 // Intrinsic, Cforall, C, AutoGen, Compiler
42 true, true, false, true, false,
43 };
[8b7ee09]44 return decoratable[t];
[51b73452]45}
46
[8b7ee09]47bool LinkageSpec::isGeneratable( Spec t ) {
48 static bool generatable[LinkageSpec::NoOfSpecs] = {
[3b8e52c]49 // Intrinsic, Cforall, C, AutoGen, Compiler
50 true, true, true, true, false,
51 };
[8b7ee09]52 return generatable[t];
[51b73452]53}
54
[8b7ee09]55bool LinkageSpec::isOverloadable( Spec t ) {
[b87a5ed]56 return isDecoratable( t );
[51b73452]57}
58
[4aa0858]59
[8b7ee09]60bool LinkageSpec::isOverridable( Spec t ) {
61 static bool overridable[LinkageSpec::NoOfSpecs] = {
[3b8e52c]62 // Intrinsic, Cforall, C, AutoGen, Compiler
63 true, false, false, true, false,
64 };
[8b7ee09]65 return overridable[t];
[4aa0858]66}
67
[8b7ee09]68bool LinkageSpec::isBuiltin( Spec t ) {
69 static bool builtin[LinkageSpec::NoOfSpecs] = {
[3b8e52c]70 // Intrinsic, Cforall, C, AutoGen, Compiler
71 true, false, false, false, true,
72 };
[8b7ee09]73 return builtin[t];
[51b73452]74}
[b87a5ed]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.