After rGa9db0a804a53, we correctly determined the end for pointer types
like `id` that are spelled without a `*`, but incorrectly determined the
end for pointer types spelled with a `*`.
case IncompleteArray:
case VariableArray:
case FunctionNoProto:
+ // The innermost type with suffix syntax always determines the end of the
+ // type.
Last = Cur;
break;
case FunctionProto:
else
Last = Cur;
break;
+ case ObjCObjectPointer:
+ // `id` and `id<...>` have no star location.
+ if (Cur.castAs<ObjCObjectPointerTypeLoc>().getStarLoc().isInvalid())
+ break;
+ LLVM_FALLTHROUGH;
case Pointer:
case BlockPointer:
case MemberPointer:
case LValueReference:
case RValueReference:
case PackExpansion:
+ // Types with prefix syntax only determine the end of the type if there
+ // is no suffix type.
if (!Last)
Last = Cur;
break;
- case ObjCObjectPointer:
case Qualified:
case Elaborated:
break;
@protocol P
@end;
-using TestAlias = id<P>;
-// CHECK: TypeAliasDecl {{.+}} <{{.+}}:[[@LINE-1]]:1, col:23> col:7 TestAlias 'id<P>'
+using TestObjCPointerWithoutStar = id<P>;
+// CHECK: TypeAliasDecl {{.+}} <{{.+}}:[[@LINE-1]]:1, col:40> col:7 TestObjCPointerWithoutStar 'id<P>'
+
+using TestObjCPointerWithStar = A *;
+// CHECK: TypeAliasDecl {{.+}} <{{.+}}:[[@LINE-1]]:1, col:35> col:7 TestObjCPointerWithStar 'A *'