The format is normally: OpenCL v1.1, s6.1.7
Does this text have much relation to the function? I don't feel that copying it from the spec is helping much in understanding of this function. It's probably just Ok to have the reference to the spec section and concisely summarize that the component swizzle length must be in accordance with the acceptable vector sizes.
Also would it be better to rename this to something like:
I think the logic in this function is all for OpenCL, but we didn't check it . Anyways, let's leave it for now.
Variable name doesn't adhere the coding style:
Also you could use CompName->getLength() instead of constructing a new StringRef object.
Could we add a non-numeric swizzle too?