Ignore:
Timestamp:
Mar 16, 2017, 6:14:32 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
615a096
Parents:
6f95000 (diff), 1fbab5a (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.cc

    r6f95000 r395fc37  
    119119                                FunctionDecl * decl;
    120120                                bool isUserDefinedFunc; // properties for this particular decl
    121                                 bool isDefaultFunc;
     121                                bool isDefaultCtor;
     122                                bool isDtor;
    122123                                bool isCopyFunc;
    123124                        };
    124125                        // properties for this type
    125                         bool userDefinedFunc = false; // any user defined function found
    126                         bool userDefinedDefaultFunc = false; // user defined default ctor found
    127                         bool userDefinedCopyFunc = false; // user defined copy ctor found
     126                        bool userDefinedFunc = false; // any user-defined function found
     127                        bool userDefinedCtor = false; // any user-defined constructor found
     128                        bool userDefinedDtor = false; // any user-defined destructor found
     129                        bool userDefinedCopyFunc = false; // user-defined copy ctor found
    128130                        std::list< DeclBall > decls;
    129131
     
    132134                        ValueType & operator+=( FunctionDecl * function ) {
    133135                                bool isUserDefinedFunc = ! LinkageSpec::isOverridable( function->get_linkage() );
    134                                 bool isDefaultFunc = function->get_functionType()->get_parameters().size() == 1;
     136                                bool isDefaultCtor = InitTweak::isDefaultConstructor( function );
     137                                bool isDtor = InitTweak::isDestructor( function );
    135138                                bool isCopyFunc = InitTweak::isCopyFunction( function, function->get_name() );
    136                                 decls.push_back( DeclBall{ function, isUserDefinedFunc, isDefaultFunc, isCopyFunc } );
     139                                decls.push_back( DeclBall{ function, isUserDefinedFunc, isDefaultCtor, isDtor, isCopyFunc } );
    137140                                userDefinedFunc = userDefinedFunc || isUserDefinedFunc;
    138                                 userDefinedDefaultFunc = userDefinedDefaultFunc || (isUserDefinedFunc && isDefaultFunc);
     141                                userDefinedCtor = userDefinedCtor || (isUserDefinedFunc && InitTweak::isConstructor( function->get_name() ) );
     142                                userDefinedDtor = userDefinedDtor || (isUserDefinedFunc && isDtor);
    139143                                userDefinedCopyFunc = userDefinedCopyFunc || (isUserDefinedFunc && isCopyFunc);
    140144                                return *this;
     
    163167                // a default ctor, then the generated default ctor should never be seen, likewise for copy ctor
    164168                // and dtor. If the user defines any ctor/dtor, then no generated field ctors should be seen.
     169                // If the user defines any ctor then the generated default ctor should not be seen.
    165170                for ( std::pair< const std::string, ValueType > & pair : funcMap ) {
    166171                        ValueType & val = pair.second;
    167172                        for ( ValueType::DeclBall ball : val.decls ) {
    168                                 if ( ! val.userDefinedFunc || ball.isUserDefinedFunc || (! val.userDefinedDefaultFunc && ball.isDefaultFunc) || (! val.userDefinedCopyFunc && ball.isCopyFunc) ) {
     173                                if ( ! val.userDefinedFunc || ball.isUserDefinedFunc || (! val.userDefinedCtor && ball.isDefaultCtor) || (! val.userDefinedCopyFunc && ball.isCopyFunc) || (! val.userDefinedDtor && ball.isDtor) ) {
    169174                                        // decl conforms to the rules described above, so it should be seen by the requester
    170175                                        out.push_back( ball.decl );
Note: See TracChangeset for help on using the changeset viewer.