[cfe-commits] r93358 - in /cfe/trunk: lib/AST/StmtPrinter.cpp test/Rewriter/rewrite-trivial-constructor.mm
Fariborz Jahanian
fjahanian at apple.com
Wed Jan 13 13:41:12 PST 2010
Author: fjahanian
Date: Wed Jan 13 15:41:11 2010
New Revision: 93358
URL: http://llvm.org/viewvc/llvm-project?rev=93358&view=rev
Log:
Fixes a rewrite bug rewriting a block call argument which has a trvial
constructor. Fixes radar 7537770.
Added:
cfe/trunk/test/Rewriter/rewrite-trivial-constructor.mm
Modified:
cfe/trunk/lib/AST/StmtPrinter.cpp
Modified: cfe/trunk/lib/AST/StmtPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=93358&r1=93357&r2=93358&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)
+++ cfe/trunk/lib/AST/StmtPrinter.cpp Wed Jan 13 15:41:11 2010
@@ -1121,6 +1121,13 @@
}
void StmtPrinter::VisitCXXConstructExpr(CXXConstructExpr *E) {
+ // FIXME. For now we just print a trivial constructor call expression,
+ // constructing its first argument object.
+ if (E->getNumArgs() == 1) {
+ CXXConstructorDecl *CD = E->getConstructor();
+ if (CD->isTrivial())
+ PrintExpr(E->getArg(0));
+ }
// Nothing to print.
}
Added: cfe/trunk/test/Rewriter/rewrite-trivial-constructor.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-trivial-constructor.mm?rev=93358&view=auto
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-trivial-constructor.mm (added)
+++ cfe/trunk/test/Rewriter/rewrite-trivial-constructor.mm Wed Jan 13 15:41:11 2010
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -fms-extensions -rewrite-objc -x objective-c++ -fblocks -o - %s
+// radar 7537770
+
+typedef struct {
+ int a;
+ int b;
+} s;
+
+extern void CFBasicHashApply(int (^block)(s)) {
+ int used, cnt;
+ for (int idx = 0; 0 < used && idx < cnt; idx++) {
+ s bkt;
+ if (0 < bkt.a) {
+ if (!block(bkt)) {
+ return;
+ }
+ used--;
+ }
+ }
+}
+
More information about the cfe-commits
mailing list