source: src/AST/LinkageSpec.cpp@ 292d599b

ADT arm-eh ast-experimental cleanup-dtors enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since 292d599b was 2bb4a01, checked in by Aaron Moss <a3moss@…>, 7 years ago

Start on new AST

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