source: src/SynTree/InlineMemberDecl.cc @ 19a8c40

ADTast-experimental
Last change on this file since 19a8c40 was 71806e0, checked in by JiadaL <j82liang@…>, 19 months ago

Rename InlineValueDecl? to InlineMemberDecl?

  • Property mode set to 100644
File size: 1.8 KB
Line 
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
11InlineMemberDecl::InlineMemberDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage,
12Type * type, const std::list< Attribute * >attributes, Type::FuncSpecifiers fs) 
13    : Parent( name, scs, linkage, attributes, fs ), type( type ) {}
14
15InlineMemberDecl::InlineMemberDecl( const InlineMemberDecl &other) 
16    : Parent( other), type( maybeClone( other.type ) ) {}
17
18InlineMemberDecl::~InlineMemberDecl() { delete type; }
19
20InlineMemberDecl * InlineMemberDecl::newInlineMemberDecl( const std::string &name, Type * type ) {
21    return new InlineMemberDecl( name, Type::StorageClasses(), LinkageSpec::C, type );
22}
23
24void 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
46void 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}
Note: See TracBrowser for help on using the repository browser.