blob: 3f4ae07eaba3f11cfb24b58c320ca1659b3954b2 [file] [log] [blame]
Chris Lattner1b926492006-08-23 06:42:10 +00001//===--- Expr.cpp - Expression AST Node Implementation --------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file was developed by Chris Lattner and is distributed under
6// the University of Illinois Open Source License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the Expr class and subclasses.
11//
12//===----------------------------------------------------------------------===//
13
14#include "clang/AST/Expr.h"
Chris Lattner5e9a8782006-11-04 06:21:51 +000015#include "clang/AST/StmtVisitor.h"
Chris Lattnere165d942006-08-24 04:40:38 +000016#include "clang/Lex/IdentifierTable.h"
Chris Lattner1b926492006-08-23 06:42:10 +000017using namespace llvm;
18using namespace clang;
19
Chris Lattner0eedafe2006-08-24 04:56:27 +000020//===----------------------------------------------------------------------===//
21// Primary Expressions.
22//===----------------------------------------------------------------------===//
23
Steve Naroff408451b2007-02-26 22:17:12 +000024StringLiteral::StringLiteral(const char *strData, unsigned byteLength,
Steve Naroff53f07dc2007-05-17 21:49:33 +000025 bool Wide, QualType t, SourceLocation firstLoc,
26 SourceLocation lastLoc) :
Steve Narofff1e53692007-03-23 22:27:02 +000027 Expr(StringLiteralClass, t) {
Steve Naroffdf7855b2007-02-21 23:46:25 +000028 // OPTIMIZE: could allocate this appended to the StringLiteral.
Chris Lattnerd3e98952006-10-06 05:22:26 +000029 char *AStrData = new char[byteLength];
30 memcpy(AStrData, strData, byteLength);
31 StrData = AStrData;
32 ByteLength = byteLength;
Chris Lattner882f7882006-11-04 18:52:07 +000033 IsWide = Wide;
Steve Naroff53f07dc2007-05-17 21:49:33 +000034 firstTokLoc = firstLoc;
35 lastTokLoc = lastLoc;
Chris Lattnerd3e98952006-10-06 05:22:26 +000036}
37
Steve Naroffdf7855b2007-02-21 23:46:25 +000038StringLiteral::~StringLiteral() {
Chris Lattnerd3e98952006-10-06 05:22:26 +000039 delete[] StrData;
40}
41
Chris Lattner15768702006-11-05 23:54:51 +000042bool UnaryOperator::isPostfix(Opcode Op) {
43 switch (Op) {
44 case PostInc:
45 case PostDec:
46 return true;
47 default:
48 return false;
49 }
50}
51
Chris Lattner1b926492006-08-23 06:42:10 +000052/// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
53/// corresponds to, e.g. "sizeof" or "[pre]++".
54const char *UnaryOperator::getOpcodeStr(Opcode Op) {
55 switch (Op) {
Chris Lattnerc52b1182006-10-25 05:45:55 +000056 default: assert(0 && "Unknown unary operator");
Chris Lattner15768702006-11-05 23:54:51 +000057 case PostInc: return "++";
58 case PostDec: return "--";
59 case PreInc: return "++";
60 case PreDec: return "--";
Chris Lattner1b926492006-08-23 06:42:10 +000061 case AddrOf: return "&";
62 case Deref: return "*";
63 case Plus: return "+";
64 case Minus: return "-";
65 case Not: return "~";
66 case LNot: return "!";
67 case Real: return "__real";
68 case Imag: return "__imag";
Chris Lattner26115ac2006-08-24 06:10:04 +000069 case SizeOf: return "sizeof";
70 case AlignOf: return "alignof";
Chris Lattnerc52b1182006-10-25 05:45:55 +000071 case Extension: return "__extension__";
Chris Lattner1b926492006-08-23 06:42:10 +000072 }
73}
74
Chris Lattner0eedafe2006-08-24 04:56:27 +000075//===----------------------------------------------------------------------===//
76// Postfix Operators.
77//===----------------------------------------------------------------------===//
Chris Lattnere165d942006-08-24 04:40:38 +000078
Steve Naroff509fe022007-05-17 01:16:00 +000079CallExpr::CallExpr(Expr *fn, Expr **args, unsigned numargs, QualType t,
80 SourceLocation l)
Steve Naroffae4143e2007-04-26 20:39:23 +000081 : Expr(CallExprClass, t), Fn(fn), NumArgs(numargs) {
Chris Lattnere165d942006-08-24 04:40:38 +000082 Args = new Expr*[numargs];
83 for (unsigned i = 0; i != numargs; ++i)
84 Args[i] = args[i];
Steve Naroff509fe022007-05-17 01:16:00 +000085 Loc = l;
Chris Lattnere165d942006-08-24 04:40:38 +000086}
87
Chris Lattner1b926492006-08-23 06:42:10 +000088/// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
89/// corresponds to, e.g. "<<=".
90const char *BinaryOperator::getOpcodeStr(Opcode Op) {
91 switch (Op) {
92 default: assert(0 && "Unknown binary operator");
93 case Mul: return "*";
94 case Div: return "/";
95 case Rem: return "%";
96 case Add: return "+";
97 case Sub: return "-";
98 case Shl: return "<<";
99 case Shr: return ">>";
100 case LT: return "<";
101 case GT: return ">";
102 case LE: return "<=";
103 case GE: return ">=";
104 case EQ: return "==";
105 case NE: return "!=";
106 case And: return "&";
107 case Xor: return "^";
108 case Or: return "|";
109 case LAnd: return "&&";
110 case LOr: return "||";
111 case Assign: return "=";
112 case MulAssign: return "*=";
113 case DivAssign: return "/=";
114 case RemAssign: return "%=";
115 case AddAssign: return "+=";
116 case SubAssign: return "-=";
117 case ShlAssign: return "<<=";
118 case ShrAssign: return ">>=";
119 case AndAssign: return "&=";
120 case XorAssign: return "^=";
121 case OrAssign: return "|=";
122 case Comma: return ",";
123 }
124}
Steve Naroff47500512007-04-19 23:00:49 +0000125
Steve Naroff475cca02007-05-14 17:19:29 +0000126/// isLvalue - C99 6.3.2.1: an lvalue is an expression with an object type or an
127/// incomplete type other than void. Nonarray expressions that can be lvalues:
Steve Naroff47500512007-04-19 23:00:49 +0000128/// - name, where name must be a variable
129/// - e[i]
130/// - (e), where e must be an lvalue
131/// - e.name, where e must be an lvalue
132/// - e->name
Steve Naroff35d85152007-05-07 00:24:15 +0000133/// - *e, the type of e cannot be a function type
Steve Naroff47500512007-04-19 23:00:49 +0000134/// - string-constant
135///
Steve Naroff9358c712007-05-27 23:58:33 +0000136Expr::isLvalueResult Expr::isLvalue() {
Steve Naroff475cca02007-05-14 17:19:29 +0000137 // first, check the type (C99 6.3.2.1)
Steve Naroff9358c712007-05-27 23:58:33 +0000138 if (isa<FunctionType>(TR.getCanonicalType())) // from isObjectType()
139 return LV_NotObjectType;
Steve Naroff475cca02007-05-14 17:19:29 +0000140 if (TR->isIncompleteType() && TR->isVoidType())
Steve Naroff9358c712007-05-27 23:58:33 +0000141 return LV_IncompleteVoidType;
Steve Naroff475cca02007-05-14 17:19:29 +0000142
Steve Naroff5dd642e2007-05-14 18:14:51 +0000143 // the type looks fine, now check the expression
Steve Naroff47500512007-04-19 23:00:49 +0000144 switch (getStmtClass()) {
Steve Naroff475cca02007-05-14 17:19:29 +0000145 case StringLiteralClass: // C99 6.5.1p4
Steve Naroff5dd642e2007-05-14 18:14:51 +0000146 case ArraySubscriptExprClass: // C99 6.5.3p4 (e1[e2] == (*((e1)+(e2))))
Steve Naroff9358c712007-05-27 23:58:33 +0000147 return LV_Valid;
Steve Naroff475cca02007-05-14 17:19:29 +0000148 case DeclRefExprClass: // C99 6.5.1p2
Steve Naroff9358c712007-05-27 23:58:33 +0000149 if (isa<VarDecl>(cast<DeclRefExpr>(this)->getDecl()))
150 return LV_Valid;
151 break;
Steve Naroff475cca02007-05-14 17:19:29 +0000152 case MemberExprClass: // C99 6.5.2.3p4
Steve Naroff47500512007-04-19 23:00:49 +0000153 const MemberExpr *m = cast<MemberExpr>(this);
Steve Naroff9358c712007-05-27 23:58:33 +0000154 return m->isArrow() ? LV_Valid : m->getBase()->isLvalue();
Steve Naroff475cca02007-05-14 17:19:29 +0000155 case UnaryOperatorClass: // C99 6.5.3p4
Steve Naroff9358c712007-05-27 23:58:33 +0000156 if (cast<UnaryOperator>(this)->getOpcode() == UnaryOperator::Deref)
157 return LV_Valid;
158 break;
Steve Naroff475cca02007-05-14 17:19:29 +0000159 case ParenExprClass: // C99 6.5.1p5
160 return cast<ParenExpr>(this)->getSubExpr()->isLvalue();
Steve Naroff9358c712007-05-27 23:58:33 +0000161 default:
162 break;
Steve Naroff47500512007-04-19 23:00:49 +0000163 }
Steve Naroff9358c712007-05-27 23:58:33 +0000164 return LV_InvalidExpression;
Steve Naroff47500512007-04-19 23:00:49 +0000165}
Steve Naroff218bc2b2007-05-04 21:54:46 +0000166
Steve Naroff475cca02007-05-14 17:19:29 +0000167/// isModifiableLvalue - C99 6.3.2.1: an lvalue that does not have array type,
168/// does not have an incomplete type, does not have a const-qualified type, and
169/// if it is a structure or union, does not have any member (including,
170/// recursively, any member or element of all contained aggregates or unions)
171/// with a const-qualified type.
Steve Naroff9358c712007-05-27 23:58:33 +0000172Expr::isModifiableLvalueResult Expr::isModifiableLvalue() {
173 isLvalueResult lvalResult = isLvalue();
174
175 switch (lvalResult) {
176 case LV_Valid: break;
177 case LV_NotObjectType: return MLV_NotObjectType;
178 case LV_IncompleteVoidType: return MLV_IncompleteVoidType;
179 case LV_InvalidExpression: return MLV_InvalidExpression;
180 }
Steve Naroff475cca02007-05-14 17:19:29 +0000181 if (TR.isConstQualified())
Steve Naroff9358c712007-05-27 23:58:33 +0000182 return MLV_ConstQualified;
Steve Naroff475cca02007-05-14 17:19:29 +0000183 if (TR->isArrayType())
Steve Naroff9358c712007-05-27 23:58:33 +0000184 return MLV_ArrayType;
Steve Naroff475cca02007-05-14 17:19:29 +0000185 if (TR->isIncompleteType())
Steve Naroff9358c712007-05-27 23:58:33 +0000186 return MLV_IncompleteType;
187
188 if (const RecordType *r = dyn_cast<RecordType>(TR.getCanonicalType())) {
189 if (r->hasConstFields())
190 return MLV_ConstQualified;
191 }
192 return MLV_Valid;
Steve Naroff475cca02007-05-14 17:19:29 +0000193}
194
Chris Lattner1f4479e2007-06-05 04:15:44 +0000195/// isIntegerConstantExpr - this recursive routine will test if an expression is
196/// an integer constant expression. Note: With the introduction of VLA's in
Steve Narofff8a28c52007-05-15 20:29:32 +0000197/// C99 the result of the sizeof operator is no longer always a constant
198/// expression. The generalization of the wording to include any subexpression
199/// that is not evaluated (C99 6.6p3) means that nonconstant subexpressions
200/// can appear as operands to other operators (e.g. &&, ||, ?:). For instance,
201/// "0 || f()" can be treated as a constant expression. In C90 this expression,
202/// occurring in a context requiring a constant, would have been a constraint
203/// violation. FIXME: This routine currently implements C90 semantics.
204/// To properly implement C99 semantics this routine will need to evaluate
205/// expressions involving operators previously mentioned.
Chris Lattnere0da5dc2007-06-05 05:58:31 +0000206
207/// FIXME: Pass up a reason why! Invalid operation in i-c-e, division by zero,
208/// comma, etc
209bool Expr::isIntegerConstantExpr(APSInt &Result, SourceLocation *Loc,
210 bool isEvaluated) const {
Steve Naroff8eeeb132007-05-08 21:09:37 +0000211 switch (getStmtClass()) {
Steve Naroff72cada02007-05-18 00:18:52 +0000212 default:
Chris Lattner238cbc52007-06-02 04:48:48 +0000213 if (Loc) *Loc = getLocStart();
Steve Naroff8eeeb132007-05-08 21:09:37 +0000214 return false;
Chris Lattnere0da5dc2007-06-05 05:58:31 +0000215 case ParenExprClass:
216 return cast<ParenExpr>(this)->getSubExpr()->
217 isIntegerConstantExpr(Result, Loc, isEvaluated);
218 case IntegerLiteralClass:
219 Result = cast<IntegerLiteral>(this)->getValue();
220 break;
221 case CharacterLiteralClass:
222 // FIXME: This doesn't set the right width etc.
223 Result.zextOrTrunc(32); // FIXME: NOT RIGHT IN GENERAL.
Chris Lattner4cd73fd2007-06-08 21:51:02 +0000224 Result = cast<CharacterLiteral>(this)->getValue();
Chris Lattnere0da5dc2007-06-05 05:58:31 +0000225 break;
226 case DeclRefExprClass:
227 if (const EnumConstantDecl *D =
228 dyn_cast<EnumConstantDecl>(cast<DeclRefExpr>(this)->getDecl())) {
229 D = D;
230 // FIXME: Get the real assigned value and width.
231 Result.zextOrTrunc(32); // FIXME: NOT RIGHT IN GENERAL.
Chris Lattner4cd73fd2007-06-08 21:51:02 +0000232 Result = 0;
Chris Lattnere0da5dc2007-06-05 05:58:31 +0000233 break;
234 }
235 if (Loc) *Loc = getLocStart();
236 return false;
237 case UnaryOperatorClass: {
238 const UnaryOperator *Exp = cast<UnaryOperator>(this);
239
240 // Get the operand value. If this is sizeof/alignof, do not evalute the
241 // operand. This affects C99 6.6p3.
242 if (Exp->isSizeOfAlignOfOp()) isEvaluated = false;
243 if (!Exp->getSubExpr()->isIntegerConstantExpr(Result, Loc, isEvaluated))
244 return false;
245
246 switch (Exp->getOpcode()) {
247 // Address, indirect, pre/post inc/dec, etc are not valid constant exprs.
248 // See C99 6.6p3.
249 default:
250 if (Loc) *Loc = Exp->getOperatorLoc();
251 return false;
252 case UnaryOperator::Extension:
253 return true;
254 case UnaryOperator::SizeOf:
255 case UnaryOperator::AlignOf:
256 // sizeof(vla) is not a constantexpr: C99 6.5.3.4p2.
257 if (!Exp->getSubExpr()->getType()->isConstantSizeType(Loc))
258 return false;
259
260 // FIXME: Evaluate sizeof/alignof.
261 Result.zextOrTrunc(32); // FIXME: NOT RIGHT IN GENERAL.
262 Result = 1; // FIXME: Obviously bogus
263 break;
264 case UnaryOperator::LNot: {
265 bool Val = Result != 0;
266 Result.zextOrTrunc(32); // FIXME: NOT RIGHT IN GENERAL.
267 Result = Val;
268 break;
269 }
270 case UnaryOperator::Plus:
271 // FIXME: Do usual unary promotions here!
272 break;
273 case UnaryOperator::Minus:
274 // FIXME: Do usual unary promotions here!
275 Result = -Result;
276 break;
277 case UnaryOperator::Not:
278 // FIXME: Do usual unary promotions here!
279 Result = ~Result;
280 break;
281 }
282 break;
Steve Naroff8eeeb132007-05-08 21:09:37 +0000283 }
Chris Lattnere0da5dc2007-06-05 05:58:31 +0000284 case SizeOfAlignOfTypeExprClass: {
285 const SizeOfAlignOfTypeExpr *Exp = cast<SizeOfAlignOfTypeExpr>(this);
286 // alignof always evaluates to a constant.
287 if (Exp->isSizeOf() && !Exp->getArgumentType()->isConstantSizeType(Loc))
288 return false;
289
290 // FIXME: Evaluate sizeof/alignof.
291 Result.zextOrTrunc(32); // FIXME: NOT RIGHT IN GENERAL.
292 Result = 1; // FIXME: Obviously bogus
293 break;
294 }
295 case BinaryOperatorClass: {
296 const BinaryOperator *Exp = cast<BinaryOperator>(this);
297
298 // The LHS of a constant expr is always evaluated and needed.
299 if (!Exp->getLHS()->isIntegerConstantExpr(Result, Loc, isEvaluated))
300 return false;
301
302 APSInt RHS(Result);
303
304 // The short-circuiting &&/|| operators don't necessarily evaluate their
305 // RHS. Make sure to pass isEvaluated down correctly.
306 if (Exp->isLogicalOp()) {
307 bool RHSEval;
308 if (Exp->getOpcode() == BinaryOperator::LAnd)
309 RHSEval = Result != 0;
310 else {
311 assert(Exp->getOpcode() == BinaryOperator::LOr &&"Unexpected logical");
312 RHSEval = Result == 0;
313 }
314
315 if (!Exp->getRHS()->isIntegerConstantExpr(RHS, Loc,
316 isEvaluated & RHSEval))
317 return false;
318 } else {
319 if (!Exp->getRHS()->isIntegerConstantExpr(RHS, Loc, isEvaluated))
320 return false;
321 }
322
323 // FIXME: These should all do the standard promotions, etc.
324 switch (Exp->getOpcode()) {
325 default:
326 if (Loc) *Loc = getLocStart();
327 return false;
328 case BinaryOperator::Mul:
329 Result *= RHS;
330 break;
331 case BinaryOperator::Div:
332 if (RHS == 0) {
333 if (!isEvaluated) break;
334 if (Loc) *Loc = getLocStart();
335 return false;
336 }
337 Result /= RHS;
338 break;
339 case BinaryOperator::Rem:
340 if (RHS == 0) {
341 if (!isEvaluated) break;
342 if (Loc) *Loc = getLocStart();
343 return false;
344 }
345 Result %= RHS;
346 break;
347 case BinaryOperator::Add: Result += RHS; break;
348 case BinaryOperator::Sub: Result -= RHS; break;
Chris Lattner901ae1f2007-06-08 21:54:26 +0000349 case BinaryOperator::Shl:
350 Result <<= RHS.getLimitedValue(Result.getBitWidth()-1);
351 break;
352 case BinaryOperator::Shr:
353 Result >>= RHS.getLimitedValue(Result.getBitWidth()-1);
354 break;
Chris Lattnere0da5dc2007-06-05 05:58:31 +0000355 case BinaryOperator::LT: Result = Result < RHS; break;
356 case BinaryOperator::GT: Result = Result > RHS; break;
357 case BinaryOperator::LE: Result = Result <= RHS; break;
358 case BinaryOperator::GE: Result = Result >= RHS; break;
359 case BinaryOperator::EQ: Result = Result == RHS; break;
360 case BinaryOperator::NE: Result = Result != RHS; break;
361 case BinaryOperator::And: Result &= RHS; break;
362 case BinaryOperator::Xor: Result ^= RHS; break;
363 case BinaryOperator::Or: Result |= RHS; break;
364 case BinaryOperator::LAnd:
365 Result = Result != 0 && RHS != 0;
366 break;
367 case BinaryOperator::LOr:
368 Result = Result != 0 || RHS != 0;
369 break;
370
371 case BinaryOperator::Comma:
372 // C99 6.6p3: "shall not contain assignment, ..., or comma operators,
373 // *except* when they are contained within a subexpression that is not
374 // evaluated". Note that Assignment can never happen due to constraints
375 // on the LHS subexpr, so we don't need to check it here.
376 if (isEvaluated) {
377 if (Loc) *Loc = getLocStart();
378 return false;
379 }
380
381 // The result of the constant expr is the RHS.
382 Result = RHS;
383 return true;
384 }
385
386 assert(!Exp->isAssignmentOp() && "LHS can't be a constant expr!");
387 break;
388 }
389 case CastExprClass: {
390 const CastExpr *Exp = cast<CastExpr>(this);
391 // C99 6.6p6: shall only convert arithmetic types to integer types.
392 if (!Exp->getSubExpr()->getType()->isArithmeticType() ||
393 !Exp->getDestType()->isIntegerType()) {
394 if (Loc) *Loc = Exp->getSubExpr()->getLocStart();
395 return false;
396 }
397
398 // Handle simple integer->integer casts.
399 if (Exp->getSubExpr()->getType()->isIntegerType()) {
400 if (!Exp->getSubExpr()->isIntegerConstantExpr(Result, Loc, isEvaluated))
401 return false;
402 // FIXME: do the conversion on Result.
403 break;
404 }
405
406 // Allow floating constants that are the immediate operands of casts or that
407 // are parenthesized.
408 const Expr *Operand = Exp->getSubExpr();
409 while (const ParenExpr *PE = dyn_cast<ParenExpr>(Operand))
410 Operand = PE->getSubExpr();
411
412 if (const FloatingLiteral *FL = dyn_cast<FloatingLiteral>(Operand)) {
413 // FIXME: Evaluate this correctly!
414 Result = (int)FL->getValue();
415 break;
416 }
Chris Lattner6046e002007-06-05 06:39:23 +0000417 if (Loc) *Loc = Operand->getLocStart();
Chris Lattnere0da5dc2007-06-05 05:58:31 +0000418 return false;
419 }
420 case ConditionalOperatorClass: {
421 const ConditionalOperator *Exp = cast<ConditionalOperator>(this);
422
423 if (!Exp->getCond()->isIntegerConstantExpr(Result, Loc, isEvaluated))
424 return false;
425
426 const Expr *TrueExp = Exp->getLHS();
427 const Expr *FalseExp = Exp->getRHS();
428 if (Result == 0) std::swap(TrueExp, FalseExp);
429
430 // Evaluate the false one first, discard the result.
431 if (!FalseExp->isIntegerConstantExpr(Result, Loc, false))
432 return false;
433 // Evalute the true one, capture the result.
434 if (!TrueExp->isIntegerConstantExpr(Result, Loc, isEvaluated))
435 return false;
436 // FIXME: promotions on result.
437 break;
438 }
439 }
440
441 // Cases that are valid constant exprs fall through to here.
442 Result.setIsUnsigned(getType()->isUnsignedIntegerType());
443 return true;
Steve Naroff8eeeb132007-05-08 21:09:37 +0000444}
445
Chris Lattner1f4479e2007-06-05 04:15:44 +0000446
Chris Lattner7eef9192007-05-24 01:23:49 +0000447/// isNullPointerConstant - C99 6.3.2.3p3 - Return true if this is either an
448/// integer constant expression with the value zero, or if this is one that is
449/// cast to void*.
Steve Naroff218bc2b2007-05-04 21:54:46 +0000450bool Expr::isNullPointerConstant() const {
Chris Lattner7eef9192007-05-24 01:23:49 +0000451 // Strip off a cast to void*, if it exists.
452 if (const CastExpr *CE = dyn_cast<CastExpr>(this)) {
453 // Check that it is a cast to void*.
454 if (const PointerType *PT = dyn_cast<PointerType>(CE->getType())) {
455 QualType Pointee = PT->getPointeeType();
456 if (Pointee.getQualifiers() == 0 && Pointee->isVoidType() && // to void*
457 CE->getSubExpr()->getType()->isIntegerType()) // from int.
458 return CE->getSubExpr()->isNullPointerConstant();
Steve Naroffada7d422007-05-20 17:54:12 +0000459 }
Chris Lattner7eef9192007-05-24 01:23:49 +0000460 } else if (const ParenExpr *PE = dyn_cast<ParenExpr>(this)) {
461 // Accept ((void*)0) as a null pointer constant, as many other
462 // implementations do.
463 return PE->getSubExpr()->isNullPointerConstant();
Chris Lattnere6b0f622007-05-21 05:58:35 +0000464 }
465
Chris Lattner7eef9192007-05-24 01:23:49 +0000466 // This expression must be an integer type.
467 if (!getType()->isIntegerType())
468 return false;
469
Chris Lattner1abbd412007-06-08 17:58:43 +0000470 // If we have an integer constant expression, we need to *evaluate* it and
471 // test for the value 0.
472 APSInt Val(32);
473 return isIntegerConstantExpr(Val, 0, true) && Val == 0;
Steve Naroff218bc2b2007-05-04 21:54:46 +0000474}