зеркало из https://github.com/microsoft/clang-1.git
Fixes a bug whereby static const block var has static
moved incorrectly. (radar 7714443). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97734 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
6a836706c4
Коммит
61b82e3ed6
|
@ -4311,6 +4311,23 @@ void RewriteObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart,
|
|||
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();
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// 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
|
Загрузка…
Ссылка в новой задаче