| 1 | #include <list>                  // for list | 
|---|
| 2 | #include <ostream>               // for operator<<, ostream, basic_ostream | 
|---|
| 3 | #include <string>                // for operator<<, string, char_traits, ope... | 
|---|
| 4 |  | 
|---|
| 5 | #include "Attribute.h"           // for Attribute | 
|---|
| 6 | #include "Declaration.h" | 
|---|
| 7 | #include "Common/utility.h"      // for maybeClone, printAll | 
|---|
| 8 | #include "LinkageSpec.h"         // for Spec, linkageName, Cforall | 
|---|
| 9 | #include "Type.h"                // for Type, Type::StorageClasses, Type::Fu... | 
|---|
| 10 |  | 
|---|
| 11 | InlineMemberDecl::InlineMemberDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, | 
|---|
| 12 | Type * type, const std::list< Attribute * >attributes, Type::FuncSpecifiers fs) | 
|---|
| 13 | : Parent( name, scs, linkage, attributes, fs ), type( type ) {} | 
|---|
| 14 |  | 
|---|
| 15 | InlineMemberDecl::InlineMemberDecl( const InlineMemberDecl &other) | 
|---|
| 16 | : Parent( other), type( maybeClone( other.type ) ) {} | 
|---|
| 17 |  | 
|---|
| 18 | InlineMemberDecl::~InlineMemberDecl() { delete type; } | 
|---|
| 19 |  | 
|---|
| 20 | InlineMemberDecl * InlineMemberDecl::newInlineMemberDecl( const std::string &name, Type * type ) { | 
|---|
| 21 | return new InlineMemberDecl( name, Type::StorageClasses(), LinkageSpec::C, type ); | 
|---|
| 22 | } | 
|---|
| 23 |  | 
|---|
| 24 | void InlineMemberDecl::print( std::ostream &os, Indenter indent ) const { | 
|---|
| 25 | if ( name != "" ) os << name << ": "; | 
|---|
| 26 |  | 
|---|
| 27 | if ( linkage != LinkageSpec::Cforall ) { | 
|---|
| 28 | os << LinkageSpec::name( linkage ) << " "; | 
|---|
| 29 | } // if | 
|---|
| 30 |  | 
|---|
| 31 | get_storageClasses().print( os ); | 
|---|
| 32 |  | 
|---|
| 33 | if ( type ) { | 
|---|
| 34 | type->print( os, indent ); | 
|---|
| 35 | } else { | 
|---|
| 36 | os << " untyped entity "; | 
|---|
| 37 | } // if | 
|---|
| 38 |  | 
|---|
| 39 | if ( ! attributes.empty() ) { | 
|---|
| 40 | os << std::endl << indent << "... with attributes:" << std::endl; | 
|---|
| 41 | printAll( attributes, os, indent+1 ); | 
|---|
| 42 | } // if | 
|---|
| 43 |  | 
|---|
| 44 | } | 
|---|
| 45 |  | 
|---|
| 46 | void InlineMemberDecl::printShort( std::ostream &os, Indenter indent ) const { | 
|---|
| 47 | if ( name != "" ) os << name << ": "; | 
|---|
| 48 |  | 
|---|
| 49 | get_storageClasses().print( os ); | 
|---|
| 50 |  | 
|---|
| 51 | if ( type ) { | 
|---|
| 52 | type->print( os, indent ); | 
|---|
| 53 | } else { | 
|---|
| 54 | os << "untyped entity "; | 
|---|
| 55 | } // if | 
|---|
| 56 |  | 
|---|
| 57 | } | 
|---|