[clang] [Clang][AArch64]Refactor typespec handling in SveEmitter.cpp (PR #117717)

via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 2 06:20:40 PST 2024


================
@@ -570,27 +579,35 @@ void SVEType::applyTypespec(StringRef TS) {
   for (char I : TS) {
     switch (I) {
     case 'Q':
+      assert(Kind == Invalid && "Invalid use of modifer!");
       Kind = Svcount;
       break;
     case 'P':
+      assert(Kind == Invalid && "Invalid use of modifer!");
       Kind = Predicate;
       break;
     case 'U':
+      assert(Kind == Invalid && "Invalid use of modifer!");
       Kind = UInt;
       break;
     case 'c':
+      Kind = isInvalid() ? SInt : Kind;
----------------
SpencerAbson wrote:

Wouldn't this restriction only be valid for `q`? We could have any modifier (`P`/`Q`/`U`) before `c`,`s`,`i`, and `l` - unless the intent is to check that the current type (if it is not `Invalid`) was set by a modifer?

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


More information about the cfe-commits mailing list