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
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//
[79970ed]7// LinkageSpec.cc --
8//
[b87a5ed]9// Author : Rodolfo G. Esteves
10// Created On : Sat May 16 13:22:09 2015
[fa4805f]11// Last Modified By : Andrew Beach
12// Last Modified On : Wed Jun 28 11:51:00 2017
13// Update Count : 24
[79970ed]14//
[b87a5ed]15
[f2a4f6c]16#include <memory>
[51b73452]17#include <string>
18#include <cassert>
[faddbd8]19using namespace std;
[51b73452]20
21#include "LinkageSpec.h"
[d3b7937]22#include "Common/SemanticError.h"
[51b73452]23
[faddbd8]24LinkageSpec::Spec LinkageSpec::linkageCheck( const string * spec ) {
25 unique_ptr<const string> guard( spec ); // allocated by lexer
26 if ( *spec == "\"Cforall\"" ) {
[b87a5ed]27 return Cforall;
[faddbd8]28 } else if ( *spec == "\"C\"" ) {
[b87a5ed]29 return C;
[fa4805f]30 } else if ( *spec == "\"BuiltinC\"" ) {
31 return BuiltinC;
[b87a5ed]32 } else {
[faddbd8]33 throw SemanticError( "Invalid linkage specifier " + *spec );
[ab57786]34 } // if
[51b73452]35}
36
[faddbd8]37string LinkageSpec::linkageName( LinkageSpec::Spec linkage ) {
38 assert( 0 <= linkage && linkage < LinkageSpec::NoOfSpecs );
[8b7ee09]39 static const char *linkageKinds[LinkageSpec::NoOfSpecs] = {
[fa4805f]40 "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in", "cfa built-in", "c built-in",
[3b8e52c]41 };
42 return linkageKinds[linkage];
[51b73452]43}
44
[fa4805f]45bool LinkageSpec::isMangled( Spec spec ) {
[faddbd8]46 assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs );
[8b7ee09]47 static bool decoratable[LinkageSpec::NoOfSpecs] = {
[fa4805f]48 // Intrinsic, Cforall, C, AutoGen, Compiler,
[79970ed]49 true, true, false, true, false,
[fa4805f]50 // Builtin, BuiltinC,
51 true, false,
[3b8e52c]52 };
[ab57786]53 return decoratable[spec];
[51b73452]54}
55
[ab57786]56bool LinkageSpec::isGeneratable( Spec spec ) {
[faddbd8]57 assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs );
[8b7ee09]58 static bool generatable[LinkageSpec::NoOfSpecs] = {
[fa4805f]59 // Intrinsic, Cforall, C, AutoGen, Compiler,
[79970ed]60 true, true, true, true, false,
[fa4805f]61 // Builtin, BuiltinC,
62 true, true,
[3b8e52c]63 };
[ab57786]64 return generatable[spec];
[51b73452]65}
66
[ab57786]67bool LinkageSpec::isOverridable( Spec spec ) {
[79970ed]68 assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
[8b7ee09]69 static bool overridable[LinkageSpec::NoOfSpecs] = {
[fa4805f]70 // Intrinsic, Cforall, C, AutoGen, Compiler,
[79970ed]71 true, false, false, true, false,
[fa4805f]72 // Builtin, BuiltinC,
73 false, false,
[3b8e52c]74 };
[ab57786]75 return overridable[spec];
[4aa0858]76}
77
[ab57786]78bool LinkageSpec::isBuiltin( Spec spec ) {
[79970ed]79 assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
[8b7ee09]80 static bool builtin[LinkageSpec::NoOfSpecs] = {
[fa4805f]81 // Intrinsic, Cforall, C, AutoGen, Compiler,
[79970ed]82 true, false, false, false, true,
[fa4805f]83 // Builtin, BuiltinC,
84 true, true,
[3b8e52c]85 };
[ab57786]86 return builtin[spec];
[51b73452]87}
[b87a5ed]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.