ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since cf5af9c 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
|
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 : Mon Mar 2 16:13:00 2020 |
---|
13 | // Update Count : 29 |
---|
14 | // |
---|
15 | |
---|
16 | #include <cassert> |
---|
17 | #include <memory> // for unique_ptr |
---|
18 | #include <string> |
---|
19 | using namespace std; |
---|
20 | |
---|
21 | #include "LinkageSpec.h" |
---|
22 | #include "Common/CodeLocation.h" |
---|
23 | #include "Common/SemanticError.h" |
---|
24 | |
---|
25 | namespace LinkageSpec { |
---|
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 |
---|
39 | |
---|
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 |
---|
52 | } // LinkageSpec |
---|
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.