Changes in / [fb24492:ec79847]
- Location:
- src
- Files:
-
- 5 edited
-
GenPoly/Box.cc (modified) (3 diffs)
-
SymTab/Autogen.cc (modified) (3 diffs)
-
SymTab/Validate.cc (modified) (1 diff)
-
SynTree/Constant.cc (modified) (1 diff)
-
SynTree/Constant.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
rfb24492 rec79847 499 499 500 500 // place current size in the current offset index 501 addExpr( layoutDecl->get_statements(), makeOp( "?=?", makeOp( "?[?]", new VariableExpr( offsetParam ), new ConstantExpr( Constant::from _ulong( n_members ) ) ),501 addExpr( layoutDecl->get_statements(), makeOp( "?=?", makeOp( "?[?]", new VariableExpr( offsetParam ), new ConstantExpr( Constant::from( n_members ) ) ), 502 502 derefVar( sizeParam ) ) ); 503 503 ++n_members; … … 2069 2069 if ( n_members == 0 ) { 2070 2070 // all empty structs have the same layout - size 1, align 1 2071 makeVar( sizeofName( typeName ), layoutType, new SingleInit( new ConstantExpr( Constant::from _ulong(1 ) ) ) );2072 makeVar( alignofName( typeName ), layoutType->clone(), new SingleInit( new ConstantExpr( Constant::from _ulong(1 ) ) ) );2071 makeVar( sizeofName( typeName ), layoutType, new SingleInit( new ConstantExpr( Constant::from( (unsigned long)1 ) ) ) ); 2072 makeVar( alignofName( typeName ), layoutType->clone(), new SingleInit( new ConstantExpr( Constant::from( (unsigned long)1 ) ) ) ); 2073 2073 // NOTE zero-length arrays are forbidden in C, so empty structs have no offsetof array 2074 2074 } else { 2075 2075 ObjectDecl *sizeVar = makeVar( sizeofName( typeName ), layoutType ); 2076 2076 ObjectDecl *alignVar = makeVar( alignofName( typeName ), layoutType->clone() ); 2077 ObjectDecl *offsetVar = makeVar( offsetofName( typeName ), new ArrayType( Type::Qualifiers(), layoutType->clone(), new ConstantExpr( Constant::from _int( n_members ) ), false, false ) );2077 ObjectDecl *offsetVar = makeVar( offsetofName( typeName ), new ArrayType( Type::Qualifiers(), layoutType->clone(), new ConstantExpr( Constant::from( n_members ) ), false, false ) ); 2078 2078 2079 2079 // generate call to layout function … … 2194 2194 2195 2195 // build the offset array and replace the pack with a reference to it 2196 ObjectDecl *offsetArray = makeVar( offsetName, new ArrayType( Type::Qualifiers(), offsetType, new ConstantExpr( Constant::from _ulong( baseMembers.size() ) ), false, false ),2196 ObjectDecl *offsetArray = makeVar( offsetName, new ArrayType( Type::Qualifiers(), offsetType, new ConstantExpr( Constant::from( baseMembers.size() ) ), false, false ), 2197 2197 new ListInit( inits ) ); 2198 2198 ret = new VariableExpr( offsetArray ); -
src/SymTab/Autogen.cc
rfb24492 rec79847 10 10 // Created On : Thu Mar 03 15:45:56 2016 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed May 11 13:22:03201612 // Last Modified On : Tue May 03 16:56:21 2016 13 13 // Update Count : 1 14 14 // … … 217 217 if ( type->get_qualifiers().isConst ) { 218 218 // don't assign const members 219 continue;220 }221 222 if ( field->get_name() == "" ) {223 // don't assign to anonymous members224 // xxx - this is a temporary fix. Anonymous members tie into225 // our inheritance model. I think the correct way to handle this is to226 // cast the structure to the type of the member and let the resolver227 // figure out whether it's valid and have a pass afterwards that fixes228 // the assignment to use pointer arithmetic with the offset of the229 // member, much like how generic type members are handled.230 219 continue; 231 220 } … … 328 317 if ( isUnnamedBitfield( dynamic_cast< ObjectDecl * > ( member ) ) ) { 329 318 // don't make a function whose parameter is an unnamed bitfield 330 continue;331 } else if ( member->get_name() == "" ) {332 // don't assign to anonymous members333 // xxx - this is a temporary fix. Anonymous members tie into334 // our inheritance model. I think the correct way to handle this is to335 // cast the structure to the type of the member and let the resolver336 // figure out whether it's valid and have a pass afterwards that fixes337 // the assignment to use pointer arithmetic with the offset of the338 // member, much like how generic type members are handled.339 319 continue; 340 320 } -
src/SymTab/Validate.cc
rfb24492 rec79847 10 10 // Created On : Sun May 17 21:50:04 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed May 11 13:17:52201612 // Last Modified On : Thu Apr 14 15:37:23 2016 13 13 // Update Count : 297 14 14 // -
src/SynTree/Constant.cc
rfb24492 rec79847 30 30 Constant::~Constant() { delete type; } 31 31 32 Constant Constant::from _int( int i ) {32 Constant Constant::from( int i ) { 33 33 return Constant( new BasicType( Type::Qualifiers(), BasicType::SignedInt ), std::to_string( i ) ); 34 34 } 35 35 36 Constant Constant::from _ulong( unsigned long i ) {36 Constant Constant::from( unsigned long i ) { 37 37 return Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), std::to_string( i ) ); 38 38 } 39 39 40 Constant Constant::from _double( double d ) {40 Constant Constant::from( double d ) { 41 41 return Constant( new BasicType( Type::Qualifiers(), BasicType::Double ), std::to_string( d ) ); 42 42 } -
src/SynTree/Constant.h
rfb24492 rec79847 33 33 34 34 /// generates an integer constant of the given int 35 static Constant from _int( int i );35 static Constant from( int i ); 36 36 /// generates an integer constant of the given unsigned long int 37 static Constant from _ulong( unsigned long i );37 static Constant from( unsigned long i ); 38 38 /// generates a floating point constant of the given double 39 static Constant from _double( double d );39 static Constant from( double d ); 40 40 41 41 virtual Constant *clone() const;
Note:
See TracChangeset
for help on using the changeset viewer.