mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-30 09:01:19 +00:00
fix leakage of var's initializers
llvm-svn: 61171
This commit is contained in:
parent
63ff81c4e1
commit
394ec984f2
@ -344,7 +344,10 @@ public:
|
||||
SourceLocation L, IdentifierInfo *Id,
|
||||
QualType T, StorageClass S, ScopedDecl *PrevDecl,
|
||||
SourceLocation TypeSpecStartLoc = SourceLocation());
|
||||
|
||||
|
||||
virtual ~VarDecl();
|
||||
virtual void Destroy(ASTContext& C);
|
||||
|
||||
StorageClass getStorageClass() const { return (StorageClass)SClass; }
|
||||
|
||||
SourceLocation getTypeSpecStartLoc() const { return TypeSpecStartLoc; }
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "clang/AST/Decl.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "clang/AST/Stmt.h"
|
||||
#include "clang/AST/Expr.h"
|
||||
#include "clang/Basic/IdentifierTable.h"
|
||||
|
||||
using namespace clang;
|
||||
@ -48,15 +49,6 @@ ImplicitParamDecl *ImplicitParamDecl::Create(ASTContext &C, DeclContext *DC,
|
||||
return new (Mem) ImplicitParamDecl(ImplicitParam, DC, L, Id, T, PrevDecl);
|
||||
}
|
||||
|
||||
VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation L,
|
||||
IdentifierInfo *Id, QualType T,
|
||||
StorageClass S, ScopedDecl *PrevDecl,
|
||||
SourceLocation TypeSpecStartLoc) {
|
||||
void *Mem = C.getAllocator().Allocate<VarDecl>();
|
||||
return new (Mem) VarDecl(Var, DC, L, Id, T, S, PrevDecl, TypeSpecStartLoc);
|
||||
}
|
||||
|
||||
ParmVarDecl *ParmVarDecl::Create(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation L, IdentifierInfo *Id,
|
||||
QualType T, StorageClass S,
|
||||
@ -165,6 +157,28 @@ ScopedDecl::~ScopedDecl() {
|
||||
delete getMultipleDC();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// VarDecl Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
VarDecl *VarDecl::Create(ASTContext &C, DeclContext *DC,
|
||||
SourceLocation L,
|
||||
IdentifierInfo *Id, QualType T,
|
||||
StorageClass S, ScopedDecl *PrevDecl,
|
||||
SourceLocation TypeSpecStartLoc) {
|
||||
void *Mem = C.getAllocator().Allocate<VarDecl>();
|
||||
return new (Mem) VarDecl(Var, DC, L, Id, T, S, PrevDecl, TypeSpecStartLoc);
|
||||
}
|
||||
|
||||
void VarDecl::Destroy(ASTContext& C) {
|
||||
this->~VarDecl();
|
||||
C.getAllocator().Deallocate((void *)this);
|
||||
}
|
||||
|
||||
VarDecl::~VarDecl() {
|
||||
delete getInit();
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// FunctionDecl Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
Loading…
Reference in New Issue
Block a user