forked from OSchip/llvm-project
Fix bugs in isIntegerConstantExpr handling character and enum literals
llvm-svn: 39617
This commit is contained in:
parent
344b92e993
commit
4cd73fd380
|
@ -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<IntegerLiteral>(this)->getValue();
|
||||
Result = cast<CharacterLiteral>(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<IntegerLiteral>(this)->getValue();
|
||||
Result = 0;
|
||||
break;
|
||||
}
|
||||
if (Loc) *Loc = getLocStart();
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue