dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnet/cscc/c c_oper.tc,1.30,1.31


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnet/cscc/c c_oper.tc,1.30,1.31
Date: Sat, 28 Jun 2003 01:42:21 -0400

Update of /cvsroot/dotgnu-pnet/pnet/cscc/c
In directory subversions:/tmp/cvs-serv26430/cscc/c

Modified Files:
        c_oper.tc 
Log Message:


ILNode_SizeOfExpr: special "sizeof" cases for calculating the size
of string constants.


Index: c_oper.tc
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/cscc/c/c_oper.tc,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** c_oper.tc   27 Jun 2003 02:04:47 -0000      1.30
--- c_oper.tc   28 Jun 2003 05:42:18 -0000      1.31
***************
*** 2298,2301 ****
--- 2298,2325 ----
        ILEvalValue evalValue;
  
+       /* Special cases for strings */
+       if(yyisa(node->expr, ILNode_CString))
+       {
+               evalValue.valueType = ILMachineType_UInt32;
+               evalValue.un.i4Value =
+                       (ILInt32)(((ILNode_CString *)(node->expr))->len + 1);
+               CSemSetConstant(value, ILType_UInt32, evalValue);
+               *parent = CreateConstantNode
+                       ((ILNode *)node, (ILNode *)node, &evalValue);
+               return value;
+       }
+       else if(yyisa(node->expr, ILNode_CWString))
+       {
+               evalValue.valueType = ILMachineType_UInt32;
+               evalValue.un.i4Value =
+                       (ILInt32)((CGenWStringLength
+                                               (((ILNode_CWString 
*)(node->expr))->str,
+                                                ((ILNode_CWString 
*)(node->expr))->len) + 1) * 2);
+               CSemSetConstant(value, ILType_UInt32, evalValue);
+               *parent = CreateConstantNode
+                       ((ILNode *)node, (ILNode *)node, &evalValue);
+               return value;
+       }
+ 
        /* Perform semantic analysis on the expression */
        value = ILNode_CSemAnalysis(node->expr, info, &(node->expr), stmtLevel);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]