Ignore:
Timestamp:
May 16, 2015, 3:36:19 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
a32b204
Parents:
b8508a2
Message:

licencing: first groups of files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • translator/Parser/LinkageSpec.cc

    rb8508a2 rb87a5ed  
     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 : Sat May 16 13:23:21 2015
     13// Update Count     : 2
     14//
     15
    116#include <string>
    217#include <cassert>
     
    621
    722LinkageSpec::Type LinkageSpec::fromString( const std::string &stringSpec ) {
    8     if ( stringSpec == "\"Cforall\"" ) {
    9         return Cforall;
    10     } else if ( stringSpec == "\"C\"" ) {
    11         return C;
    12     } else {
    13         throw SemanticError( "Invalid linkage specifier " + stringSpec );
    14     }
     23        if ( stringSpec == "\"Cforall\"" ) {
     24                return Cforall;
     25        } else if ( stringSpec == "\"C\"" ) {
     26                return C;
     27        } else {
     28                throw SemanticError( "Invalid linkage specifier " + stringSpec );
     29        }
    1530}
    1631
    1732std::string LinkageSpec::toString( LinkageSpec::Type linkage ) {
    18     switch ( linkage ) {
    19       case Intrinsic:
    20         return "intrinsic";
    21       case Cforall:
    22         return "Cforall";
    23       case C:
    24         return "C";
    25       case AutoGen:
    26         return "automatically generated";
    27       case Compiler:
    28         return "compiler built-in";
    29     }
    30     assert( false );
    31     return "";
     33        switch ( linkage ) {
     34          case Intrinsic:
     35                return "intrinsic";
     36          case Cforall:
     37                return "Cforall";
     38          case C:
     39                return "C";
     40          case AutoGen:
     41                return "automatically generated";
     42          case Compiler:
     43                return "compiler built-in";
     44        }
     45        assert( false );
     46        return "";
    3247}
    3348
    3449bool LinkageSpec::isDecoratable( Type t ) {
    35     switch ( t ) {
    36       case Intrinsic:
    37       case Cforall:
    38       case AutoGen:
    39         return true;
    40       case C:
    41       case Compiler:
     50        switch ( t ) {
     51          case Intrinsic:
     52          case Cforall:
     53          case AutoGen:
     54                return true;
     55          case C:
     56          case Compiler:
     57                return false;
     58        }
     59        assert( false );
    4260        return false;
    43     }
    44     assert( false );
    45     return false;
    4661}
    4762
    4863bool LinkageSpec::isGeneratable( Type t ) {
    49     switch ( t ) {
    50       case Intrinsic:
    51       case Cforall:
    52       case AutoGen:
    53       case C:
    54         return true;
    55       case Compiler:
     64        switch ( t ) {
     65          case Intrinsic:
     66          case Cforall:
     67          case AutoGen:
     68          case C:
     69                return true;
     70          case Compiler:
     71                return false;
     72        }
     73        assert( false );
    5674        return false;
    57     }
    58     assert( false );
    59     return false;
    6075}
    6176
    6277bool LinkageSpec::isOverloadable( Type t ) {
    63     return isDecoratable( t );
     78        return isDecoratable( t );
    6479}
    6580
    6681bool LinkageSpec::isBuiltin( Type t ) {
    67     switch ( t ) {
    68       case Cforall:
    69       case AutoGen:
    70       case C:
     82        switch ( t ) {
     83          case Cforall:
     84          case AutoGen:
     85          case C:
     86                return false;
     87          case Intrinsic:
     88          case Compiler:
     89                return true;
     90        }
     91        assert( false );
    7192        return false;
    72       case Intrinsic:
    73       case Compiler:
    74         return true;
    75     }
    76     assert( false );
    77     return false;
    7893}
     94
     95// Local Variables: //
     96// tab-width: 4 //
     97// mode: c++ //
     98// compile-command: "make install" //
     99// End: //
Note: See TracChangeset for help on using the changeset viewer.