================
@@ -930,7 +930,11 @@ NumericLiteralParser::NumericLiteralParser(StringRef 
TokSpelling,
   // and FP constants (specifically, the 'pp-number' regex), and assumes that
   // the byte at "*end" is both valid and not part of the regex.  Because of
   // this, it doesn't have to check for 'overscan' in various places.
-  if (isPreprocessingNumberBody(*ThisTokEnd)) {
+  // Note: For HLSL, the end token is allowed to be '.' which would be in the
+  // 'pp-number' regex. This is required to support vector swizzles on numeric
+  // constants (i.e. 1.xx or 1.5f.rrr).
+  if (isPreprocessingNumberBody(*ThisTokEnd) &&
+      !(LangOpts.HLSL && *ThisTokEnd == '.')) {
----------------
bogner wrote:

I'm kind of surprised that this doesn't break anything, given the number of 
places that we compare the current character to `ThisTokEnd` below. Are you 
sure there aren't any cases where we get caught up by some edge case like 
`1.5.x` or `1..x` or something here?

https://github.com/llvm/llvm-project/pull/67700
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to