[PATCH] D115107: [clang][clangd] Desugar array type.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 7 04:10:12 PST 2021


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

Nice!



================
Comment at: clang/lib/AST/ASTDiagnostic.cpp:134
 
+    if (const auto *CAT = dyn_cast<ConstantArrayType>(Ty)) {
+      QualType ElementTy =
----------------
this doesn't directly express the idea "we handle all array types". You *could* write:

```
if (const auto *AT = dyn_cast<ArrayType>(Ty)) {
 QualType ElementTy = desugar(...);
 switch(AT->getTypeClass()) {
    case Type::ConstantArray:
      QT = Context.getConstantArrayType(...);
      break;
    ...
    default:
      llvm_unreachable("Unhandled array type");
 }
 break;
}
```

Up to you whether you think this is clearer.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115107/new/

https://reviews.llvm.org/D115107



More information about the cfe-commits mailing list