[PATCH] D20844: FixIt: correctly set DeclSpec's range end for a type name annotation.
Manman Ren via cfe-commits
cfe-commits at lists.llvm.org
Tue May 31 16:44:05 PDT 2016
manmanren created this revision.
manmanren added a reviewer: rjmccall.
manmanren added a subscriber: cfe-commits.
Before this fix, both the start and the end point to the same location, and we will add the FixIt before the type name:
^(NSView view) to ^(*NSView view)
After this commit, fixit will change it to ^(NSView *view).
http://reviews.llvm.org/D20844
Files:
lib/Parse/ParseDecl.cpp
test/FixIt/fixit-interface-as-param.m
Index: test/FixIt/fixit-interface-as-param.m
===================================================================
--- test/FixIt/fixit-interface-as-param.m
+++ test/FixIt/fixit-interface-as-param.m
@@ -5,7 +5,16 @@
@interface INTF
- (void) drawRect : inView:(NSView)view;
+- (void)test:(NSView )a;
+- (void)foo;
@end
// CHECK: {7:35-7:35}:"*"
-
+// CHECK: {8:22-8:22}:"*"
+ at implementation INTF
+-(void)foo {
+ ^(NSView view) {
+ };
+}
+ at end
+// CHECK: {16:12-16:12}:"*"
Index: lib/Parse/ParseDecl.cpp
===================================================================
--- lib/Parse/ParseDecl.cpp
+++ lib/Parse/ParseDecl.cpp
@@ -2935,8 +2935,8 @@
if (isInvalid)
break;
- DS.SetRangeEnd(Tok.getAnnotationEndLoc());
ConsumeToken(); // The typename
+ DS.SetRangeEnd(Tok.getLocation());
continue;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20844.59150.patch
Type: text/x-patch
Size: 853 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160531/6a521452/attachment.bin>
More information about the cfe-commits
mailing list