~blep/llvm/clang-win32

« back to all changes in this revision

Viewing changes to lib/Sema/SemaDeclObjC.cpp

  • Committer: fjahanian
  • Date: 2009-08-11 22:02:25 UTC
  • Revision ID: vcs-imports@canonical.com-20090811220225-cthr4h7drke2tc8r
Patch to warn if a property which is 'assign' by default
may not implement NSCopying protocol in -fobjc-gc[-only] mode.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1924
1924
        return DeclPtrTy();
1925
1925
      } 
1926
1926
    }
1927
 
 
 
1927
  
 
1928
  // Issue a warning if property is 'assign' as default and its object, which is
 
1929
  // gc'able conforms to NSCopying protocol 
 
1930
  if (getLangOptions().getGCMode() != LangOptions::NonGC &&
 
1931
      isAssign && !(Attributes & ObjCDeclSpec::DQ_PR_assign))
 
1932
      if (T->isObjCObjectPointerType()) {
 
1933
        QualType InterfaceTy = T->getPointeeType();
 
1934
        ObjCInterfaceDecl *IDecl= 
 
1935
          InterfaceTy->getAsObjCInterfaceType()->getDecl();
 
1936
        if (IDecl)
 
1937
          if (ObjCProtocolDecl* PNSCopying = 
 
1938
                LookupProtocol(&Context.Idents.get("NSCopying")))
 
1939
            if (IDecl->ClassImplementsProtocol(PNSCopying, true))
 
1940
              Diag(AtLoc, diag::warn_implements_nscopying)  
 
1941
                << FD.D.getIdentifier();
 
1942
      }
 
1943
  
1928
1944
  DeclContext *DC = dyn_cast<DeclContext>(ClassDecl);
1929
1945
  assert(DC && "ClassDecl is not a DeclContext");
1930
1946
  ObjCPropertyDecl *PDecl = ObjCPropertyDecl::Create(Context, DC,