Ignore:
Timestamp:
Mar 8, 2016, 10:25:06 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
5447e09
Parents:
b63e376 (diff), bed4c63e (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 plg2:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Indexer.h

    rb63e376 rae357ec  
    2121
    2222#include "SynTree/Visitor.h"
    23 #include "IdTable.h"
    24 #include "AggregateTable.h"
    25 #include "TypeTable.h"
    2623
    2724namespace SymTab {
     
    2926          public:
    3027                Indexer( bool useDebug = false );
     28
     29                Indexer( const Indexer &that );
     30                Indexer( Indexer &&that );
    3131                virtual ~Indexer();
     32                Indexer& operator= ( const Indexer &that );
     33                Indexer& operator= ( Indexer &&that );
    3234
    3335                //using Visitor::visit;
     
    7880                void leaveScope();
    7981
    80                 void lookupId( const std::string &id, std::list< DeclarationWithType* >& ) const;
    81                 DeclarationWithType* lookupId( const std::string &id) const;
     82                /// Gets all declarations with the given ID
     83                void lookupId( const std::string &id, std::list< DeclarationWithType* > &out ) const;
     84                /// Gets the top-most type declaration with the given ID
    8285                NamedTypeDecl *lookupType( const std::string &id ) const;
     86                /// Gets the top-most struct declaration with the given ID
    8387                StructDecl *lookupStruct( const std::string &id ) const;
     88                /// Gets the top-most enum declaration with the given ID
    8489                EnumDecl *lookupEnum( const std::string &id ) const;
     90                /// Gets the top-most union declaration with the given ID
    8591                UnionDecl *lookupUnion( const std::string &id ) const;
     92                /// Gets the top-most trait declaration with the given ID
    8693                TraitDecl *lookupTrait( const std::string &id ) const;
    8794 
    8895                void print( std::ostream &os, int indent = 0 ) const;
    8996          private:
    90                 IdTable idTable;
    91                 TypeTable typeTable;
    92                 StructTable structTable;
    93                 EnumTable enumTable;
    94                 UnionTable unionTable;
    95                 TraitTable contextTable;
    96  
    97                 bool doDebug;                                   // display debugging trace
     97                /// looks up a specific mangled ID at the given scope
     98                DeclarationWithType *lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) const;
     99                /// returns true if there exists a declaration with C linkage and the given name
     100                bool hasCDeclWithName( const std::string &id ) const;
     101                // equivalents to lookup functions that only look at tables at scope `scope` (which should be >= tables->scope)
     102                NamedTypeDecl *lookupTypeAtScope( const std::string &id, unsigned long scope ) const;
     103                StructDecl *lookupStructAtScope( const std::string &id, unsigned long scope ) const;
     104                EnumDecl *lookupEnumAtScope( const std::string &id, unsigned long scope ) const;
     105                UnionDecl *lookupUnionAtScope( const std::string &id, unsigned long scope ) const;
     106                TraitDecl *lookupTraitAtScope( const std::string &id, unsigned long scope ) const;
     107               
     108                void addId( DeclarationWithType *decl );
     109                void addType( NamedTypeDecl *decl );
     110                void addStruct( const std::string &id );
     111                void addStruct( StructDecl *decl );
     112                void addEnum( EnumDecl *decl );
     113                void addUnion( const std::string &id );
     114                void addUnion( UnionDecl *decl );
     115                void addTrait( TraitDecl *decl );
     116               
     117                struct Impl;
     118                Impl *tables;         ///< Copy-on-write instance of table data structure
     119                unsigned long scope;  ///< Scope index of this pointer
     120                bool doDebug;         ///< Display debugging trace?
     121
     122                /// Takes a new ref to a table (returns null if null)
     123                static Impl *newRef( Impl *toClone );
     124                /// Clears a ref to a table (does nothing if null)
     125                static void deleteRef( Impl *toFree );
     126
     127                /// Ensures that tables variable is writable (i.e. allocated, uniquely owned by this Indexer, and at the current scope)
     128                void makeWritable();
    98129        };
    99130} // namespace SymTab
Note: See TracChangeset for help on using the changeset viewer.