[cfe-commits] r115934 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/Rewriter/property-dot-syntax.mm

Fariborz Jahanian fjahanian at apple.com
Thu Oct 7 11:12:21 PDT 2010


Author: fjahanian
Date: Thu Oct  7 13:12:21 2010
New Revision: 115934

URL: http://llvm.org/viewvc/llvm-project?rev=115934&view=rev
Log:
Start and end location of a property-dot syntax expression
must match start and end location of the expression
as expected by the rewriter client. Fixes // rdar: // 8520727


Added:
    cfe/trunk/test/Rewriter/property-dot-syntax.mm
Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=115934&r1=115933&r2=115934&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Oct  7 13:12:21 2010
@@ -3289,11 +3289,14 @@
         // Check the use of this method.
         if (DiagnoseUseOfDecl(OMD, MemberLoc))
           return ExprError();
-
+        // It is important that start and end position is the first character
+        // and last character position of the property-dot syntax expression.
+        SourceLocation MemberEndLoc = PP.getLocForEndOfToken(MemberLoc, 1);
         return Owned(ObjCMessageExpr::Create(Context,
                                              OMD->getSendResultType(),
-                                             OpLoc, BaseExpr, Sel,
-                                             OMD, NULL, 0, MemberLoc));
+                                             BaseExpr->getExprLoc(), 
+                                             BaseExpr, Sel,
+                                             OMD, NULL, 0, MemberEndLoc));
       }
     }
 

Added: cfe/trunk/test/Rewriter/property-dot-syntax.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/property-dot-syntax.mm?rev=115934&view=auto
==============================================================================
--- cfe/trunk/test/Rewriter/property-dot-syntax.mm (added)
+++ cfe/trunk/test/Rewriter/property-dot-syntax.mm Thu Oct  7 13:12:21 2010
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp
+// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+// rdar:// 8520727
+
+void *sel_registerName(const char *);
+
+ at class NSString;
+
+ at protocol CoreDAVAccountInfoProvider
+- (NSString *)userAgentHeader;
+ at end
+
+ at interface CoreDAVTask
+{
+  id<CoreDAVAccountInfoProvider> _accountInfoProvider;
+}
+- (void)METHOD;
+ at end
+
+ at implementation CoreDAVTask
+- (void)METHOD {
+  if ([_accountInfoProvider userAgentHeader]) {
+  }
+  if (_accountInfoProvider.userAgentHeader) {
+  }
+}
+ at end
+





More information about the cfe-commits mailing list