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

Chris Lattner sabre at nondot.org
Tue Feb 17 22:53:08 PST 2009


Author: lattner
Date: Wed Feb 18 00:53:08 2009
New Revision: 64901

URL: http://llvm.org/viewvc/llvm-project?rev=64901&view=rev
Log:
teach child iterators to walk into the child string of an ObjCStringLiteral,
so it shows up in -ast-dump.

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

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

==============================================================================
--- cfe/trunk/include/clang/AST/ExprObjC.h (original)
+++ cfe/trunk/include/clang/AST/ExprObjC.h Wed Feb 18 00:53:08 2009
@@ -26,15 +26,14 @@
 /// ObjCStringLiteral, used for Objective-C string literals
 /// i.e. @"foo".
 class ObjCStringLiteral : public Expr {
-  StringLiteral *String;
+  Stmt *String;
   SourceLocation AtLoc;
 public:
   ObjCStringLiteral(StringLiteral *SL, QualType T, SourceLocation L)
     : Expr(ObjCStringLiteralClass, T), String(SL), AtLoc(L) {}
   
-  StringLiteral* getString() { return String; }
-
-  const StringLiteral* getString() const { return String; }
+  StringLiteral* getString() { return cast<StringLiteral>(String); }
+  const StringLiteral* getString() const { return cast<StringLiteral>(String); }
 
   SourceLocation getAtLoc() const { return AtLoc; }
 

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

==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Wed Feb 18 00:53:08 2009
@@ -1803,10 +1803,10 @@
 
 // ObjCStringLiteral
 Stmt::child_iterator ObjCStringLiteral::child_begin() { 
-  return child_iterator();
+  return &String;
 }
 Stmt::child_iterator ObjCStringLiteral::child_end() {
-  return child_iterator();
+  return &String+1;
 }
 
 // ObjCEncodeExpr





More information about the cfe-commits mailing list