Fixes PR18762, stop the StmtPrinter for ObjCPropertyRefExpr from crashing on

certain receiver types.

llvm-svn: 200953
This commit is contained in:
Richard Trieu 2014-02-06 23:26:23 +00:00
parent ccf8e29060
commit 6d92e50263
2 changed files with 12 additions and 1 deletions

View File

@ -716,9 +716,11 @@ void StmtPrinter::VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node) {
void StmtPrinter::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) {
if (Node->isSuperReceiver())
OS << "super.";
else if (Node->getBase()) {
else if (Node->isObjectReceiver() && Node->getBase()) {
PrintExpr(Node->getBase());
OS << ".";
} else if (Node->isClassReceiver() && Node->getClassReceiver()) {
OS << Node->getClassReceiver()->getName() << ".";
}
if (Node->isImplicitProperty())

View File

@ -134,3 +134,12 @@ void TestBlockDecl(int x) {
// CHECK-NEXT: ...
// CHECK-NEXT: capture ParmVar{{.*}} 'x' 'int'
// CHECK-NEXT: CompoundStmt
@interface B
+ (int) foo;
@end
void f() {
__typeof__(B.foo) Test;
}
// CHECK: VarDecl{{.*}}Test 'typeof (B.foo)':'int'