| [fa2e183] | 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 | 
 | 
|---|
| [71806e0] | 11 | InlineMemberDecl::InlineMemberDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage,
 | 
|---|
| [fa2e183] | 12 | Type * type, const std::list< Attribute * >attributes, Type::FuncSpecifiers fs) 
 | 
|---|
 | 13 |     : Parent( name, scs, linkage, attributes, fs ), type( type ) {}
 | 
|---|
 | 14 | 
 | 
|---|
| [71806e0] | 15 | InlineMemberDecl::InlineMemberDecl( const InlineMemberDecl &other) 
 | 
|---|
| [fa2e183] | 16 |     : Parent( other), type( maybeClone( other.type ) ) {}
 | 
|---|
 | 17 | 
 | 
|---|
| [71806e0] | 18 | InlineMemberDecl::~InlineMemberDecl() { delete type; }
 | 
|---|
| [fa2e183] | 19 | 
 | 
|---|
| [71806e0] | 20 | InlineMemberDecl * InlineMemberDecl::newInlineMemberDecl( const std::string &name, Type * type ) {
 | 
|---|
 | 21 |     return new InlineMemberDecl( name, Type::StorageClasses(), LinkageSpec::C, type );
 | 
|---|
| [fa2e183] | 22 | }
 | 
|---|
 | 23 | 
 | 
|---|
| [71806e0] | 24 | void InlineMemberDecl::print( std::ostream &os, Indenter indent ) const {
 | 
|---|
| [fa2e183] | 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 | 
 | 
|---|
| [71806e0] | 46 | void InlineMemberDecl::printShort( std::ostream &os, Indenter indent ) const {
 | 
|---|
| [fa2e183] | 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 | }
 | 
|---|