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
diff --git a/include/clang/AST/ExprObjC.h b/include/clang/AST/ExprObjC.h
index 03d904d..9483833 100644
--- a/include/clang/AST/ExprObjC.h
+++ b/include/clang/AST/ExprObjC.h
@@ -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; }
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index e436a41..dec1749 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -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