aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-02-18 06:53:08 +0000
committerChris Lattner <sabre@nondot.org>2009-02-18 06:53:08 +0000
commitc6c16af963eddc3e9b75b5d2614d069e1162fe27 (patch)
treea73298d0de0336bc33f6229302cd610f0f32fa57
parent39c28bbbf235533e9ae7d06fb9b13371dfcc542d (diff)
teach child iterators to walk into the child string of an ObjCStringLiteral,
so it shows up in -ast-dump. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64901 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/AST/ExprObjC.h7
-rw-r--r--lib/AST/Expr.cpp4
2 files changed, 5 insertions, 6 deletions
diff --git a/include/clang/AST/ExprObjC.h b/include/clang/AST/ExprObjC.h
index 03d904d6fd..9483833a6e 100644
--- a/include/clang/AST/ExprObjC.h
+++ b/include/clang/AST/ExprObjC.h
@@ -26,15 +26,14 @@ namespace clang {
/// 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; }
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index e436a41b55..dec17493f4 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -1803,10 +1803,10 @@ Stmt::child_iterator ImplicitValueInitExpr::child_end() {
// 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