summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2008-02-29 20:35:55 +0000
committerGabor Greif <ggreif@gmail.com>2008-02-29 20:35:55 +0000
commit05fdaeaed2c6dfaad1f56942b44dacebc0818d71 (patch)
tree6bb8ec104deee593de5f4fb0a22521aea1260970 /clang
parent17f4dbde366b62e07b2a61b33f99310d9ede11c4 (diff)
downloadbcm5719-llvm-05fdaeaed2c6dfaad1f56942b44dacebc0818d71.tar.gz
bcm5719-llvm-05fdaeaed2c6dfaad1f56942b44dacebc0818d71.zip
Fix a crash where PI.TypeInfo has not been filled in case of missing ObjCInterfaceDecl.
Happens with Xcode 2.4.1 headers on test Parser/objc-foreach-error-1.m llvm-svn: 47767
Diffstat (limited to 'clang')
-rw-r--r--clang/Sema/SemaDeclObjC.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/Sema/SemaDeclObjC.cpp b/clang/Sema/SemaDeclObjC.cpp
index 85797a5373e..267a9ef7896 100644
--- a/clang/Sema/SemaDeclObjC.cpp
+++ b/clang/Sema/SemaDeclObjC.cpp
@@ -43,17 +43,18 @@ void Sema::ObjCActOnStartOfMethodDef(Scope *FnBodyScope, DeclTy *D) {
PI.IdentLoc = SourceLocation(); // synthesized vars have a null location.
PI.InvalidType = false;
PI.AttrList = 0;
+ PI.TypeInfo = Context.getObjCIdType().getAsOpaquePtr();
+
if (MDecl->isInstance()) {
- ObjCInterfaceDecl *OID = MDecl->getClassInterface();
- // There may be no interface context due to error in declaration of the
- // interface (which has been reported). Recover gracefully
- if (OID) {
+ if (ObjCInterfaceDecl *OID = MDecl->getClassInterface()) {
+ // There may be no interface context due to error in declaration of the
+ // interface (which has been reported). Recover gracefully
QualType selfTy = Context.getObjCInterfaceType(OID);
selfTy = Context.getPointerType(selfTy);
PI.TypeInfo = selfTy.getAsOpaquePtr();
}
- } else
- PI.TypeInfo = Context.getObjCIdType().getAsOpaquePtr();
+ }
+
CurMethodDecl->setSelfDecl(ActOnParamDeclarator(PI, FnBodyScope));
PI.Ident = &Context.Idents.get("_cmd");
OpenPOWER on IntegriCloud