]> granicus.if.org Git - clang/commitdiff
Support MS-specific integer suffixes (i8, i16, i32, i64, i128).
authorSteve Naroff <snaroff@apple.com>
Fri, 4 Apr 2008 21:02:54 +0000 (21:02 +0000)
committerSteve Naroff <snaroff@apple.com>
Fri, 4 Apr 2008 21:02:54 +0000 (21:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49229 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/LiteralSupport.cpp

index aa0b831af90013f3d7ec9e555af3f06f8c7364b3..7d775dc85542bab467a9d01d27b1f69638f434e5 100644 (file)
@@ -349,6 +349,35 @@ NumericLiteralParser(const char *begin, const char *end,
       }
       continue;  // Success.
     case 'i':
+      if (PP.getLangOptions().Microsoft) {
+        // Allow i8, i16, i32, i64, and i128.
+        if (++s == ThisTokEnd) break;
+        switch (*s) {
+          case '8': 
+            s++; // i8 suffix
+            break;
+          case '1':
+            if (++s == ThisTokEnd) break;
+            if (*s == '6') s++; // i16 suffix
+            else if (*s == '2') {
+              if (++s == ThisTokEnd) break;
+              if (*s == '8') s++; // i128 suffix
+            }
+            break;
+          case '3':
+            if (++s == ThisTokEnd) break;
+            if (*s == '2') s++; // i32 suffix
+            break;
+          case '6':
+            if (++s == ThisTokEnd) break;
+            if (*s == '4') s++; // i64 suffix
+            break;
+          default:
+            break;
+        }
+        break;
+      }
+      // fall through.
     case 'I':
     case 'j':
     case 'J':