Minor refactoring of foreach's semantics code per Chris's suggetion.

llvm-svn: 45604
This commit is contained in:
Fariborz Jahanian 2008-01-04 23:59:09 +00:00
parent 6bb0c52628
commit bad3218954
3 changed files with 5 additions and 5 deletions

View File

@ -286,7 +286,7 @@ private:
/// or "Protocol".
bool isBuiltinObjcType(TypedefDecl *TD);
/// isObjcObjectPointerType - Returns tru if type is an objective-c pointer
/// isObjcObjectPointerType - Returns true if type is an objective-c pointer
/// to an object type; such as "id", "Class", Intf*, id<P>, etc.
bool isObjcObjectPointerType(QualType type) const;

View File

@ -217,7 +217,7 @@ Sema::ExprResult Sema::ActOnInstanceMessage(
return true;
}
} else {
bool receiverIsQualId = dyn_cast<ObjcQualifiedIdType>(receiverType) != 0;
bool receiverIsQualId = isa<ObjcQualifiedIdType>(receiverType);
// FIXME (snaroff): checking in this code from Patrick. Needs to be
// revisited. how do we get the ClassDecl from the receiver expression?
if (!receiverIsQualId)

View File

@ -540,15 +540,15 @@ Sema::ActOnObjcForCollectionStmt(SourceLocation ForColLoc,
Stmt *Body = static_cast<Stmt*>(body);
QualType FirstType;
if (DeclStmt *DS = dyn_cast_or_null<DeclStmt>(First)) {
FirstType = dyn_cast<ValueDecl>(DS->getDecl())->getType();
FirstType = cast<ValueDecl>(DS->getDecl())->getType();
// C99 6.8.5p3: The declaration part of a 'for' statement shall only declare
// identifiers for objects having storage class 'auto' or 'register'.
for (ScopedDecl *D = DS->getDecl(); D; D = D->getNextDeclarator()) {
BlockVarDecl *BVD = dyn_cast<BlockVarDecl>(D);
BlockVarDecl *BVD = cast<BlockVarDecl>(D);
if (BVD && !BVD->hasLocalStorage())
BVD = 0;
if (BVD == 0)
return Diag(dyn_cast<ScopedDecl>(D)->getLocation(),
return Diag(cast<ScopedDecl>(D)->getLocation(),
diag::err_non_variable_decl_in_for);
}
}