ADT
arm-eh
ast-experimental
enum
forall-pointer-decay
jacob/cs343-translation
new-ast
new-ast-unique-expr
pthread-emulation
qualifiedEnum
Rev | Line | |
---|
[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
|
---|
[b499c18] | 12 | // Last Modified On : Thr Spt 12 15:59:00 2018
|
---|
| 13 | // Update Count : 26
|
---|
[79970ed] | 14 | //
|
---|
[b87a5ed] | 15 |
|
---|
[f2a4f6c] | 16 | #include <memory>
|
---|
[51b73452] | 17 | #include <string>
|
---|
| 18 | #include <cassert>
|
---|
[faddbd8] | 19 | using namespace std;
|
---|
[51b73452] | 20 |
|
---|
| 21 | #include "LinkageSpec.h"
|
---|
[d3b7937] | 22 | #include "Common/SemanticError.h"
|
---|
[51b73452] | 23 |
|
---|
[54d714e] | 24 | namespace LinkageSpec {
|
---|
| 25 |
|
---|
[d55d7a6] | 26 | Spec linkageUpdate( CodeLocation location, Spec old_spec, const string * cmd ) {
|
---|
[54d714e] | 27 | assert( cmd );
|
---|
| 28 | unique_ptr<const string> guard( cmd ); // allocated by lexer
|
---|
| 29 | if ( *cmd == "\"Cforall\"" ) {
|
---|
| 30 | old_spec.is_mangled = true;
|
---|
| 31 | return old_spec;
|
---|
| 32 | } else if ( *cmd == "\"C\"" ) {
|
---|
| 33 | old_spec.is_mangled = false;
|
---|
| 34 | return old_spec;
|
---|
| 35 | } else {
|
---|
[a16764a6] | 36 | SemanticError( location, "Invalid linkage specifier " + *cmd );
|
---|
[54d714e] | 37 | } // if
|
---|
[51b73452] | 38 | }
|
---|
| 39 |
|
---|
[54d714e] | 40 | std::string linkageName( Spec linkage ) {
|
---|
| 41 | switch ( linkage ) {
|
---|
| 42 | case Intrinsic:
|
---|
| 43 | return "intrinsic";
|
---|
| 44 | case C:
|
---|
| 45 | return "C";
|
---|
| 46 | case Cforall:
|
---|
| 47 | return "Cforall";
|
---|
| 48 | case AutoGen:
|
---|
| 49 | return "autogenerated cfa";
|
---|
| 50 | case Compiler:
|
---|
| 51 | return "compiler built-in";
|
---|
| 52 | case BuiltinCFA:
|
---|
| 53 | return "cfa built-in";
|
---|
| 54 | case BuiltinC:
|
---|
| 55 | return "c built-in";
|
---|
| 56 | default:
|
---|
| 57 | return "<unnamed linkage spec>";
|
---|
| 58 | }
|
---|
[4aa0858] | 59 | }
|
---|
| 60 |
|
---|
[54d714e] | 61 | } // LinkageSpec
|
---|
[b87a5ed] | 62 |
|
---|
| 63 | // Local Variables: //
|
---|
| 64 | // tab-width: 4 //
|
---|
| 65 | // mode: c++ //
|
---|
| 66 | // compile-command: "make install" //
|
---|
| 67 | // End: //
|
---|
Note:
See
TracBrowser
for help on using the repository browser.