Changeset 6250a312 for src/SynTree


Ignore:
Timestamp:
May 10, 2017, 5:00:47 PM (9 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, stuck-waitfor-destruct, with_gc
Children:
8514fe19, dbfb35d
Parents:
0f9bef3 (diff), 29cf9c8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src/SynTree
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/BaseSyntaxNode.h

    r0f9bef3 r6250a312  
    1818
    1919#include "Common/utility.h"
     20#include "Visitor.h"
    2021
    2122class BaseSyntaxNode {
    2223  public:
    2324        CodeLocation location;
     25
     26        virtual void accept( Visitor & v ) = 0; // temporary -- needs to be here so that BaseSyntaxNode is polymorphic and can be dynamic_cast
    2427};
    2528
  • src/SynTree/Declaration.h

    r0f9bef3 r6250a312  
    204204
    205205        virtual std::string typeString() const;
     206        virtual std::string genTypeString() const;
    206207
    207208        virtual TypeDecl *clone() const { return new TypeDecl( *this ); }
  • src/SynTree/PointerType.cc

    r0f9bef3 r6250a312  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // PointerType.cc -- 
     7// PointerType.cc --
    88//
    99// Author           : Richard C. Bilson
     
    3838void PointerType::print( std::ostream &os, int indent ) const {
    3939        Type::print( os, indent );
    40         os << "pointer to ";
    41         if ( isStatic ) {
    42                 os << "static ";
    43         } // if
    44         if ( isVarLen ) {
    45                 os << "variable length array of ";
    46         } else if ( dimension ) {
    47                 os << "array of ";
    48                 dimension->print( os, indent );
    49         } // if
     40        if ( ! is_array() ) {
     41                os << "pointer to ";
     42        } else {
     43                os << "decayed ";
     44                if ( isStatic ) {
     45                        os << "static ";
     46                } // if
     47                if ( isVarLen ) {
     48                        os << "variable length array of ";
     49                } else if ( dimension ) {
     50                        os << "array of ";
     51                        dimension->print( os, indent );
     52                        os << " ";
     53                } // if
     54        }
    5055        if ( base ) {
    5156                base->print( os, indent );
  • src/SynTree/SynTree.h

    r0f9bef3 r6250a312  
    2121#include <map>
    2222#include <iostream>
     23
     24class BaseSyntaxNode;
    2325
    2426class Declaration;
  • src/SynTree/Type.h

    r0f9bef3 r6250a312  
    247247        void set_isStatic( bool newValue ) { isStatic = newValue; }
    248248
     249        bool is_array() const { return isStatic || isVarLen || dimension; }
     250
    249251        virtual PointerType *clone() const { return new PointerType( *this ); }
    250252        virtual void accept( Visitor & v ) { v.visit( this ); }
  • src/SynTree/TypeDecl.cc

    r0f9bef3 r6250a312  
    2929}
    3030
     31std::string TypeDecl::genTypeString() const {
     32        static const std::string kindNames[] = { "otype", "dtype", "ftype", "ttype" };
     33        return kindNames[ kind ];
     34}
     35
    3136std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data ) {
    3237  return os << data.kind << ", " << data.isComplete;
  • src/SynTree/Visitor.h

    r0f9bef3 r6250a312  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  9 14:23:24 2017
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed May  3 08:58:00 2017
    1313// Update Count     : 10
    1414//
     
    2626        virtual ~Visitor();
    2727  public:
     28        // visit: Default implementation of all functions visits the children
     29    // of the given syntax node, but performs no other action.
     30
    2831        virtual void visit( ObjectDecl *objectDecl );
    2932        virtual void visit( FunctionDecl *functionDecl );
Note: See TracChangeset for help on using the changeset viewer.