From: Ted Kremenek Date: Mon, 6 Oct 2008 22:16:13 +0000 (+0000) Subject: Use DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when rewriting Objecti... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1ed8e2a39456d064a346a6a5c2f6bd53e6d57345;p=clang Use DeclStmt::getSolitaryDecl() instead of DeclStmt::getDecl() when rewriting Objective-c foreach statements. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57212 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/RewriteObjC.cpp b/Driver/RewriteObjC.cpp index 1ec83bf9c8..d23bf2d225 100644 --- a/Driver/RewriteObjC.cpp +++ b/Driver/RewriteObjC.cpp @@ -1161,11 +1161,12 @@ Stmt *RewriteObjC::RewriteObjCForCollectionStmt(ObjCForCollectionStmt *S, buf = "\n{\n\t"; if (DeclStmt *DS = dyn_cast(S->getElement())) { // type elem; - QualType ElementType = cast(DS->getDecl())->getType(); + ScopedDecl* D = DS->getSolitaryDecl(); + QualType ElementType = cast(D)->getType(); elementTypeAsString = ElementType.getAsString(); buf += elementTypeAsString; buf += " "; - elementName = DS->getDecl()->getName(); + elementName = D->getName(); buf += elementName; buf += ";\n\t"; }