llvm / clangir

A new (MLIR based) high-level IR for clang.
https://clangir.org
Other
351 stars 95 forks source link

Add switch support for GNU range #596

Closed bcardosolopes closed 4 months ago

bcardosolopes commented 4 months ago

We should add support for this:

enum xyz {
 A, B, C, D, E, F, G, H, I, J, L
};

int yolo(
    enum xyz c) {
  switch (c) {
    case A ... C:
    case D ... E:
    case F ... H:
    case I ... L:
      return 1;
    default:
      return 0;
  }
}

https://godbolt.org/z/Mqes48vz3

bcardosolopes commented 4 months ago

@wenpen this is a simpler one to address.