Changeset 4fbdfae0 for src


Ignore:
Timestamp:
Jul 18, 2017, 4:39:08 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
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, with_gc
Children:
870d1f0
Parents:
f19339e
Message:

Find intrinsic dereference declaration so that dereference ApplicationExprs? can be built without the resolver

Location:
src/SymTab
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Autogen.h

    rf19339e r4fbdfae0  
    3434        /// such as in determining array dimension type
    3535        extern Type * SizeType;
     36
     37        /// intrinsic dereference operator for unqualified types - set when *? function is seen in FindSpecialDeclarations.
     38        /// Useful for creating dereference ApplicationExprs without a full resolver pass.
     39        extern FunctionDecl * dereferenceOperator;
    3640
    3741        /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls.
  • src/SymTab/Validate.cc

    rf19339e r4fbdfae0  
    237237        };
    238238
     239
     240        FunctionDecl * dereferenceOperator = nullptr;
     241        struct FindSpecialDeclarations final {
     242                void previsit( FunctionDecl * funcDecl );
     243        };
     244
    239245        void validate( std::list< Declaration * > &translationUnit, bool doDebug ) {
    240246                PassVisitor<EnumAndPointerDecay> epc;
     
    243249                PassVisitor<CompoundLiteral> compoundliteral;
    244250                PassVisitor<ValidateGenericParameters> genericParams;
     251                PassVisitor<FindSpecialDeclarations> finder;
    245252
    246253                EliminateTypedef::eliminateTypedef( translationUnit );
     
    259266                acceptAll( translationUnit, fpd );
    260267                ArrayLength::computeLength( translationUnit );
     268                acceptAll( translationUnit, finder );
    261269        }
    262270
     
    943951                }
    944952        }
     953
     954        void FindSpecialDeclarations::previsit( FunctionDecl * funcDecl ) {
     955                if ( ! dereferenceOperator ) {
     956                        if ( funcDecl->get_name() == "*?" && funcDecl->get_linkage() == LinkageSpec::Intrinsic ) {
     957                                FunctionType * ftype = funcDecl->get_functionType();
     958                                if ( ftype->get_parameters().size() == 1 && ftype->get_parameters().front()->get_type()->get_qualifiers() == Type::Qualifiers() ) {
     959                                        dereferenceOperator = funcDecl;
     960                                }
     961                        }
     962                }
     963        }
    945964} // namespace SymTab
    946965
Note: See TracChangeset for help on using the changeset viewer.