diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2014-04-08 18:57:44 +0000 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2014-04-08 18:57:44 +0000 |
commit | c2519b23238088aa438008506d9ac121b12b5720 (patch) | |
tree | c2e567b1cedded36a45ae10cf0a3ea8e933b27cf | |
parent | ef43fc70cb8897573501c3350d2f1ef52e70c3c0 (diff) | |
download | clang-c2519b23238088aa438008506d9ac121b12b5720.tar.gz clang-c2519b23238088aa438008506d9ac121b12b5720.tar.bz2 clang-c2519b23238088aa438008506d9ac121b12b5720.tar.xz |
Merging r200953:
------------------------------------------------------------------------
r200953 | rtrieu | 2014-02-06 18:26:23 -0500 (Thu, 06 Feb 2014) | 3 lines
Fixes PR18762, stop the StmtPrinter for ObjCPropertyRefExpr from crashing on
certain receiver types.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@205785 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/StmtPrinter.cpp | 4 | ||||
-rw-r--r-- | test/Misc/ast-dump-decl.m | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp index 0ecb5b52c2..ae2cdf7574 100644 --- a/lib/AST/StmtPrinter.cpp +++ b/lib/AST/StmtPrinter.cpp @@ -709,9 +709,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()) diff --git a/test/Misc/ast-dump-decl.m b/test/Misc/ast-dump-decl.m index f8a5e5a263..539923b2e3 100644 --- a/test/Misc/ast-dump-decl.m +++ b/test/Misc/ast-dump-decl.m @@ -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' |