aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-04 06:05:19 +0000
committerChris Lattner <sabre@nondot.org>2009-03-04 06:05:19 +0000
commitcc5814732edc0c382d0136ab57ec6149566043e2 (patch)
treef732f78e4d3f1f8e03cf08ebf2cd605ba4681b3a /lib/Sema/SemaDecl.cpp
parentcdf00290c8988b54073775c9442615a23df405fc (diff)
add an a Attr::Destroy method and force clients to go through it. As part of
this, make DeclBase::Destroy destroy attributes instead of the DeclBase dtor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66020 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 8d32578c98..6a6628f748 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -482,11 +482,11 @@ static bool DeclHasAttr(const Decl *decl, const Attr *target) {
}
/// MergeAttributes - append attributes from the Old decl to the New one.
-static void MergeAttributes(Decl *New, Decl *Old) {
- Attr *attr = const_cast<Attr*>(Old->getAttrs()), *tmp;
+static void MergeAttributes(Decl *New, Decl *Old, ASTContext &C) {
+ Attr *attr = const_cast<Attr*>(Old->getAttrs());
while (attr) {
- tmp = attr;
+ Attr *tmp = attr;
attr = attr->getNext();
if (!DeclHasAttr(New, tmp) && tmp->isMerged()) {
@@ -494,7 +494,7 @@ static void MergeAttributes(Decl *New, Decl *Old) {
New->addAttr(tmp);
} else {
tmp->setNext(0);
- delete(tmp);
+ tmp->Destroy(C);
}
}
@@ -678,7 +678,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) {
/// \returns false
bool Sema::MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old) {
// Merge the attributes
- MergeAttributes(New, Old);
+ MergeAttributes(New, Old, Context);
// Merge the storage class.
New->setStorageClass(Old->getStorageClass());
@@ -767,7 +767,7 @@ bool Sema::MergeVarDecl(VarDecl *New, Decl *OldD) {
return true;
}
- MergeAttributes(New, Old);
+ MergeAttributes(New, Old, Context);
// Merge the types
QualType MergedT = Context.mergeTypes(New->getType(), Old->getType());