Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/LinkageSpec.cc

    rfaddbd8 rf2a4f6c  
    1010// Created On       : Sat May 16 13:22:09 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Oct  2 23:16:21 2016
    13 // Update Count     : 23
     12// Last Modified On : Sun Aug 21 12:32:53 2016
     13// Update Count     : 17
    1414//
    1515
     
    1717#include <string>
    1818#include <cassert>
    19 using namespace std;
    2019
    2120#include "LinkageSpec.h"
    2221#include "Common/SemanticError.h"
    2322
    24 LinkageSpec::Spec LinkageSpec::linkageCheck( const string * spec ) {
    25         unique_ptr<const string> guard( spec ); // allocated by lexer
    26         if ( *spec == "\"Cforall\"" ) {
     23LinkageSpec::Spec LinkageSpec::fromString( const std::string &spec ) {
     24        std::unique_ptr<const std::string> guard(&spec);                // allocated by lexer
     25        if ( spec == "\"Cforall\"" ) {
    2726                return Cforall;
    28         } else if ( *spec == "\"C\"" ) {
     27        } else if ( spec == "\"C\"" ) {
    2928                return C;
    3029        } else {
    31                 throw SemanticError( "Invalid linkage specifier " + *spec );
     30                throw SemanticError( "Invalid linkage specifier " + spec );
    3231        } // if
    3332}
    3433
    35 string LinkageSpec::linkageName( LinkageSpec::Spec linkage ) {
    36         assert( 0 <= linkage && linkage < LinkageSpec::NoOfSpecs );
     34std::string LinkageSpec::toString( LinkageSpec::Spec linkage ) {
     35        assert( linkage >= 0 && linkage < LinkageSpec::NoOfSpecs );
    3736        static const char *linkageKinds[LinkageSpec::NoOfSpecs] = {
    3837                "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in",
     
    4241
    4342bool LinkageSpec::isDecoratable( Spec spec ) {
    44         assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs );
     43        assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
    4544        static bool decoratable[LinkageSpec::NoOfSpecs] = {
    4645                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
     
    5150
    5251bool LinkageSpec::isGeneratable( Spec spec ) {
    53         assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs );
     52        assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs );
    5453        static bool generatable[LinkageSpec::NoOfSpecs] = {
    5554                //      Intrinsic,      Cforall,        C,              AutoGen,        Compiler
Note: See TracChangeset for help on using the changeset viewer.