[cfe-commits] r39617 - in /cfe/cfe/trunk: AST/Expr.cpp include/clang/AST/Expr.h

clattner at cs.uiuc.edu clattner at cs.uiuc.edu
Wed Jul 11 09:46:17 PDT 2007


Author: clattner
Date: Wed Jul 11 11:46:17 2007
New Revision: 39617

URL: http://llvm.org/viewvc/llvm-project?rev=39617&view=rev
Log:
Fix bugs in isIntegerConstantExpr handling character and enum literals

Modified:
    cfe/cfe/trunk/AST/Expr.cpp
    cfe/cfe/trunk/include/clang/AST/Expr.h

Modified: cfe/cfe/trunk/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/AST/Expr.cpp?rev=39617&r1=39616&r2=39617&view=diff

==============================================================================
--- cfe/cfe/trunk/AST/Expr.cpp (original)
+++ cfe/cfe/trunk/AST/Expr.cpp Wed Jul 11 11:46:17 2007
@@ -221,7 +221,7 @@
   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 @@
       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();

Modified: cfe/cfe/trunk/include/clang/AST/Expr.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/AST/Expr.h?rev=39617&r1=39616&r2=39617&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/AST/Expr.h (original)
+++ cfe/cfe/trunk/include/clang/AST/Expr.h Wed Jul 11 11:46:17 2007
@@ -151,6 +151,8 @@
     : 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) { 





More information about the cfe-commits mailing list