[clang] [HLSL] Support vector swizzles on scalars (PR #67700)

Justin Bogner via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 9 18:35:38 PDT 2023


================
@@ -1950,6 +1950,10 @@ bool Lexer::LexNumericConstant(Token &Result, const char *CurPtr) {
   while (isPreprocessingNumberBody(C)) {
     CurPtr = ConsumeChar(CurPtr, Size, Result);
     PrevCh = C;
+    if (LangOpts.HLSL && C == '.' && (*CurPtr == 'x' || *CurPtr == 'r')) {
+      CurPtr--;
----------------
bogner wrote:

I think we'd need to decrement by `Size` here in case there's an escaped newline or something:
```
  return 1\
.xx;
```

https://github.com/llvm/llvm-project/pull/67700


More information about the cfe-commits mailing list