Ignore:
Timestamp:
Aug 27, 2018, 4:40:34 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
b7c89aa
Parents:
f9feab8 (diff), 305581d (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' into cleanup-dtors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Indexer.h

    rf9feab8 r90152a4  
    1919#include <list>               // for list
    2020#include <string>             // for string
     21#include <functional>         // for function
    2122
    2223#include "SynTree/Visitor.h"  // for Visitor
    2324#include "SynTree/SynTree.h"  // for AST nodes
     25
     26namespace ResolvExpr {
     27class Cost;
     28}
    2429
    2530namespace SymTab {
     
    4045
    4146                struct IdData {
    42                         DeclarationWithType * id;
    43                         Expression * baseExpr; // WithExpr
     47                        DeclarationWithType * id = nullptr;
     48                        Expression * baseExpr = nullptr; // WithExpr
    4449
    45                         Expression * combine() const;
     50                        /// non-null if this declaration is deleted
     51                        BaseSyntaxNode * deleteStmt = nullptr;
     52
     53                        // NOTE: shouldn't need either of these constructors, but gcc-4 does not properly support initializer lists with default members.
     54                        IdData() = default;
     55                        IdData( DeclarationWithType * id, Expression * baseExpr, BaseSyntaxNode * deleteStmt ) : id( id ), baseExpr( baseExpr ), deleteStmt( deleteStmt ) {}
     56
     57                        Expression * combine( ResolvExpr::Cost & cost ) const;
    4658                };
    4759
     
    5971                TraitDecl *lookupTrait( const std::string &id ) const;
    6072
     73                /// Gets the type declaration with the given ID at global scope
     74                NamedTypeDecl *globalLookupType( const std::string &id ) const;
     75                /// Gets the struct declaration with the given ID at global scope
     76                StructDecl *globalLookupStruct( const std::string &id ) const;
     77                /// Gets the union declaration with the given ID at global scope
     78                UnionDecl *globalLookupUnion( const std::string &id ) const;
     79                /// Gets the enum declaration with the given ID at global scope
     80                EnumDecl *globalLookupEnum( const std::string &id ) const;
     81
    6182                void print( std::ostream &os, int indent = 0 ) const;
    6283
    6384                /// looks up a specific mangled ID at the given scope
    64                 DeclarationWithType *lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) const;
     85                IdData * lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope );
     86                const IdData * lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) const;
    6587                /// returns true if there exists a declaration with C linkage and the given name with a different mangled name
    6688                bool hasIncompatibleCDecl( const std::string &id, const std::string &mangleName, unsigned long scope ) const;
     
    7496                TraitDecl *lookupTraitAtScope( const std::string &id, unsigned long scope ) const;
    7597
    76                 void addId( DeclarationWithType *decl, Expression * baseExpr = nullptr );
     98                typedef std::function<bool(IdData &, const std::string &)> ConflictFunction;
     99
     100                void addId( DeclarationWithType * decl, Expression * baseExpr = nullptr );
     101                void addDeletedId( DeclarationWithType * decl, BaseSyntaxNode * deleteStmt );
     102
    77103                void addType( NamedTypeDecl *decl );
    78104                void addStruct( const std::string &id );
     
    84110
    85111                /// adds all of the IDs from WithStmt exprs
    86                 void addWith( WithStmt * );
     112                void addWith( std::list< Expression * > & withExprs, BaseSyntaxNode * withStmt );
     113
     114                /// adds all of the members of the Aggregate (addWith helper)
     115                void addMembers( AggregateDecl * aggr, Expression * expr, ConflictFunction );
    87116
    88117                /// convenience function for adding a list of Ids to the indexer
     
    114143                /// Ensures that tables variable is writable (i.e. allocated, uniquely owned by this Indexer, and at the current scope)
    115144                void makeWritable();
     145
     146                /// common code for addId, addDeletedId, etc.
     147                void addId( DeclarationWithType * decl, ConflictFunction, Expression * baseExpr = nullptr, BaseSyntaxNode * deleteStmt = nullptr );
    116148        };
    117149} // namespace SymTab
Note: See TracChangeset for help on using the changeset viewer.