ADTast-experimentalenumpthread-emulationqualifiedEnum
Last change
on this file since 12c1eef was
1e2de89,
checked in by Andrew Beach <ajbeach@…>, 5 years ago
|
Wandered into LinkageSpec? and moved an include out of the header.
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
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 |
---|
[1e2de89] | 11 | // Last Modified By : Andrew Beach |
---|
| 12 | // Last Modified On : Mon Mar 2 16:13:00 2020 |
---|
| 13 | // Update Count : 29 |
---|
[79970ed] | 14 | // |
---|
[b87a5ed] | 15 | |
---|
[51b7345] | 16 | #include <cassert> |
---|
[d912bed] | 17 | #include <memory> // for unique_ptr |
---|
| 18 | #include <string> |
---|
[faddbd8] | 19 | using namespace std; |
---|
[51b7345] | 20 | |
---|
| 21 | #include "LinkageSpec.h" |
---|
[1e2de89] | 22 | #include "Common/CodeLocation.h" |
---|
[d3b7937] | 23 | #include "Common/SemanticError.h" |
---|
[51b7345] | 24 | |
---|
[54d714e] | 25 | namespace LinkageSpec { |
---|
[d912bed] | 26 | Spec update( CodeLocation location, Spec spec, const string * cmd ) { |
---|
| 27 | assert( cmd ); |
---|
| 28 | unique_ptr<const string> guard( cmd ); // allocated by lexer |
---|
| 29 | if ( *cmd == "\"Cforall\"" ) { |
---|
| 30 | spec.is_mangled = true; |
---|
| 31 | return spec; |
---|
| 32 | } else if ( *cmd == "\"C\"" ) { |
---|
| 33 | spec.is_mangled = false; |
---|
| 34 | return spec; |
---|
| 35 | } else { |
---|
| 36 | SemanticError( location, "Invalid linkage specifier " + *cmd ); |
---|
| 37 | } // if |
---|
| 38 | } // update |
---|
[54d714e] | 39 | |
---|
[d912bed] | 40 | string name( Spec spec ) { |
---|
| 41 | switch ( spec ) { |
---|
| 42 | case Intrinsic: return "intrinsic"; |
---|
| 43 | case C: return "C"; |
---|
| 44 | case Cforall: return "Cforall"; |
---|
| 45 | case AutoGen: return "autogenerated cfa"; |
---|
| 46 | case Compiler: return "compiler built-in"; |
---|
| 47 | case BuiltinCFA: return "cfa built-in"; |
---|
| 48 | case BuiltinC: return "c built-in"; |
---|
| 49 | default: return "<unnamed linkage spec>"; |
---|
| 50 | } // siwtch |
---|
| 51 | } // name |
---|
[54d714e] | 52 | } // LinkageSpec |
---|
[b87a5ed] | 53 | |
---|
| 54 | // Local Variables: // |
---|
| 55 | // tab-width: 4 // |
---|
| 56 | // mode: c++ // |
---|
| 57 | // compile-command: "make install" // |
---|
| 58 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.