source: src/AST/LinkageSpec.cpp @ f9a0dd0

Last change on this file since f9a0dd0 was c92bdcc, checked in by Andrew Beach <ajbeach@…>, 7 months ago

Updated the rest of the names in src/ (except for the generated files).

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[2bb4a01]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
[b1f2007]11// Last Modified By : Peter A. Buhr
12// Last Modified On : Mon Dec 11 16:08:58 2023
13// Update Count     : 2
[2bb4a01]14//
15
16#include "LinkageSpec.hpp"
17
18#include <cassert>
19#include <memory>   // for unique_ptr
20#include <string>
21
[c92bdcc]22#include "Common/CodeLocation.hpp"
23#include "Common/SemanticError.hpp"
[2bb4a01]24
25namespace ast {
26
[a300e4a]27namespace Linkage {
28
[c7ebbec]29Spec update( const CodeLocation & loc, Spec spec, const std::string * cmd ) {
[260dad7]30        assert( cmd );
31        std::unique_ptr<const std::string> guard( cmd ); // allocated by lexer
32        if ( *cmd == "\"Cforall\"" ) {
[c7ebbec]33                spec.is_mangled = spec.is_overloadable = true;
[260dad7]34        } else if ( *cmd == "\"C\"" ) {
[c7ebbec]35                spec.is_mangled = spec.is_overloadable = false;
[260dad7]36        } else {
[b1f2007]37                SemanticError( loc, "Invalid linkage specifier %s", cmd->c_str() );
[a300e4a]38        }
[c7ebbec]39        return spec;
[260dad7]40}
[a300e4a]41
[260dad7]42std::string name( Spec spec ) {
43        switch ( spec.val ) {
44        case Intrinsic.val:  return "intrinsic";
45        case C.val:          return "C";
46        case Cforall.val:    return "Cforall";
47        case AutoGen.val:    return "autogenerated cfa";
48        case Compiler.val:   return "compiler built-in";
49        case BuiltinCFA.val: return "cfa built-in";
50        case BuiltinC.val:   return "c built-in";
51        default:             return "<unnamed linkage spec>";
[2bb4a01]52        }
[260dad7]53}
[14cebb7a]54
[a300e4a]55}
56
[2bb4a01]57}
58
59// Local Variables: //
60// tab-width: 4 //
61// mode: c++ //
62// compile-command: "make install" //
63// End: //
Note: See TracBrowser for help on using the repository browser.