source: src/SynTree/LinkageSpec.cc @ d912bed

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since d912bed was d912bed, checked in by Peter A. Buhr <pabuhr@…>, 4 years ago

harmonize SynTree/LinkageSpec?.* with AST/LinkageSpec.*

  • 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 : Peter A. Buhr
12// Last Modified On : Mon Dec 16 15:02:29 2019
13// Update Count     : 28
14//
15
16#include <cassert>
17#include <memory>   // for unique_ptr
18#include <string>
19using namespace std;
20
21#include "LinkageSpec.h"
22#include "Common/SemanticError.h"
23
24namespace LinkageSpec {
25        Spec update( CodeLocation location, Spec spec, const string * cmd ) {
26                assert( cmd );
27                unique_ptr<const string> guard( cmd ); // allocated by lexer
28                if ( *cmd == "\"Cforall\"" ) {
29                        spec.is_mangled = true;
30                        return spec;
31                } else if ( *cmd == "\"C\"" ) {
32                        spec.is_mangled = false;
33                        return spec;
34                } else {
35                        SemanticError( location, "Invalid linkage specifier " + *cmd );
36                } // if
37        } // update
38
39        string name( Spec spec ) {
40                switch ( spec ) {
41                  case Intrinsic: return "intrinsic";
42                  case C: return "C";
43                  case Cforall: return "Cforall";
44                  case AutoGen: return "autogenerated cfa";
45                  case Compiler: return "compiler built-in";
46                  case BuiltinCFA: return "cfa built-in";
47                  case BuiltinC: return "c built-in";
48                  default: return "<unnamed linkage spec>";
49                } // siwtch
50        } // name
51} // LinkageSpec
52
53// Local Variables: //
54// tab-width: 4 //
55// mode: c++ //
56// compile-command: "make install" //
57// End: //
Note: See TracBrowser for help on using the repository browser.