[cfe-commits] r109833 - in /cfe/trunk: lib/AST/DeclPrinter.cpp test/SemaObjC/static-ivar-ref-1.m
Ted Kremenek
kremenek at apple.com
Thu Jul 29 17:47:46 PDT 2010
Author: kremenek
Date: Thu Jul 29 19:47:46 2010
New Revision: 109833
URL: http://llvm.org/viewvc/llvm-project?rev=109833&view=rev
Log:
Don't print out ivars twice in Decl::print(). Fixes <rdar://problem/8253668>.
Modified:
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/test/SemaObjC/static-ivar-ref-1.m
Modified: cfe/trunk/lib/AST/DeclPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclPrinter.cpp?rev=109833&r1=109832&r2=109833&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclPrinter.cpp (original)
+++ cfe/trunk/lib/AST/DeclPrinter.cpp Thu Jul 29 19:47:46 2010
@@ -198,6 +198,12 @@
llvm::SmallVector<Decl*, 2> Decls;
for (DeclContext::decl_iterator D = DC->decls_begin(), DEnd = DC->decls_end();
D != DEnd; ++D) {
+
+ // Don't print ObjCIvarDecls, as they are printed when visiting the
+ // containing ObjCInterfaceDecl.
+ if (isa<ObjCIvarDecl>(*D))
+ continue;
+
if (!Policy.Dump) {
// Skip over implicit declarations in pretty-printing mode.
if (D->isImplicit()) continue;
Modified: cfe/trunk/test/SemaObjC/static-ivar-ref-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/static-ivar-ref-1.m?rev=109833&r1=109832&r2=109833&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/static-ivar-ref-1.m (original)
+++ cfe/trunk/test/SemaObjC/static-ivar-ref-1.m Thu Jul 29 19:47:46 2010
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -triple i386-unknown-unknown -ast-print %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -ast-print %s
+// RUN: %clang_cc1 -triple i386-unknown-unknown -ast-print %s 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -ast-print %s 2>&1 | FileCheck %s
@interface current
{
@@ -14,5 +14,17 @@
int foo()
{
- return pc->ivar2 + (*pc).ivar + pc->ivar1;
+ return pc->ivar2 + (*pc).ivar + pc->ivar1;
}
+
+// CHECK: @interface current{
+// CHECK: int ivar;
+// CHECK: int ivar1;
+// CHECK: int ivar2;
+// CHECK: }
+// CHECK: @end
+// CHECK: current *pc;
+// CHECK: int foo() {
+// CHECK: return pc->ivar2 + (*pc).ivar + pc->ivar1;
+// CHECK: }
+
More information about the cfe-commits
mailing list