Changeset 395fc37 for src/SymTab
- Timestamp:
- Mar 16, 2017, 6:14:32 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:
- 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. - Location:
- src/SymTab
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Autogen.cc
r6f95000 r395fc37 151 151 bool hasDynamicLayout( AggrDecl * aggregateDecl ) { 152 152 for ( TypeDecl * param : aggregateDecl->get_parameters() ) { 153 if ( param-> get_kind() == TypeDecl::Any) return true;153 if ( param->isComplete() ) return true; 154 154 } 155 155 return false; -
src/SymTab/Indexer.cc
r6f95000 r395fc37 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/SymTab/Validate.cc
r6f95000 r395fc37 224 224 HoistStruct::hoistStruct( translationUnit ); 225 225 ReturnTypeFixer::fix( translationUnit ); // must happen before autogen 226 acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions 226 227 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecayPass 227 228 acceptAll( translationUnit, epc ); 228 acceptAll( translationUnit, lrt );229 229 ReturnChecker::checkFunctionReturns( translationUnit ); 230 230 compoundliteral.mutateDeclarationList( translationUnit ); … … 840 840 assertf( retVals.size() == 0 || retVals.size() == 1, "Function %s has too many return values: %d", functionDecl->get_name().c_str(), retVals.size() ); 841 841 if ( retVals.size() == 1 ) { 842 // ensure all function return values have a name - use the name of the function to disambiguate (this also provides a nice bit of help for debugging) 843 // ensure other return values have a name 842 // ensure all function return values have a name - use the name of the function to disambiguate (this also provides a nice bit of help for debugging). 843 // ensure other return values have a name. 844 844 DeclarationWithType * ret = retVals.front(); 845 845 if ( ret->get_name() == "" ) {
Note: See TracChangeset
for help on using the changeset viewer.