Changes in / [c831073:8a2f7f1]
- Location:
- src
- Files:
-
- 2 deleted
- 10 edited
-
AST/Inspect.cpp (modified) (2 diffs)
-
AST/Inspect.hpp (modified) (2 diffs)
-
AST/SymbolTable.cpp (modified) (4 diffs)
-
AST/SymbolTable.hpp (modified) (1 diff)
-
InitTweak/FixInitNew.cpp (modified) (8 diffs)
-
InitTweak/GenInit.cc (modified) (1 diff)
-
SymTab/Autogen.cc (modified) (4 diffs)
-
SymTab/Autogen.h (modified) (8 diffs)
-
SymTab/GenImplicitCall.cpp (deleted)
-
SymTab/GenImplicitCall.hpp (deleted)
-
SymTab/module.mk (modified) (1 diff)
-
Validate/Autogen.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Inspect.cpp
rc831073 r8a2f7f1 10 10 // Created On : Fri Jun 24 13:16:31 2022 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Apr 14 15:09:00 202313 // Update Count : 412 // Last Modified On : Mon Oct 3 11:04:00 2022 13 // Update Count : 3 14 14 // 15 15 … … 168 168 } 169 169 170 bool isUnnamedBitfield( const ast::ObjectDecl * obj ) {171 return obj && obj->name.empty() && obj->bitfieldWidth;172 }173 174 170 } // namespace ast -
src/AST/Inspect.hpp
rc831073 r8a2f7f1 10 10 // Created On : Fri Jun 24 13:16:31 2022 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Apr 14 15:09:00 202313 // Update Count : 312 // Last Modified On : Thr Sep 22 13:44:00 2022 13 // Update Count : 2 14 14 // 15 15 … … 38 38 const ApplicationExpr * isIntrinsicCallExpr( const Expr * expr ); 39 39 40 /// Returns true if obj's name is the empty string and it has a bitfield width.41 bool isUnnamedBitfield( const ObjectDecl * obj );42 43 40 } -
src/AST/SymbolTable.cpp
rc831073 r8a2f7f1 260 260 void SymbolTable::addId( const DeclWithType * decl, const Expr * baseExpr ) { 261 261 // default handling of conflicts is to raise an error 262 addId Common( decl, OnConflict::error(), baseExpr, decl->isDeleted ? decl : nullptr );262 addId( decl, OnConflict::error(), baseExpr, decl->isDeleted ? decl : nullptr ); 263 263 } 264 264 265 265 void SymbolTable::addDeletedId( const DeclWithType * decl, const Decl * deleter ) { 266 266 // default handling of conflicts is to raise an error 267 addId Common( decl, OnConflict::error(), nullptr, deleter );267 addId( decl, OnConflict::error(), nullptr, deleter ); 268 268 } 269 269 … … 677 677 } 678 678 679 void SymbolTable::addId Common(680 const DeclWithType * decl, SymbolTable::OnConflict handleConflicts, 681 const Expr * baseExpr, constDecl * deleter ) {679 void SymbolTable::addId( 680 const DeclWithType * decl, SymbolTable::OnConflict handleConflicts, const Expr * baseExpr, 681 const Decl * deleter ) { 682 682 SpecialFunctionKind kind = getSpecialFunctionKind(decl->name); 683 683 if (kind == NUMBER_OF_KINDS) { // not a special decl 684 addId ToTable(decl, decl->name, idTable, handleConflicts, baseExpr, deleter);684 addId(decl, decl->name, idTable, handleConflicts, baseExpr, deleter); 685 685 } 686 686 else { … … 695 695 assertf(false, "special decl with non-function type"); 696 696 } 697 addIdToTable(decl, key, specialFunctionTable[kind], handleConflicts, baseExpr, deleter); 698 } 699 } 700 701 void SymbolTable::addIdToTable( 702 const DeclWithType * decl, const std::string & lookupKey, 703 IdTable::Ptr & table, SymbolTable::OnConflict handleConflicts, 704 const Expr * baseExpr, const Decl * deleter ) { 697 addId(decl, key, specialFunctionTable[kind], handleConflicts, baseExpr, deleter); 698 } 699 } 700 701 void SymbolTable::addId( 702 const DeclWithType * decl, const std::string & lookupKey, IdTable::Ptr & table, SymbolTable::OnConflict handleConflicts, const Expr * baseExpr, 703 const Decl * deleter ) { 705 704 ++*stats().add_calls; 706 705 const std::string &name = decl->name; … … 779 778 void SymbolTable::addMembers( 780 779 const AggregateDecl * aggr, const Expr * expr, SymbolTable::OnConflict handleConflicts ) { 781 for ( const ptr<Decl> &decl : aggr->members ) {782 auto dwt = decl.as<DeclWithType>();783 if ( nullptr == dwt ) continue;784 addIdCommon( dwt, handleConflicts, expr );785 // Inline through unnamed struct/union members.786 if ( "" != dwt->name ) continue;787 const Type * t = dwt->get_type()->stripReferences();788 if ( auto rty = dynamic_cast<const BaseInstType *>( t ) ) {789 if ( ! dynamic_cast<const StructInstType *>(rty)790 && ! dynamic_cast<const UnionInstType *>(rty) ) continue;791 ResolvExpr::Cost cost = ResolvExpr::Cost::zero;792 ast::ptr<ast::TypeSubstitution> tmp = expr->env;793 expr = mutate_field(expr, &Expr::env, nullptr);794 const Expr * base = ResolvExpr::referenceToRvalueConversion( expr, cost ); 795 base = mutate_field(base, &Expr::env, tmp);796 797 addMembers(798 rty->aggr(), new MemberExpr{ base->location, dwt, base }, handleConflicts );780 for ( const Decl * decl : aggr->members ) { 781 if ( auto dwt = dynamic_cast< const DeclWithType * >( decl ) ) { 782 addId( dwt, handleConflicts, expr ); 783 if ( dwt->name == "" ) { 784 const Type * t = dwt->get_type()->stripReferences(); 785 if ( auto rty = dynamic_cast<const BaseInstType *>( t ) ) { 786 if ( ! dynamic_cast<const StructInstType *>(rty) 787 && ! dynamic_cast<const UnionInstType *>(rty) ) continue; 788 ResolvExpr::Cost cost = ResolvExpr::Cost::zero; 789 ast::ptr<ast::TypeSubstitution> tmp = expr->env; 790 expr = mutate_field(expr, &Expr::env, nullptr); 791 const Expr * base = ResolvExpr::referenceToRvalueConversion( expr, cost ); 792 base = mutate_field(base, &Expr::env, tmp); 793 794 addMembers( 795 rty->aggr(), new MemberExpr{ base->location, dwt, base }, handleConflicts ); 796 } 797 } 799 798 } 800 799 } -
src/AST/SymbolTable.hpp
rc831073 r8a2f7f1 192 192 193 193 /// common code for addId, addDeletedId, etc. 194 void addId Common(195 const DeclWithType * decl, OnConflict handleConflicts, 196 const Expr * baseExpr = nullptr, constDecl * deleter = nullptr );194 void addId( 195 const DeclWithType * decl, OnConflict handleConflicts, const Expr * baseExpr = nullptr, 196 const Decl * deleter = nullptr ); 197 197 198 198 /// common code for addId when special decls are placed into separate tables 199 void addIdToTable( 200 const DeclWithType * decl, const std::string & lookupKey, 201 IdTable::Ptr & idTable, OnConflict handleConflicts, 199 void addId( 200 const DeclWithType * decl, const std::string & lookupKey, IdTable::Ptr & idTable, OnConflict handleConflicts, 202 201 const Expr * baseExpr = nullptr, const Decl * deleter = nullptr); 203 202 204 203 /// adds all of the members of the Aggregate (addWith helper) 205 204 void addMembers( const AggregateDecl * aggr, const Expr * expr, OnConflict handleConflicts ); -
src/InitTweak/FixInitNew.cpp
rc831073 r8a2f7f1 14 14 #include <utility> // for pair 15 15 16 #include "AST/DeclReplacer.hpp"17 #include "AST/Expr.hpp"18 16 #include "AST/Inspect.hpp" // for getFunction, getPointerBase, g... 19 #include "AST/Node.hpp"20 #include "AST/Pass.hpp"21 #include "AST/Print.hpp"22 #include "AST/SymbolTable.hpp"23 #include "AST/Type.hpp"24 17 #include "CodeGen/GenType.h" // for genPrettyType 25 18 #include "CodeGen/OperatorTable.h" 19 #include "Common/CodeLocationTools.hpp" 26 20 #include "Common/PassVisitor.h" // for PassVisitor, WithStmtsToAdd 27 21 #include "Common/SemanticError.h" // for SemanticError … … 34 28 #include "ResolvExpr/Unify.h" // for typesCompatible 35 29 #include "SymTab/Autogen.h" // for genImplicitCall 36 #include "SymTab/GenImplicitCall.hpp" // for genImplicitCall37 30 #include "SymTab/Indexer.h" // for Indexer 38 31 #include "SymTab/Mangler.h" // for Mangler … … 52 45 #include "Validate/FindSpecialDecls.h" // for dtorStmt, dtorStructDestroy 53 46 47 #include "AST/Expr.hpp" 48 #include "AST/Node.hpp" 49 #include "AST/Pass.hpp" 50 #include "AST/Print.hpp" 51 #include "AST/SymbolTable.hpp" 52 #include "AST/Type.hpp" 53 #include "AST/DeclReplacer.hpp" 54 54 55 extern bool ctordtorp; // print all debug 55 56 extern bool ctorp; // print ctor debug … … 62 63 namespace InitTweak { 63 64 namespace { 64 65 // Shallow copy the pointer list for return.66 std::vector<ast::ptr<ast::TypeDecl>> getGenericParams( const ast::Type * t ) {67 if ( auto inst = dynamic_cast<const ast::StructInstType *>( t ) ) {68 return inst->base->params;69 }70 if ( auto inst = dynamic_cast<const ast::UnionInstType *>( t ) ) {71 return inst->base->params;72 }73 return {};74 }75 76 /// Given type T, generate type of default ctor/dtor, i.e. function type void (*) (T &).77 ast::FunctionDecl * genDefaultFunc(78 const CodeLocation loc,79 const std::string fname,80 const ast::Type * paramType,81 bool maybePolymorphic = true) {82 std::vector<ast::ptr<ast::TypeDecl>> typeParams;83 if ( maybePolymorphic ) typeParams = getGenericParams( paramType );84 auto dstParam = new ast::ObjectDecl( loc,85 "_dst",86 new ast::ReferenceType( paramType ),87 nullptr,88 {},89 ast::Linkage::Cforall90 );91 return new ast::FunctionDecl( loc,92 fname,93 std::move(typeParams),94 {dstParam},95 {},96 new ast::CompoundStmt(loc),97 {},98 ast::Linkage::Cforall99 );100 }101 102 65 struct SelfAssignChecker { 103 66 void previsit( const ast::ApplicationExpr * appExpr ); … … 158 121 void previsit( const ast::FunctionDecl * ) { visit_children = false; } 159 122 160 protected:123 protected: 161 124 ObjectSet curVars; 162 125 }; … … 239 202 240 203 SemanticErrorException errors; 241 private:204 private: 242 205 template< typename... Params > 243 206 void emit( CodeLocation, const Params &... params ); … … 325 288 static UniqueName dtorNamer( "__cleanup_dtor" ); 326 289 std::string name = dtorNamer.newName(); 327 ast::FunctionDecl * dtorFunc = genDefaultFunc( loc, name, objDecl->type->stripReferences(), false );290 ast::FunctionDecl * dtorFunc = SymTab::genDefaultFunc( loc, name, objDecl->type->stripReferences(), false ); 328 291 stmtsToAdd.push_back( new ast::DeclStmt(loc, dtorFunc ) ); 329 292 … … 1117 1080 void InsertDtors::previsit( const ast::BranchStmt * stmt ) { 1118 1081 switch( stmt->kind ) { 1119 case ast::BranchStmt::Continue:1120 case ast::BranchStmt::Break:1082 case ast::BranchStmt::Continue: 1083 case ast::BranchStmt::Break: 1121 1084 // could optimize the break/continue case, because the S_L-S_G check is unnecessary (this set should 1122 1085 // always be empty), but it serves as a small sanity check. 1123 case ast::BranchStmt::Goto:1086 case ast::BranchStmt::Goto: 1124 1087 handleGoto( stmt ); 1125 1088 break; 1126 default:1089 default: 1127 1090 assert( false ); 1128 1091 } // switch -
src/InitTweak/GenInit.cc
rc831073 r8a2f7f1 39 39 #include "ResolvExpr/Resolver.h" 40 40 #include "SymTab/Autogen.h" // for genImplicitCall 41 #include "SymTab/GenImplicitCall.hpp" // for genImplicitCall42 41 #include "SymTab/Mangler.h" // for Mangler 43 42 #include "SynTree/LinkageSpec.h" // for isOverridable, C -
src/SymTab/Autogen.cc
rc831073 r8a2f7f1 10 10 // Created On : Thu Mar 03 15:45:56 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Apr 14 15:03:00 202313 // Update Count : 6 412 // Last Modified On : Fri Apr 27 14:39:06 2018 13 // Update Count : 63 14 14 // 15 15 … … 211 211 } 212 212 213 bool isUnnamedBitfield( const ast::ObjectDecl * obj ) { 214 return obj && obj->name.empty() && obj->bitfieldWidth; 215 } 216 213 217 /// inserts a forward declaration for functionDecl into declsToAdd 214 218 void addForwardDecl( FunctionDecl * functionDecl, std::list< Declaration * > & declsToAdd ) { … … 230 234 } 231 235 236 // shallow copy the pointer list for return 237 std::vector<ast::ptr<ast::TypeDecl>> getGenericParams (const ast::Type * t) { 238 if (auto structInst = dynamic_cast<const ast::StructInstType*>(t)) { 239 return structInst->base->params; 240 } 241 if (auto unionInst = dynamic_cast<const ast::UnionInstType*>(t)) { 242 return unionInst->base->params; 243 } 244 return {}; 245 } 246 232 247 /// given type T, generate type of default ctor/dtor, i.e. function type void (*) (T *) 233 248 FunctionType * genDefaultType( Type * paramType, bool maybePolymorphic ) { … … 241 256 ftype->parameters.push_back( dstParam ); 242 257 return ftype; 258 } 259 260 /// Given type T, generate type of default ctor/dtor, i.e. function type void (*) (T &). 261 ast::FunctionDecl * genDefaultFunc(const CodeLocation loc, const std::string fname, const ast::Type * paramType, bool maybePolymorphic) { 262 std::vector<ast::ptr<ast::TypeDecl>> typeParams; 263 if (maybePolymorphic) typeParams = getGenericParams(paramType); 264 auto dstParam = new ast::ObjectDecl(loc, "_dst", new ast::ReferenceType(paramType), nullptr, {}, ast::Linkage::Cforall); 265 return new ast::FunctionDecl(loc, fname, std::move(typeParams), {dstParam}, {}, new ast::CompoundStmt(loc), {}, ast::Linkage::Cforall); 243 266 } 244 267 -
src/SymTab/Autogen.h
rc831073 r8a2f7f1 9 9 // Author : Rob Schluntz 10 10 // Created On : Sun May 17 21:53:34 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Fri Apr 14 15:06:00 202313 // Update Count : 1 711 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Dec 13 16:38:06 2019 13 // Update Count : 16 14 14 // 15 15 … … 45 45 /// returns true if obj's name is the empty string and it has a bitfield width 46 46 bool isUnnamedBitfield( ObjectDecl * obj ); 47 bool isUnnamedBitfield( const ast::ObjectDecl * obj ); 47 48 48 49 /// generate the type of an assignment function for paramType. … … 54 55 FunctionType * genDefaultType( Type * paramType, bool maybePolymorphic = true ); 55 56 57 ast::FunctionDecl * genDefaultFunc(const CodeLocation loc, const std::string fname, const ast::Type * paramType, bool maybePolymorphic = true); 58 56 59 /// generate the type of a copy constructor for paramType. 57 60 /// maybePolymorphic is true if the resulting FunctionType is allowed to be polymorphic … … 64 67 template< typename OutputIterator > 65 68 Statement * genCall( InitTweak::InitExpander_old & srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, Type * addCast = nullptr, bool forward = true ); 69 70 template< typename OutIter > 71 ast::ptr< ast::Stmt > genCall( 72 InitTweak::InitExpander_new & srcParam, const ast::Expr * dstParam, 73 const CodeLocation & loc, const std::string & fname, OutIter && out, 74 const ast::Type * type, const ast::Type * addCast, LoopDirection forward = LoopForward ); 66 75 67 76 /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Should only be called with non-array types. … … 112 121 113 122 *out++ = new ExprStmt( fExpr ); 123 124 srcParam.clearArrayIndices(); 125 126 return listInit; 127 } 128 129 /// inserts into out a generated call expression to function fname with arguments dstParam and 130 /// srcParam. Should only be called with non-array types. 131 /// optionally returns a statement which must be inserted prior to the containing loop, if 132 /// there is one 133 template< typename OutIter > 134 ast::ptr< ast::Stmt > genScalarCall( 135 InitTweak::InitExpander_new & srcParam, const ast::Expr * dstParam, 136 const CodeLocation & loc, std::string fname, OutIter && out, const ast::Type * type, 137 const ast::Type * addCast = nullptr 138 ) { 139 bool isReferenceCtorDtor = false; 140 if ( dynamic_cast< const ast::ReferenceType * >( type ) && CodeGen::isCtorDtor( fname ) ) { 141 // reference constructors are essentially application of the rebind operator. 142 // apply & to both arguments, do not need a cast 143 fname = "?=?"; 144 dstParam = new ast::AddressExpr{ dstParam }; 145 addCast = nullptr; 146 isReferenceCtorDtor = true; 147 } 148 149 // want to be able to generate assignment, ctor, and dtor generically, so fname is one of 150 // "?=?", "?{}", or "^?{}" 151 ast::UntypedExpr * fExpr = new ast::UntypedExpr{ loc, new ast::NameExpr{ loc, fname } }; 152 153 if ( addCast ) { 154 // cast to T& with qualifiers removed, so that qualified objects can be constructed and 155 // destructed with the same functions as non-qualified objects. Unfortunately, lvalue 156 // is considered a qualifier - for AddressExpr to resolve, its argument must have an 157 // lvalue-qualified type, so remove all qualifiers except lvalue. 158 // xxx -- old code actually removed lvalue too... 159 ast::ptr< ast::Type > guard = addCast; // prevent castType from mutating addCast 160 ast::ptr< ast::Type > castType = addCast; 161 ast::remove_qualifiers( 162 castType, 163 ast::CV::Const | ast::CV::Volatile | ast::CV::Restrict | ast::CV::Atomic ); 164 dstParam = new ast::CastExpr{ dstParam, new ast::ReferenceType{ castType } }; 165 } 166 fExpr->args.emplace_back( dstParam ); 167 168 ast::ptr<ast::Stmt> listInit = srcParam.buildListInit( fExpr ); 169 170 // fetch next set of arguments 171 ++srcParam; 172 173 // return if adding reference fails -- will happen on default ctor and dtor 174 if ( isReferenceCtorDtor && ! srcParam.addReference() ) return listInit; 175 176 std::vector< ast::ptr< ast::Expr > > args = *srcParam; 177 splice( fExpr->args, args ); 178 179 *out++ = new ast::ExprStmt{ loc, fExpr }; 114 180 115 181 srcParam.clearArrayIndices(); … … 182 248 } 183 249 250 /// Store in out a loop which calls fname on each element of the array with srcParam and 251 /// dstParam as arguments. If forward is true, loop goes from 0 to N-1, else N-1 to 0 252 template< typename OutIter > 253 void genArrayCall( 254 InitTweak::InitExpander_new & srcParam, const ast::Expr * dstParam, 255 const CodeLocation & loc, const std::string & fname, OutIter && out, 256 const ast::ArrayType * array, const ast::Type * addCast = nullptr, 257 LoopDirection forward = LoopForward 258 ) { 259 static UniqueName indexName( "_index" ); 260 261 // for a flexible array member nothing is done -- user must define own assignment 262 if ( ! array->dimension ) return; 263 264 if ( addCast ) { 265 // peel off array layer from cast 266 addCast = strict_dynamic_cast< const ast::ArrayType * >( addCast )->base; 267 } 268 269 ast::ptr< ast::Expr > begin, end; 270 std::string cmp, update; 271 272 if ( forward ) { 273 // generate: for ( int i = 0; i < N; ++i ) 274 begin = ast::ConstantExpr::from_int( loc, 0 ); 275 end = array->dimension; 276 cmp = "?<?"; 277 update = "++?"; 278 } else { 279 // generate: for ( int i = N-1; i >= 0; --i ) 280 begin = ast::UntypedExpr::createCall( loc, "?-?", 281 { array->dimension, ast::ConstantExpr::from_int( loc, 1 ) } ); 282 end = ast::ConstantExpr::from_int( loc, 0 ); 283 cmp = "?>=?"; 284 update = "--?"; 285 } 286 287 ast::ptr< ast::DeclWithType > index = new ast::ObjectDecl{ 288 loc, indexName.newName(), new ast::BasicType{ ast::BasicType::SignedInt }, 289 new ast::SingleInit{ loc, begin } }; 290 ast::ptr< ast::Expr > indexVar = new ast::VariableExpr{ loc, index }; 291 292 ast::ptr< ast::Expr > cond = ast::UntypedExpr::createCall( 293 loc, cmp, { indexVar, end } ); 294 295 ast::ptr< ast::Expr > inc = ast::UntypedExpr::createCall( 296 loc, update, { indexVar } ); 297 298 ast::ptr< ast::Expr > dstIndex = ast::UntypedExpr::createCall( 299 loc, "?[?]", { dstParam, indexVar } ); 300 301 // srcParam must keep track of the array indices to build the source parameter and/or 302 // array list initializer 303 srcParam.addArrayIndex( indexVar, array->dimension ); 304 305 // for stmt's body, eventually containing call 306 ast::CompoundStmt * body = new ast::CompoundStmt{ loc }; 307 ast::ptr< ast::Stmt > listInit = genCall( 308 srcParam, dstIndex, loc, fname, std::back_inserter( body->kids ), array->base, addCast, 309 forward ); 310 311 // block containing the stmt and index variable 312 ast::CompoundStmt * block = new ast::CompoundStmt{ loc }; 313 block->push_back( new ast::DeclStmt{ loc, index } ); 314 if ( listInit ) { block->push_back( listInit ); } 315 block->push_back( new ast::ForStmt{ loc, {}, cond, inc, body } ); 316 317 *out++ = block; 318 } 319 184 320 template< typename OutputIterator > 185 321 Statement * genCall( InitTweak::InitExpander_old & srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, Type * addCast, bool forward ) { … … 189 325 } else { 190 326 return genScalarCall( srcParam, dstParam, fname, out, type, addCast ); 327 } 328 } 329 330 template< typename OutIter > 331 ast::ptr< ast::Stmt > genCall( 332 InitTweak::InitExpander_new & srcParam, const ast::Expr * dstParam, 333 const CodeLocation & loc, const std::string & fname, OutIter && out, 334 const ast::Type * type, const ast::Type * addCast, LoopDirection forward 335 ) { 336 if ( auto at = dynamic_cast< const ast::ArrayType * >( type ) ) { 337 genArrayCall( 338 srcParam, dstParam, loc, fname, std::forward< OutIter >(out), at, addCast, 339 forward ); 340 return {}; 341 } else { 342 return genScalarCall( 343 srcParam, dstParam, loc, fname, std::forward< OutIter >( out ), type, addCast ); 191 344 } 192 345 } … … 226 379 } 227 380 381 static inline ast::ptr< ast::Stmt > genImplicitCall( 382 InitTweak::InitExpander_new & srcParam, const ast::Expr * dstParam, 383 const CodeLocation & loc, const std::string & fname, const ast::ObjectDecl * obj, 384 LoopDirection forward = LoopForward 385 ) { 386 // unnamed bit fields are not copied as they cannot be accessed 387 if ( isUnnamedBitfield( obj ) ) return {}; 388 389 ast::ptr< ast::Type > addCast; 390 if ( (fname == "?{}" || fname == "^?{}") && ( ! obj || ( obj && ! obj->bitfieldWidth ) ) ) { 391 assert( dstParam->result ); 392 addCast = dstParam->result; 393 } 394 395 std::vector< ast::ptr< ast::Stmt > > stmts; 396 genCall( 397 srcParam, dstParam, loc, fname, back_inserter( stmts ), obj->type, addCast, forward ); 398 399 if ( stmts.empty() ) { 400 return {}; 401 } else if ( stmts.size() == 1 ) { 402 const ast::Stmt * callStmt = stmts.front(); 403 if ( addCast ) { 404 // implicitly generated ctor/dtor calls should be wrapped so that later passes are 405 // aware they were generated. 406 callStmt = new ast::ImplicitCtorDtorStmt{ callStmt->location, callStmt }; 407 } 408 return callStmt; 409 } else { 410 assert( false ); 411 return {}; 412 } 413 } 228 414 } // namespace SymTab 229 415 -
src/SymTab/module.mk
rc831073 r8a2f7f1 20 20 SymTab/FixFunction.cc \ 21 21 SymTab/FixFunction.h \ 22 SymTab/GenImplicitCall.cpp \23 SymTab/GenImplicitCall.hpp \24 22 SymTab/Indexer.cc \ 25 23 SymTab/Indexer.h \ -
src/Validate/Autogen.cpp
rc831073 r8a2f7f1 39 39 #include "InitTweak/GenInit.h" // for fixReturnStatements 40 40 #include "InitTweak/InitTweak.h" // for isAssignment, isCopyConstructor 41 #include "SymTab/GenImplicitCall.hpp" // for genImplicitCall42 41 #include "SymTab/Mangler.h" // for Mangler 43 42 #include "CompilationState.h" … … 424 423 for ( unsigned int index = 0 ; index < fields ; ++index ) { 425 424 auto member = aggr->members[index].strict_as<ast::DeclWithType>(); 426 if ( ast::isUnnamedBitfield(425 if ( SymTab::isUnnamedBitfield( 427 426 dynamic_cast<const ast::ObjectDecl *>( member ) ) ) { 428 427 if ( index == fields - 1 ) { … … 600 599 // Not sure why it could be null. 601 600 // Don't make a function for a parameter that is an unnamed bitfield. 602 if ( nullptr == field || ast::isUnnamedBitfield( field ) ) {601 if ( nullptr == field || SymTab::isUnnamedBitfield( field ) ) { 603 602 continue; 604 603 // Matching Parameter: Initialize the field by copy.
Note:
See TracChangeset
for help on using the changeset viewer.