Ignore:
Timestamp:
Dec 16, 2019, 5:40:36 PM (3 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
7006ba5
Parents:
6f9cc13
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/LinkageSpec.cc

    r6f9cc13 rd912bed  
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:22:09 2015
    11 // Last Modified By : Andrew Beach
    12 // Last Modified On : Thr Spt 12 15:59:00 2018
    13 // Update Count     : 26
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Mon Dec 16 15:02:29 2019
     13// Update Count     : 28
    1414//
    1515
    16 #include <memory>
     16#include <cassert>
     17#include <memory>   // for unique_ptr
    1718#include <string>
    18 #include <cassert>
    1919using namespace std;
    2020
     
    2323
    2424namespace 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
    2538
    26 Spec linkageUpdate( CodeLocation location, Spec old_spec, const string * cmd ) {
    27         assert( cmd );
    28         unique_ptr<const string> guard( cmd ); // allocated by lexer
    29         if ( *cmd == "\"Cforall\"" ) {
    30                 old_spec.is_mangled = true;
    31                 return old_spec;
    32         } else if ( *cmd == "\"C\"" ) {
    33                 old_spec.is_mangled = false;
    34                 return old_spec;
    35         } else {
    36                 SemanticError( location, "Invalid linkage specifier " + *cmd );
    37         } // if
    38 }
    39 
    40 std::string linkageName( Spec linkage ) {
    41     switch ( linkage ) {
    42     case Intrinsic:
    43         return "intrinsic";
    44     case C:
    45         return "C";
    46     case Cforall:
    47         return "Cforall";
    48     case AutoGen:
    49         return "autogenerated cfa";
    50     case Compiler:
    51         return "compiler built-in";
    52     case BuiltinCFA:
    53         return "cfa built-in";
    54     case BuiltinC:
    55         return "c built-in";
    56     default:
    57         return "<unnamed linkage spec>";
    58     }
    59 }
    60 
     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
    6151} // LinkageSpec
    6252
Note: See TracChangeset for help on using the changeset viewer.