source: src/Parser/LinkageSpec.cc@ 2b7afbd

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors 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 2b7afbd was fa4805f, checked in by Andrew Beach <ajbeach@…>, 8 years ago

The builtins.cf now includes exception handling functions.

  • Property mode set to 100644
File size: 2.6 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 : Andrew Beach
12// Last Modified On : Wed Jun 28 11:51:00 2017
13// Update Count : 24
14//
15
16#include <memory>
17#include <string>
18#include <cassert>
19using namespace std;
20
21#include "LinkageSpec.h"
22#include "Common/SemanticError.h"
23
24LinkageSpec::Spec LinkageSpec::linkageCheck( const string * spec ) {
25 unique_ptr<const string> guard( spec ); // allocated by lexer
26 if ( *spec == "\"Cforall\"" ) {
27 return Cforall;
28 } else if ( *spec == "\"C\"" ) {
29 return C;
30 } else if ( *spec == "\"BuiltinC\"" ) {
31 return BuiltinC;
32 } else {
33 throw SemanticError( "Invalid linkage specifier " + *spec );
34 } // if
35}
36
37string LinkageSpec::linkageName( LinkageSpec::Spec linkage ) {
38 assert( 0 <= linkage && linkage < LinkageSpec::NoOfSpecs );
39 static const char *linkageKinds[LinkageSpec::NoOfSpecs] = {
40 "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in", "cfa built-in", "c built-in",
41 };
42 return linkageKinds[linkage];
43}
44
45bool LinkageSpec::isMangled( Spec spec ) {
46 assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs );
47 static bool decoratable[LinkageSpec::NoOfSpecs] = {
48 // Intrinsic, Cforall, C, AutoGen, Compiler,
49 true, true, false, true, false,
50 // Builtin, BuiltinC,
51 true, false,
52 };
53 return decoratable[spec];
54}
55
56bool LinkageSpec::isGeneratable( Spec spec ) {
57 assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs );
58 static bool generatable[LinkageSpec::NoOfSpecs] = {
59 // Intrinsic, Cforall, C, AutoGen, Compiler,
60 true, true, true, true, false,
61 // Builtin, BuiltinC,
62 true, true,
63 };
64 return generatable[spec];
65}
66
67bool LinkageSpec::isOverridable( Spec spec ) {
68 assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
69 static bool overridable[LinkageSpec::NoOfSpecs] = {
70 // Intrinsic, Cforall, C, AutoGen, Compiler,
71 true, false, false, true, false,
72 // Builtin, BuiltinC,
73 false, false,
74 };
75 return overridable[spec];
76}
77
78bool LinkageSpec::isBuiltin( Spec spec ) {
79 assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
80 static bool builtin[LinkageSpec::NoOfSpecs] = {
81 // Intrinsic, Cforall, C, AutoGen, Compiler,
82 true, false, false, false, true,
83 // Builtin, BuiltinC,
84 true, true,
85 };
86 return builtin[spec];
87}
88
89// Local Variables: //
90// tab-width: 4 //
91// mode: c++ //
92// compile-command: "make install" //
93// End: //
Note: See TracBrowser for help on using the repository browser.