forked from OSchip/llvm-project
parent
3277557741
commit
7b1866930e
|
@ -5784,7 +5784,9 @@ void RewriteObjC::RewriteRecordBody(RecordDecl *RD) {
|
|||
/// HandleDeclInMainFile - This is called for each top-level decl defined in the
|
||||
/// main file of the input.
|
||||
void RewriteObjC::HandleDeclInMainFile(Decl *D) {
|
||||
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
|
||||
switch (D->getKind()) {
|
||||
case Decl::Function: {
|
||||
FunctionDecl *FD = cast<FunctionDecl>(D);
|
||||
if (FD->isOverloadedOperator())
|
||||
return;
|
||||
|
||||
|
@ -5812,9 +5814,10 @@ void RewriteObjC::HandleDeclInMainFile(Decl *D) {
|
|||
CurFunctionDef = 0;
|
||||
CurFunctionDeclToDeclareForBlock = 0;
|
||||
}
|
||||
return;
|
||||
break;
|
||||
}
|
||||
if (ObjCMethodDecl *MD = dyn_cast<ObjCMethodDecl>(D)) {
|
||||
case Decl::ObjCMethod: {
|
||||
ObjCMethodDecl *MD = cast<ObjCMethodDecl>(D);
|
||||
if (CompoundStmt *Body = MD->getCompoundBody()) {
|
||||
CurMethodDef = MD;
|
||||
CurrentBody = Body;
|
||||
|
@ -5829,14 +5832,20 @@ void RewriteObjC::HandleDeclInMainFile(Decl *D) {
|
|||
InsertBlockLiteralsWithinMethod(MD);
|
||||
CurMethodDef = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (ObjCImplementationDecl *CI = dyn_cast<ObjCImplementationDecl>(D))
|
||||
case Decl::ObjCImplementation: {
|
||||
ObjCImplementationDecl *CI = cast<ObjCImplementationDecl>(D);
|
||||
ClassImplementation.push_back(CI);
|
||||
else if (ObjCCategoryImplDecl *CI = dyn_cast<ObjCCategoryImplDecl>(D))
|
||||
break;
|
||||
}
|
||||
case Decl::ObjCCategoryImpl: {
|
||||
ObjCCategoryImplDecl *CI = cast<ObjCCategoryImplDecl>(D);
|
||||
CategoryImplementation.push_back(CI);
|
||||
else if (isa<ObjCClassDecl>(D))
|
||||
llvm_unreachable("RewriteObjC::HandleDeclInMainFile - ObjCClassDecl");
|
||||
else if (VarDecl *VD = dyn_cast<VarDecl>(D)) {
|
||||
break;
|
||||
}
|
||||
case Decl::Var: {
|
||||
VarDecl *VD = cast<VarDecl>(D);
|
||||
RewriteObjCQualifiedInterfaceTypes(VD);
|
||||
if (isTopLevelBlockPointerType(VD->getType()))
|
||||
RewriteBlockPointerDecl(VD);
|
||||
|
@ -5861,8 +5870,7 @@ void RewriteObjC::HandleDeclInMainFile(Decl *D) {
|
|||
delete PropParentMap;
|
||||
PropParentMap = 0;
|
||||
}
|
||||
SynthesizeBlockLiterals(VD->getTypeSpecStartLoc(),
|
||||
VD->getName());
|
||||
SynthesizeBlockLiterals(VD->getTypeSpecStartLoc(), VD->getName());
|
||||
GlobalVarDecl = 0;
|
||||
|
||||
// This is needed for blocks.
|
||||
|
@ -5870,19 +5878,31 @@ void RewriteObjC::HandleDeclInMainFile(Decl *D) {
|
|||
RewriteCastExpr(CE);
|
||||
}
|
||||
}
|
||||
return;
|
||||
break;
|
||||
}
|
||||
case Decl::TypeAlias:
|
||||
case Decl::Typedef: {
|
||||
if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(D)) {
|
||||
if (isTopLevelBlockPointerType(TD->getUnderlyingType()))
|
||||
RewriteBlockPointerDecl(TD);
|
||||
else if (TD->getUnderlyingType()->isFunctionPointerType())
|
||||
CheckFunctionPointerDecl(TD->getUnderlyingType(), TD);
|
||||
return;
|
||||
}
|
||||
if (RecordDecl *RD = dyn_cast<RecordDecl>(D)) {
|
||||
break;
|
||||
}
|
||||
case Decl::CXXRecord:
|
||||
case Decl::Record: {
|
||||
RecordDecl *RD = cast<RecordDecl>(D);
|
||||
if (RD->isCompleteDefinition())
|
||||
RewriteRecordBody(RD);
|
||||
return;
|
||||
break;
|
||||
}
|
||||
case Decl::ObjCClass: {
|
||||
llvm_unreachable("RewriteObjC::HandleDeclInMainFile - ObjCClassDecl");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// Nothing yet.
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue