Do not do the block-specific rewrite when there is no block literals.

Fixes radar 7546096.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93519 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Fariborz Jahanian 2010-01-15 18:14:52 +00:00
Родитель 501edb6a54
Коммит bf07012cf9
2 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -4043,7 +4043,7 @@ std::string RewriteObjC::SynthesizeBlockDescriptor(std::string DescTag,
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++) {

Просмотреть файл

@ -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;