diff --git a/clang/lib/Analysis/CFG.cpp b/clang/lib/Analysis/CFG.cpp --- a/clang/lib/Analysis/CFG.cpp +++ b/clang/lib/Analysis/CFG.cpp @@ -2839,6 +2839,19 @@ /// DeclStmts and initializers in them. CFGBlock *CFGBuilder::VisitDeclSubExpr(DeclStmt *DS) { assert(DS->isSingleDecl() && "Can handle single declarations only."); + + if (const auto *TDD = dyn_cast(DS->getSingleDecl())) { + // If we encounter a VLA in typedef, then process its size expressions. + CFGBlock *LastBlock = Block; + for (const VariableArrayType *VA = + FindVA(TDD->getUnderlyingType().getTypePtr()); + VA != nullptr; VA = FindVA(VA->getElementType().getTypePtr())) { + if (CFGBlock *newBlock = addStmt(VA->getSizeExpr())) + LastBlock = newBlock; + } + return LastBlock; + } + VarDecl *VD = dyn_cast(DS->getSingleDecl()); if (!VD) {