diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-05-20 03:56:00 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-05-20 03:56:00 +0000 |
commit | b65cf41707d190d5ce3d48b9e5bd2dc9d7b4a4c0 (patch) | |
tree | 71f9004f00c463cdbc31c970480efea9a92f12c2 /lib/AST/Decl.cpp | |
parent | 3bbc1989a38cada2f3ae92a43eb311bf341eeddf (diff) |
Reclaim memory allocated for ParmVarDecl's in FunctionDecl::Destroy.
Fixed a bug in ParmVarDecl::param_end(): Handle the case where there are no
ParmVarDecls for a FunctionDecl, but its function prototype has formal arguments
(can happen with typedefs).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51297 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 51040d3620..c75fb8b674 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -412,7 +412,12 @@ FunctionDecl::~FunctionDecl() { } void FunctionDecl::Destroy(ASTContext& C) { - if (Body) Body->Destroy(C); + if (Body) + Body->Destroy(C); + + for (param_iterator I=param_begin(), E=param_end(); I!=E; ++I) + (*I)->Destroy(C); + Decl::Destroy(C); } |