mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-12 01:18:53 +00:00
ASTPrinter: Objective-C method declarations don't need a space after
the return type rdar://32332039 llvm-svn: 304553
This commit is contained in:
parent
57d8a417e7
commit
bbf4f7091f
@ -1189,7 +1189,9 @@ void DeclPrinter::VisitObjCMethodDecl(ObjCMethodDecl *OMD) {
|
||||
for (const auto *PI : OMD->parameters()) {
|
||||
// FIXME: selector is missing here!
|
||||
pos = name.find_first_of(':', lastPos);
|
||||
Out << " " << name.substr(lastPos, pos - lastPos) << ':';
|
||||
if (lastPos != 0)
|
||||
Out << " ";
|
||||
Out << name.substr(lastPos, pos - lastPos) << ':';
|
||||
PrintObjCMethodType(OMD->getASTContext(),
|
||||
PI->getObjCDeclQualifier(),
|
||||
PI->getType());
|
||||
@ -1198,7 +1200,7 @@ void DeclPrinter::VisitObjCMethodDecl(ObjCMethodDecl *OMD) {
|
||||
}
|
||||
|
||||
if (OMD->param_begin() == OMD->param_end())
|
||||
Out << " " << name;
|
||||
Out << name;
|
||||
|
||||
if (OMD->isVariadic())
|
||||
Out << ", ...";
|
||||
|
@ -17,25 +17,30 @@
|
||||
@implementation I
|
||||
- (void)MethP __attribute__((availability(macosx,introduced=10.1.0,deprecated=10.2))) {}
|
||||
- (void)MethI __attribute__((availability(macosx,introduced=10.1.0,deprecated=10.2))) {}
|
||||
|
||||
- (void)methodWithArg:(int)x andAnotherOne:(int)y { }
|
||||
@end
|
||||
|
||||
// CHECK: @protocol P
|
||||
// CHECK: - (void) MethP __attribute__((availability(macos, introduced=10.1.0, deprecated=10.2)));
|
||||
// CHECK: - (void)MethP __attribute__((availability(macos, introduced=10.1.0, deprecated=10.2)));
|
||||
// CHECK: @end
|
||||
|
||||
// CHECK: @interface I : NSObject<P>
|
||||
// CHECK: - (void) MethI __attribute__((availability(macos, introduced=10.1.0, deprecated=10.2)));
|
||||
// CHECK: - (void)MethI __attribute__((availability(macos, introduced=10.1.0, deprecated=10.2)));
|
||||
// CHECK: @end
|
||||
|
||||
// CHECK: @interface I(CAT)
|
||||
// CHECK: - (void) MethCAT __attribute__((availability(macos, introduced=10_1_0, deprecated=10_2)));
|
||||
// CHECK: - (void)MethCAT __attribute__((availability(macos, introduced=10_1_0, deprecated=10_2)));
|
||||
// CHECK: @end
|
||||
|
||||
// CHECK: @implementation I
|
||||
// CHECK: - (void) MethP __attribute__((availability(macos, introduced=10.1.0, deprecated=10.2))) {
|
||||
// CHECK: - (void)MethP __attribute__((availability(macos, introduced=10.1.0, deprecated=10.2))) {
|
||||
// CHECK: }
|
||||
|
||||
// CHECK: - (void) MethI __attribute__((availability(macos, introduced=10.1.0, deprecated=10.2))) {
|
||||
// CHECK: - (void)MethI __attribute__((availability(macos, introduced=10.1.0, deprecated=10.2))) {
|
||||
// CHECK: }
|
||||
|
||||
// CHECK: - (void)methodWithArg:(int)x andAnotherOne:(int)y {
|
||||
// CHECK: }
|
||||
|
||||
// CHECK: @end
|
||||
|
@ -14,7 +14,7 @@ void test(id x) {
|
||||
// expected-note@Inputs/lookup_right.h:3{{also found}}
|
||||
}
|
||||
|
||||
// CHECK-PRINT: - (int) method;
|
||||
// CHECK-PRINT: - (double) method
|
||||
// CHECK-PRINT: - (int)method;
|
||||
// CHECK-PRINT: - (double)method
|
||||
// CHECK-PRINT: void test(id x)
|
||||
|
||||
|
@ -1228,7 +1228,7 @@ TEST(DeclPrinter, TestObjCMethod1) {
|
||||
"@end\n",
|
||||
namedDecl(hasName("A:inRange:"),
|
||||
hasDescendant(namedDecl(hasName("printThis")))).bind("id"),
|
||||
"- (int) A:(id)anObject inRange:(long)range"));
|
||||
"- (int)A:(id)anObject inRange:(long)range"));
|
||||
}
|
||||
|
||||
TEST(DeclPrinter, TestObjCProtocol1) {
|
||||
|
Loading…
Reference in New Issue
Block a user