- Timestamp:
- Mar 13, 2017, 4:50:15 PM (8 years ago)
- 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:
- 88d1066
- Parents:
- 0b465a5
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Indexer.cc
r0b465a5 r235114f 119 119 FunctionDecl * decl; 120 120 bool isUserDefinedFunc; // properties for this particular decl 121 bool isDefaultFunc; 121 bool isDefaultCtor; 122 bool isDtor; 122 123 bool isCopyFunc; 123 124 }; 124 125 // 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 128 130 std::list< DeclBall > decls; 129 131 … … 132 134 ValueType & operator+=( FunctionDecl * function ) { 133 135 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 ); 135 138 bool isCopyFunc = InitTweak::isCopyFunction( function, function->get_name() ); 136 decls.push_back( DeclBall{ function, isUserDefinedFunc, isDefault Func, isCopyFunc } );139 decls.push_back( DeclBall{ function, isUserDefinedFunc, isDefaultCtor, isDtor, isCopyFunc } ); 137 140 userDefinedFunc = userDefinedFunc || isUserDefinedFunc; 138 userDefinedDefaultFunc = userDefinedDefaultFunc || (isUserDefinedFunc && isDefaultFunc); 141 userDefinedCtor = userDefinedCtor || (isUserDefinedFunc && InitTweak::isConstructor( function->get_name() ) ); 142 userDefinedDtor = userDefinedDtor || (isUserDefinedFunc && isDtor); 139 143 userDefinedCopyFunc = userDefinedCopyFunc || (isUserDefinedFunc && isCopyFunc); 140 144 return *this; … … 163 167 // a default ctor, then the generated default ctor should never be seen, likewise for copy ctor 164 168 // 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. 165 170 for ( std::pair< const std::string, ValueType > & pair : funcMap ) { 166 171 ValueType & val = pair.second; 167 172 for ( ValueType::DeclBall ball : val.decls ) { 168 if ( ! val.userDefinedFunc || ball.isUserDefinedFunc || (! val.userDefined DefaultFunc && ball.isDefaultFunc) || (! val.userDefinedCopyFunc && ball.isCopyFunc) ) {173 if ( ! val.userDefinedFunc || ball.isUserDefinedFunc || (! val.userDefinedCtor && ball.isDefaultCtor) || (! val.userDefinedCopyFunc && ball.isCopyFunc) || (! val.userDefinedDtor && ball.isDtor) ) { 169 174 // decl conforms to the rules described above, so it should be seen by the requester 170 175 out.push_back( ball.decl ); -
src/tests/memberCtors.c
r0b465a5 r235114f 30 30 WrappedInt x, y, z; 31 31 }; 32 33 void ?{}(A * a) { 34 // currently must define default ctor, since there's no "= default" syntax 35 } 32 36 33 37 void ?{}(A * a, int x) {
Note: See TracChangeset
for help on using the changeset viewer.