[cfe-commits] r73854 - in /cfe/trunk: include/clang/AST/ExprObjC.h lib/AST/Expr.cpp

Fariborz Jahanian fjahanian at apple.com
Mon Jun 22 08:53:50 PDT 2009


Only ObjC++ side of gcc issues an error. It is a bug in objc++'s gcc,  
but for the immediate need, we have decided to
change the clang source.

typedef int Protocol;
struct S {
   int Protocol;

   void Meth () {
        Protocol = 1;
   }
};

% g++ t.mm
t.mm:1: error: conflicting declaration 'typedef int Protocol'
<built-in>:0: error: 'struct Protocol' has a previous declaration as  
'struct Protocol'
t.mm: In member function 'void S::Meth()':
t.mm:7: error: expected unqualified-id before '=' token

(clang crashes on the above test case).

- Fariborz


On Jun 21, 2009, at 12:24 PM, Daniel Dunbar wrote:

> I don't understand this change, does lookup in Obj-C++ not find the
> member variable before the class at global scope?
>
> - Daniel
>
> On Sun, Jun 21, 2009 at 11:26 AM, Fariborz Jahanian<fjahanian at apple.com 
> > wrote:
>> Author: fjahanian
>> Date: Sun Jun 21 13:26:03 2009
>> New Revision: 73854
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=73854&view=rev
>> Log:
>> Renamed Protocol as TheProtocol so people can use clang header for
>> building obj-c++ clients. "Protocol" is a class name in Cocoa.h
>>
>> Modified:
>>    cfe/trunk/include/clang/AST/ExprObjC.h
>>    cfe/trunk/lib/AST/Expr.cpp
>>
>> Modified: cfe/trunk/include/clang/AST/ExprObjC.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprObjC.h?rev=73854&r1=73853&r2=73854&view=diff
>>
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- cfe/trunk/include/clang/AST/ExprObjC.h (original)
>> +++ cfe/trunk/include/clang/AST/ExprObjC.h Sun Jun 21 13:26:03 2009
>> @@ -138,20 +138,20 @@
>>  ///   obj conformsToProtocol:@protocol(foo)]
>>  /// The return type is "Protocol*".
>>  class ObjCProtocolExpr : public Expr {
>> -  ObjCProtocolDecl *Protocol;
>> +  ObjCProtocolDecl *TheProtocol;
>>   SourceLocation AtLoc, RParenLoc;
>>  public:
>>   ObjCProtocolExpr(QualType T, ObjCProtocolDecl *protocol,
>>                    SourceLocation at, SourceLocation rp)
>> -  : Expr(ObjCProtocolExprClass, T), Protocol(protocol),
>> +  : Expr(ObjCProtocolExprClass, T), TheProtocol(protocol),
>>     AtLoc(at), RParenLoc(rp) {}
>>   explicit ObjCProtocolExpr(EmptyShell Empty)
>>     : Expr(ObjCProtocolExprClass, Empty) {}
>>
>>   ObjCProtocolExpr *Clone(ASTContext &C) const;
>>
>> -  ObjCProtocolDecl *getProtocol() const { return Protocol; }
>> -  void setProtocol(ObjCProtocolDecl *P) { Protocol = P; }
>> +  ObjCProtocolDecl *getProtocol() const { return TheProtocol; }
>> +  void setProtocol(ObjCProtocolDecl *P) { TheProtocol = P; }
>>
>>   SourceLocation getAtLoc() const { return AtLoc; }
>>   SourceLocation getRParenLoc() const { return RParenLoc; }
>>
>> Modified: cfe/trunk/lib/AST/Expr.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=73854&r1=73853&r2=73854&view=diff
>>
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- cfe/trunk/lib/AST/Expr.cpp (original)
>> +++ cfe/trunk/lib/AST/Expr.cpp Sun Jun 21 13:26:03 2009
>> @@ -1571,7 +1571,7 @@
>>  }
>>
>>  ObjCProtocolExpr *ObjCProtocolExpr::Clone(ASTContext &C) const {
>> -  return new (C) ObjCProtocolExpr(getType(), Protocol, AtLoc,  
>> RParenLoc);
>> +  return new (C) ObjCProtocolExpr(getType(), TheProtocol, AtLoc,  
>> RParenLoc);
>>  }
>>
>>  // constructor for class messages.
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>




More information about the cfe-commits mailing list