[PATCH] D20844: FixIt: use getLocForEndOfToken to insert fix-it after a type name.
Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 1 17:17:43 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL271448: FixIt: use getLocForEndOfToken to insert fix-it after a type name. (authored by mren).
Changed prior to commit:
http://reviews.llvm.org/D20844?vs=59296&id=59315#toc
Repository:
rL LLVM
http://reviews.llvm.org/D20844
Files:
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/FixIt/fixit-interface-as-param.m
Index: cfe/trunk/test/FixIt/fixit-interface-as-param.m
===================================================================
--- cfe/trunk/test/FixIt/fixit-interface-as-param.m
+++ cfe/trunk/test/FixIt/fixit-interface-as-param.m
@@ -1,11 +1,20 @@
-// RUN: not %clang_cc1 -triple x86_64-apple-darwin10 -fdiagnostics-parseable-fixits -x objective-c %s 2>&1 | FileCheck %s
+// RUN: not %clang_cc1 -triple x86_64-apple-darwin10 -fblocks -fdiagnostics-parseable-fixits -x objective-c %s 2>&1 | FileCheck %s
// rdar://11311333
@interface NSView @end
@interface INTF
- (void) drawRect : inView:(NSView)view;
+- (void)test:(NSView )a;
+- (void)foo;
@end
// CHECK: {7:35-7:35}:"*"
-
+// CHECK: {8:21-8:21}:"*"
+ at implementation INTF
+-(void)foo {
+ ^(NSView view) {
+ };
+}
+ at end
+// CHECK: {16:11-16:11}:"*"
Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -10954,7 +10954,8 @@
// Parameter declarators cannot be interface types. All ObjC objects are
// passed by reference.
if (T->isObjCObjectType()) {
- SourceLocation TypeEndLoc = TSInfo->getTypeLoc().getLocEnd();
+ SourceLocation TypeEndLoc =
+ getLocForEndOfToken(TSInfo->getTypeLoc().getLocEnd());
Diag(NameLoc,
diag::err_object_cannot_be_passed_returned_by_value) << 1 << T
<< FixItHint::CreateInsertion(TypeEndLoc, "*");
Index: cfe/trunk/lib/Parse/ParseObjc.cpp
===================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp
+++ cfe/trunk/lib/Parse/ParseObjc.cpp
@@ -1277,7 +1277,6 @@
if (context == Declarator::ObjCResultContext)
dsContext = DSC_objc_method_result;
ParseSpecifierQualifierList(declSpec, AS_none, dsContext);
- declSpec.SetRangeEnd(Tok.getLocation());
Declarator declarator(declSpec, context);
ParseDeclarator(declarator);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20844.59315.patch
Type: text/x-patch
Size: 1955 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160602/e1457c96/attachment.bin>
More information about the cfe-commits
mailing list