diff options
author | Thorsten Schütt <schuett@gmail.com> | 2020-12-23 16:56:00 +0100 |
---|---|---|
committer | Thorsten Schütt <schuett@gmail.com> | 2021-01-04 22:58:26 +0100 |
commit | efc82c4ad2bcb256a4f4c20238d08cd3afba4d2d (patch) | |
tree | 9967045d388f16ffead61a0cfd57c5043d0efab1 /clang/lib/Frontend/Rewrite | |
parent | abbef2fd46d48a0d92d86f0c00fa2973f8ae2c85 (diff) | |
download | llvm-efc82c4ad2bcb256a4f4c20238d08cd3afba4d2d.zip llvm-efc82c4ad2bcb256a4f4c20238d08cd3afba4d2d.tar.gz llvm-efc82c4ad2bcb256a4f4c20238d08cd3afba4d2d.tar.bz2 |
[NFC, Refactor] Modernize StorageClass from Specifiers.h to a scoped enum (II)
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D93765
Diffstat (limited to 'clang/lib/Frontend/Rewrite')
-rw-r--r-- | clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp | 124 | ||||
-rw-r--r-- | clang/lib/Frontend/Rewrite/RewriteObjC.cpp | 108 |
2 files changed, 94 insertions, 138 deletions
diff --git a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp index 9d5366b..dd2a204 100644 --- a/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp +++ b/clang/lib/Frontend/Rewrite/RewriteModernObjC.cpp @@ -2318,11 +2318,9 @@ void RewriteModernObjC::SynthSelGetUidFunctionDecl() { ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst())); QualType getFuncType = getSimpleFunctionType(Context->getObjCSelType(), ArgTys); - SelGetUidFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - SelGetUidIdent, getFuncType, - nullptr, SC_Extern); + SelGetUidFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), SelGetUidIdent, + getFuncType, nullptr, StorageClass::Extern); } void RewriteModernObjC::RewriteFunctionDecl(FunctionDecl *FD) { @@ -2416,11 +2414,9 @@ void RewriteModernObjC::SynthSuperConstructorFunctionDecl() { ArgTys.push_back(argT); QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(), ArgTys); - SuperConstructorFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - msgSendIdent, msgSendType, - nullptr, SC_Extern); + SuperConstructorFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent, + msgSendType, nullptr, StorageClass::Extern); } // SynthMsgSendFunctionDecl - id objc_msgSend(id self, SEL op, ...); @@ -2435,11 +2431,9 @@ void RewriteModernObjC::SynthMsgSendFunctionDecl() { ArgTys.push_back(argT); QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(), ArgTys, /*variadic=*/true); - MsgSendFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - msgSendIdent, msgSendType, nullptr, - SC_Extern); + MsgSendFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent, + msgSendType, nullptr, StorageClass::Extern); } // SynthMsgSendSuperFunctionDecl - id objc_msgSendSuper(void); @@ -2449,11 +2443,9 @@ void RewriteModernObjC::SynthMsgSendSuperFunctionDecl() { ArgTys.push_back(Context->VoidTy); QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(), ArgTys, /*variadic=*/true); - MsgSendSuperFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - msgSendIdent, msgSendType, - nullptr, SC_Extern); + MsgSendSuperFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent, + msgSendType, nullptr, StorageClass::Extern); } // SynthMsgSendStretFunctionDecl - id objc_msgSend_stret(id self, SEL op, ...); @@ -2468,11 +2460,9 @@ void RewriteModernObjC::SynthMsgSendStretFunctionDecl() { ArgTys.push_back(argT); QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(), ArgTys, /*variadic=*/true); - MsgSendStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - msgSendIdent, msgSendType, - nullptr, SC_Extern); + MsgSendStretFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent, + msgSendType, nullptr, StorageClass::Extern); } // SynthMsgSendSuperStretFunctionDecl - @@ -2484,12 +2474,9 @@ void RewriteModernObjC::SynthMsgSendSuperStretFunctionDecl() { ArgTys.push_back(Context->VoidTy); QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(), ArgTys, /*variadic=*/true); - MsgSendSuperStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - msgSendIdent, - msgSendType, nullptr, - SC_Extern); + MsgSendSuperStretFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent, + msgSendType, nullptr, StorageClass::Extern); } // SynthMsgSendFpretFunctionDecl - double objc_msgSend_fpret(id self, SEL op, ...); @@ -2504,11 +2491,9 @@ void RewriteModernObjC::SynthMsgSendFpretFunctionDecl() { ArgTys.push_back(argT); QualType msgSendType = getSimpleFunctionType(Context->DoubleTy, ArgTys, /*variadic=*/true); - MsgSendFpretFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - msgSendIdent, msgSendType, - nullptr, SC_Extern); + MsgSendFpretFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent, + msgSendType, nullptr, StorageClass::Extern); } // SynthGetClassFunctionDecl - Class objc_getClass(const char *name); @@ -2518,11 +2503,9 @@ void RewriteModernObjC::SynthGetClassFunctionDecl() { ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst())); QualType getClassType = getSimpleFunctionType(Context->getObjCClassType(), ArgTys); - GetClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - getClassIdent, getClassType, - nullptr, SC_Extern); + GetClassFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), getClassIdent, + getClassType, nullptr, StorageClass::Extern); } // SynthGetSuperClassFunctionDecl - Class class_getSuperclass(Class cls); @@ -2533,12 +2516,9 @@ void RewriteModernObjC::SynthGetSuperClassFunctionDecl() { ArgTys.push_back(Context->getObjCClassType()); QualType getClassType = getSimpleFunctionType(Context->getObjCClassType(), ArgTys); - GetSuperClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - getSuperClassIdent, - getClassType, nullptr, - SC_Extern); + GetSuperClassFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), getSuperClassIdent, + getClassType, nullptr, StorageClass::Extern); } // SynthGetMetaClassFunctionDecl - Class objc_getMetaClass(const char *name); @@ -2548,11 +2528,9 @@ void RewriteModernObjC::SynthGetMetaClassFunctionDecl() { ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst())); QualType getClassType = getSimpleFunctionType(Context->getObjCClassType(), ArgTys); - GetMetaClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - getClassIdent, getClassType, - nullptr, SC_Extern); + GetMetaClassFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), getClassIdent, + getClassType, nullptr, StorageClass::Extern); } Stmt *RewriteModernObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) { @@ -2586,7 +2564,7 @@ Stmt *RewriteModernObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) { VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(), &Context->Idents.get(S), - strType, nullptr, SC_Static); + strType, nullptr, StorageClass::Static); DeclRefExpr *DRE = new (Context) DeclRefExpr(*Context, NewVD, false, strType, VK_LValue, SourceLocation()); Expr *Unop = UnaryOperator::Create( @@ -3048,7 +3026,7 @@ static SourceLocation getFunctionSourceLocation (RewriteModernObjC &R, if (!LSD->getRBraceLoc().isValid()) return LSD->getExternLoc(); } - if (FD->getStorageClass() != SC_None) + if (FD->getStorageClass() != StorageClass::None) R.RewriteBlockLiteralFunctionDecl(FD); return FD->getTypeSpecStartLoc(); } @@ -3173,9 +3151,9 @@ Expr *RewriteModernObjC::SynthMsgSendStretCallExpr(FunctionDecl *MsgSendStretFla // AST for __Stretn(receiver, args).s; IdentifierInfo *ID = &Context->Idents.get(name); - FunctionDecl *FD = - FunctionDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(), - ID, FuncType, nullptr, SC_Extern, false, false); + FunctionDecl *FD = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), ID, FuncType, + nullptr, StorageClass::Extern, false, false); DeclRefExpr *DRE = new (Context) DeclRefExpr(*Context, FD, false, castType, VK_RValue, SourceLocation()); CallExpr *STCE = @@ -3593,9 +3571,9 @@ Stmt *RewriteModernObjC::RewriteObjCProtocolExpr(ObjCProtocolExpr *Exp) { std::string Name = "_OBJC_PROTOCOL_REFERENCE_$_" + Exp->getProtocol()->getNameAsString(); IdentifierInfo *ID = &Context->Idents.get(Name); - VarDecl *VD = VarDecl::Create(*Context, TUDecl, SourceLocation(), - SourceLocation(), ID, getProtocolType(), - nullptr, SC_Extern); + VarDecl *VD = + VarDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(), ID, + getProtocolType(), nullptr, StorageClass::Extern); DeclRefExpr *DRE = new (Context) DeclRefExpr( *Context, VD, false, getProtocolType(), VK_LValue, SourceLocation()); CastExpr *castExpr = NoTypeInfoCStyleCastExpr( @@ -4331,9 +4309,8 @@ std::string RewriteModernObjC::SynthesizeBlockDescriptor(std::string DescTag, void RewriteModernObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart, StringRef FunName) { - bool RewriteSC = (GlobalVarDecl && - !Blocks.empty() && - GlobalVarDecl->getStorageClass() == SC_Static && + bool RewriteSC = (GlobalVarDecl && !Blocks.empty() && + GlobalVarDecl->getStorageClass() == StorageClass::Static && GlobalVarDecl->getType().getCVRQualifiers()); if (RewriteSC) { std::string SC(" void __"); @@ -4401,7 +4378,7 @@ void RewriteModernObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart, // Must insert any 'const/volatile/static here. Since it has been // removed as result of rewriting of block literals. std::string SC; - if (GlobalVarDecl->getStorageClass() == SC_Static) + if (GlobalVarDecl->getStorageClass() == StorageClass::Static) SC = "static "; if (GlobalVarDecl->getType().isConstQualified()) SC += "const "; @@ -5201,8 +5178,8 @@ FunctionDecl *RewriteModernObjC::SynthBlockInitFunctionDecl(StringRef name) { IdentifierInfo *ID = &Context->Idents.get(name); QualType FType = Context->getFunctionNoProtoType(Context->VoidPtrTy); return FunctionDecl::Create(*Context, TUDecl, SourceLocation(), - SourceLocation(), ID, FType, nullptr, SC_Extern, - false, false); + SourceLocation(), ID, FType, nullptr, + StorageClass::Extern, false, false); } Stmt *RewriteModernObjC::SynthBlockInitExpr(BlockExpr *Exp, @@ -5298,9 +5275,10 @@ Stmt *RewriteModernObjC::SynthBlockInitExpr(BlockExpr *Exp, // Initialize the block descriptor. std::string DescData = "__" + FuncName + "_block_desc_" + BlockNumber + "_DATA"; - VarDecl *NewVD = VarDecl::Create( - *Context, TUDecl, SourceLocation(), SourceLocation(), - &Context->Idents.get(DescData), Context->VoidPtrTy, nullptr, SC_Static); + VarDecl *NewVD = + VarDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(), + &Context->Idents.get(DescData), Context->VoidPtrTy, + nullptr, StorageClass::Static); UnaryOperator *DescRefExpr = UnaryOperator::Create( const_cast<ASTContext &>(*Context), new (Context) DeclRefExpr(*Context, NewVD, false, Context->VoidPtrTy, @@ -7488,10 +7466,10 @@ Stmt *RewriteModernObjC::RewriteObjCIvarRefExpr(ObjCIvarRefExpr *IV) { Context->getPointerType(Context->CharTy), CK_BitCast, BaseExpr); - VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, SourceLocation(), - SourceLocation(), &Context->Idents.get(IvarOffsetName), - Context->UnsignedLongTy, nullptr, - SC_Extern); + VarDecl *NewVD = VarDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), + &Context->Idents.get(IvarOffsetName), Context->UnsignedLongTy, + nullptr, StorageClass::Extern); DeclRefExpr *DRE = new (Context) DeclRefExpr(*Context, NewVD, false, Context->UnsignedLongTy, VK_LValue, SourceLocation()); diff --git a/clang/lib/Frontend/Rewrite/RewriteObjC.cpp b/clang/lib/Frontend/Rewrite/RewriteObjC.cpp index 543b3b0..1032d56 100644 --- a/clang/lib/Frontend/Rewrite/RewriteObjC.cpp +++ b/clang/lib/Frontend/Rewrite/RewriteObjC.cpp @@ -2232,11 +2232,9 @@ void RewriteObjC::SynthSelGetUidFunctionDecl() { ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst())); QualType getFuncType = getSimpleFunctionType(Context->getObjCSelType(), ArgTys); - SelGetUidFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - SelGetUidIdent, getFuncType, - nullptr, SC_Extern); + SelGetUidFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), SelGetUidIdent, + getFuncType, nullptr, StorageClass::Extern); } void RewriteObjC::RewriteFunctionDecl(FunctionDecl *FD) { @@ -2327,11 +2325,9 @@ void RewriteObjC::SynthSuperConstructorFunctionDecl() { ArgTys.push_back(argT); QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(), ArgTys); - SuperConstructorFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - msgSendIdent, msgSendType, - nullptr, SC_Extern); + SuperConstructorFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent, + msgSendType, nullptr, StorageClass::Extern); } // SynthMsgSendFunctionDecl - id objc_msgSend(id self, SEL op, ...); @@ -2346,11 +2342,9 @@ void RewriteObjC::SynthMsgSendFunctionDecl() { ArgTys.push_back(argT); QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(), ArgTys, /*variadic=*/true); - MsgSendFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - msgSendIdent, msgSendType, - nullptr, SC_Extern); + MsgSendFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent, + msgSendType, nullptr, StorageClass::Extern); } // SynthMsgSendSuperFunctionDecl - id objc_msgSendSuper(struct objc_super *, SEL op, ...); @@ -2368,11 +2362,9 @@ void RewriteObjC::SynthMsgSendSuperFunctionDecl() { ArgTys.push_back(argT); QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(), ArgTys, /*variadic=*/true); - MsgSendSuperFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - msgSendIdent, msgSendType, - nullptr, SC_Extern); + MsgSendSuperFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent, + msgSendType, nullptr, StorageClass::Extern); } // SynthMsgSendStretFunctionDecl - id objc_msgSend_stret(id self, SEL op, ...); @@ -2387,11 +2379,9 @@ void RewriteObjC::SynthMsgSendStretFunctionDecl() { ArgTys.push_back(argT); QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(), ArgTys, /*variadic=*/true); - MsgSendStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - msgSendIdent, msgSendType, - nullptr, SC_Extern); + MsgSendStretFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent, + msgSendType, nullptr, StorageClass::Extern); } // SynthMsgSendSuperStretFunctionDecl - @@ -2411,12 +2401,9 @@ void RewriteObjC::SynthMsgSendSuperStretFunctionDecl() { ArgTys.push_back(argT); QualType msgSendType = getSimpleFunctionType(Context->getObjCIdType(), ArgTys, /*variadic=*/true); - MsgSendSuperStretFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - msgSendIdent, - msgSendType, nullptr, - SC_Extern); + MsgSendSuperStretFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent, + msgSendType, nullptr, StorageClass::Extern); } // SynthMsgSendFpretFunctionDecl - double objc_msgSend_fpret(id self, SEL op, ...); @@ -2431,11 +2418,9 @@ void RewriteObjC::SynthMsgSendFpretFunctionDecl() { ArgTys.push_back(argT); QualType msgSendType = getSimpleFunctionType(Context->DoubleTy, ArgTys, /*variadic=*/true); - MsgSendFpretFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - msgSendIdent, msgSendType, - nullptr, SC_Extern); + MsgSendFpretFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), msgSendIdent, + msgSendType, nullptr, StorageClass::Extern); } // SynthGetClassFunctionDecl - id objc_getClass(const char *name); @@ -2445,11 +2430,9 @@ void RewriteObjC::SynthGetClassFunctionDecl() { ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst())); QualType getClassType = getSimpleFunctionType(Context->getObjCIdType(), ArgTys); - GetClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - getClassIdent, getClassType, - nullptr, SC_Extern); + GetClassFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), getClassIdent, + getClassType, nullptr, StorageClass::Extern); } // SynthGetSuperClassFunctionDecl - Class class_getSuperclass(Class cls); @@ -2460,12 +2443,9 @@ void RewriteObjC::SynthGetSuperClassFunctionDecl() { ArgTys.push_back(Context->getObjCClassType()); QualType getClassType = getSimpleFunctionType(Context->getObjCClassType(), ArgTys); - GetSuperClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - getSuperClassIdent, - getClassType, nullptr, - SC_Extern); + GetSuperClassFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), getSuperClassIdent, + getClassType, nullptr, StorageClass::Extern); } // SynthGetMetaClassFunctionDecl - id objc_getMetaClass(const char *name); @@ -2475,11 +2455,9 @@ void RewriteObjC::SynthGetMetaClassFunctionDecl() { ArgTys.push_back(Context->getPointerType(Context->CharTy.withConst())); QualType getClassType = getSimpleFunctionType(Context->getObjCIdType(), ArgTys); - GetMetaClassFunctionDecl = FunctionDecl::Create(*Context, TUDecl, - SourceLocation(), - SourceLocation(), - getClassIdent, getClassType, - nullptr, SC_Extern); + GetMetaClassFunctionDecl = FunctionDecl::Create( + *Context, TUDecl, SourceLocation(), SourceLocation(), getClassIdent, + getClassType, nullptr, StorageClass::Extern); } Stmt *RewriteObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) { @@ -2513,7 +2491,7 @@ Stmt *RewriteObjC::RewriteObjCStringLiteral(ObjCStringLiteral *Exp) { VarDecl *NewVD = VarDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(), &Context->Idents.get(S), - strType, nullptr, SC_Static); + strType, nullptr, StorageClass::Static); DeclRefExpr *DRE = new (Context) DeclRefExpr(*Context, NewVD, false, strType, VK_LValue, SourceLocation()); Expr *Unop = UnaryOperator::Create( @@ -3049,9 +3027,9 @@ QualType RewriteObjC::getProtocolType() { Stmt *RewriteObjC::RewriteObjCProtocolExpr(ObjCProtocolExpr *Exp) { std::string Name = "_OBJC_PROTOCOL_" + Exp->getProtocol()->getNameAsString(); IdentifierInfo *ID = &Context->Idents.get(Name); - VarDecl *VD = VarDecl::Create(*Context, TUDecl, SourceLocation(), - SourceLocation(), ID, getProtocolType(), - nullptr, SC_Extern); + VarDecl *VD = + VarDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(), ID, + getProtocolType(), nullptr, StorageClass::Extern); DeclRefExpr *DRE = new (Context) DeclRefExpr( *Context, VD, false, getProtocolType(), VK_LValue, SourceLocation()); Expr *DerefExpr = UnaryOperator::Create( @@ -3545,9 +3523,8 @@ void RewriteObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart, // Insert declaration for the function in which block literal is used. if (CurFunctionDeclToDeclareForBlock && !Blocks.empty()) RewriteBlockLiteralFunctionDecl(CurFunctionDeclToDeclareForBlock); - bool RewriteSC = (GlobalVarDecl && - !Blocks.empty() && - GlobalVarDecl->getStorageClass() == SC_Static && + bool RewriteSC = (GlobalVarDecl && !Blocks.empty() && + GlobalVarDecl->getStorageClass() == StorageClass::Static && GlobalVarDecl->getType().getCVRQualifiers()); if (RewriteSC) { std::string SC(" void __"); @@ -3611,7 +3588,7 @@ void RewriteObjC::SynthesizeBlockLiterals(SourceLocation FunLocStart, // Must insert any 'const/volatile/static here. Since it has been // removed as result of rewriting of block literals. std::string SC; - if (GlobalVarDecl->getStorageClass() == SC_Static) + if (GlobalVarDecl->getStorageClass() == StorageClass::Static) SC = "static "; if (GlobalVarDecl->getType().isConstQualified()) SC += "const "; @@ -4356,8 +4333,8 @@ FunctionDecl *RewriteObjC::SynthBlockInitFunctionDecl(StringRef name) { IdentifierInfo *ID = &Context->Idents.get(name); QualType FType = Context->getFunctionNoProtoType(Context->VoidPtrTy); return FunctionDecl::Create(*Context, TUDecl, SourceLocation(), - SourceLocation(), ID, FType, nullptr, SC_Extern, - false, false); + SourceLocation(), ID, FType, nullptr, + StorageClass::Extern, false, false); } Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp, @@ -4437,9 +4414,10 @@ Stmt *RewriteObjC::SynthBlockInitExpr(BlockExpr *Exp, // Initialize the block descriptor. std::string DescData = "__" + FuncName + "_block_desc_" + BlockNumber + "_DATA"; - VarDecl *NewVD = VarDecl::Create( - *Context, TUDecl, SourceLocation(), SourceLocation(), - &Context->Idents.get(DescData), Context->VoidPtrTy, nullptr, SC_Static); + VarDecl *NewVD = + VarDecl::Create(*Context, TUDecl, SourceLocation(), SourceLocation(), + &Context->Idents.get(DescData), Context->VoidPtrTy, + nullptr, StorageClass::Static); UnaryOperator *DescRefExpr = UnaryOperator::Create( const_cast<ASTContext &>(*Context), new (Context) DeclRefExpr(*Context, NewVD, false, Context->VoidPtrTy, |