[cfe-commits] r65332 - in /cfe/trunk: include/clang/AST/ASTContext.h include/clang/AST/Type.h lib/AST/ASTContext.cpp lib/AST/ExprConstant.cpp lib/AST/Type.cpp lib/Sema/SemaExpr.cpp lib/Sema/SemaType.cpp test/SemaObjC/protocol-archane.m test/SemaObjC/protocol-atttribute-1.m

Steve Naroff snaroff at apple.com
Mon Feb 23 10:36:17 PST 2009


Author: snaroff
Date: Mon Feb 23 12:36:16 2009
New Revision: 65332

URL: http://llvm.org/viewvc/llvm-project?rev=65332&view=rev
Log:
Revert http://llvm.org/viewvc/llvm-project?view=rev&revision=65244.

Remove support for "Class<P>". Will be making this an error.

Modified:
    cfe/trunk/include/clang/AST/ASTContext.h
    cfe/trunk/include/clang/AST/Type.h
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/lib/AST/ExprConstant.cpp
    cfe/trunk/lib/AST/Type.cpp
    cfe/trunk/lib/Sema/SemaExpr.cpp
    cfe/trunk/lib/Sema/SemaType.cpp
    cfe/trunk/test/SemaObjC/protocol-archane.m
    cfe/trunk/test/SemaObjC/protocol-atttribute-1.m

Modified: cfe/trunk/include/clang/AST/ASTContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=65332&r1=65331&r2=65332&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/ASTContext.h (original)
+++ cfe/trunk/include/clang/AST/ASTContext.h Mon Feb 23 12:36:16 2009
@@ -73,7 +73,6 @@
     ClassTemplateSpecializationTypes;
   llvm::FoldingSet<ObjCQualifiedInterfaceType> ObjCQualifiedInterfaceTypes;
   llvm::FoldingSet<ObjCQualifiedIdType> ObjCQualifiedIdTypes;
-  llvm::FoldingSet<ObjCQualifiedClassType> ObjCQualifiedClassTypes;
   /// ASTRecordLayouts - A cache mapping from RecordDecls to ASTRecordLayouts.
   ///  This is lazily created.  This is intentionally not serialized.
   llvm::DenseMap<const RecordDecl*, const ASTRecordLayout*> ASTRecordLayouts;
@@ -292,10 +291,6 @@
   QualType getObjCQualifiedIdType(ObjCProtocolDecl **ProtocolList, 
                                   unsigned NumProtocols);
                                   
-  /// getObjCQualifiedClassType - Return an ObjCQualifiedClassType for a 
-  /// given 'Class' and conforming protocol list.
-  QualType getObjCQualifiedClassType(ObjCProtocolDecl **ProtocolList, 
-                                     unsigned NumProtocols);
 
   /// getTypeOfType - GCC extension.
   QualType getTypeOfExpr(Expr *e);

Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=65332&r1=65331&r2=65332&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Mon Feb 23 12:36:16 2009
@@ -69,7 +69,6 @@
   class BuiltinType;
   class ObjCInterfaceType;
   class ObjCQualifiedIdType;
-  class ObjCQualifiedClassType;
   class ObjCQualifiedInterfaceType;
   class StmtIteratorBase;
   class ClassTemplateSpecializationType;
@@ -385,7 +384,6 @@
   bool isObjCInterfaceType() const;             // NSString or NSString<foo>
   bool isObjCQualifiedInterfaceType() const;    // NSString<foo>
   bool isObjCQualifiedIdType() const;           // id<foo>
-  bool isObjCQualifiedClassType() const;        // Class<foo>
   bool isTemplateTypeParmType() const;          // C++ template type parameter
 
   /// isDependentType - Whether this type is a dependent type, meaning
@@ -419,7 +417,6 @@
   const ObjCInterfaceType *getAsObjCInterfaceType() const;
   const ObjCQualifiedInterfaceType *getAsObjCQualifiedInterfaceType() const;
   const ObjCQualifiedIdType *getAsObjCQualifiedIdType() const;
-  const ObjCQualifiedClassType *getAsObjCQualifiedClassType() const;
   const TemplateTypeParmType *getAsTemplateTypeParmType() const;
 
   const ClassTemplateSpecializationType *
@@ -1945,9 +1942,6 @@
 inline bool Type::isObjCQualifiedIdType() const {
   return isa<ObjCQualifiedIdType>(CanonicalType.getUnqualifiedType());
 }
-inline bool Type::isObjCQualifiedClassType() const {
-  return isa<ObjCQualifiedClassType>(CanonicalType.getUnqualifiedType());
-}
 inline bool Type::isTemplateTypeParmType() const {
   return isa<TemplateTypeParmType>(CanonicalType.getUnqualifiedType());
 }

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=65332&r1=65331&r2=65332&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Mon Feb 23 12:36:16 2009
@@ -1397,29 +1397,6 @@
   return QualType(QType, 0);
 }
 
-/// getObjCQualifiedClassType - Return an ObjCQualifiedIdType for the 'Class'
-/// decl and the conforming protocol list.
-QualType ASTContext::getObjCQualifiedClassType(ObjCProtocolDecl **Protocols, 
-                                               unsigned NumProtocols) {
-  // Sort the protocol list alphabetically to canonicalize it.
-  SortAndUniqueProtocols(Protocols, NumProtocols);
-
-  llvm::FoldingSetNodeID ID;
-  ObjCQualifiedIdType::Profile(ID, Protocols, NumProtocols);
-  
-  void *InsertPos = 0;
-  if (ObjCQualifiedClassType *QT =
-        ObjCQualifiedClassTypes.FindNodeOrInsertPos(ID, InsertPos))
-    return QualType(QT, 0);
-  
-  // No Match;
-  ObjCQualifiedClassType *QType =
-    new (*this,8) ObjCQualifiedClassType(Protocols, NumProtocols);
-  Types.push_back(QType);
-  ObjCQualifiedClassTypes.InsertNode(QType, InsertPos);
-  return QualType(QType, 0);
-}
-
 /// getTypeOfExpr - Unlike many "get<Type>" functions, we can't unique
 /// TypeOfExpr AST's (since expression's are never shared). For example,
 /// multiple declarations that refer to "typeof(x)" all contain different
@@ -2422,7 +2399,7 @@
 /// to struct), Interface* (pointer to ObjCInterfaceType) and id<P> (qualified
 /// ID type).
 bool ASTContext::isObjCObjectPointerType(QualType Ty) const {
-  if (Ty->isObjCQualifiedIdType() || Ty->isObjCQualifiedClassType())
+  if (Ty->isObjCQualifiedIdType())
     return true;
   
   // Blocks are objects.

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=65332&r1=65331&r2=65332&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Mon Feb 23 12:36:16 2009
@@ -285,8 +285,7 @@
 static bool HasPointerEvalType(const Expr* E) {
   return E->getType()->isPointerType()
          || E->getType()->isBlockPointerType()
-         || E->getType()->isObjCQualifiedIdType()
-         || E->getType()->isObjCQualifiedClassType();
+         || E->getType()->isObjCQualifiedIdType();
 }
 
 static bool EvaluatePointer(const Expr* E, APValue& Result, EvalInfo &Info) {

Modified: cfe/trunk/lib/AST/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=65332&r1=65331&r2=65332&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Type.cpp (original)
+++ cfe/trunk/lib/AST/Type.cpp Mon Feb 23 12:36:16 2009
@@ -870,17 +870,6 @@
   Profile(ID, &Protocols[0], getNumProtocols());
 }
 
-void ObjCQualifiedClassType::Profile(llvm::FoldingSetNodeID &ID,
-                                     ObjCProtocolDecl **protocols, 
-                                     unsigned NumProtocols) {
-  for (unsigned i = 0; i != NumProtocols; i++)
-    ID.AddPointer(protocols[i]);
-}
-
-void ObjCQualifiedClassType::Profile(llvm::FoldingSetNodeID &ID) {
-  Profile(ID, &Protocols[0], getNumProtocols());
-}
-
 /// LookThroughTypedefs - Return the ultimate type this typedef corresponds to
 /// potentially looking through *all* consequtive typedefs.  This returns the
 /// sum of the type qualifiers, so if you have:
@@ -1357,22 +1346,6 @@
   InnerString = ObjCQIString + InnerString;
 }
 
-void ObjCQualifiedClassType::getAsStringInternal(std::string &InnerString) const 
-{
-  if (!InnerString.empty())    // Prefix the basic type, e.g. 'typedefname X'.
-    InnerString = ' ' + InnerString;
-  std::string ObjCQIString = "Class";
-  ObjCQIString += '<';
-  int num = getNumProtocols();
-  for (int i = 0; i < num; i++) {
-    ObjCQIString += getProtocols(i)->getNameAsString();
-    if (i < num-1)
-      ObjCQIString += ',';
-  }
-  ObjCQIString += '>';
-  InnerString = ObjCQIString + InnerString;
-}
-
 void TagType::getAsStringInternal(std::string &InnerString) const {
   if (!InnerString.empty())    // Prefix the basic type, e.g. 'typedefname X'.
     InnerString = ' ' + InnerString;

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=65332&r1=65331&r2=65332&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Feb 23 12:36:16 2009
@@ -2736,7 +2736,6 @@
   // a null pointer constant.
   if ((lhsType->isPointerType() || 
        lhsType->isObjCQualifiedIdType() || 
-       lhsType->isObjCQualifiedClassType() ||
        lhsType->isBlockPointerType())
       && rExpr->isNullPointerConstant(Context)) {
     ImpCastExprToType(rExpr, lhsType);

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=65332&r1=65331&r2=65332&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Mon Feb 23 12:36:16 2009
@@ -151,10 +151,6 @@
         // id<protocol-list>
         Result = Context.getObjCQualifiedIdType((ObjCProtocolDecl**)PQ,
                                                 DS.getNumProtocolQualifiers());
-      else if (Result == Context.getObjCClassType())
-        // Support the following GCC extension: Class<protocol-list>
-        Result = Context.getObjCQualifiedClassType((ObjCProtocolDecl**)PQ,
-                                                DS.getNumProtocolQualifiers());
       else
         Diag(DS.getSourceRange().getBegin(), 
              diag::warn_ignoring_objc_qualifiers) << DS.getSourceRange();

Modified: cfe/trunk/test/SemaObjC/protocol-archane.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocol-archane.m?rev=65332&r1=65331&r2=65332&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/protocol-archane.m (original)
+++ cfe/trunk/test/SemaObjC/protocol-archane.m Mon Feb 23 12:36:16 2009
@@ -27,8 +27,3 @@
 
 // GCC doesn't diagnose this.
 NotAnObjCObjectType <SomeProtocol> *obj; // expected-warning {{ignoring protocol qualifiers on non-ObjC type}}
-
-// GCC extension (sigh). Found while researching rdar://6497631
-typedef struct objc_class *Class;
-
-Class <SomeProtocol> UnfortunateGCCExtension;

Modified: cfe/trunk/test/SemaObjC/protocol-atttribute-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/protocol-atttribute-1.m?rev=65332&r1=65331&r2=65332&view=diff

==============================================================================
--- cfe/trunk/test/SemaObjC/protocol-atttribute-1.m (original)
+++ cfe/trunk/test/SemaObjC/protocol-atttribute-1.m Mon Feb 23 12:36:16 2009
@@ -3,7 +3,7 @@
 __attribute ((unavailable))
 @protocol FwProto; // expected-note{{marked unavailable}}
 
-Class <FwProto> cFw = 0;  // expected-warning {{'FwProto' is unavailable}}
+Class <FwProto> cFw = 0;  // expected-warning {{'FwProto' is unavailable}} expected-warning{{ignoring protocol qualifiers on non-ObjC type}}
 
 
 __attribute ((deprecated)) @protocol MyProto1
@@ -31,7 +31,7 @@
 
 
 
-Class <MyProto1> clsP1 = 0;  // expected-warning {{'MyProto1' is deprecated}}
+Class <MyProto1> clsP1 = 0;  // expected-warning {{'MyProto1' is deprecated}} expected-warning{{ignoring protocol qualifiers on non-ObjC type}}
 
 @protocol FwProto @end // expected-note{{marked unavailable}}
 





More information about the cfe-commits mailing list