Ignore:
Timestamp:
Dec 3, 2014, 3:08:38 PM (10 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:
d9a0e76
Parents:
42dcae7
Message:

underscore changes, ptrdiff_t changes, formating, _Bool prelude

File:
1 edited

Legend:

Unmodified
Added
Removed
  • translator/Parser/LinkageSpec.cc

    r42dcae7 r3848e0e  
    1 /*
    2  * This file is part of the Cforall project
    3  *
    4  * $Id: LinkageSpec.cc,v 1.3 2003/01/29 14:55:08 rcbilson Exp $
    5  *
    6  */
    7 
    81#include <string>
    92#include <cassert>
     
    125#include "SemanticError.h"
    136
    14 /* static class method */
    15 LinkageSpec::Type
    16 LinkageSpec::fromString( const std::string &stringSpec )
    17 {
    18   if( stringSpec == "\"Cforall\"" ) {
    19     return Cforall;
    20   } else if( stringSpec == "\"C\"" ) {
    21     return C;
    22   } else {
    23     throw SemanticError( "Invalid linkage specifier " + stringSpec );
    24   }
     7LinkageSpec::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    }
    2515}
    2616
    27 /* static class method */
    28 std::string
    29 LinkageSpec::toString( LinkageSpec::Type linkage )
    30 {
    31   switch( linkage ) {
    32   case Intrinsic:
    33     return "intrinsic";
    34    
    35   case Cforall:
    36     return "Cforall";
    37    
    38   case C:
    39     return "C";
    40    
    41   case AutoGen:
    42     return "automatically generated";
    43    
    44   case Compiler:
    45     return "compiler built-in";
    46   }
    47   assert( false );
    48   return "";
     17std::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 "";
    4932}
    5033
    51 /* static class method */
    52 bool
    53 LinkageSpec::isDecoratable( Type t )
    54 {
    55   switch( t ) {
    56   case Intrinsic:
    57   case Cforall:
    58   case AutoGen:
    59     return true;
    60    
    61   case C:
    62   case Compiler:
     34bool 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:
     42        return false;
     43    }
     44    assert( false );
    6345    return false;
    64   }
    65   assert( false );
    66   return false;
    6746}
    6847
    69 /* static class method */
    70 bool
    71 LinkageSpec::isGeneratable( Type t )
    72 {
    73   switch( t ) {
    74   case Intrinsic:
    75   case Cforall:
    76   case AutoGen:
    77   case C:
    78     return true;
    79    
    80   case Compiler:
     48bool 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:
     56        return false;
     57    }
     58    assert( false );
    8159    return false;
    82   }
    83   assert( false );
    84   return false;
    8560}
    8661
    87 /* static class method */
    88 bool
    89 LinkageSpec::isOverloadable( Type t )
    90 {
    91   return isDecoratable( t );
     62bool LinkageSpec::isOverloadable( Type t ) {
     63    return isDecoratable( t );
    9264}
    9365
    94 /* static class method */
    95 bool
    96 LinkageSpec::isBuiltin( Type t )
    97 {
    98   switch( t ) {
    99   case Cforall:
    100   case AutoGen:
    101   case C:
     66bool LinkageSpec::isBuiltin( Type t ) {
     67    switch ( t ) {
     68      case Cforall:
     69      case AutoGen:
     70      case C:
     71        return false;
     72      case Intrinsic:
     73      case Compiler:
     74        return true;
     75    }
     76    assert( false );
    10277    return false;
    103    
    104   case Intrinsic:
    105   case Compiler:
    106     return true;
    107   }
    108   assert( false );
    109   return false;
    11078}
    111 
Note: See TracChangeset for help on using the changeset viewer.