ADT
        aaron-thesis
        arm-eh
        ast-experimental
        cleanup-dtors
        ctor
        deferred_resn
        demangler
        enum
        forall-pointer-decay
        gc_noraii
        jacob/cs343-translation
        jenkins-sandbox
        memory
        new-ast
        new-ast-unique-expr
        new-env
        no_list
        persistent-indexer
        pthread-emulation
        qualifiedEnum
        resolv-new
        string
        with_gc
      
      
        
          | Last change
 on this file since 71bd8c6 was             843054c2, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago | 
        
          | 
licencing: seventh groups of files
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            1.9 KB | 
      
      
| Rev | Line |  | 
|---|
| [b87a5ed] | 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 |  | 
|---|
| [51b73452] | 16 | #include <string> | 
|---|
|  | 17 | #include <cassert> | 
|---|
|  | 18 |  | 
|---|
|  | 19 | #include "LinkageSpec.h" | 
|---|
|  | 20 | #include "SemanticError.h" | 
|---|
|  | 21 |  | 
|---|
| [3848e0e] | 22 | LinkageSpec::Type LinkageSpec::fromString( const std::string &stringSpec ) { | 
|---|
| [b87a5ed] | 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 | } | 
|---|
| [51b73452] | 30 | } | 
|---|
|  | 31 |  | 
|---|
| [3848e0e] | 32 | std::string LinkageSpec::toString( LinkageSpec::Type linkage ) { | 
|---|
| [b87a5ed] | 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 ""; | 
|---|
| [51b73452] | 47 | } | 
|---|
|  | 48 |  | 
|---|
| [3848e0e] | 49 | bool LinkageSpec::isDecoratable( Type t ) { | 
|---|
| [b87a5ed] | 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 ); | 
|---|
| [3848e0e] | 60 | return false; | 
|---|
| [51b73452] | 61 | } | 
|---|
|  | 62 |  | 
|---|
| [3848e0e] | 63 | bool LinkageSpec::isGeneratable( Type t ) { | 
|---|
| [b87a5ed] | 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 ); | 
|---|
| [3848e0e] | 74 | return false; | 
|---|
| [51b73452] | 75 | } | 
|---|
|  | 76 |  | 
|---|
| [3848e0e] | 77 | bool LinkageSpec::isOverloadable( Type t ) { | 
|---|
| [b87a5ed] | 78 | return isDecoratable( t ); | 
|---|
| [51b73452] | 79 | } | 
|---|
|  | 80 |  | 
|---|
| [3848e0e] | 81 | bool LinkageSpec::isBuiltin( Type t ) { | 
|---|
| [b87a5ed] | 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 ); | 
|---|
| [3848e0e] | 92 | return false; | 
|---|
| [51b73452] | 93 | } | 
|---|
| [b87a5ed] | 94 |  | 
|---|
|  | 95 | // Local Variables: // | 
|---|
|  | 96 | // tab-width: 4 // | 
|---|
|  | 97 | // mode: c++ // | 
|---|
|  | 98 | // compile-command: "make install" // | 
|---|
|  | 99 | // End: // | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.