Changes in / [083cf31:de91427b]


Ignore:
Location:
src
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r083cf31 rde91427b  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Thu Sep 17 15:25:58 2015
    13 // Update Count     : 233
     12// Last Modified On : Thu Sep 17 15:24:08 2015
     13// Update Count     : 231
    1414//
    1515
     
    258258             
    259259                                  case OT_CALL:
    260                                   case OT_CTOR:
    261                                   case OT_DTOR:
    262                                         // there are no intrinsic definitions of the function call operator or constructors or destructors
     260                                        // there are no intrinsic definitions of the function call operator
    263261                                        assert( false );
    264262                                        break;
     
    324322             
    325323                                  case OT_CALL:
    326                                         case OT_CTOR:
    327                                         case OT_DTOR:
    328324                                        assert( false );
    329325                                        break;
  • src/CodeGen/OperatorTable.cc

    r083cf31 rde91427b  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Tue Oct 06 15:26:34 2015
    13 // Update Count     : 9
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Tue Jun 23 17:41:14 2015
     13// Update Count     : 5
    1414//
    1515
     
    2121                const OperatorInfo tableValues[] = {
    2222                        {       "?[?]",         "",             "_operator_index",                              OT_INDEX                        },
    23                         {       "?{}",          "",             "_constructor",                                 OT_CTOR                         },
    24                         {       "^?{}",         "",             "_destructor",                                  OT_DTOR                         }, // ~?{}, -?{}, !?{}, $?{}, ??{}, ^?{}, ?destroy, ?delete
    2523                        {       "?()",          "",             "_operator_call",                               OT_CALL                         },
    2624                        {       "?++",          "++",   "_operator_postincr",                   OT_POSTFIXASSIGN        },
  • src/CodeGen/OperatorTable.h

    r083cf31 rde91427b  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Jun 24 16:17:57 2015
    13 // Update Count     : 5
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Tue Jun 23 16:09:27 2015
     13// Update Count     : 3
    1414//
    1515
     
    2222        enum OperatorType {
    2323                OT_INDEX,
    24                 OT_CTOR,
    25                 OT_DTOR,
    2624                OT_CALL,
    2725                OT_PREFIX,
  • src/MakeLibCfa.cc

    r083cf31 rde91427b  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sat May 16 10:33:33 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Fri Jul 03 18:11:37 2015
    13 // Update Count     : 18
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Fri Jun 26 16:52:59 2015
     13// Update Count     : 14
    1414//
    1515
     
    7777                                break;
    7878                        }
    79                   case CodeGen::OT_CTOR:
    80                   case CodeGen::OT_DTOR:
    8179                  case CodeGen::OT_CONSTANT:
    8280                  case CodeGen::OT_LABELADDRESS:
  • src/Parser/ParseNode.h

    r083cf31 rde91427b  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Aug 19 15:59:27 2015
    13 // Update Count     : 174
     12// Last Modified On : Wed Aug 12 13:27:11 2015
     13// Update Count     : 172
    1414//
    1515
     
    180180                                Assign, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn,
    181181                                ERAssn, OrAssn, Index, FieldSel, PFieldSel, Range,
    182                                 UnPlus, UnMinus, AddressOf, PointTo, Neg, BitNeg, Incr, IncrPost, Decr, DecrPost, LabelAddress,
    183                                 Ctor, Dtor,
     182                                UnPlus, UnMinus, AddressOf, PointTo, Neg, BitNeg, Incr, IncrPost, Decr, DecrPost, LabelAddress
    184183        };
    185184
  • src/SymTab/Validate.cc

    r083cf31 rde91427b  
    1010// Created On       : Sun May 17 21:50:04 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Thu Jan 07 11:27:49 2016
    13 // Update Count     : 269
     12// Last Modified On : Fri Dec 18 15:34:05 2015
     13// Update Count     : 218
    1414//
    1515
     
    202202        };
    203203
    204         class VerifyCtorDtor : public Visitor {
    205         public:
    206                 /// ensure that constructors and destructors have at least one
    207                 /// parameter, the first of which must be a pointer, and no
    208                 /// return values.
    209                 static void verify( std::list< Declaration * > &translationUnit );
    210 
    211                 // VerifyCtorDtor() {}
    212 
    213                 virtual void visit( FunctionDecl *funcDecl );
    214         private:
    215         };
    216 
    217204        void validate( std::list< Declaration * > &translationUnit, bool doDebug ) {
    218205                Pass1 pass1;
     
    226213                AutogenerateRoutines::autogenerateRoutines( translationUnit );
    227214                acceptAll( translationUnit, pass3 );
    228                 VerifyCtorDtor::verify( translationUnit );
    229215        }
    230216
     
    10431029        }
    10441030
    1045         void VerifyCtorDtor::verify( std::list< Declaration * > & translationUnit ) {
    1046                 VerifyCtorDtor verifier;
    1047                 acceptAll( translationUnit, verifier );
    1048         }
    1049 
    1050         void VerifyCtorDtor::visit( FunctionDecl * funcDecl ) {
    1051                 FunctionType * funcType = funcDecl->get_functionType();
    1052                 std::list< DeclarationWithType * > &returnVals = funcType->get_returnVals();
    1053                 std::list< DeclarationWithType * > &params = funcType->get_parameters();
    1054 
    1055                 if ( funcDecl->get_name() == "?{}" || funcDecl->get_name() == "^?{}" ) {
    1056                         if ( params.size() == 0 ) {
    1057                                 throw SemanticError( "Constructors and destructors require at least one parameter ", funcDecl );
    1058                         }
    1059                         if ( ! dynamic_cast< PointerType * >( params.front()->get_type() ) ) {
    1060                                 throw SemanticError( "First parameter of a constructor or destructor must be a pointer ", funcDecl );
    1061                         }
    1062                         if ( returnVals.size() != 0 ) {
    1063                                 throw SemanticError( "Constructors and destructors cannot have explicit return values ", funcDecl );
    1064                         }
    1065                 }
    1066 
    1067                 Visitor::visit( funcDecl );
    1068                 // original idea: modify signature of ctor/dtors and insert appropriate return statements
    1069                 // to cause desired behaviour
    1070                 // new idea: add comma exprs to every ctor call to produce first parameter.
    1071                 // this requires some memoization of the first parameter, because it can be a
    1072                 // complicated expression with side effects (see: malloc). idea: add temporary variable
    1073                 // that is assigned address of constructed object in ctor argument position and
    1074                 // return the temporary. It should also be done after all implicit ctors are
    1075                 // added, so not in this pass!
    1076         }
    10771031} // namespace SymTab
    10781032
  • src/initialization.txt

    r083cf31 rde91427b  
    3434sure that resolved initializers for all declarations are being
    3535generated.
    36 
    37 
    38 ------
    39 
    40 More recent email: (I am quoted; Richard is the responder)
    41 > As far as I'm aware, the only way that I could currently get the correct
    42 > results from the unification engine is by feeding it an expression that
    43 > looks like "?=?( ((struct Y)x.y).a, 10 )", then picking out the pieces that
    44 > I need (namely the correct choice for a). Does this seem like a reasonable
    45 > approach to solve this problem?
    46 
    47 No, unfortunately. Initialization isn't being rewritten as assignment,
    48 so you shouldn't allow the particular selection of assignment
    49 operators that happen to be in scope (and which may include
    50 user-defined operators) to guide the type resolution.
    51 
    52 I don't think there is any way to rewrite an initializer as a single
    53 expression and have the resolver just do the right thing. I see the
    54 algorithm as:
    55 
    56 For each alternative interpretation of the designator:
    57   Construct an expression that casts the initializer to the type of
    58     the designator
    59   Construct an AlternativeFinder and use it to find the lowest cost
    60     interpretation of the expression
    61   Add this interpretation to a list of possibilities
    62 Go through the list of possibilities and pick the lowest cost
    63 
    64 As with many things in the resolver, it's conceptually simple but the
    65 implementation may be a bit of a pain. It fits in with functions like
    66 findSingleExpression, findIntegralExpression in Resolver.cc, although
    67 it will be significantly more complicated than any of the existing
    68 ones.
    69 
    70 
    71 
Note: See TracChangeset for help on using the changeset viewer.