[cfe-commits] r93917 - in /cfe/trunk: lib/Frontend/RewriteObjC.cpp test/Rewriter/rewrite-typeof.mm

Fariborz Jahanian fjahanian at apple.com
Sun Jan 24 10:41:45 PST 2010


On Jan 23, 2010, at 2:32 PM, Daniel Dunbar wrote:

> Hi Fariborz,
>
> On Tue, Jan 19, 2010 at 1:48 PM, Fariborz Jahanian <fjahanian at apple.com 
> > wrote:
>> Author: fjahanian
>> Date: Tue Jan 19 15:48:35 2010
>> New Revision: 93917
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=93917&view=rev
>> Log:
>> Rewriteing of gnu extension __typeof in objective-c rewriter.
>> Fixes radar 6358225.
>>
>> Added:
>>    cfe/trunk/test/Rewriter/rewrite-typeof.mm
>> Modified:
>>    cfe/trunk/lib/Frontend/RewriteObjC.cpp
>>
>> Modified: cfe/trunk/lib/Frontend/RewriteObjC.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/RewriteObjC.cpp?rev=93917&r1=93916&r2=93917&view=diff
>>
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- cfe/trunk/lib/Frontend/RewriteObjC.cpp (original)
>> +++ cfe/trunk/lib/Frontend/RewriteObjC.cpp Tue Jan 19 15:48:35 2010
>> @@ -4293,7 +4293,19 @@
>>
>>   const char *startBuf = SM->getCharacterData(LocStart);
>>   const char *endBuf = SM->getCharacterData(LocEnd);
>> -
>> +  QualType QT = CE->getType();
>> +  const Type* TypePtr = QT->getAs<Type>();
>> +  if (isa<TypeOfExprType>(TypePtr)) {
>> +    const TypeOfExprType *TypeOfExprTypePtr = cast<TypeOfExprType> 
>> (TypePtr);
>> +    QT = TypeOfExprTypePtr->getUnderlyingExpr()->getType();
>> +    std::string TypeAsString = "(";
>> +    TypeAsString += QT.getAsString();
>> +    TypeAsString += ")";
>> +    ReplaceText(LocStart, endBuf-startBuf+1,
>> +                TypeAsString.c_str(), TypeAsString.size());
>> +    return;
>> +  }
>> +
>>   // advance the location to startArgList.
>>   const char *argPtr = startBuf;
>>
>>
>> Added: cfe/trunk/test/Rewriter/rewrite-typeof.mm
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-typeof.mm?rev=93917&view=auto
>>
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> = 
>> =====================================================================
>> --- cfe/trunk/test/Rewriter/rewrite-typeof.mm (added)
>> +++ cfe/trunk/test/Rewriter/rewrite-typeof.mm Tue Jan 19 15:48:35  
>> 2010
>> @@ -0,0 +1,20 @@
>> +// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions - 
>> rewrite-objc -o - %s
>
> Please include at least one check that the output matches what is  
> expected.
Done in http://llvm.org/viewvc/llvm-project?view=rev&revision=94368

- Fariborz

>
> - Daniel
>




More information about the cfe-commits mailing list