This is an archive of the discontinued LLVM Phabricator instance.

[clang][clangd] Desugar array type.
ClosedPublic

Authored by lh123 on Dec 4 2021, 7:13 PM.

Details

Summary

Desugar array type.

Diff Detail

Event Timeline

lh123 created this revision.Dec 4 2021, 7:13 PM
lh123 requested review of this revision.Dec 4 2021, 7:13 PM
sammccall accepted this revision.Dec 7 2021, 4:10 AM

Nice!

clang/lib/AST/ASTDiagnostic.cpp
134

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.

This revision is now accepted and ready to land.Dec 7 2021, 4:10 AM
This revision was automatically updated to reflect the committed changes.
lh123 marked an inline comment as done.Dec 9 2021, 6:14 AM