diff options
Diffstat (limited to 'clang/lib/Frontend/Rewrite/RewriteObjC.cpp')
-rw-r--r-- | clang/lib/Frontend/Rewrite/RewriteObjC.cpp | 108 |
1 files changed, 43 insertions, 65 deletions
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, |