[cfe-commits] r43474 - /cfe/trunk/AST/StmtIterator.cpp
Ted Kremenek
kremenek at apple.com
Mon Oct 29 14:38:03 PDT 2007
Author: kremenek
Date: Mon Oct 29 16:38:03 2007
New Revision: 43474
URL: http://llvm.org/viewvc/llvm-project?rev=43474&view=rev
Log:
Added support for StmtIterators to iterate over the size expressions
of VariableArrayTypes that appear in TypedefDecls.
for example:
typedef int T[x][x];
the StmtIterator will iterate over "x" and "x" as subexpressions of
the DeclStmt for T.
Modified:
cfe/trunk/AST/StmtIterator.cpp
Modified: cfe/trunk/AST/StmtIterator.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/StmtIterator.cpp?rev=43474&r1=43473&r2=43474&view=diff
==============================================================================
--- cfe/trunk/AST/StmtIterator.cpp (original)
+++ cfe/trunk/AST/StmtIterator.cpp Mon Oct 29 16:38:03 2007
@@ -38,10 +38,11 @@
setVAPtr(p);
if (!p) {
- VarDecl* VD = cast<VarDecl>(decl);
-
- if (!VD->Init)
- NextDecl();
+ if (VarDecl* VD = dyn_cast<VarDecl>(decl))
+ if (VD->Init)
+ return;
+
+ NextDecl();
}
}
@@ -69,6 +70,13 @@
if (VD->getInit())
return;
}
+ else if (TypedefDecl* TD = dyn_cast<TypedefDecl>(decl)) {
+ if (VariableArrayType* VAPtr =
+ FindVA(TD->getUnderlyingType().getTypePtr())) {
+ setVAPtr(VAPtr);
+ return;
+ }
+ }
else if (EnumConstantDecl* ECD = dyn_cast<EnumConstantDecl>(decl))
if (ECD->getInitExpr())
return;
More information about the cfe-commits
mailing list