not be consulted for its size expression when operator* was called in the
StmtIterator (this resulted in an assertion failure).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66679
91177308-0d34-0410-b5e6-
96231b3b80d8
Stmt*& StmtIteratorBase::GetDeclExpr() const {
- if (inDeclGroup()) {
- VarDecl* VD = cast<VarDecl>(*DGI);
- return VD->Init;
- }
-
- assert (inDecl() || inSizeOfTypeVA());
-
if (VariableArrayType* VAPtr = getVAPtr()) {
assert (VAPtr->SizeExpr);
return VAPtr->SizeExpr;
}
+
+ assert (inDecl() || inDeclGroup());
+
+ if (inDeclGroup()) {
+ VarDecl* VD = cast<VarDecl>(*DGI);
+ return VD->Init;
+ }
assert (inDecl());
return 'a';
}
-// PR 3780
+// PR 3772
// - We just want to test that this doesn't crash the analyzer.
typedef struct st ST;
struct st { char *name; };
extern ST *Cur_Pu;
-void pr3780(void)
+void pr3772(void)
{
static ST *last_Cur_Pu;
if (last_Cur_Pu == Cur_Pu) {
}
}
+// PR 3780 - This tests that StmtIterator isn't broken for VLAs in DeclGroups.
+void pr3780(int sz) { typedef double MAT[sz][sz]; }