[cfe-commits] r93519 - in /cfe/trunk: lib/Frontend/RewriteObjC.cpp test/Rewriter/rewrite-extern-c.mm
Fariborz Jahanian
fjahanian at apple.com
Fri Jan 15 10:14:52 PST 2010
Author: fjahanian
Date: Fri Jan 15 12:14:52 2010
New Revision: 93519
URL: http://llvm.org/viewvc/llvm-project?rev=93519&view=rev
Log:
Do not do the block-specific rewrite when there is no block literals.
Fixes radar 7546096.
Added:
cfe/trunk/test/Rewriter/rewrite-extern-c.mm
Modified:
cfe/trunk/lib/Frontend/RewriteObjC.cpp
Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=93519&r1=93518&r2=93519&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Fri Jan 15 12:14:52 2010
@@ -4043,7 +4043,7 @@
void RewriteObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart,
const char *FunName) {
// Insert declaration for the function in which block literal is used.
- if (CurFunctionDeclToDeclareForBlock)
+ if (CurFunctionDeclToDeclareForBlock && !Blocks.empty())
RewriteBlockLiteralFunctionDecl(CurFunctionDeclToDeclareForBlock);
// Insert closures that were part of the function.
for (unsigned i = 0; i < Blocks.size(); i++) {
Added: cfe/trunk/test/Rewriter/rewrite-extern-c.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-extern-c.mm?rev=93519&view=auto
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-extern-c.mm (added)
+++ cfe/trunk/test/Rewriter/rewrite-extern-c.mm Fri Jan 15 12:14:52 2010
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -x objective-c++ -fblocks -rewrite-objc -o - %s
+// radar 7546096
+
+extern "C" {
+ short foo() { }
+}
+typedef unsigned char Boolean;
+
More information about the cfe-commits
mailing list