diff --git a/clang/AST/Expr.cpp b/clang/AST/Expr.cpp index e092ab8d6be8..a4024d9ee98a 100644 --- a/clang/AST/Expr.cpp +++ b/clang/AST/Expr.cpp @@ -221,7 +221,7 @@ bool Expr::isIntegerConstantExpr(APSInt &Result, SourceLocation *Loc, case CharacterLiteralClass: // FIXME: This doesn't set the right width etc. Result.zextOrTrunc(32); // FIXME: NOT RIGHT IN GENERAL. - Result = cast(this)->getValue(); + Result = cast(this)->getValue(); break; case DeclRefExprClass: if (const EnumConstantDecl *D = @@ -229,7 +229,7 @@ bool Expr::isIntegerConstantExpr(APSInt &Result, SourceLocation *Loc, D = D; // FIXME: Get the real assigned value and width. Result.zextOrTrunc(32); // FIXME: NOT RIGHT IN GENERAL. - Result = cast(this)->getValue(); + Result = 0; break; } if (Loc) *Loc = getLocStart(); diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h index 140e97dfd144..523d3ff58b7f 100644 --- a/clang/include/clang/AST/Expr.h +++ b/clang/include/clang/AST/Expr.h @@ -151,6 +151,8 @@ public: : Expr(CharacterLiteralClass, type), Value(value), Loc(l) { } virtual SourceRange getSourceRange() const { return SourceRange(Loc); } + + unsigned getValue() const { return Value; } virtual void visit(StmtVisitor &Visitor); static bool classof(const Stmt *T) {