BlockByCopyDeclsPtrSet.clear();
ImportedBlockDecls.clear();
}
+ if (GlobalVarDecl && !Blocks.empty()) {
+ // Must insert any 'const/volatile/static here. Since it has been
+ // removed as result of rewriting of block literals.
+ // FIXME. We add as we need.
+ std::string SC;
+ if (GlobalVarDecl->getStorageClass() == VarDecl::Static)
+ SC = "static ";
+ if (GlobalVarDecl->getStorageClass() == VarDecl::Extern)
+ SC = "extern ";
+ if (GlobalVarDecl->getType().isConstQualified())
+ SC += "const ";
+ if (GlobalVarDecl->getType().isVolatileQualified())
+ SC += "volatile ";
+ if (!SC.empty())
+ InsertText(FunLocStart, SC);
+ }
+
Blocks.clear();
InnerDeclRefsCount.clear();
InnerDeclRefs.clear();
--- /dev/null
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -Wno-address-of-temporary -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp -emit-llvm -o %t-rw.ll
+// RUN: FileCheck --input-file=%t-rw.ll %s
+
+typedef void (^void_block_t)(void);
+
+static const void_block_t myblock = ^{
+
+};
+
+// CHECK: myblock = internal global